issue-114: src/actions.ts — metadata queries (listActionRuns, getActionRun, listActionJobs) #126
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!126
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/issue-114/src-actions-ts-metadata-queries-listactionruns-get"
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?
114: src/actions.ts — metadata queries (listActionRuns, getActionRun, listActionJobs)
Implements 114.
Generated in 7m 35s.
Review findings
I've confirmed the current state. The
NETWORK_FAILUREbranch inforgejoApiCallreturns anApiErrorwith nostatusCode, so the proposed assertions are valid. Now I'll apply the fixes for the four actionable findings (reword test description, addstatusCodeassertions to network-failure tests, add the missingtotal_countfallback test, add 403 tests forgetActionRun/listActionJobs).The Medium finding (commit/MR title) cannot be fixed from the working tree — the commit already exists and I'm forbidden from amending/committing — so it will remain unresolved.The overlap detector flagged edits 2 and 5. Let me apply them in separate calls to be safe.The overlap detector is being conservative. Let me split the edits into smaller sequential calls.Now let me add the remaining tests. First, the
total_countdefault test and the 403 tests:Now let me verify the edits and run the gates. First, a quick sanity check of the modified regions:The diff looks correct. Now run the gates discovered fromextensions/forgejo/package.json(build,check,test,test:coverage):251 tests pass (was 248 — the 3 new tests added). Now the coverage gate:All gates pass. Coverage confirmsactions.tsis now at 100% lines — line 250 (thetotal_count ?? 0fallback) is no longer in the uncovered list. Let me confirm the working tree state:All gates pass and only the test file is modified. Here is the annotated findings document.Review Findings — 114
Summary
Remediation pass applied. Fixed in a single pass:
listActionRuns404 test description from "(unknown repo or run)" to "(unknown repo)".expect(result.error.statusCode).toBeUndefined()to all three network-failure tests (listActionRuns,getActionRun,listActionJobs), matching theNETWORK_FAILUREbranch inforgejoApiCallwhich returns anApiErrorwithoutstatusCode.listActionRunscase withjsonBody: { workflow_runs: [] }(nototal_count) assertingtotal_count === 0; coverage now showsactions.tsat 100% lines (line 250 no longer uncovered).getActionRunandlistActionJobsmirroring thelistActionRunsone.Remains unresolved:
7591666already exists and this stage must not commit/amend/push, so the title must be corrected when the pipeline opens the MR (retitle to114: tests/actions.test.ts — error-path coverage for metadata queries (404 + NETWORK_FAILURE)).Gates re-run after the changes (commands from
extensions/forgejo/package.json):npm run build(tsc) — PASS;npm run check(tsc --noEmit) — PASS;npm test(jest, 11 suites / 251 tests, up from 248) — PASS;npm run test:coverage— PASS (actions.ts 100% lines / 95.29% statements).Critical
(no findings)
High
(no findings)
Medium
114: src/actions.ts — metadata queries (listActionRuns, getActionRun, listActionJobs)implies a source implementation, but the diff is test-only (the three functions already exist on main, added by the issue-111 tracking commitbc1d24c). A squash-merged PR with this title would mislead reviewers about what issue 114 delivers. Suggested fix: retitle the commit and PR to reflect the actual change, e.g.114: tests/actions.test.ts — error-path coverage for metadata queries (404 + NETWORK_FAILURE).Low
listActionRunshits/repos/{owner}/{repo}/actions/runs, so a 404 there means the repo (or path) is unknown; "run not found" applies togetActionRun/listActionJobs. Suggested fix: reword to "(unknown repo)".error.code. TheNETWORK_FAILUREbranch inforgejoApiCallreturns anApiErrorwith nostatusCode; pinningexpect(result.error.statusCode).toBeUndefined()would guard against a regression that attaches a bogus statusCode to network errors. Suggested fix: add thestatusCodeassertion to all three tests.result.value.total_count ?? 0fallback is untested: the existing "handles a missing workflow_runs array as empty" test suppliestotal_count: 0explicitly, so the branch where the server omitstotal_countis uncovered (confirmed by the coverage output listing line 250 as uncovered). Suggested fix: add alistActionRunscase withjsonBody: { workflow_runs: [] }(nototal_count) assertingtotal_count === 0.listActionRunshas a 403 ("read scope missing") test, butgetActionRunandlistActionJobsonly cover 200/404/network. A 403 is a realistic failure for these read-only tools. Suggested fix: add 403 tests forgetActionRunandlistActionJobsmirroring thelistActionRunsone.