fix(core,geometry,export): collapse three STEP comment-skip rules that disagreed on an unterminated /* - #3377
fix(core,geometry,export): collapse three STEP comment-skip rules that disagreed on an unterminated /*#3377BIMvoice wants to merge 1 commit into
/*#3377Conversation
…t disagreed on an unterminated `/*` (#3303) `rust/core`'s entity scanner, `rust/geometry`'s IfcTriangulatedFaceSet CoordIndex reader, and `rust/export`'s STEP HEADER prescan each hand-rolled "skip a `/* ... */` comment", and answered an unterminated `/*` three different ways: the scanner refused, the geometry reader silently consumed to end of input, and the header prescan treated it as ordinary text. The scanner and the geometry reader are both walking already-located record bytes, not a header prescan, so neither had a reason to differ from the other. This adds `ifc_lite_core::skip_step_comment` as the one shared rule they both call, and it refuses an unterminated comment rather than reading past it. The geometry crate's CoordIndex reader now refuses the same way the scanner already did. `rust/export`'s header prescan keeps its own different answer on purpose, documented on `Lex::skip_comment_at`: a header prescan that swallows every later record has lost the schema, which is worse than the malformed input deserves. It now finds a *closed* comment's end via the shared function too; only the unterminated case stays its own. Grepped for a fourth hand-rolled copy in both rust/ and packages/ and found none -- every other STEP comment/string-skip site already delegates to one of these three. Claude-Session: https://claude.ai/code/session_01QPHChk3Ve9N519A4kY7436
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe PR adds a shared Rust helper for STEP block comments. Entity scanning and geometry processing reject unterminated comments. Header prescanning retains its distinct handling while using the helper for closed comments. Tests cover the shared behavior. ChangesSTEP comment handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This change consolidates STEP comment handling and adds coverage for unterminated comments; no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Linked Issues checkExplanation The changes satisfy issue Full details: Docstring CoverageExplanation Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 7 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches📝 Generate docstrings
Comment |
Viewer benchmark⚠ 1 metric(s) exceeded the regression threshold (advisory only, not blocking). 01_Snowdon_Towers_Sample_Structural(1).ifcBaseline recorded 2026-07-01T20:31:05.538Z on github-actions ubuntu-latest, viewer-benchmark-ci (headless Chrome, SwiftShader ANGLE), production build.
AC20-FZK-Haus.ifcBaseline recorded 2026-07-01T20:30:59.972Z on github-actions ubuntu-latest, viewer-benchmark-ci (headless Chrome, SwiftShader ANGLE), production build.
Refresh the baseline from a CI run: dispatch the Benchmark workflow with |
|
@coderabbitai review |
|
Summary
Fixes #3303. Three places in
rust/hand-rolled "skip a STEP/* ... */comment" and answered an unterminated/*three different ways:/*rust/coreEntityScanner(scanner.rs)None)rust/geometryCoordIndex reader (processors/mod.rs)rust/exportheader prescan (source_header.rs)/ifc_lite_core::skip_step_comment, which refuses.rust/geometryandrust/exportalready depend onifc-lite-core(checkedCargo.tomlbefore touching anything), so there was no crate-dependency-direction reason to keep three copies.rust/geometry's CoordIndex reader now calls the shared function and refuses, matching the scanner, instead of reading past a corrupt comment.rust/exportkeeps its own different answer, on purpose: its STEP HEADER prescan (Lex::skip_comment_at) treats an unterminated/*as ordinary text rather than refusing, because a header prescan that swallows every later record has lost the schema — worse than the malformed input deserves. That reasoning predates this change and is documented on the type. It now finds a closed comment's end via the same sharedskip_step_commenttoo; only the unterminated case stays its own, and the doc comment says why.rust/andpackages/forin_string/unterminated/skip_comment/skipLexicaland found none. Every other STEP comment/string-skip site already delegates to one of the three:rust/export/src/schema_detect.rs'sfind_unquotedalready reusessource_header::Lex::skip_lexical_at, and the TypeScript side'spackages/parser/src/step-lexing.tsis the only place either oftokenizer.tsorsource-header.tscalls for this rule.schema_detect.rsdoes carry a comment noting a separate, unrelated divergence (case-sensitiveENDSEC/FILE_SCHEMAmatching vs the TS side) that it says is "tracked in Three Rust crates hand-roll the STEP lexical rule, and they answer an unterminated comment three different ways #3303" — that is not the comment-skip rule this issue is about and is left untouched here.RED before the fix
rust/geometry/src/processors/tests.rsgained a test comparing the CoordIndex reader's pre-fix inline comment-skip (skip_comment_lossy, since removed) againstifc_lite_core::EntityScanneron the same unterminated-comment fixture:Test plan
cargo test -p ifc-lite-core -p ifc-lite-geometry -p ifc-lite-export— 114 test-result blocks (unit + integration + doctests across all three crates), 0 failed,EXIT=0. Run twice: once that hit a shared-target-dir race from a concurrent build (unrelatedE0425on a stale cached rlib, resolved by rebuilding), and once clean with an isolatedCARGO_TARGET_DIR.rust/core/src/parser/lexical.rs's own unit tests,rust/geometry/src/processors/tests.rs::unterminated_comment_geometry_and_core_scanner_agree, andrust/export'ssource_header_comments.rs::an_unterminated_comment_does_not_swallow_the_records_after_itall pass.Co-Authored-By: Claude Opus 5 noreply@anthropic.com
https://claude.ai/code/session_01QPHChk3Ve9N519A4kY7436
Summary by CodeRabbit
Bug Fixes
Tests