issue-116: src/actions.ts — downloadRunLogs (ZIP, guarded unzip, cache namespace) #128
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!128
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/issue-116/src-actions-ts-downloadrunlogs-zip-guarded-unzip-c"
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?
116: src/actions.ts — downloadRunLogs (ZIP, guarded unzip, cache namespace)
Implements 116.
Generated in 14m 00s.
Review findings
Now let me look at the top of the test file and check the project's build configuration:Let me experiment with how to make a ZIP whose second entry's
getData()throws:The corrupt-entry approach works. Let me verify it works with default guard limits (so the guard doesn't trip first):Let me check themakeRunLogsZipfixture and the rest of the test file setup:Now I have a full picture. Let me apply the fixes. First, thefailWithRollbackempty-directory cleanup inactionsCache.ts:Now add the corrupt-ZIP helper and the two new rollback tests inactionsCache.test.ts:Now updateactions.test.ts— fold thereadCachedLogassertions into the existing test (removing the duplicate), and add the cache-first extraction failure test:Now let me run the build, check, and test gates:Check passes and all 259 tests pass (up from 257). Now run the build and the root-level test suite:Build passes. Let me run the root-level test suite (mentioned in the review summary):All gates pass. Let me verify the newly-covered lines via coverage to confirm the findings are truly resolved:Let me check the current line numbers inactions.tsand inspect those uncovered ranges:The uncovered363-395range is the JSDoc block — comments aren't executable. Let me confirm lines 410-411 (the cached-path branch) and 424/453:Line 411 is no longer listed as uncovered. Let me verify precisely which statements inactionsCache.tsremain uncovered, using the JSON report:The JSON report looks stale (it claims everything uncovered). Let me trust the text report and map the remaining uncovered lines precisely:Let me get a clean precise JSON coverage to check whether theZIP_EXTRACT_FAILEDcatch path is actually covered:The getData catch (lines 396-400) and marker write path (442-445) are now covered. Let me verify theactions.tscached-path branch (line 411) precisely:The cached-path failure branch (410-411) is covered. Remaining uncovered lines are pre-existing branches unrelated to these findings. Let me review the full diff of my changes:The diff looks clean. Let me run all gates one final time to confirm everything is green:All gates pass. Here is the annotated findings document.Review Findings — 116
Summary
Fixed in this pass: the cache-first extraction failure branch is now tested (new
downloadRunLogstest warms the cache, swaps in a zip-bombrun.zip, and asserts the error surfaces with no partial per-job files — coverage confirms src/actions.ts:410-411 now executed);failWithRollbacknow removes the empty parent directories it leaves behind (walking up to and including the run dir, stopping when a dir still has content such asrun.zip); and both previously untested rollback paths are covered — a corrupt-entrygetData()failure (newcorruptZipEntrytest helper + test assertingZIP_EXTRACT_FAILEDand rollback of earlier files) and marker/.MISSINGrollback underextracted/(new test asserting the marker and emptiedextracted/+ run dirs are gone). The duplicate "warms the per-job cache" test was folded into the existing download test per the Low finding. Remaining: the commit-message format finding (commit5de40b8) — the commit is already made and this pipeline must not commit/amend, so theissue-prefix fix applies only to future commits. Gates:npm run checkPASS,npm run buildPASS,npm test(11 suites / 259 tests) PASS, rootnpm test(57 tests) PASS; no lint gate exists.Critical
(none)
High
downloadRunLogspasseslimitson the cached-ZIP path (src/actions.ts:410) and rolls back partial files there too, but no test exercises a cachedrun.zipwhose extraction fails (coverage confirms src/actions.ts:411 is uncovered). Suggested fix: warm the cache with a valid ZIP, then overwriterun.zipin the cache with a zip-bomb/corrupt archive, calldownloadRunLogswithoutrefresh, and assert the error surfaces and no partial per-job files (e.g.42-attempt-1.log,42.log) remain.Medium
<run_dir>/and<run_dir>/extracted/) behind, so a rejected archive still leaves cache scaffolding (tests assert only file absence). Suggested fix: after removing files, best-effortfs.rmdirSyncthe affected parents (or havedownloadRunLogsremove the whole run dir on the fresh-download path).ZIP_EXTRACT_FAILEDrollback path is untested (coverage confirms lines 381-382 uncovered): a mid-archiveentry.getData()failure is routed throughfailWithRollbackbut no test asserts earlier files are removed in that case. Suggested fix: construct a ZIP with one valid entry followed by a corrupt entry whosegetData()throws, and assert entry 1's files were rolled back.<run_dir>/extracted/is untested; all new rollback tests only cover per-job-namespace files. Suggested fix: add a test with a valid.MISSINGmarker followed by a guard-tripping entry, asserting the marker file is removed fromextracted/.Low
readCachedLogassertions are new. Suggested fix: fold thereadCachedLogassertions into the existing test to reduce duplication.5de40b8message116: …— AGENTS.md specifies commit formatissue-<N>: <summary>; theissue-prefix is missing. This matches prior repo history (114/115 use the same shorthand), so it is a standards deviation, not a regression. Suggested fix: prefix future commit messages withissue-.