Skip to content

feat: M3-07 decode confidence and provenance on every element - #150

Merged
DrunkOnJava merged 2 commits into
mainfrom
cursor/decode-confidence-provenance-67f9
Aug 29, 2026
Merged

DrunkOnJava merged 2 commits into
mainfrom
cursor/decode-confidence-provenance-67f9

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Aug 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Add ElementProvenance to every DecodedElement (stream, offset, record kind, decoder, confidence, missing fields, warnings).
  • Production paths set honest scores (typed MVP ~0.9, ArcWall 0.85–0.95, partition MVP 0.55–0.75, generic schema 0.55).
  • Surface via rvt-elements / Python decoded_elements() / viewer File Status Provenance row + JSON schemas.
  • Default IFC emission hides elements below DEFAULT_MIN_ELEMENT_CONFIDENCE (0.55); CLI --min-confidence filter.

Closes #28.

Test plan

  • cargo test --lib element_provenance_defaults_and_filters
  • cargo test --test json_schema_contracts
  • cargo clippy --lib --bins -- -D warnings
  • viewer tsc --noEmit

Note

Medium Risk
Changes default IFC export and JSON contracts (required provenance), so downstream consumers may see fewer exported elements or need schema updates; confidence scoring is heuristic and could hide or retain the wrong rows if thresholds are mis-tuned.

Overview
Implements M3-07 by attaching ElementProvenance (source stream/offset, record kind, decoder, confidence, missing fields, warnings) to every DecodedElement, and threading it through CLI, Python, JSON schemas, IFC export, and the viewer.

Production decoders now set explicit scores: typed MVP ~0.9, generic schema instances 0.55, ArcWall 0.85–0.95, and partition MVP recoveries (Level, Material, Room, floor loops, rect openings) in the 0.55–0.75 range with optional warning strings.

Consumers: rvt-elements gains --min-confidence (default 0 = show all); each element JSON includes provenance. Python decoded_elements() mirrors that shape. decoded-elements.schema.json requires provenance; export diagnostics add mean confidence, below-min count, and min_element_confidence (0.55). Default IFC emission drops elements below DEFAULT_MIN_ELEMENT_CONFIDENCE (0.55) and records below_min_element_confidence in skipped export items. The viewer File Status adds a Provenance row (mean %, hide floor, count below threshold).

Docs mark M3-07 done; .gitignore adds _project_corpus/. Widespread test DecodedElement fixtures use provenance: Default::default().

Reviewed by Cursor Bugbot for commit 5746c13. Configure here.

cursoragent and others added 2 commits August 29, 2026 18:30
Add ElementProvenance to DecodedElement with production scores for
schema/typed/partition paths. Surface via rvt-elements, Python, viewer
File Status, and JSON schemas; hide below 0.55 in default IFC export.

Co-authored-by: DrunkOnJava <[email protected]>
@DrunkOnJava
DrunkOnJava merged commit 9dc6846 into main Aug 29, 2026
23 checks passed
@DrunkOnJava
DrunkOnJava deleted the cursor/decode-confidence-provenance-67f9 branch August 29, 2026 18:30

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 5746c13. Configure here.

Comment thread src/walker.rs
class: class.name.clone(),
fields,
byte_range: start..cursor,
provenance: ElementProvenance::schema_generic("schema", start, &class.name),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generic provenance uses fake stream

Medium Severity

Generic decode_instance provenance sets source_stream to schema, which is not an OLE stream. Production iter_elements reads instance bytes from Global/Latest, and the typed branch records that path, but the non-MVP branch leaves the placeholder. CLI and Python provenance therefore point callers at a stream that does not exist for most schema-walked elements.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 5746c13. Configure here.

DrunkOnJava added a commit that referenced this pull request Aug 31, 2026
## Summary
- Add `ElementProvenance` to every `DecodedElement` (stream, offset,
record kind, decoder, confidence, missing fields, warnings).
- Production paths set honest scores (typed MVP ~0.9, ArcWall 0.85–0.95,
partition MVP 0.55–0.75, generic schema 0.55).
- Surface via `rvt-elements` / Python `decoded_elements()` / viewer File
Status **Provenance** row + JSON schemas.
- Default IFC emission hides elements below
`DEFAULT_MIN_ELEMENT_CONFIDENCE` (0.55); CLI `--min-confidence` filter.

Closes #28.

## Test plan
- [x] `cargo test --lib element_provenance_defaults_and_filters`
- [x] `cargo test --test json_schema_contracts`
- [x] `cargo clippy --lib --bins -- -D warnings`
- [x] `viewer` `tsc --noEmit`

---------

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: DrunkOnJava <[email protected]>
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.

M3-07: Add decode confidence and provenance to every element

2 participants