Repository navigation
feat(metadata): read worksharing, last save and document identity, and inventory folders with rvt-info - #284
Merged
Merged
Conversation
…d inventory folders with rvt-info BasicFileInfo carries a block of `Key: value` lines on every release 2016-2026 (Worksharing, Username, Central Model Path, Last Save Path, Unique Document GUID, Unique Document Increments, IsSingleUserCloudModel, Author, ClientAppName, ...) that the regex scan never read: the block starts at an odd byte offset on 2026 and both magnetar projects, and IsSingleUserCloudModel is a narrow "False\0" packed into wide text. parse_properties decodes both alignments, restores narrow booleans and recovers the tail after a narrow "True\0" alignment flip. Pinned on all 11 phi-ag releases (tests/samples.rs) plus synthetic odd/even/flip cases. ProjectInformation, the one-entry ZIP project files carry instead of PartAtom, is parsed for its Atom entry (save timestamp); the entry name embeds the saving machine's user folder and is never surfaced. PartAtom::entry_title is the entry's own title; `title` keeps its last-title-wins value, which the Python API documents. rvt::metadata::FileMetadata combines both; read_metadata(path) reads only those two streams from disk. rvt-info gains a Document section and takes several files or folders (recursive, --no-recurse) as an inventory: table, -f csv, -f json, -f jsonl, backup copies marked, unreadable files as error rows with exit status 1, --json shorthand. --redact also scrubs the last-saved-by user inside local-copy names (<central>_<user>.rvt). Python: RevitFile.metadata(), rvt.read_metadata(). Wasm: fileMetadata(). Viewer: Saved and Worksharing rows in File status. Open errors name the file and report directories. Schemas: file-metadata, inventory-row; summary gains `document`.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_010cc59b-6410-4bc8-8182-8096e512872c) |
DrunkOnJava
enabled auto-merge (squash)
September 22, 2026 19:06
This was referenced Sep 22, 2026
DrunkOnJava
added a commit
that referenced
this pull request
Sep 22, 2026
…#286) ## Summary The 18 CLIs now take input, write output and report errors the same way: positional input with a sensible default output, one `error: <message>` line that names the file, `--json` everywhere a JSON format exists, worked examples in every `--help`, and no panic backtrace when output is piped into `head`. ## Motivation The CLIs grew one at a time and a first-time user trips over the seams: - The README shows `rvt-gltf my-project.rvt -o out.glb` and `rvt-sheet my-project.rvt -o out.svg`; both binaries rejected that and demanded `--src` / `--dst`. - `rvt-ifc`, `rvt-doc` and `rvt-elements` returned `anyhow::Result` from `main`, so failures printed Rust's Debug form (`Error: …`); `rvt-gltf` printed `rvt-gltf: open …`; the rest `error: …`. - JSON output was `--json` on some tools and `-f json` on others. - `rvt-schema model.rfa --json | head` (or any large output into a closed pipe) ended in `failed printing to stdout: Broken pipe` plus a `RUST_BACKTRACE` hint. ## Changes - `rvt-gltf`, `rvt-sheet`: positional `INPUT`, `-o/--output` defaulting to the input with `.glb` / `.svg`; `--src`/`-s` (hidden) and `--dst`/`-d` (alias of `--output`) still work; refuse to overwrite the input. - `rvt-ifc`, `rvt-doc`, `rvt-elements`: `main` returns `ExitCode` and prints `error: <message>` (exit 1). Open errors name the file once (the path comes from the library since #284). - `--json` shorthand on `rvt-schema`, `rvt-history`, `rvt-corpus` (+ `doctor`), `rvt-elem-table`, `rvt-capabilities`; combining it with `--format` is a usage error (exit 2). - `src/cli.rs` (new): `exit_quietly_on_broken_pipe()` — a panic hook that turns exactly `println!`'s closed-pipe panic (`os error 32` Unix, `os error 232` Windows) into exit 141 and leaves every other panic, including a full disk behind a redirect, to the default report. Called first in all 18 `main`s. Safe code, no new dependency. - Every `--help` ends with an `Examples:` block; each example was run against the phi-ag family corpus before being written down (that run caught one wrong example: `rvt-write --dry-run` still needs `--dst`). - `rvt-history` / `rvt-elem-table` document their positional `FILE`. - CHANGELOG entry under Fixed. ## Testing - [x] `tools/check-local.sh` with `RVT_SAMPLES_DIR`: fmt, clippy -D warnings, rustdoc -D warnings; workspace tests 1,291 passed, 1 failed — the failure is `rvt_ifc_diagnostics_cli::rvt_ifc_cli_strict_mode_fails_before_writing_ifc_but_keeps_diagnostics`, which fails identically on `main` and on the commit before #284 whenever the family corpus is present (it expects confidence `scaffold`, the 2024 sample now yields `typed_no_geometry`). CI never runs that file, so it went unnoticed; the follow-up PR fixes it together with the CI gap that hid it. - [x] `cargo +1.85.0 check --profile ci --all-targets` (MSRV) - [x] New `tests/cli_ergonomics.rs` (7 tests): positional input + default output, `-o`, legacy `--src/--dst` and `-s/-d`, overwrite refusal, one `error:` line naming the missing file exactly once for five CLIs, `--json` == `--format json` and the clash is exit 2, every `--help` has examples, closed stdout pipe exits 141 without "panicked" (corpus-gated) - [x] Unit tests for the closed-pipe matcher (Unix / Windows messages recognised; disk-full and unrelated panics left alone) - [x] N/A: IFC / glTF / SVG output unchanged ## Audit-honesty checklist - [x] README / docs reflect the current state after this PR — the README's positional examples now actually work - [x] N/A: no capability-status change - [x] No new limitation - [x] Commit messages describe WHAT changed and WHY - [x] No emojis in code, docs, or commit messages - [x] No private paths, personal email addresses, or internal jargon in committed files - [x] N/A: not a reverse-engineering finding ## Legal and contribution hygiene - [x] I agree this work is licensable under Apache-2.0 (see `CONTRIBUTING.md`) - [x] This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content (see `CLEANROOM.md`) - [x] Test fixtures: tier-1 synthetic files only (plus the phi-ag family sample, gated, for the pipe test) ## Breaking changes None for invocations: every previous flag still parses. `rvt-ifc`, `rvt-doc` and `rvt-elements` print `error: …` instead of `Error: …` (exit code unchanged, 1). ## Screenshots or output samples ``` $ rvt-gltf model.rvt --verbose rvt-gltf: wrote 860 bytes (0 building elements) to model.glb $ rvt-gltf model.rvt -o model.rvt error: refusing to overwrite the input model.rvt; pass -o <path> $ rvt-ifc nope.rvt error: I/O error: nope.rvt: No such file or directory (os error 2) $ rvt-ifc --help ... Examples: rvt-ifc model.rvt writes model.ifc next to the input rvt-ifc model.rvt -o out.ifc --diagnostics out.diagnostics.json rvt-ifc model.rvt --mode geometry ``` ## Related issues None <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > User-facing CLI parsing and error/pipe handling only; export and decode paths are untouched aside from clearer error messages. > > **Overview** > Standardizes how the shipped binaries accept input, write output, report failures, and behave when stdout is closed early—without changing IFC, glTF, or SVG export logic. > > **`rvt-gltf` and `rvt-sheet`** now match the README: positional model path, default **`model.glb` / `model.svg`** beside the input, **`-o`**, and hidden legacy **`--src` / `--dst`** (aliases still work). Shared **`resolve_paths`** refuses to overwrite the input. Errors use **`error: …`** instead of tool-prefixed lines. > > **`rvt-ifc`, `rvt-doc`, and `rvt-elements`** return **`ExitCode`** from **`main`** and print a single **`error: <message>`** (exit 1) instead of anyhow’s **`Error:`** debug form. > > Several tools gain **`--json`** as shorthand for **`--format json`** (conflicts with **`-f`** → usage error exit 2). Every **`--help`** adds an **`Examples:`** block. > > New **`rvt::cli::exit_quietly_on_broken_pipe`** (in **`src/cli.rs`**) is invoked first in all shipped **`main`** functions so piping into **`head`** exits **141** without a broken-pipe panic; other panics are unchanged. **`tests/cli_ergonomics.rs`** locks in positional/legacy flags, overwrite refusal, error shape, **`--json`**, help examples, and the quiet pipe exit. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 17b8896. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
DrunkOnJava
added a commit
that referenced
this pull request
Sep 22, 2026
## Summary CI now runs every `tests/*.rs` file. Until this PR, 21 of the 37 integration-test files ran in no CI job at all, including the honesty gates the docs describe as CI-enforced. ## Motivation The test matrix runs `cargo test --lib --bins` (unit tests only) and then a few integration targets by name (`samples`, `ifc_roundtrip`, `field_type_coverage`, `elem_table_corpus`); the tier-2 job runs its own name list. A target on neither list never executes. Confirmed against the log of the latest successful `main` run — only these 16 test binaries ran: `arc_wall_corpus`, `cfb_roundtrip_delta`, `corpus_tier1_health`, `corpus_tier2_health`, `elem_table_corpus`, `field_type_coverage`, `ifc_roundtrip`, `ifc_synthetic_project`, `iter_elements_typed`, `partition_scanner`, `project_corpus_smoke`, `project_count_fixtures`, `re15_geometry_invariants`, `re19_door_window_wall_negative`, `samples`, `walker_to_ifc_integration`. Never run anywhere: `support_matrix`, `witness_registry`, `witness_verdict`, `binary_inventory`, `json_schema_contracts`, `fuzz_regressions`, `proptest_parsers`, `typed_decoders`, `graceful_degradation`, `control_cancellation`, `checksum_page_framing`, `cfb_patch_corpus`, `es_remap_golden`, `gen_fixture_roundtrip`, `geometry_recovery`, `ifc_export_modes`, `ifc_synthetic_structural`, `rvt_ifc_diagnostics_cli`, `rvt_inspect_cli`, `rvt_info_cli`, `cli_ergonomics`. The #206 comment in the tier-2 job already records this failure mode once (`elem_table_corpus` hid a real decoder bug while off the list); a hand-kept list keeps reproducing it. ## Changes - `ci.yml` test matrix: the named `samples` / `ifc_roundtrip` steps become one `Integration tests (every tests/*.rs)` step, `cargo test --profile ci --no-fail-fast --test '*'`, on every OS, with `RVT_SAMPLES_DIR` set where the job fetched the family corpus. The `RVT_REQUIRE_CORPUS=1` gates (`field_type_coverage`, `elem_table_corpus`) stay as they are. - `ci.yml` tier 2: the three named steps and the seven-target decoder-gate list become one step running every target against the magnetar project corpus (`RVT_CORPUS_TIER2_LIMIT=8` kept). - `tests/rvt_ifc_diagnostics_cli.rs`: the one stale assertion the newly run files surfaced (details below). - `CONTRIBUTING.md`: says every `tests/` file runs in CI and that corpus-reading tests must skip cleanly without their variable. - `CHANGELOG.md` entry. ### The stale assertion `rvt_ifc_cli_strict_mode_fails_before_writing_ifc_but_keeps_diagnostics` asserted `confidence.level == "scaffold"` for the strict-mode rejection of the 2024 sample family. The family has exported at `typed_no_geometry` for a while — verified identical on `main` and on `a779122` (before #284) — so the test has been red whenever the family corpus is present, unseen because nothing ran it. The test is about strict mode rejecting an incomplete export, not about which below-geometry level it lands on, so it now accepts any below-geometry level. ## Testing - [x] Locally, every integration target against both corpora: `RVT_SAMPLES_DIR=… RVT_PROJECT_CORPUS_DIR=… cargo test --profile ci --no-fail-fast --test '*'` — 65 s wall clock; the only failures were the stale assertion above (fixed) and `project_count_fixtures` needing magnetar's two reference IFCs that my local corpus lacked (fetched; passes; CI's full clone has them) - [x] `actionlint` — no new findings (the only report is the pre-existing SC1003 info note in the PII guard) - [x] This PR's own CI is the proof on macOS / Windows / MSRV, where these files have never run before - [x] N/A: no source, IFC output or performance change ## Audit-honesty checklist - [x] README / docs reflect the current state after this PR — `docs/status.md` / `docs/verification-protocol.md` describe the support-matrix and witness-registry tests as CI-enforced; after this PR that is true - [x] N/A: no capability limitation changed - [x] No new limitation - [x] Commit messages describe WHAT changed and WHY - [x] No emojis in code, docs, or commit messages - [x] No private paths, personal email addresses, or internal jargon in committed files - [x] N/A: not a reverse-engineering finding ## Legal and contribution hygiene - [x] I agree this work is licensable under Apache-2.0 (see `CONTRIBUTING.md`) - [x] This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content (see `CLEANROOM.md`) - [x] N/A: no test fixtures added ## Breaking changes None. ## Screenshots or output samples N/A ## Related issues Refs #206 (the same failure mode, fixed then for one target). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Changes are limited to CI workflow wiring, contributor docs, and a test assertion loosened to match current export behavior; no library or runtime behavior changes. > > **Overview** > **CI now runs every `tests/*.rs` integration target** instead of naming a few binaries per job. The cross-OS test matrix replaces separate `samples` / `ifc_roundtrip` steps with one `cargo test --profile ci --no-fail-fast --test '*'` step; `RVT_SAMPLES_DIR` is set only when that runner fetched the family corpus. The tier-2 job collapses its named health/smoke/decoder lists into the same wildcard run against the magnetar project corpus (keeping `RVT_CORPUS_TIER2_LIMIT=8`). Corpus-required gates like `field_type_coverage` and `elem_table_corpus` stay as dedicated steps. > > That coverage caught a **stale strict-mode assertion** in `rvt_ifc_diagnostics_cli`: strict rejection is still required, but `confidence.level` is no longer pinned to `scaffold`—it accepts any below-geometry level as decoders improve. > > **Docs:** `CHANGELOG.md` and `CONTRIBUTING.md` document the new gating model and the requirement that corpus-dependent tests skip cleanly when env vars are unset. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 7618722. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
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.
Summary
Every Revit file records who saved it last, when, whether it is workshared and where its central model lives; rvt-rs now reads all of it, and
rvt-infoinventories whole folders (table / CSV / JSON / JSON Lines) by reading only each file's two small identity streams.Motivation
The first question anyone asks about a Revit file they cannot open is "which release saved this, is it workshared, who touched it last?" — and the most common BIM-manager task before an upgrade is answering that for a whole project archive. The data was already in every file (BasicFileInfo's
Key: valueblock, 2016-2026) but the regex scan never read it.Changes
src/basic_file_info.rs:parse_propertiesrecovers the text block at either byte alignment (odd on 2026 and both magnetar projects), restores the narrow-packedIsSingleUserCloudModelboolean, and recovers the tail after a narrow"True\0"alignment flip.BasicFileInfo::properties+ typed accessors (worksharing,username,central_model_path,last_save_path,document_guid,document_increments,is_single_user_cloud_model, …).locale/guidnow prefer the text block (the oldENU-anywhere scan could match inside a path).src/project_information.rs(new): the project-fileProjectInformationstream is a one-entry ZIP with an Atomproject.xml; parsed for the save timestamp. The entry name embeds the saving machine's user folder and is never surfaced.src/part_atom.rs:entry_title= the Atom entry's own title.titlekeeps its last-title-wins value (the Python API documents"0610 x 0915mm"); on project files that value is a parameter-group name ("Other"), which is why the new field exists.src/metadata.rs(new):FileMetadata,RevitFile::metadata(),read_metadata(path)/read_metadata_from(reader)(identity streams only),redact()(also scrubs the user inside local-copy names<central>_<user>.rvt).src/reader.rs:project_information(),document_atom(); open errors name the file and report directories (ErrorKind preserved).src/bin/rvt_info.rs: Document section; several files / folders → inventory (recursive,--no-recurse,-f csv|json|jsonl,--json), backup copies marked, error rows + exit 1.RevitFile.metadata(redact=False),rvt.read_metadata(path, redact=False)(FileNotFoundError / OSError / ValueError). Wasm:fileMetadata(bytes). Viewer: File status "Saved" and "Worksharing" rows.file-metadata.schema.json,inventory-row.schema.json;summary.schema.jsongainsdocument(additive).Testing
tools/check-local.sh(fmt, clippy -D warnings, rustdoc -D warnings, workspace tests: 1,327 passed), plus the corpus tests withRVT_SAMPLES_DIRpointing at the 11-release phi-ag corpuscargo +1.85.0 check --profile ci --all-targets(MSRV)basic_file_info(even/odd alignment, narrow True flip, unknown keys, header strings not mistaken for properties, no-panic sweep),project_information(deflated / stored / size-less entries, nestedA:titlenot taken as the entry title, inflate limit, malformed input),metadata(redaction, non-CFB rejection, missing path named)tests/samples.rs::basic_file_info_properties_read_on_every_release— worksharing, save counter (59 on 2016 → 70 on 2026), locale, Format / Revit Build, cloud flag, Author, ClientAppName on all 11 releasestests/rvt_info_cli.rs(tier-1 fixtures only): folder table + error row + exit 1,--no-recurse, CSV header + backup flag, argument order, missing-file message,--extract-previewrefuses a foldertests/json_schema_contracts.rs: tier-1 single-file summary + folder inventory validate; the embedded metadata schema cannot drift from the standalone onematurin develop+pytest tests/python— 62 passed (5 new)wasm-pack build,npm run typecheck,npm run build, wasm network-import audit PASS, Playwright 14 passed (the Einhoven project test now asserts the Saved and Worksharing rows)Audit-honesty checklist
Not enabledare read verbatim — no workshared sample is in the redistributable corpus, soCentral/Localhandling is covered by synthetic tests only (stated in the support-matrix row)Legal and contribution hygiene
CONTRIBUTING.md)CLEANROOM.md). Based solely on public byte observations of the phi-ag/rvt and magnetar-io/revit-test-datasets sample files.testuser, etc.) and contain no real-world PIIBreaking changes
BasicFileInfogains a publicpropertiesfield andPartAtoma publicentry_titlefield, so struct literals outside the crate need the new field (or..Default::default()forPartAtom). Serde input is backward-compatible (#[serde(default)]). JSON outputs only gain keys.Screenshots or output samples
Related issues
None
Note
Low Risk
Read-only metadata and CLI inventory on user-supplied files; stream reads are capped and redaction is extended, with no changes to write paths or IFC export logic.
Overview
Adds document identity beyond the old regex skim:
BasicFileInfonow parses the fullKey: valuetext block (2016–2026), including odd-byte alignment and the narrow-packedIsSingleUserCloudModelflag, with typed accessors and verbatimproperties.rvt::metadatamerges that with the document Atom (PartAtomor newProjectInformationZIP →project.xml) intoFileMetadata, exposed viaread_metadata(identity streams only),RevitFile::metadata(), and stronger--redact(paths, usernames, local-copy filenames).rvt-infogains a Document section for one file and folder/multi-file inventory (table, CSV, JSON, JSONL,--no-recurse, backup detection, error rows → exit 1). Single-file JSON adds adocumentfield;PartAtom::entry_titledistinguishes the real document name from legacytitle.Python (
read_metadata,RevitFile.metadata), wasm (fileMetadata), and the viewer File status panel show last saved and worksharing early in the worker summary. Newfile-metadata/inventory-rowschemas and corpus-backed tests pin behavior across releases.Reviewed by Cursor Bugbot for commit 7ba25eb. Configure here.