Repository navigation
Description
Goal
Add an evidence-backed Structure view to Review Tutor so a reviewer can understand how changed files connect and how dependency topology changes without reading every file sequentially.
Parent work: #59
Current UI PR: #61
Product contract
- Diff remains the default and source of truth.
Diff | Structureswitches views over the same immutable input snapshot.- Structure shows deterministic import/dependency topology, not inferred runtime architecture.
- Changed files are the default scope; optional one-hop neighbors provide context.
- Every shown connection has exact source or diff-line evidence.
- Added connections use semantic green, removed connections use dashed rose, unchanged context is muted, and the selected item owns the single ember highlight.
- Selecting a file or connection opens a compact evidence panel with
Open in Diff; tutor integration comes only after the graph is trustworthy. - Mobile and high zoom default to an accessible Connections list rather than forcing a cramped graph.
- Partial analysis is explicit: say
no import data, neverno dependencies.
Source fidelity
| Source | Honest comparison |
|---|---|
| Worktree | index → working-tree patch |
| Staged | HEAD → index |
| Commit | first parent → commit; root/unsupported merge cases degrade explicitly |
| Range | merge-base → target |
| Pull request | base SHA → head SHA only when required Git objects are local |
| Pasted code | unavailable; do not guess |
Remote PR objects must not be fetched or checked out automatically. When unavailable locally, provide a clearly labeled patch-only partial result.
Acceptance criteria
- Parse changed files, additions/deletions, and renames once in a DOM-free server module.
- Produce deterministic, sorted Structure snapshots from a bounded local analyzer.
- Support TypeScript/JavaScript import, re-export,
require, and dynamic-import edges first. - Represent added, removed, unchanged, unresolved, partial, truncated, and unavailable states honestly.
- Attach bounded exact evidence lines to every edge; no edge may exist only because a model inferred it.
- Limit scope to changed files plus at most one-hop neighbors.
- Expose one bearer-authenticated, Host/Origin-protected local endpoint.
- Add an accessible Connections list with evidence and Diff jumps before the graph canvas.
- Add a deterministic DOM/SVG Structure graph with stable positions and keyboard navigation.
- Preserve the existing diff, tutor, configuration, learning-log, responsive, security, and persistence behavior.
- Add Dart support next and Rust after TypeScript/JavaScript is proven.
- Pass functional, security, resource-limit, keyboard, responsive, and rendered visual acceptance.
- Stop at Ready for human review; Elberte alone authorizes merges.
Non-goals
- No whole-repository hairball, transitive expansion, call graph, runtime tracing, architecture score, or health badge.
- No LLM-generated edges or architecture verdicts.
- No cloud analysis, daemon, telemetry, external assets, source writes, PR actions, or automatic Git fetch/checkout.
- No force-directed physics, decorative animation, multicolor edge palette, or canvas-only inaccessible graph.
- No speculative analyzer plugin system.
PR plan
-
PR 1 — comparison provenance and analysis core
- Depends on: feat(review-tutor): redesign guided review interface #61 finished and human-approved.
- Add DOM-free diff parsing with rename tracking.
- Capture honest source comparison metadata.
- Add deterministic TypeScript/JavaScript connection analysis and bounded evidence.
- Add the authenticated Structure endpoint; no UI.
- Validation: focused graph/protocol/security/resource tests plus
bun run check. - Link: pending.
-
PR 2 — accessible Connections list
- Depends on: PR 1.
- Add
Diff | Structure, partial-state disclosure, per-file changed connections, compact evidence rows, andOpen in Diff. - Make List mode the keyboard, screen-reader, mobile, and high-zoom baseline.
- Validation: executable page tests and browser proof at 1440, 860, 390, and 400% zoom.
- Link: pending.
-
PR 3 — deterministic Structure graph
- Depends on: PR 2.
- Add stable layered DOM/SVG layout, directory clustering, node/edge selection, bounded filtering, and one-hop neighbor toggle.
- Keep mobile/high zoom on List mode unless the user explicitly opens the graph.
- Validation: small, partial, truncated, clustered, keyboard-only, and resize/zoom browser acceptance.
- Link: pending.
-
PR 4 — mobile-language and tutor integration
- Depends on: PR 3.
- Add Dart, then Rust, using private language-table entries rather than a plugin system.
- Add
Ask about this file/connectionusing exact evidence as the existing tutor selection. - Complete final design-lead, local-review, CI, and human-review gates.
- Link: pending.
Traceability
| Acceptance area | Slice | Validation | Status |
|---|---|---|---|
| Honest source provenance and deterministic edges | PR 1 | graph fixtures across worktree/staged/commit/range/PR/paste | pending |
| Auth, limits, cancellation, and failure containment | PR 1 | server security and bounded-read tests | pending |
| Evidence-first architectural review | PR 2 | runtime DOM tests and Diff-jump browser flow | pending |
| Diagram comprehension and scale | PR 3 | rendered small/large/partial graph acceptance | pending |
| Flutter/mobile relevance and tutor reuse | PR 4 | Dart/Rust fixtures and real tutor question flow | pending |
Resource and honesty limits
Start with conservative caps and return a valid partial snapshot when exceeded. The implementation plan must bound changed files, nodes, edges, analyzer output, evidence per edge, line length, runtime, and child processes. Binary, oversized, unsupported, aliased, or unresolved inputs are omitted with explicit reasons rather than guessed.
Feature flag decision
No flag while Review Tutor remains a private, unreleased prototype and each user-visible slice is independently complete. If packaging or release exposure lands before this work is complete, stop and add a default-off reviewTutorStructureView flag with the full enable-and-remove lifecycle before merging user-visible graph work.
Validation
bun run typecheck
bun run lint
bun run test
bun run test:coverage
bun run build
bun run checkRendered proof must cover 1440px desktop, the 860px boundary, 390px mobile, and 400% zoom. Final aesthetic acceptance returns to the named Pickforge design lead.
Status
Current status: Deferred / planned
Do not start implementation until #61 is finished, manually approved, and its final disposition is recorded in #59.
Next action when resumed: run a read-only TypeScript/JavaScript analysis spike on several real PR snapshots and lock the analyzer payload before source edits.
Activity
ElbertePlinio commentedon Aug 23, 2026
Agent plan — resumed
Per the recorded next action: running a read-only TypeScript/JavaScript analysis spike on real PR snapshots now to lock the analyzer payload before source edits. PR 1 (comparison provenance + analysis core) follows in worktree feat/review-tutor-structure-core, stacked on #64's branch so Elberte can review the whole Review Tutor chain (#65 → #64 → #62 slices) in one batch. Each slice still stops at Ready for human review.
Current status: In progress (spike)
Next: lock analyzer payload, dispatch PR 1 implementation
ElbertePlinio commentedon Aug 23, 2026
Progress update — PR 1 (analysis core) built, under review
typeimports via verbatimModuleSyntax;.js→.tsbundler specifiers; no tsconfig aliases)GET /api/structurebehind the existing auth (149 focused tests, full check 442 passed | 25 skipped)Schema decisions locked for PR 2–4:
StructureEdge.statusgainsmodified: a binding-only change to an existing import collapses to one edge with both evidence lines (never green + rose for the same pair).comparison.from/comparison.tocarry the fidelity table explicitly (e.g. index → working tree); PR = patch-only partial, never fetched.Next: fix verification, PR 1 ready for human review (batched chain #65 → #66 → PR 1).
ElbertePlinio commentedon Aug 23, 2026
PR 1 is open: #67 (stacked on #66) at
82ebb32.GET /api/structure; 47 focused structure tests; full check 466 passed | 25 skipped, 81.25% statementsopensRegexguard (keyword-named member before/is division) is disclosed in the PR body as validated-but-not-re-reviewedNext: PR 2 (accessible Connections list) — design contract first, stacked on #67.
ElbertePlinio commentedon Aug 23, 2026
Design contract — Review Tutor Structure PR 2 (Connections list)
Status: locked
Design lead: Fable 5 (this session)
Mode: targeted (inside the existing Review Tutor product window)
Outcome
Diff | Structure | Learning logpeer view where Structure lists changed files and their evidence-backed connections, discloses partial analysis honestly, and jumps to the exact diff line.Context
page-script.tsstring, styles inpage-styles.ts, static shell inpage.ts; happy-dom tests.--ember,--green,--rose,--amber,--muted, hairlines, radii,--control-h-touch), the tablist pattern (view-diff/view-log,setView), sticky file heads, live-region announcements, stable stateful nodes, 860px stacked mode, mobile drawer.GET /api/structurefrom PR 1 is the only new call), no server change in this slice.StructureSnapshotfrom PR 1 (files[],edges[]withstatus added|removed|modified|unchanged,typeOnly,kind, boundedevidence[],comparison.from/to/partial/reasons,limits.truncated/omitted).Direction
.file-head.typeas small uppercase mono chips (existing label style); semantic status: added =--greentext + solid 2px left rule, removed =--rose+ dashed left rule, modified =--amberchip "edited" with muted text, unchanged =--muted; selected row = ember outline/rule, exactly one at a time. No new colors.Behavior
Structuretab → first visit per input fetches/api/structure(status "Analyzing structure…" in the live region) → list renders → click/Enter on a connection row toggles its evidence (aria-expanded) and makes it the selected row → Open in Diff on an evidence line switches to Diff, navigates to that file, scrolls the line into view, and moves focus to it (reuse existing file navigation and line anchoring). Input change resets Structure state and refetches on next visit.<details>"N reasons" list); unanalyzed file (group shows the exact reason inline, muted); removed file (rose status, removed rows); modified edge; type-only chip; selected + expanded row; focus-visible on every control.tablistwith roving tabindex; each file group is asectionwitharia-labelledby; rows arebuttons witharia-expandedandaria-controls; evidence lists areul; status conveyed in text (chip) not color alone; contrast ≥4.5:1 for all text; announcements on view switch, load, error;prefers-reduced-motionrespected.Implementation boundary
setView,.file-head, label/chip styles,announce, notice card style, existing file/line navigation helpers, existing fetch/auth helpers (bearer from session).page-script.ts(structure state, fetch, render, jump),page-styles.ts(structure styles),page.ts(static shell: tab + section),test/page.test.tsor a newtest/structure-page.test.ts.Acceptance proof
bun run check.ElbertePlinio commentedon Aug 23, 2026
PR 1 #67 is Ready for human review at
82ebb32(basefeat/review-tutor-hardening, mergeable).PR 2 (Connections list) is in implementation under the locked design contract above, stacked on #67. No merge attempted; chain #65 → #66 → #67 → PR 2 awaits one batched human review.
ElbertePlinio commentedon Aug 24, 2026
PR 2 (Connections list) is open and stacked on #67; design accepted against DESIGN-PRINCIPLES.md (left status rules and empty containers removed); review panel running. PR 1 #67 is green on main and awaiting Elberte's merge.
ElbertePlinio commentedon Aug 24, 2026
Design contract amendment (PR 2, design lead): group heads are not sticky, and the
+N −Mcounts are removed from structure group heads (they duplicate the Diff file heads; removing them also fixes path truncation at 360px). File groups with no rows and no reason are not rendered. Rationale: DESIGN-PRINCIPLES.md rules 1, 3, 5. Panel findings (2 correctness P2s, 7 UI P2s, test-integrity gaps) are being fixed in one batch on #71.ElbertePlinio commentedon Aug 24, 2026
PR 2 #71 is Ready for human review at
616dd86(basefeat/review-tutor-structure-core= #67).bun run check483 passed | 25 skipped, 81.51%; required CI greenDeferred P3 follow-ups (pick up in PR 3/4, not blockers):
.structure-file-headinherits the mobile fixed 44px height; paths wrapping to 3+ lines at 390px overflow — useheight:autowith padding in the ≤860 block.emptynow hasmargin:0, also normalizing Diff's no-source paragraph (consistency change, outside the item's scope)kind+typechips into one (type import)Chain: #67 → #71 (→ PR 3 graph → PR 4 Dart/Rust + tutor integration). Merges remain Elberte's call.
ElbertePlinio commentedon Aug 24, 2026
Design contract — Review Tutor Structure PR 3 (graph)
Status: locked
Design lead: Fable 5 (this session)
Mode: targeted (inside the Structure view shipped in #71)
Doctrine: branding-visual/DESIGN-PRINCIPLES.md is binding.
Outcome
List | Graphswitch inside Structure. Graph is a deterministic layered diagram of changed files and their evidence-backed connections; selecting a node or edge shows the same evidence rows and Open in Diff the list already has.Elements added and why each is necessary
List | Graphsegmented switch in the Structure header (same style as the view tablist). Needed: the only way to reach the graph; List stays default everywhere.Nothing else: no legend (status is text-labelled on selection and encoded like the list), no minimap, no zoom controls, no cluster boxes, no filters, no tooltips.
Direction
titlefor longer). Fixed column gap. No physics, no animation, byte-identical positions for identical snapshots.--surface-1with a hairline border; label = path in mono 12px; status conveyed by the label color (--greenadded,--roseremoved,--ambermodified,--mutedunchanged/renamed). Unanalyzed files are not drawn (they have no edges); they remain in the list.--green,--rosedashed,--amberfor modified,--mutedunchanged); type-only edges use the same color at 60% opacity. Straight lines between layer columns; orthogonal routing is not required.Behavior
role="group"with anaria-label"Structure graph, N files, M connections"; each node is a<a>/focusable<g>witharia-label"path, status"; each edge hasaria-label"from → to, kind, status". Live region announces mode switch and selection.sessionStorage(reviewTutorStructureMode).Implementation boundary
jumpToEvidence, landing marker,announce, chip styles, tablist/switch styles, tokens.page-script.ts(graph layout + render + selection),page-styles.ts,page.ts(switch + graph container),test/page.test.tsor a newtest/structure-graph.test.ts.Acceptance proof
ElbertePlinio commentedon Aug 24, 2026
Re-slice (design lead): PR 3 = graph UI only over the existing snapshot; PR 4 = analyzer extensions (Dart, Rust, bounded one-hop neighbours read through Git, outgoing only, default off) + 'Ask about this connection'. Rationale: the one-hop toggle needs server-side file reads, which belong with the other analyzer work, and the graph should not wait on it. Both slices are now in implementation, stacked on #71.
ElbertePlinio commentedon Aug 24, 2026
Progress update:
inputs.tspins--src-prefix=a/ --dst-prefix=b/(fixes wrong snapshot paths underdiff.mnemonicPrefix); 3-reviewer panel + verification cleanDeferred P3s from the PR 4 analyzer review: page-script parseUnifiedDiff still hard-codes
b/(harmless now that inputs.ts pins prefixes); Rustmodwith botha.rsanda/mod.rspresent is deterministic first-wins and untested.ElbertePlinio commentedon Aug 25, 2026
PR 3 #72 is Ready for human review at
c4a2f82(basefeat/review-tutor-structure-list= #71).bun run check493 passed | 25 skipped; required CI greenDeferred low-severity follow-ups (graph): share one right-side port ladder for in/out edges on the same node; clamp port spread when a node has ≥6 ports; guard the Escape announcement on an actual selection; move the edge hit-path inline style into page-styles; add the persist-list storage assertion.
PR 4 is being rebased onto #72 with its panel batch; it opens next as the final link.
ElbertePlinio commentedon Aug 25, 2026
PR 4 #73 is Ready for human review at
7869a39(basefeat/review-tutor-structure-graph= #72). The #62 PR plan is complete:PR 4 review: serious-backend panel + verification on the analyzer half (1 P1 + 5 P2 fixed), serious-user-facing panel + verification on the UI half (1 P1 + 6 P2 fixed, two one-line regressions fixed with tests); design accepted against DESIGN-PRINCIPLES.md;
bun run check553 passed | 25 skipped, 83.07%; required CI green.Merge order (Elberte): #67 → #69 → #71 → #72 → #73, retargeting each child to main before merging its base. Deferred low-severity items are listed above (graph port ladder/spread, Escape guard, inline hit-path style, persist-list assertion; page parseUnifiedDiff
b/hard-coding; Rusta.rs+a/mod.rsambiguity test).ElbertePlinio commentedon Aug 25, 2026
PR 5 opened: #74 (stacked on #73) — rail collapse animation + no diff actions on neighbour evidence, from Elberte's live test. Review clean (Sol, standard). Chain: #67 → #69 → #71 → #72 → #73 → #74.
ElbertePlinio commentedon Aug 25, 2026
Shipped to main after Elberte's live test of the stacked chain (2026-08-25):
GET /api/structure(34fe17c)Deferred low-severity follow-ups from earlier comments remain valid; Obsidian-style force graph discussed and not adopted (layered layout kept for direction + determinism).