Skip to content

Count only git-tracked files in the provider-literal ratchet - #8528

Merged
ymichael merged 1 commit into
get-bb:mainfrom
lanjak:fix-ratchet-tracked-files
Dec 2, 2026
Merged

ymichael merged 1 commit into
get-bb:mainfrom
lanjak:fix-ratchet-tracked-files

Conversation

@lanjak

@lanjak lanjak commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

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

scanTree walked the file system, so a file 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 then fails with
"core gained provider-id references" until someone deletes it. Two
earlier artifacts of the same kind got their own path exclusion.

scanTree now lists files with git ls-files, so untracked files never
count. The file walk and the exclusions for untracked artifacts
(.packaged-plugin-build-, .runtime-test-, .wrangler) are removed. The
fixture tests now run in a temporary git repository and write their
artifacts as untracked files.

.gitignore now ignores the bb-app and plugin-sdk test temp roots, so
git add -A cannot commit a leaked bundle. docs/debugging-and-qa.md
says that the ratchet counts git-tracked files.
@ymichael
ymichael merged commit 1db0e6e into get-bb:main Dec 2, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provider-literal ratchet counts untracked files that a test run leaves behind

2 participants