issue-113: src/actionsCache.ts — cache paths + cache-first read/write #125
No reviewers
Labels
No labels
bug
chore
documentation
enhancement
feature
ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
david/pi-extensions-and-skills!125
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/issue-113/src-actionscache-ts-cache-paths-cache-first-read-w"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
113: src/actionsCache.ts — cache paths + cache-first read/write
Implements 113.
Generated in 7m 53s.
Review findings
Now let me look at the callers and tests to understand the full picture:The shell interpreted the pipe. Let me quote the pattern:Now let me read the test file sections and check the project's build configuration:Let me check AGENTS.md line 26 and whether the commit message is recorded anywhere, plus look at git log for the Stage 1 commit:The commit message finding anchors to AGENTS.md's convention documentation; the Stage 1 commit
970391cuses113: …instead ofissue-113: …. I cannot rewrite commits in this stage (no git operations allowed), so that finding stays unresolved.Now let me implement the code fixes. First,
src/actionsCache.ts:Now update the callers insrc/actions.ts:Now update the tests intests/actionsCache.test.ts:Let me verify no other callers use the old signatures, then run the gates:All callers updated. Now run the project gates (build, check, test):All gates pass (build, check, 244 tests). Let me review the final diff of my remediation changes:The diff is clean and all tests pass. Let me double-check there's no test asserting the old swallow-error behavior indownloadJobLog:All gates pass and the changes are consistent. Here is the final annotated findings document.Review Findings — 113
Summary
Reviewed the Stage 1 changes for issue 113 (cache paths + cache-first read/write in
extensions/forgejo/src/actionsCache.tsand its callers/tests). Gates run fromextensions/forgejo:npm run build(tsc) PASS,npm run check(tsc --noEmit) PASS,npm test(jest, 11 suites / 244 tests) PASS; lint N/A — the repo has no lint tooling (no eslint/prettier configs or lint scripts in the root orextensions/forgejopackage). The refactor (options-object path helpers, injectable env forcacheRoot,readCachedLogIfPresent→readCachedLog) is internally consistent, all callers were updated, no stale references to removed symbols remain, and the new tests cover the changed behavior. Findings below are diagnostic-quality and cleanup items; none block merge.Remediation pass (single pass, gates re-run green): the Medium finding was fixed by restoring a
Result<string | null, CacheError>return forreadCachedLogthat distinguishesENOENT(cache miss) from other read failures (surfaced asCacheError READ_FAILED), which also resolves the dead-READ_FAILEDLow finding. TherunDirLow finding was fixed by converting it to an options object (RunDirOptions) consistent with the other path helpers. The commit-message Low finding (AGENTS.md:26) remains unresolved — this stage is prohibited from git operations, so the Stage 1 commit message cannot be rewritten here; the squash PR title/body must carryissue-113: …+Closes #113.Critical
High
Medium
extensions/forgejo/src/actionsCache.ts:188—readCachedLognow swallows all read errors (catch { return null; }), not justENOENT. A cached-but-unreadable log (e.g.EACCESon the cache file, orENOTDIR) is silently treated as a cache miss, sodownloadJobLogre-downloads from the network even though a local copy exists; if the network is unavailable the user now getsApiError NETWORK_FAILUREinstead of the old, accurateCacheError READ_FAILED("Failed to read cached log …"). The previousResult-returning read preserved this diagnostic, and the new behavior can also cause a redundant download on every call when the cache dir permissions are wrong. Suggested fix: keep thestring | nullshape for the happy path but distinguishENOENT(returnnull= miss) from other errors (return/rethrow aCacheErrorwithCacheErrorCode.READ_FAILEDso the caller surfaces it), or at minimum log the underlying error before falling back to re-download.Low
extensions/forgejo/src/errors.ts:74—CacheErrorCode.READ_FAILEDis now dead code: its only consumer (readCachedLogIfPresent) was removed in this change, and a repo-wide grep shows no remaining usage insrc/. Suggested fix: remove the enum member if the swallow-all-read-errors design is kept, or restore its use per the Medium finding above.AGENTS.md:26— the Stage 1 commit message is113: src/actionsCache.ts — cache paths + cache-first read/write, which does not match the repo conventionissue-<N>: <summary>(e.g.issue-42: add user auth; theissue-prefix is missing). The branch name (feature/issue-113/…) follows the convention correctly. Suggested fix: rewrite the commit (or the eventual squash PR title/body) toissue-113: …and referenceCloses #113so downstream artifacts stay issue-number-driven.extensions/forgejo/src/actionsCache.ts:97—runDirstill takes positional args (root, owner, repo, runId) while its two path helperscachedLogPathandrunZipPathwere converted to options objects in this same change (and the new JSDoc calls them "Inputs"). The mixed style is mildly inconsistent for readers of the module. Suggested fix: either convertrunDirto an options object too (e.g.RunDirOptions) or note in its JSDoc why it intentionally remains positional; therunDir(root, owner, repo, runId)call atactions.ts:392would need the same update.