fix(ci): stop a comment in tach.toml from truncating a module's deps - #76629
Merged
Conversation
|
😎 This pull request was merged. |
parseTachModules scanned for the closing bracket of depends_on with a non-greedy match, so a `]` inside a comment ended the list early and every entry below it was dropped. products.review_hog annotates its facade-only edge with the name of the tach block that enforces it, and the two entries after that comment, products.stamphog and products.tasks, were never parsed. The drop was silent because the fail-closed check discarded comments before looking for unsupported syntax, so a truncated list looked well-formed. Both consumers lost the same edges: turbo-discover skipped review_hog's suite when stamphog or tasks changed, and the merge queue put the two products in parallel lanes. Ten of the last 500 merged PRs should have claimed py:product:review_hog and did not. Comments are now stripped before the block scan, which also lets the fail-closed check see the raw list again. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
gantoine
force-pushed
the
fix/tach-depends-on-comment-parse
branch
from
August 3, 2026 12:43
b17ec24 to
49c32d8
Compare
gantoine
marked this pull request as ready for review
August 3, 2026 12:49
Contributor
Prompt To Fix All With AI### Issue 1
.github/scripts/turbo-discover.js:258
**Count preceding escape characters**
When a valid TOML string closes after an escaped backslash, checking only the immediately preceding character leaves `inString` enabled, so later comments are not stripped and their brackets can truncate dependency lists or trigger unnecessary all-product test runs.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "fix(ci): stop a comment in tach.toml fro..." | Re-trigger Greptile |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the .github/scripts tach graph parsing used by CI targeting (Turbo discovery + Trunk merge-queue lanes) so that TOML comments inside depends_on lists can’t silently truncate dependency edges.
Changes:
- Strip TOML
#comments (while respecting#inside double-quoted strings) before scanning[[modules]]blocks, preventing early termination on]inside comments. - Simplify the “fail-closed” leftover validation now that comments are removed up-front.
- Add a regression test ensuring a
depends_oncomment containing]does not drop subsequent dependencies.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| .github/scripts/turbo-discover.js | Adds comment stripping before module parsing and adjusts fail-closed validation to prevent silent edge loss. |
| .github/scripts/turbo-discover-cascade.test.js | Adds a focused regression test covering ] inside comments within a depends_on list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
rnegron
approved these changes
Aug 3, 2026
|
This pull request was merged into |
joethreepwood
added a commit
that referenced
this pull request
Aug 5, 2026
…76629) Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Problem
parseTachModulesfinds the end of adepends_onlist with a non-greedy\[([\s\S]*?)\], so it stops at the first]in the block. A comment inside the list can carry one.products.review_hoghas exactly that:The scan ends inside
[[interfaces]], so the parser returns["engineering_analytics", "signals", "skills"]and drops stamphog and tasks.It is silent, which is the part that matters. The fail-closed check right below is meant to throw on anything the regexes cannot represent, but it strips
#comments before looking, so a list truncated by a comment looks perfectly well-formed.Two consumers read that graph and both lost the same edges:
py:product:review_hogout of the lane set for those changes, so a stamphog facade rename and a review_hog call site could merge in parallel without ever being tested together. That is the exact conflict the lanes exist to prevent.Replaying the last 500 merged PRs through the target script, 10 should have claimed
py:product:review_hogand did not, all of them touchingproducts/tasks.Changes
Strip TOML comments before the block scan, tracking double-quoted strings so a
#inside one is left alone. With comments gone the non-greedy scan is correct again, and the fail-closed check can go back to seeing the raw list (it no longer needs to strip comments itself, which is what blinded it).review_hog is the only module affected today. I verified that by diffing the parser's output against a line-based reference parse of the real
tach.toml:After the fix,
tachDependents(['stamphog'])returns['review-hog']andtachDependents(['tasks'])gainsreview-hogalongside the nine products it already named.Note
This only ever adds edges, so both consumers move in the safe direction: more test suites run, more lanes claimed. No product loses coverage.
How did you test this code?
node --teston all three suites that read this parser:turbo-discover-cascade.test.js(11 pass, 1 new),turbo-discover-staleness.test.js(10 pass),trunk-impacted-targets.test.js(36 pass).The new case covers the regression no existing test caught: a
depends_onlist whose comment contains], asserting all three entries survive. Against the current parser it returns only the first entry, so it fails without the fix. The two existing fail-closed tests still pass, which is what keeps theleftoverchange honest.I also ran the real
tach.tomlthrough both versions and diffed all 69 product modules against an independent line-based parse (numbers above), and replayed the last 500 merged PRs throughtrunk-impacted-targets.jswith each version to get the 10-PR figure.👉 Stay up-to-date with PostHog coding conventions for a smoother review.
Automatic notifications
Docs update
Not applicable. The reasoning lives in the parser's own comments.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Found by Claude (Claude Code) while I had it checking whether the merge-queue lane rules could lean harder on the tach graph (#76481). Before answering that, it validated the graph the rules already trust, comparing
parseTachModulesoutput against an independent parse oftach.toml, and this was the one module where they disagreed.Worth a reviewer's eye: I kept the fix to comment stripping rather than swapping in a real TOML parser.
.github/scriptshas no dependencies and runs on bare node in CI, and the existing throw-on-anything-unusual contract already covers the shapes a hand-rolled reader cannot represent. A parser would be the right call if these blocks ever grow inline tables./writing-testsand/writing-code-commentsinvoked before the test and comment edits.