Skip to content

fix(ci): treat __corpus__ and sibling fixture dirs as test data in revert-oracle - #4145

Merged
louistrue merged 4 commits into
mainfrom
fix-4142-corpus-test-dir
Sep 8, 2026
Merged

fix(ci): treat __corpus__ and sibling fixture dirs as test data in revert-oracle#4145
louistrue merged 4 commits into
mainfrom
fix-4142-corpus-test-dir

Conversation

@BIMvoice

@BIMvoice BIMvoice commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

TEST_DIR_RE in scripts/lib/revert-oracle.mjs did not match __corpus__,
so a branch touching only packages/ids/src/__corpus__/ -- 334 of the
repo's 367 tracked .ifc files -- was classified as production code with
no accompanying test, and the oracle false-aborted:

[revert-oracle] ABORT: this branch changes production code and adds/changes NO test file.

Same false-abort family as #4137 and #4108, tracked under the umbrella
#4109.

The choice

#4142 presented two options without advocating one. I checked the issue's
comments and there were none, so no choice was made for me. This PR infers
option 1
-- treat __corpus__ as test data -- rather than presenting it as
the only possibility:

  1. Add __corpus__ (and the siblings found by the sweep below) to
    TEST_DIR_RE. This matches how __fixtures__, test-fixtures etc. are
    already treated, and is what the revert-oracle renders capability gaps as findings about the PR (umbrella: #4050, #4085, #4104, #4107, #4108) #4109 umbrella is converging on. Trade-off
    accepted
    : a corpus edit that genuinely changes behaviour no longer gets
    flagged by the oracle as needing an observing test.
  2. Leave __corpus__ classified as production and require
    revert-oracle-exempt on every corpus-only PR. Keeps the signal at the
    cost of a manual label each time. This option remains available if the
    trade-off above turns out wrong for a maintainer.

Sibling sweep

Enumerated every directory segment in the repo (git ls-files, grouped by
basename) that looks fixture-like, and checked each against TEST_DIR_RE /
TEST_SEGMENT_RE:

directory (basename) files already matched? verdict
packages/ids/src/__corpus__/ 673 no added -- raw .ifc/data fixtures, the issue's subject
apps/viewer/src/lib/__test__/ 1 no added (__test__, singular) -- stubs.ts says "Production code never imports from this module", imported only by *.test.ts
rust/{core,geometry}/fuzz/corpus/ 13 no added (bare corpus) -- raw fuzzer seed inputs, no code
packages/bcf/test-data/ 4 no added (test-data, hyphenated) -- .bcf fixtures imported only by *.test.ts
packages/{bcf,export,server-client}/src/__fixtures__/, packages/ids/src/audit/__fixtures__/ 82 yes (__fixtures__) no change
*/tests/{fixtures,golden,snapshots,census_golden}/ (rust crates, packages/provenance/test/golden, packages/extensions/test/fixtures) ~127 yes (tests?/ segment) no change
packages/collab/src/snapshot/ 11 no left out -- production feature code, not test snapshots
packages/source-fixture/, packages/world-frame-fixtures/ 39 no left out -- published packages with their own src/, versioned, changelogs
scripts/fixtures/ (build-manifest.mjs, fetch-fixtures.mjs, upload-fixtures.mjs) 3 no left out -- tooling scripts, not fixture data
packages/data/scripts/fixtures/epsg-control-points.json 1 no left out -- production config data
apps/landing/samples/, apps/viewer/public/samples/ 12 no left out -- assets shipped to users, not test data
examples/, rust/*/examples/, demo/ 58 no left out -- SDK example/demo code

Bare fixtures is deliberately not added, precisely because
scripts/fixtures/*.mjs holds real tooling scripts -- adding it would have
misclassified production code as test scaffolding.

Verification

RED, before the fix:

$ node --input-type=module -e "import { classifyPath } from './scripts/lib/revert-oracle.mjs'; console.log(classifyPath('packages/ids/src/__corpus__/foo.ifc'));"
production

GREEN, after:

test

Over-reach check (mutation-style, run against every look-alike found by the
sweep): all still classify production, e.g.
packages/collab/src/snapshot/from-step.ts -> production,
packages/source-fixture/src/index.ts -> production,
scripts/fixtures/build-manifest.mjs -> production,
apps/viewer/public/samples/hello-wall.ifc -> production. Genuine
production paths (packages/ids/src/audit/engine.ts, rust/core/src/parser.rs)
still classify production too.

Mutation of the fix itself: reverting TEST_DIR_RE to the original five
alternatives drops the suite from 56/56 to 55 pass / 1 fail -- exactly the
new sibling test added for #4142.

node --test scripts/lib/revert-oracle.test.mjs: 56 pass, 0 fail
(was 54 before this change; +2 test blocks).

Also ran and confirmed exit 0: check-module-size.mjs (revert-oracle.mjs
stays at its exact 528-line budget -- the doc comment above TEST_DIR_RE
was kept to one line for this, with the fuller rationale in
revert-oracle.test.mjs instead), check-test-wiring.mjs,
check-source-text-assertions.mjs.

Conflict with the revert-oracle cluster

#4140, #4141 and #4131 all edit scripts/lib/revert-oracle.mjs in or near
this same region
(classification helpers / TEST_DIR_RE neighbourhood).
#4141 in particular restructures classification into a new
revert-oracle-classify.mjs. This PR's diff to revert-oracle.mjs is a
2-line change (one comment, one regex), so it should be low-friction to
rebase onto whichever of #4140/#4141/#4131 merges first, but it will likely
need to sequence behind them rather than merge independently.

No changeset: scripts-only change to internal CI tooling, no published
package changes -- following the precedent of the other revert-oracle
fixes in this cluster, none of which carry a changeset.

Closes #4142

Summary by CodeRabbit

  • Bug Fixes

    • Improved classification of fixture and test-data directories so they are correctly treated as test files rather than production files.
    • Preserved production classification for similarly named directories containing shipped code or assets.
  • Tests

    • Added coverage for supported fixture-directory patterns and production-directory lookalikes.

…n revert-oracle

TEST_DIR_RE did not match __corpus__, so a branch touching only
packages/ids/src/__corpus__/ (334 of the repo's 367 tracked .ifc files) was
classified as changing production code with no accompanying test and
false-aborted.

#4142 presented two options without a maintainer choice in the issue's
comments (there were none): treat __corpus__ as test data, or leave it
production and require revert-oracle-exempt per PR. This implements the
first, inferred rather than chosen for me -- it matches how sibling
directories are already treated. The trade-off accepted: a corpus edit that
genuinely changes behaviour no longer gets flagged as needing an observing
test. Option 2 (revert-oracle-exempt per PR) remains available if that
trade-off turns out wrong.

A repo-wide sweep for directories in the same shape (raw fixture data, not
code) added __test__, bare corpus (fuzz seed inputs under rust/*/fuzz/corpus)
and test-data alongside __corpus__. Left out as genuine production, verified
by mutation: packages/collab/src/snapshot/ (a feature), packages/source-fixture/
and packages/world-frame-fixtures/ (published packages with their own src/),
scripts/fixtures/*.mjs (tooling scripts), and the app samples/ directories
(assets shipped to users).

Refs #4109
@BIMvoice
BIMvoice requested a review from louistrue as a code owner September 8, 2026 07:25
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Claude review - no findings for 5a913926f

Reviewed this diff and found nothing to flag.

@github-actions github-actions Bot added the llm-reviewed A review was verified as posted for this PR's head. label Sep 8, 2026
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Warning

Review limit reached

  • Run on-demand review

This review includes 2 billable files and costs up to $0.50.

Or wait 59 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: a92c9105-2474-4672-a599-ddcc6a97d418

📥 Commits

Reviewing files that changed from the base of the PR and between 5a91392 and 4d409dd.

📒 Files selected for processing (2)
  • scripts/lib/revert-oracle.mjs
  • scripts/lib/revert-oracle.test.mjs

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: c1d5bdd4-305b-460a-8b6f-b46fd468e4f6

📥 Commits

Reviewing files that changed from the base of the PR and between 0546d79 and 5a91392.

📒 Files selected for processing (2)
  • scripts/lib/revert-oracle.mjs
  • scripts/lib/revert-oracle.test.mjs

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The revert oracle now classifies __corpus__, __test__, corpus, and test-data paths as test files. New tests confirm these paths classify as test while similar production and asset paths remain production.

Changes

Fixture classification

Layer / File(s) Summary
Classifier and regression tests
scripts/lib/revert-oracle.mjs, scripts/lib/revert-oracle.test.mjs
TEST_DIR_RE recognizes four additional fixture directory names. Tests cover both fixture paths and look-alike production paths.

Priority: ➖ Normal — Impact reflects medium issue severity.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 0e83a

Fixture and corpus directories now avoid false production-without-tests aborts while similarly named production and asset paths retain production classification. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 7 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The change also adds test, corpus, and test-data patterns. Issue #4142 directly requires a decision for corpus, but it does not define requirements for these additional directory patterns. Limit the implementation to corpus and its required tests, or link an issue that explicitly requires the additional fixture-directory patterns and their production-path exclusions.
✅ Passed checks (7 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the primary change: classifying corpus and related fixture directories as test data in revert-oracle.
Linked Issues check ✅ Passed The change satisfies issue #4142 by adding corpus to TEST_DIR_RE and preventing corpus-only changes from being classified as untested production changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Changeset Bump Matches The Api Surface ✅ Passed No .changeset/ file changed in the pull request. The HEAD-to-parent diff contains only scripts/lib/revert-oracle.mjs and scripts/lib/revert-oracle.test.mjs, and git diff -- .changeset is empty…
Verification Evidence Is Present ✅ Passed The description states what ran and what was observed. It reports the node --input-type=module classification output changing from production to test for packages/ids/src/__corpus__/foo.ifc, a…
One Defect Class Per Pr ✅ Passed PASS: The PR fixes one shared classification defect in scripts/lib/revert-oracle.mjs. The four directory forms are alternatives in the single TEST_DIR_RE predicate at line 65, consumed by `classif…
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-4142-corpus-test-dir

Comment @coderabbitai help to get the list of available commands.

@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated
ifc-lite-dev Ignored Ignored Sep 8, 2026 11:41am UTC
ifc-lite-viewer-embed Ignored Ignored Sep 8, 2026 11:41am UTC

@github-actions github-actions Bot removed the llm-reviewed A review was verified as posted for this PR's head. label Sep 8, 2026
BIMvoice added a commit that referenced this pull request Sep 8, 2026
…t inert

#4137's new `inert` bucket demotes a binary path with no runner claiming it
as source. The four `.bcf` fixtures under `packages/bcf/test-data/` are real
zip archives read byte-for-byte by reader.test.ts, schema-validation.test.ts
and the fabricated-*.test.ts suites, but `test-data` matched neither
TEST_DIR_RE (testdata, test-fixtures) nor TEST_SEGMENT_RE (needs a literal
test/tests segment). On this branch they classified `production` before
#4137 and silently drop to `inert` under it -- exactly the silent-miss
direction the bucket exists to avoid.

Verified against #4145 (open, not yet merged): that PR separately adds
`test-data` (plus `__corpus__`/`corpus`/`__test__`) to the pre-split
revert-oracle.mjs, but #4137 already moved TEST_DIR_RE out of that file into
revert-oracle-classify.mjs, so #4145's patch cannot land here as-is. The
regression exists on this branch today independent of merge order, so the
fix belongs here.

Swept the repo's fixture-directory naming conventions for the same shape by
enumerating every binary path in the tree and classifying it: the only other
binaries hitting `inert` are icons/favicons (correctly inert -- no test
reads them) and rust/geometry/fuzz/corpus/** seeds (correctly inert -- only
`cargo fuzz run` touches them). apps/landing/samples/hello-wall.parquet also
lands `inert`; no test references it (only the sibling .ifc, which stays
production via the .gitattributes `-diff` exemption), so that is a real
shipped-but-unwitnessed asset, not a regression. `packages/extensions/src/
testing/` was checked and confirmed to stay `production` (exports public SDK
API), so it was deliberately left out of the pattern.
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Claude review - no findings for 0e83a73f0

Reviewed this diff and found nothing to flag.

@github-actions github-actions Bot added the llm-reviewed A review was verified as posted for this PR's head. label Sep 8, 2026
@github-actions github-actions Bot removed the llm-reviewed A review was verified as posted for this PR's head. label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Claude review - no findings for a0ec9f783

Reviewed this diff and found nothing to flag.

@github-actions github-actions Bot added the llm-reviewed A review was verified as posted for this PR's head. label Sep 8, 2026
@github-actions github-actions Bot removed the llm-reviewed A review was verified as posted for this PR's head. label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Claude review - no findings for 4d409ddbf

Reviewed this diff and found nothing to flag.

@github-actions github-actions Bot added the llm-reviewed A review was verified as posted for this PR's head. label Sep 8, 2026
@louistrue
louistrue merged commit a7883c4 into main Sep 8, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llm-reviewed A review was verified as posted for this PR's head.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

revert-oracle: TEST_DIR_RE does not match __corpus__, so IDS corpus-only branches false-abort as untested production

2 participants