Skip to content

feat: journey query — lazy page→event→effect expansion, cyclic-safe (B5/B6)#20

Merged
officialCodeWork merged 1 commit into
developmentfrom
build/phase-3/step-3.3-journey-query
Jul 14, 2026
Merged

feat: journey query — lazy page→event→effect expansion, cyclic-safe (B5/B6)#20
officialCodeWork merged 1 commit into
developmentfrom
build/phase-3/step-3.3-journey-query

Conversation

@officialCodeWork

Copy link
Copy Markdown
Owner

Step 3.3 — Journey query (lazy expansion)

Failure modes B5/B6. Adds journeys(graph, start, { depth }) in core — the third of CodeRadar's three core requirements (match · attribution · journeys).

Given a route path (/users/:id), component name, or instance id, it enumerates user-journey paths at query time: on each screen the user fires an event whose action effect (step 3.2) either navigates to another route — continuing on the next page — or terminates the path at a fetch or state write.

Cyclic-safe by construction (B6)

Per-path visited-set of pages: a node may recur across sibling paths but never loops within one. A list ↔ detail cycle yields a finite path that ends cycle instead of hanging — depth=50 on a cyclic graph still returns in <1 ms.

  • depth caps navigation levels; the boundary path ends depth-limit and the result is flagged truncated. maxPaths caps total fan-out.
  • Steps carry the EdgeCondition that gated them (populated by step 3.5).
  • Screen events include those handled by the page component and any component in its render subtree, so a button living in a child component still counts as on the page.

Now testable end-to-end 🎉

New coderadar journeys <start> CLI command. Full pipeline on the b6 fixture:

$ coderadar scan eval/fixtures/b6-cyclic-journeys/app
$ coderadar journeys /users
3 journey path(s) from /users:

  ▸ /users  • onClick()  ⇢ fetch /api/users
  ▸ /users  • onClick()  → /users/:userId  ▸ /users/:userId  • onClick()  → /users  ▸ /users  ↩ cycle
  ▸ /users  • onClick()  → /users/:userId  ▸ /users/:userId  • onClick()  ⇢ fetch /api/users/current

Plus the existing find (screenshot text → component) and trace (component → data/state/events) commands.

Eval

  • New journeys golden check (asserts a path visiting an ordered page sequence with a given end).
  • New fixture b6-cyclic-journeys (list ↔ detail loop).
  • journeys.test.ts: navigate/fetch expansion, cycle termination, large-depth safety, depth cap, start resolution (route/component/instance), condition threading.

Verification

  • pnpm -r build / typecheck / test: 29 core + 84 parser tests pass.
  • pnpm eval: 185 pass · 0 fail, precision/recall 1.000, match accuracy 1.000.

🤖 Generated with Claude Code

…B5/B6)

Add journeys(graph, start, { depth }) in core (TRACKER step 3.3). Given a route
path, component name, or instance id, it enumerates user-journey paths at query
time: on each screen the user fires an event whose action effect (step 3.2)
either navigates to another route — continuing on the next page — or terminates
the path at a fetch or state write.

- Per-path visited-set of pages: a node may recur across sibling paths but never
  loops within one, so a list ↔ detail cycle yields a finite path that ends
  "cycle" (B6) instead of hanging. depth=50 on a cyclic graph still returns in <1ms.
- depth caps navigation levels; the boundary path ends "depth-limit" and the
  result is flagged truncated. maxPaths caps total fan-out.
- Steps carry the EdgeCondition that gated them (populated by step 3.5).
- Screen events include those handled by the page component and any component in
  its render subtree, so a button living in a child component is on the page.

Also expose it end-to-end: new `coderadar journeys <start>` CLI command renders
each path (▸ page • event → navigate ⇢ fetch ✎ state-write, with ↩ cycle).

Eval: new `journeys` golden check (page-sequence + end) and fixture
b6-cyclic-journeys (list ↔ detail loop). Core journeys.test.ts covers navigate/
fetch expansion, cycle termination, large-depth safety, depth cap, start
resolution, and condition threading. 29 core + 84 parser tests pass; eval green
(185 pass, precision/recall 1.000).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@officialCodeWork
officialCodeWork merged commit 9b0d9e6 into development Jul 14, 2026
1 check passed
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.

2 participants