Repository navigation
Deduplicate cycle-analysis work and missing-dependency records across output aliases (#979) - #1198
Conversation
Record the delivery plan for deduplicating cycle-analysis work and missing-dependency records across output aliases. The plan traces the reported allocation finding to alias-keyed traversal, sets out the edge-keyed remediation, and records that the supplied instruction to exclude order-only dependencies is not actioned because it contradicts ADR-0068 and a live Kani proof. Co-Authored-By: Claude Code <noreply@anthropic.com>
Reproduce the reported amplification before changing traversal. A target with four output aliases and four absent dependencies retains sixteen missing-dependency records instead of four, and a three-alias edge with two dependencies is scanned six times instead of twice. Also pin the existing exact alias witnesses so the fix cannot silently alter them. The scan accounting is a test-only thread-local counter reset at the start of each detection pass; non-test builds compile it as a no-op. Co-Authored-By: Claude Code <noreply@anthropic.com>
Cycle detection previously keyed visitation by output alias, so an edge with several aliases was expanded once per alias and every absent dependency was copied into the report once per alias. Key state by EdgeId instead, resolve each alias before the state check, and retain the entry alias in each stack frame so witnesses still name real output paths. Missing dependencies are now recorded once per examined entry under the alias that entered the edge, bounding the report by the declared dependency entries. Presence mode keeps allocating no records and no witness, and Kani's bounded map gains plain EdgeId key equality. Order- only dependencies remain in traversal per ADR-0068. Co-Authored-By: Claude Code <noreply@anthropic.com>
Add a generated-graph property that requires every edge to declare at least two aliases and an absent dependency, then asserts that missing records and dependency scans stay within the declared entries. Each reported witness must be closed and every consecutive pair must be a declared dependency of its producer, and cycle presence must agree with the independent edge-level oracle. Add manifest-lowering cases for one target with 64 aliases and 64 external sources, and for a cycle closed through the second alias. The cyclic case proves the report retains one record per external source under the entry alias and still names the requested alias in its witness. Co-Authored-By: Claude Code <noreply@anthropic.com>
Describe the once-per-edge traversal, alias-bearing stack frames, and missing-record bound in the design and developers' guides. Regenerate the five mutation patches whose hunk context moved when traversal became edge-keyed; the seeded faults are unchanged. Record the implementation progress and decisions in the ExecPlan. Co-Authored-By: Claude Code <noreply@anthropic.com>
Split the generator and its graph descriptions into a child module so neither source file exceeds the repository's 400-line limit. No test behaviour changes. Co-Authored-By: Claude Code <noreply@anthropic.com>
Extract the extra-dependency resolution so the generator closure is no longer excessively nested, rename the bounded alias ordinal, and give each representative-graph violation list its own binding. Behaviour is unchanged. Co-Authored-By: Claude Code <noreply@anthropic.com>
Point the developers' guide at the directory module produced by the file-size split, and record the gate results, the Kani prewarm capacity retry, and the measured bounds in the ExecPlan. Co-Authored-By: Claude Code <noreply@anthropic.com>
The representative cyclic graph declared no implicit output on its target edge, so the implicit-output back arc fell back to an explicit alias and the control did not test what its documentation claimed. Give that edge an implicit output and require the witness to name it. Addresses the CodeRabbit review finding on the multi-alias property module. Co-Authored-By: Claude Code <noreply@anthropic.com>
Describe VisitState in terms of canonical edges, which is what the detector now keys on, and record the test-only gate scope in the ExecPlan. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true |
Reviewer's GuideData structuresAdd
APIAdd a crate-private graph lookup that returns the stored alias, canonical edge ID, and producing edge in one probe.
ImplementationChange cycle detection to visit each canonical edge once while retaining entry aliases for missing-dependency records and cycle witnesses.
Update cycle-analysis helpers to resolve aliases to canonical edge IDs and look up visitation state by edge.
Wire in the scan-accounting helper and test modules for the new cycle-analysis coverage.
Add test-only per-thread accounting for dependency entries examined during cycle detection.
DocumentationDocument edge-keyed traversal, alias-bearing witnesses, and the bound on missing-dependency records in the design and developer guides.
Record the implementation plan, constraints, decisions, and verification evidence for issue 979.
TestsAdd focused regressions for bounded missing records, once-per-edge scans, and alias-specific cycle witnesses.
Add generated multi-alias graphs and properties checking scan and record bounds, witness validity, and cycle detection against an independent oracle.
Share cycle-test graph builders and update existing detector tests to use the revised lookup result.
Extend manifest-lowering tests to cover one canonical edge with many aliases and bounded missing records in a cycle through a non-first alias.
Refresh mutation patches so the existing Kani verification faults still apply to the restructured detector.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Record the draft pull request, the final review outcome, and the plan's completion status. Co-Authored-By: Claude Code <noreply@anthropic.com>
There was a problem hiding this comment.
Gates Failed
Enforce advisory code health rules
(2 files with Code Duplication)
Our agent can fix these. Install it.
Gates Passed
5 Quality Gates Passed
Reason for failure
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| alias_regression_tests.rs | 1 advisory rule | 9.39 | Suppress |
| mod.rs | 1 advisory rule | 10.00 → 9.39 | Suppress |
Quality Gate Profile: Pay Down Tech Debt
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
Closes #979
Summary
Cycle analysis previously keyed its depth-first traversal by output alias,
so an edge with several aliases was expanded once per alias and every absent
dependency was copied into the report once per alias. Key traversal state by
the canonical
EdgeIdinstead, and retain the entry alias in each stack frameso witnesses still name real output paths.
lists are scanned once, regardless of how many aliases index it.
bof an active edge yields the witness[b, later entry aliases…, b]. Exact single-output diagnostics areunchanged.
that entered the dependent edge. Retained records are bounded by the declared
dependency entries rather than the alias × dependency product.
order_only_depsremain in traversal per ADR-0068.Bounds and evidence
and a three-alias edge with two entries was scanned six times.
dscans forddeclared entries.
5 missing records exceed 3 declared entriesand7 dependency scans exceed 3 declared entries.canonical edge. A cyclic variant retains exactly 64 records and a witness
naming the requested non-first alias.
Tests and gates
make check-fmtmake markdownlintmake doc-coveragemake testmake lintmake test-workflow-contractsmake kani-checkmake kani-fullmake test-kani-mutationsToolchain: Rust
nightly-2026-11-10, Linuxmoldlinker, pinned Kani 0.67.0.The mutation gate needs a git checkout, which the worktree provides.
All gates passed on the final head. The first
make test-kani-mutationsruntimed out its cold prewarm at the configured 900-second allowance under host
load; the warm retry passed the prewarm, the negative control, and every
patched-tree compile. CodeRabbit reported one trivial finding on the
multi-alias control graph, which is fixed; the re-review reports zero
findings.
Notes
Displaytext, or users' guide behaviour changes.order_only_depswas not actioned:ADR-0068 and the live
order_only_two_node_cycle_reports_cycleharnessrequire order-only traversal.
src/ir/cycle/alias_regression_tests.rs,src/ir/cycle/property_tests/multi_alias_property_tests/, andtests/ir_from_manifest_tests/canonical_edge_storage.rs.docs/execplans/issue-979-deduplicate-cycle-analysis-work-and-missing-dependency-records-across-output-aliases.md.References
🤖 Generated with Claude Code
Summary by Sourcery
Deduplicate cycle detection across output aliases while retaining accurate diagnostics and bounded missing-dependency reporting.
Bug Fixes:
Enhancements:
Documentation:
Tests: