Repository navigation
test(depgraph): pin computeLevels on a diamond and on a value cycle - #3292
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Size Report
Startup median (7 runs, lower is better):
|
|
This PR is ready to merge: the new I did not run the tests locally. I checked the expected diamond and cycle values by reading the code and tracing them by hand. Not blocking: the cycle assertion (a=1, b=0) at line 306 follows the sorted node order, so starting from b would give b=1, a=0. You could assert only that every level is finite and that z is greater than a, or leave it as is. Smoke Tests are still running. The diff only touches a depgraph unit test, which the device smoke tests do not exercise. Wait for CI to finish before merging. There are no conflicts. |
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Took the cycle-order point in b76abe0, but kept the assertion exact. The two cycle members must take levels {0, 1} in either order, and z must be 2. Checking only "finite and z > a" would also pass under the old behaviour, where the closing edge added one level ({1, 2} and z = 3). Making the closing edge add a level again fails this test. |
|
Summary
Follow-up to the non-blocking points in the #3275 review.
computeLevelsrelies ongenPostorderyielding each node after its successors. No test checked this. A new test builds a diamond with a shortcut (a→b→d,a→c→d,a→d), plus a type-only back edge and an isolated file, and asserts the exact level map.height()returned 0 for the node in progress, so that edge added one. Levels ingraph.jsontherefore differ from the old output only while an R4 cycle exists. A second test pins the current behaviour.scripts/layeringis already listed in Architecture quality: replace custom graph/layering code with maintained tools, close guardrail gaps, fix collocation (umbrella) #3276.Validation
pnpm check:affected --runpasses.valueGraph.nodesinstead ofgenPostordermakes both new tests fail./cycle/match in the existing cycle test fits the library's error,getTransitiveReduction: the graph contains a cycle — ….🤖 Generated with Claude Code