feat: add jj support to call flow mode - #1312
Conversation
e3a8cac to
db91154
Compare
…t revsets `jj diff --from/--to` take exactly one revision, and the parent shorthands do not guarantee one: `@-` is `parents(@)`, so on a merge revision both `@-` (jj-current's base) and `parents(@-)` (jj-last's base) resolve to several revisions and jj rejects the command outright with "resolved to more than one revision". The visible `jj diff -r @` review still renders in that state, so Call flow failed on exactly the revisions a reviewer is most likely to be looking at. Parent hops are no longer encoded as revsets. `getJjSnapshotRevsets` now returns a revset plus a first-parent hop count, and `resolveJjSnapshotEndpoint` walks those hops against the repository, taking the first parent's commit id at each step. jj lists a merge's parents in the order they were given to `jj new`, so index 0 is stable across invocations, unlike `heads()` or `latest()`. This is also the side `getJjFileContentsForDiff` already expands merges on, so Call flow and file expansion now agree. packages/shared/jj-snapshot.test.ts builds a real jj workspace whose working copy IS a merge and drives both revset paths through the provider. All three tests fail on the previous revsets with the exact jj ambiguity error.
…ization Three properties of the Jujutsu snapshot routine, all invisible in the visible review but all reaching CallDiff: Fileset anchoring. `glob-i:` patterns are relative to the INVOCATION directory, so a review started from a subdirectory of the workspace silently dropped every source file above it and handed CallDiff a partial repository call graph — the opposite of the whole-repo call graph this spec exists to preserve. The `root-glob-i:` prefix anchors at the workspace root instead; patch paths were already workspace-relative either way. Output ceiling. The 64 MB limit was checked AFTER `jj diff` had been buffered in full, so it validated a number without bounding the memory that produced it. The limit is now passed to the runtime, which stops reading and kills the command at the ceiling and reports `truncated`. Both runtimes implement it: Bun reads the stream with a budget, Pi counts chunks in its node:child_process reader. Materialization cost. Both sides used to materialize the whole parseable tree (`--from root()`), so cost scaled with the repository twice over. Only the base side does now; the second side is that tree plus the changed-file delta between the two revisions, which is what a review actually needs. Scoping the analysis itself to changed files is deliberately NOT done — the spec's whole-repository same-language call graph depends on both snapshots being complete — so this scopes the materialization without narrowing what CallDiff sees. A whole-tree second pass remains as the fallback when a delta cannot be replayed.
|
TLDR: great refactor, merging after two fixes I pushed straight to this branch ( AI-assisted review: findings were re-verified against real What's good herePulling snapshot materialization behind the VCS abstraction is the right call and it is a nicer shape than what was there before. The Jujutsu materialization itself is careful in the ways that are easy to get wrong. Both runtimes were wired symmetrically too ( Findings1. Blocker, confirmed: merge revisions broke both jj revset paths. The asymmetry is what makes it bad: Fixed in 2. Confirmed:
3. Confirmed: the 64 MB cap was post-hoc. Neither 4. Partially refuted, and I did not do what the finding asked. Scoping the analysis to changed files only would have broken the spec on purpose: "This preserves complete same-language repository call graphs rather than reducing analysis to changed files." The real cost problem was that BOTH sides materialized the whole tree, so a review paid for the repository twice. Worth noting as a possible follow-up, not something I touched: jj's default backend is git, so on a colocated repo the revisions already exist as git objects and materialization could be skipped entirely. Bigger change, and it does not hold for the native backend. 5. Confirmed: no coverage for either case. Verification
Have a look at the two commits and tell me if anything reads wrong to you, particularly the first-parent choice in finding 1 and the delta materialization in finding 4. Thanks for another careful piece of jj work. |
|
Merged, thanks @graemefolk. jj Call Flow ships in the next release. |
Adds Jujutsu (jj) as a Call Flow analysis provider: jj-current/jj-last/jj-line/jj-all snapshot revsets with deterministic first-parent resolution across merge revisions, root-anchored filesets so results are cwd-independent, bounded snapshot materialization (base tree + changed-file delta) with a streamed 64MB output ceiling in both the Bun and Pi runtimes, and real-jj regression tests covering merges and subdirectory invocation. Contributed by @graemefolk, who also built the original jj integration. Review fixes pushed in-branch: merge-parent resolution, root-glob filesets, bounded materialization and buffering, plus CI gating guards for runners without jj.
Uh oh!
There was an error while loading. Please reload this page.