issue-115: src/actions.ts — downloadJobLog (cache-first, attempt param) #127
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!127
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/issue-115/src-actions-ts-downloadjoblog-cache-first-attempt"
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?
115: src/actions.ts — downloadJobLog (cache-first, attempt param)
Implements 115.
Generated in 6m 22s.
Review findings
Now I understand the full picture. Let me apply the fixes: (1) import
ApiErrorso the narrowing cast works, (2) make the statusCode assertion unconditional via a hoisted narrowed local, (3) pin the error message, (4) prefix the test title.The fix looks good. Now let me run the project gates — jest tests and TypeScript checks for the forgejo extension.All forgejo gates pass. Let me also re-run the root test gate that the review ran, for completeness.All gates are green after remediation:jest: 252/252 pass (including the updatedactions.test.ts)npm run check(tsc --noEmit): passnpm run build(tsc): passnpm test: 57/57 passReview Findings — 115
Summary
Stage 1's delta is a single test added to
extensions/forgejo/tests/actions.test.tscovering the previously-untested fetch-rejection path ofdownloadJobLog(asserting the error maps toNETWORK_FAILUREand nothing is written to the cache). ThedownloadJobLogimplementation itself (cache-first +attemptparam) already exists on main, so this branch's contribution is test coverage only. Gates run: forgejo extensionjest(252/252 pass, including 30/30 inactions.test.ts),tsc --noEmit(pass),npm run build/tsc(pass), rootnpm test(57/57 pass). No lint configuration exists in the repository (no eslint/prettier/biome configs found), so no lint gate ran.Remediation pass: all three Low findings in
actions.test.tswere fixed in place — thestatusCodeassertion is now unconditional (via a hoisted narrowed local), the error message is pinned withtoContain("ECONNREFUSED"), and the test title is prefixed with the function name. Gates re-run and green after the edits.Critical
High
Medium
Low
extensions/forgejo/tests/actions.test.ts:612 — The
statusCodeassertion is wrapped inif (result.error.code === ApiErrorCode.NETWORK_FAILURE), a condition the preceding assertion on line 610 already guarantees, so the assertion is silently skippable if that guard is ever reordered or removed. (The narrowing is needed for TS becauseresult.errorisApiError | CacheError, but the assertion should not live behind a condition that is provably always true.) Suggested fix: assert unconditionally after the code check, e.g.expect((result.error as ApiError).statusCode).toBeUndefined();or hoist a narrowed local (const apiError = result.error as ApiError;).extensions/forgejo/tests/actions.test.ts:610 — The test asserts the error code but not the message, so a regression in
forgejoApiCall's rejection mapping (e.g. a droppedNetwork error: ...message) would go undetected. Suggested fix: addexpect(result.error.message).toContain("ECONNREFUSED");to pin the mapping.extensions/forgejo/tests/actions.test.ts:596 — The identical test title "maps a fetch rejection (network failure) to NETWORK_FAILURE" is now the fourth occurrence in this file (listActionRuns, getActionRun, listActionJobs, downloadJobLog). Jest tolerates this and it matches the existing file convention, but prefixing the suite name (e.g. "downloadJobLog maps a fetch rejection ...") would make failures easier to locate. Optional polish only.