Skip to content

fix: Align mymir_analyze downstream traversal with effective-dep-graph semantics#100

Merged
FrkAk merged 2 commits into
mainfrom
fix/mymr-209-effective-downstream-analyze
May 25, 2026
Merged

fix: Align mymir_analyze downstream traversal with effective-dep-graph semantics#100
FrkAk merged 2 commits into
mainfrom
fix/mymr-209-effective-downstream-analyze

Conversation

@ulascanzorer
Copy link
Copy Markdown
Collaborator

Summary

Task Reference: [MYMR-209]

Aligns the mymir_analyze type='downstream' impact-analysis surface with the cancelled-transparent effective-dep-graph semantics MYMR-207 shipped for the agent/planning/review context bundles. Swaps the single helper call inside getDownstreamTx from the depth-naive fetchDownstream CTE to fetchEffectiveDownstream (lib/db/raw/fetch-effective-downstream.ts), so cancelled tasks no longer appear as dependents and cancelled middles no longer consume depth slots. Both surfaces now consume the same SQL CTE substrate, which makes divergence between them structurally impossible.

Out-of-scope-looking but intentional cleanups bundled in the same change so reviewers do not flag them as drift:

  • Deletes the now-orphan lib/db/raw/fetch-downstream.ts. Pre-change grep confirmed getDownstreamTx was the only consumer; the post-change grep returns zero matches.
  • Updates the dangling JSDoc reference in lib/db/raw/fetch-task-full.ts:52 from fetch-downstream.ts to fetch-effective-downstream.ts so the comment stays a useful pointer.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation

Testing

  • Tested locally with bun run dev (not applicable: server-side SQL change with no UI surface; coverage is the test fixture exercising auth → tx → CTE → projection end-to-end)
  • Linting passes (bun run lint)
  • Typecheck passes (bun run typecheck)

bun test: 546 pass, 0 fail across 58 files. Three new tests added in tests/data/traversal.test.ts under describe("getDownstream: cancelled-transparency for the analyze surface", ...):

  • AC 1 — cancelled task is never reported as a dependent (direct edge).
  • AC 2 — A depends_on B(cancelled) depends_on C returns A at effective depth 1, B absent.
  • AC 3 — analyze downstream and the bundle's fetchEffectiveDownstream return the same id set for the same topology.

All three failed against the unchanged fetchDownstream substrate (regression check bites) and pass after the swap.

Notes for reviewer

  • The CTE swap is a structural change with identical 4-arg signature and { id, depth } row shape, so the rest of getDownstreamTx (auth assertion, early-exit, tasks ⋈ projects join, infoMap projection) is unchanged.
  • fetchEffectiveDownstream adds CYCLE id SET is_cycle USING path plus WHERE NOT is_cycle, converting a hypothetical infinite recursion on cyclic edges (today guarded by lib/data/edge.ts insertion checks) into bounded termination. No behavior change for acyclic inputs.
  • No JSDoc on getDownstream / getDownstreamTx was modified; the existing defense-in-depth note about cross-project edges still holds (the project-id filter is in both seed and recursive steps of the new CTE).

@ulascanzorer ulascanzorer requested review from FrkAk and ZeyNor as code owners May 24, 2026 17:24
@ulascanzorer ulascanzorer self-assigned this May 24, 2026
@FrkAk FrkAk merged commit 8927122 into main May 25, 2026
4 checks passed
@FrkAk FrkAk deleted the fix/mymr-209-effective-downstream-analyze branch May 25, 2026 11:38
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