From 830e36d0c40947b6b1c87fbfd5485975225e296a Mon Sep 17 00:00:00 2001 From: robbond Date: Thu, 26 Mar 2026 11:36:47 +0000 Subject: [PATCH] TASK22269: reuse contentLength locals in touched azurestorage blob loops --- actions/azurestorage.js | 11 +++++++---- memory-bank/change-log.md | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/actions/azurestorage.js b/actions/azurestorage.js index 9bb8394b..02383819 100644 --- a/actions/azurestorage.js +++ b/actions/azurestorage.js @@ -273,6 +273,7 @@ export const getBlobs = async (containerName, casefolderID) => { })) { const blobPathParts = blob.name.split("/"); const fileName = blobPathParts[2]; + const contentLength = blob.properties.contentLength; blobObj.push({ "name": fileName, @@ -281,8 +282,8 @@ export const getBlobs = async (containerName, casefolderID) => { "versionId": blob.versionId, "caseObj": buildCaseObjectPath(casefolderID), "isCurrentVersion": blob.isCurrentVersion, - "contentLength": blob.properties.contentLength, - "size": blob.properties.contentLength, + "contentLength": contentLength, + "size": contentLength, "contentType": blob.contentType, "lastModified": blob.properties.lastModified, "filepath": buildDownloadBlobQueryPath({ @@ -1295,6 +1296,7 @@ export const getProgressBlobs = async (containerName, caseReference) => { })) { const blobPathParts = blob.name.split("/"); const appealBlobName = blobPathParts[1]; + const contentLength = blob.properties.contentLength; consoleLogger("getProgressBlobs in here", blobPathParts); blobObj.push({ @@ -1303,7 +1305,7 @@ export const getProgressBlobs = async (containerName, caseReference) => { "versionId": blob.versionId, "caseObj": buildCaseObjectPath(caseReference), "isCurrentVersion": blob.isCurrentVersion, - "contentLength": blob.properties.contentLength, + "contentLength": contentLength, "contentType": blob.contentType, "lastModified": blob.properties.lastModified, ...buildHashMetadataPaths({ @@ -1476,6 +1478,7 @@ export const getRepsFilesBlobs = async ( const blobPathParts = blob.name.split("/"); const casefolderPath = blobPathParts[0] + "/" + blobPathParts[1]; const repFileName = blobPathParts[3]; + const contentLength = blob.properties.contentLength; consoleLogger(blob.name); @@ -1485,7 +1488,7 @@ export const getRepsFilesBlobs = async ( "documentType": getDocumentTypeFromFilename(repFileName), "versionId": blob.versionId, "isCurrentVersion": blob.isCurrentVersion, - "contentLength": blob.properties.contentLength, + "contentLength": contentLength, "filenameprefix": filenamePrefix, "filepath": buildDownloadBlobQueryPath({ containerName, diff --git a/memory-bank/change-log.md b/memory-bank/change-log.md index fbd49187..c6e4d9b9 100644 --- a/memory-bank/change-log.md +++ b/memory-bank/change-log.md @@ -3162,3 +3162,35 @@ Validation: Follow-ups: - Optional next bounded slice: continue tiny helper reuse in touched functions only if any duplicated path literals remain and can be reduced without behavior change. + +--- + +### CL-089: TASK22269 Slice B1.14 — azurestorage touched-function contentLength local reuse + +date: 2026-03-26 +author: Cline +scope: `actions/azurestorage.js` +type: change +rationale: Execute the next tiny bounded readability slice by reusing local `contentLength` values in touched helper-consumer functions to reduce repeated property access and keep object assembly consistent. +impact: Maintainability/readability improvement only; no route/query/output behavior changes. +status: completed + +Summary: + +- In touched functions: + - `getBlobs` + - `getProgressBlobs` + - `getRepsFilesBlobs` +- Added local `contentLength` variable (`blob.properties.contentLength`) per loop iteration. +- Replaced repeated inline `blob.properties.contentLength` assignments in object assembly with the local variable. +- Preserved field contracts (`contentLength`, `size`) and values. + +Validation: + +- `npm run lint` -> pass with warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors) +- `node tests/phase22/index.test.cjs` -> pass +- `node tests/phase7/service-behaviour.test.cjs` -> pass (13/13) + +Follow-ups: + +- Optional next bounded slice: stop or switch scope; touched-function micro-tidies in this area are now largely exhausted.