Skip to content

fix(download): parse byte-progress events with action.file shape - #375

Merged
neuromechanist merged 1 commit into
devfrom
feature/issue-346-progress-action-file
Apr 28, 2026
Merged

neuromechanist merged 1 commit into
devfrom
feature/issue-346-progress-action-file

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

Changes

  • src/lib/progress.ts: type action as {command?, file?, key?} object; read event file as parsed.file ?? parsed.action?.file for both byte-progress and completion events.
  • src/lib/git-annex.ts: align the duplicate GitAnnexProgressLine interface so the two structurally match (TypeScript was rejecting cross-module assignment otherwise).
  • test/progress.test.ts: migrate existing tests to emit the real git-annex shape via progressEvent() / completionEvent() helpers; add a regression test for the nested-action.file byte-progress shape.

Test plan

  • bun test test/progress.test.ts test/git-annex-precount.test.ts — 15/15 pass
  • bun run build clean
  • bunx tsc --noEmit clean
  • Live test against nm000114 (812 MB, 181 files): bar climbs monotonically 0% → 98% → 99% → 100%, file count 0/181 → 181/181, bytes match precount (812.2 MB / 812.2 MB), final summary 181 files downloaded | 812.2 MB | 18.1 MB/s.

Closes #346.

git annex --json-progress nests file/key/command under `action` for byte-progress events; the parser only checked top-level `parsed.file`. Result: inFlight never populated, every ok credited 0 bytes, bar pinned at 0% while files counter advanced (e.g. `0% 134/181 files`).

Update GitAnnexProgressLine in both progress.ts and git-annex.ts to type `action` as {command,file,key} object, and read the file path from `parsed.file ?? parsed.action?.file` for both event shapes.

Migrate progress tests to emit the real git-annex shape via progressEvent/completionEvent helpers; add a regression test covering byte-progress with file nested under action.

Verified live against nm000114: bar climbs 0% to 100%, 181/181 files, 812.2 MB matches precount.
@github-actions

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR375

Version: 0.8.3-PR375.2855d94
Commit: 2855d94


🤖 Updated on each push.

@neuromechanist
neuromechanist merged commit e97e0d0 into dev Apr 28, 2026
8 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-346-progress-action-file branch April 28, 2026 01:21

This branch was previously deployed

1 inactive deployment
npm — 2855d94f Deployed Apr 27, 2026 by neuromechanist via publish #659
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant