Skip to content

fix(traces): include finding.json in the export manifest for flagged traces#63

Open
dark-sorceror wants to merge 1 commit into
mainfrom
fix/export-manifest-finding
Open

fix(traces): include finding.json in the export manifest for flagged traces#63
dark-sorceror wants to merge 1 commit into
mainfrom
fix/export-manifest-finding

Conversation

@dark-sorceror

@dark-sorceror dark-sorceror commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #56

traces export on a flagged trace writes five files and announces all five — stderr says Wrote 5 files: … finding.json, --json lists the same five — but manifest.json's own files array only listed the four core files. The bundle's self-describing index disagreed with its own contents: anything iterating manifest.files silently skipped the finding, the most important file in a flagged trace's bundle.

How it works

The server has no knowledge of the finding (the CLI fetches it separately), so response.manifest.files never includes finding.json. The fix computes the files list once, up front — BUNDLE_FILES plus finding.json when a finding is present — and uses that single array everywhere: it's spread into manifest.json before writing (overriding only files; bundle_version, project_id, trace_id pass through untouched), and it's the same array the stderr summary and --json output already reported. One source of truth, so the manifest can no longer drift from what the CLI actually announces.

What's included

  • src/commands/traces/export.tsfiles is now computed before the manifest is written (not appended after), and manifest.json's contents are { ...response.manifest, files } instead of the raw server manifest.
  • tests/commands/traces.export.test.ts — three new tests: flagged export's manifest lists 5 files and matches the --json summary exactly, with bundle_version/project_id/trace_id passed through untouched; unflagged export's manifest is byte-identical to the server's; --force re-export from flagged to unflagged removes finding.json from disk and shrinks manifest.files back to 4.

Commit: 3dabf02 fix(traces): include finding.json in the export manifest for flagged traces

Test plan

  • 594/594 vitest tests pass (including the 3 new ones above)
  • typecheck, lint, and format all clean
  • Live e2e against app.traceroot.ai — flagged trace export: stderr, --json, and manifest.json all agree on 5 files including finding.json, with bundle_version/project_id/trace_id intact
  • Live e2e — unflagged trace export: stderr, --json, and manifest.json all agree on 4 files
  • Live e2e — --force re-export of a flagged trace's directory as unflagged: finding.json removed from disk and from the manifest

Summary by cubic

Fixes traces export so manifest.json includes finding.json for flagged traces. The manifest now matches the files written and the CLI summaries, so consumers don’t skip the finding.

  • Bug Fixes
    • Build a single files list (BUNDLE_FILES + finding.json when present) and use it for the manifest and CLI summaries.
    • Write manifest.json as { ...response.manifest, files } to keep bundle_version, project_id, and trace_id unchanged.
    • On --force re-export from flagged to unflagged, remove stale finding.json and shrink manifest.files back to 4; tests added for flagged, unflagged, and re-export cases.

Written for commit 3dabf02. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

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.

traces export writes finding.json but manifest.json doesn't list it — the bundle's own index is wrong

1 participant