fix: Align mymir_analyze downstream traversal with effective-dep-graph semantics#100
Merged
Merged
Conversation
FrkAk
approved these changes
May 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 insidegetDownstreamTxfrom the depth-naivefetchDownstreamCTE tofetchEffectiveDownstream(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:
lib/db/raw/fetch-downstream.ts. Pre-change grep confirmedgetDownstreamTxwas the only consumer; the post-change grep returns zero matches.lib/db/raw/fetch-task-full.ts:52fromfetch-downstream.tstofetch-effective-downstream.tsso the comment stays a useful pointer.Type of change
Testing
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)bun run lint)bun run typecheck)bun test: 546 pass, 0 fail across 58 files. Three new tests added intests/data/traversal.test.tsunderdescribe("getDownstream: cancelled-transparency for the analyze surface", ...):A depends_on B(cancelled) depends_on Creturns A at effective depth 1, B absent.fetchEffectiveDownstreamreturn the same id set for the same topology.All three failed against the unchanged
fetchDownstreamsubstrate (regression check bites) and pass after the swap.Notes for reviewer
{ id, depth }row shape, so the rest ofgetDownstreamTx(auth assertion, early-exit,tasks ⋈ projectsjoin,infoMapprojection) is unchanged.fetchEffectiveDownstreamaddsCYCLE id SET is_cycle USING pathplusWHERE NOT is_cycle, converting a hypothetical infinite recursion on cyclic edges (today guarded bylib/data/edge.tsinsertion checks) into bounded termination. No behavior change for acyclic inputs.getDownstream/getDownstreamTxwas 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).