Repository navigation
Fix CI lifecycle, readiness, generation, and test isolation flakes - #4976
Merged
Merged
Conversation
ymichael
marked this pull request as ready for review
October 6, 2026 00:58
ymichael
pushed a commit
that referenced
this pull request
Dec 2, 2026
## Human comments ## What was wrong The provider-literal ratchet walked the file system, so files that a test run leaves in the tree counted as core code. `bb-app`'s managed-json-process test bundles into `packages/bb-app/.managed-json-cli-*`. When turbo cancels that test, the bundle stays, and the ratchet fails until someone deletes it. This is the third artifact of the kind. The first two got a path exclusion each (#4064, #4976). ## What changed - `scripts/check-provider-literal-ratchet.mjs`: `scanTree` lists files with `git ls-files -z`, so untracked files never count. The same `isIncluded` filter applies. The file walk is removed, together with the exclusions that only skipped untracked artifacts (`.packaged-plugin-build-`, `.runtime-test-`, `.wrangler`). Git tracks no file under them. A new core file now counts locally after `git add`. CI scans the committed tree, so the merge check is unchanged. - `packages/scripts/test/provider-literal-ratchet.test.mjs`: each fixture is a temporary git repository. `write()` stages the file, and artifacts are written untracked. A case for `packages/bb-app/.managed-json-cli-*/bb-app.mjs` is added. - `.gitignore`: ignores `packages/bb-app/.managed-json-cli-*` and `packages/plugin-sdk/.runtime-test-*`, like `apps/cli/.packaged-plugin-build-*`, so `git add -A` cannot commit a leaked bundle. - `docs/debugging-and-qa.md`: says that the ratchet counts git-tracked files. Why not one more exclusion: it would fix only this artifact. Filtering on git fixes the class and removes about 20 lines. ## How you verified | check | main | this PR | |---|---|---| | `node scripts/check-provider-literal-ratchet.mjs --base origin/main` (CI command), untracked `.managed-json-cli-PROBE/bb-app.mjs` present | `FAILED vs origin/main`, exit 1 | exit 0 | | same, clean tree | exit 0 | exit 0 | | git-tracked scan vs file walk on the clean repo | - | identical: 13 references in 6 files | | new test "does not count the untracked artifact packages/bb-app/.managed-json-cli-…" | fails | passes (25/25) | `turbo run typecheck lint test --filter=@bb/scripts` and `oxlint -c .oxlintrc.type-aware.json scripts .github ./*.ts` pass. Fixes #8527 > AGENT GENERATED
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.
Human comments
What was wrong
Recent CI failures came from independent lifecycle and readiness races, shared test state, and live registry resolution. A review of 900 recent CI runs classified 213 distinct failing test names; broad shuffled runs then exposed additional icon-generation and app teardown/order failures. A refresh of newer main runs found three more failures from the generated-bundle checker race fixed here. This follows #4963.
Evidence includes host/ACP failures, browser ownership, Claude permissions, Pi PID reuse, server move, environment cleanup, and registry resolution.
What changed
apps/demo-server/.wrangler/tmp/dev-*/worker.jsas the extra provider-reference source.No wire, public API, or user-facing configuration changes.
How you verified
Controlled before/after failures cover duplicate directory cleanup, readiness publication, stale PID probes, delayed permission delivery, retirement/cleanup scheduling, occupied ports, disabled form submission, open WebSocket shutdown, concurrent icon checking, shuffled toast startup, unfinished focus cleanup, delayed native filesystem events, and generated bundles appearing in the source scan. The replay regression launches eight real workers, checks the initialization bound, then verifies all eight can replay concurrently; failure cases verify queued work completes and children exit.
Diff scope: four production/tooling files (+392/-317, mostly replay-helper try/finally indentation) and 23 tests/support files (+745/-230).