Skip to content

fix(cli): rvt-doc --redact scrubs the whole path, the notes, the strings of the fields and the error text, as its help says (#1919) - #1920

Merged
DrunkOnJava merged 1 commit into
mainfrom
fix/1919-rvt-doc-redact
Nov 13, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
fix/1919-rvt-doc-redact

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

rvt-doc --redact scrubbed the user name of a home folder in the path it printed and nothing else, against its own help, which promised user names and Autodesk-internal paths. It now scrubs the whole path, the notes, the strings a field holds and the error text, with the scrubber the other commands' --redact runs.

Motivation

Item 1 of #1919 (found reading the CLI help against the code). What leaked, as measured:

  • The error text. RevitFile::open puts the path it was given in its error (I/O error: <path>: No such file or directory (os error 2); a_missing_input_is_named_with_one_error_prefix already pins that the path appears once), and main printed it as it stood, so rvt-doc /home/<name>/... --redact named the user on stderr.
  • Autodesk-internal parts of the path. redact_path_str scrubs a \Users\, /Users/ or /home/ name only. An OneDrive - Autodesk or Revit - <digits> folder is scrubbed by redact_sensitive, which rvt-doc did not call.
  • String fields. The field arm printed a string as it stood. This one is latent: on the 17 local files, ADocument's decoded fields are 8 or 9 pointers, one container and 3 ids, and none is a string (below). The scrub is there so the flag's promise does not depend on which field kinds the walker decodes.

Changes

  • src/redact.rs: redact_json_strings, which runs redact_sensitive over every string value of a JSON value (keys, numbers, booleans and nulls untouched), with a doctest and three failure-first unit tests (a string however deep; what is not text with a path in it is unchanged; scrubbing twice is scrubbing once). It is a pure helper with no I/O, the one case the unit-test ban allows.
  • src/bin/rvt_doc.rs: scrub over the path, each field's value and the notes, run when --redact is set; the error text goes through redact_sensitive in main; the flag's help says what it scrubs.
  • tests/cli_ergonomics.rs: rvt_doc_redact_scrubs_the_path_an_error_names (needs no corpus).
  • tests/cli_real_files.rs: doc_redact_scrubs_the_path_given_and_changes_nothing_else runs every family file from under Users/<name>/OneDrive - Autodesk/, plain against --redact: the plain path names both folders, no string of the redacted output holds either, and version, entry offset, fields and notes are equal.
  • changelog.d/security/1919-doc-redact.md.

Testing

Unit tests are banned in this repository: the only unit tests here are the helper's.

  • tools/check-local.sh passes (fmt, clippy, rustdoc, build, real-file / CLI / contract checks)
    • Run by this PR's CI at afc399a3 (full / CI passed), not on this Mac, which does not build this repository. Run locally: rustfmt --edition 2024 --check on the four Rust files, tools/ci/api-doc-ids.py (it caught a planning label in a doc comment, fixed in afc399a3), tools/release/changelog.py check, and the PII guard's five patterns over the tree: all clean.
  • Verified end to end on real Revit files: the command, the files (and their licence), and the measured result against Revit's own export are in the PR body, with the script or probe that reproduces it
    • What ADocument's fields decode to, on the 11 family releases of the phi-ag/rvt corpus (2016 to 2026) and 6 files of the local project corpus (2024_Core_Interior, RE1-Architecture, -Electrical, -Mechanical, -Plumbing, Revit_IFC5_Einhoven; magnetar-io/revit-test-datasets, MIT, and the RE1 set, MIT): 2016 to 2018 hold 8 pointers, 1 container and 3 ids, every later file 9, 1 and 3. No string field. Measured with read_adocument() of the Python extension built on 2026-11-10, the ADocument walk rvt-doc calls:

      import glob, collections, rvt
      for f in sorted(glob.glob("<corpus>/*.rfa") + glob.glob("<project corpus>/*.rvt")):
          d = rvt.RevitFile(f).read_adocument()
          print(f, dict(collections.Counter(x["kind"] for x in d["fields"])))
    • The two end-to-end tests above exercise the path and the error text. No local file exercises the field scrub, which the helper's unit tests cover.

  • If this touches the IFC exporter: the witness verdicts replay (see CONTRIBUTING.md) or the changed observations are refreshed in this PR
    • N/A: no exporter code changes.
  • If this is a performance change: reran tools/bench.sh and attached the before / after
    • N/A: not a performance change.

Audit-honesty checklist

  • README / docs reflect the current state after this PR — no claims of features that are not actually shipped in this PR
    • No document describes what rvt-doc --redact scrubs beyond the flag's help, which is corrected here (docs/demos.md only runs it).
  • A user-visible change has its entry as a fragment under changelog.d/<section>/ (see changelog.d/README.md), not in CHANGELOG.md
    • changelog.d/security/1919-doc-redact.md.
  • If a limitation was resolved, the "Known limitations" / "What works today" section in the relevant docs is updated
    • None listed.
  • If a new limitation was introduced, it is documented in the PR body and in-code
    • None. redact_sensitive keeps its known cut: a user name with a space is scrubbed up to the space where no separator follows it (documented on redact_path_str).
  • Commit messages describe WHAT changed and WHY, not "fix things" or "updates"
  • No emojis in code, docs, or commit messages
  • No private paths, personal email addresses, or internal jargon in committed files
    • The tests build their home paths from parts, so the PII guard job has no whole path to match.
  • If this is a reverse-engineering finding: a reproducible probe under probes/examples/ and a dated addendum to docs/format-reconnaissance.md are included
    • N/A: not a format finding.

Legal and contribution hygiene

  • I agree this work is licensable under Apache-2.0 (see CONTRIBUTING.md)
  • This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content (see CLEANROOM.md)
  • Any new test fixtures use synthetic values (testuser, 111111, FY-20XX, etc.) and contain no real-world PII
    • No fixtures added; the tests use a copy of a family file under a made-up user folder.

Breaking changes

None. rvt::redact::redact_json_strings is a new public function. rvt-doc --redact prints less than before in two places: an Autodesk OneDrive or project-id folder in the path is replaced, and an error that names a path has it scrubbed. Without --redact nothing changes.

Screenshots or output samples

The path .../Users/<name>/OneDrive - Autodesk/Models/m.rfa printed as .../Users/<redacted>/OneDrive - Autodesk/Models/m.rfa under --redact before, and prints as .../Users/<redacted>/<redacted autodesk internal path> now (redact_sensitive replaces the Autodesk folder through the file's extension).

Related issues

Refs #1919 (item 1 of 3; the two rvt-mcp schema descriptions are the next PR).

…ngs of the fields and the error text, as its help says (#1919)

--redact ran redact_path_str over the path given and nothing else, so an
Autodesk OneDrive or project-id folder in the path was printed as it stood,
and the error rvt-doc prints when it cannot open a file, which echoes that
path, was not scrubbed at all. Its help promised user names and
Autodesk-internal paths in any string surfaced.

The path, the notes and the error text now go through redact_sensitive, the
scrubber the other commands' --redact runs, and the value of each field
through the new redact_json_strings. On the 11 family releases (2016 to 2026)
and the 6 projects measured, no ADocument field decodes as a string, so what
changes today is the path and the error text; the string scrub is ahead of the
first string field.

Tested end to end: the error text with a missing path (always runs), and the
family corpus run from under a user folder and an Autodesk OneDrive folder,
plain against --redact. redact_json_strings is a pure helper with three
failure-first unit tests.
@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Self-approval by rvtReview, under Griffin's 2026-11-10 and 2026-11-12 answers that either maintainer session may approve its own work; rvtDevelop's second read is welcome after it lands. I re-read the whole diff at afc399a3 once full / CI passed was green:

  • scrub runs on the path, each field's value and the notes before either output form is printed, and text mode prints nothing else of the file's (the path, field names and kinds, the notes). The error text goes through redact_sensitive in main, which is where the path an open error echoes reaches the terminal.
  • redact_json_strings touches string values only; the three unit tests are pure-helper tests of the ways it can leave text behind or change what is not text.
  • rvt_doc_redact_scrubs_the_path_an_error_names and doc_redact_scrubs_the_path_given_and_changes_nothing_else ran in this PR's CI and passed. The second is the one that runs every family file from under a made-up user folder and Autodesk OneDrive folder.
  • Not covered by a real file: a string field holding a path. None of the 17 local files has a string field (PR body), so that arm is covered by the helper's tests alone.
  • No export code path calls rvt-doc or the new function, so I arm it with --no-gates and that reason (as for fix(cli): rvt-dump takes the resource-limit options and goes on past a stream it cannot read, rvt-info refuses a preview that is not a whole PNG, and gen-fixture refuses a name with a path in it (#1885) #1906).

@DrunkOnJava
DrunkOnJava merged commit bd58ab8 into main Nov 13, 2026
36 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/1919-rvt-doc-redact branch November 13, 2026 17:27
DrunkOnJava added a commit that referenced this pull request Nov 13, 2026
…offers, and what each saved-mesh choice draws, curtain-embedding walls included (#1919) (#1926)

## Summary

The `export_ifc` tool's schema called its `options` "the `rvt-ifc`
switches that change the model" and described its mesh choices without
the walls that embed a curtain wall. Both now say what the code does.

## Motivation

Items 2 and 3 of #1919 (found reading the generated tool contract
against the code):

- `IfcOptions` offers `mode`, `saved_meshes`, `revit_property_sets`,
`revit_set_placement`, `no_base_quantities` and `allow_partial`.
`ExportOptions` has three more switches that change the model, `kind`
(`--placeholder`, `--diagnostic-proxies`) and `family_extrusions`, which
`IfcOptions::export_options` never sets, so a client reading "the
switches that change the model" would expect them.
- `MeshesArg` described `default` as every boxed element on Revit 2023
to 2027. The same pass (`attach_scoped_with_control`) also draws the
walls that embed a curtain wall from their saved graphics where Revit
raised their base, on Revit 2024 to 2027 (`ExportNote::EmbedHostBodies`,
RE-340), under `default`, `doors_and_windows` and `all`, and `off` runs
no pass (`src/ifc/export_pipeline.rs`, `SavedMeshChoice`, whose
documentation already says so).

## Changes

- `rvt-mcp/src/args.rs`: the doc comments of `IfcOptions` and of the
four `MeshesArg` variants, which are the descriptions in the tool
contract.
- `docs/mcp.md`: the `export_ifc` row says the same.
- `docs/mcp-tools.json` and `docs/mcp-tools.md`: regenerated from CI's
built server by `.claude/scripts/sync-mcp-contract.sh` (the contract
test names the new text), in a following commit.
- `changelog.d/fixed/1919-mcp-export-options.md`.

## Testing

Unit tests are banned in this repository; this is a change of
documentation strings.

- [ ] `tools/check-local.sh` passes (fmt, clippy, rustdoc, build,
real-file / CLI / contract checks)
- Run by this PR's CI (`tool_contract_is_committed` is the check that
carries the change). On this Mac, which does not build this repository:
`rustfmt --edition 2024 --check rvt-mcp/src/args.rs`,
`tools/ci/api-doc-ids.py`, `tools/release/changelog.py check`.
- [x] Verified end to end on real Revit files: the command, the files
(and their licence), and the measured result against Revit's own export
are in the PR body, with the script or probe that reproduces it
- N/A for Revit files: the change is descriptions only, no behaviour.
The claims are read from the code that decides them:
`IfcOptions::export_options` (which switches it sets), and
`run_export`'s `scope` match with the `embed_hosts` pass
(`src/ifc/export_pipeline.rs`).
- [x] If this touches the IFC exporter: the witness verdicts replay (see
CONTRIBUTING.md) or the changed observations are refreshed in this PR
  - N/A: no exporter code.
- [ ] If this is a performance change: reran `tools/bench.sh` and
attached the before / after
  - N/A: not a performance change.

## Audit-honesty checklist

- [x] README / docs reflect the current state after this PR — no claims
of features that are not actually shipped in this PR
  - `docs/mcp.md` and the tool contract say the same as the code.
- [x] A user-visible change has its entry as a fragment under
`changelog.d/<section>/` (see `changelog.d/README.md`), not in
`CHANGELOG.md`
  - `changelog.d/fixed/1919-mcp-export-options.md`.
- [x] If a limitation was resolved, the "Known limitations" / "What
works today" section in the relevant docs is updated
  - None listed.
- [x] If a new limitation was introduced, it is documented in the PR
body and in-code
  - None.
- [x] Commit messages describe WHAT changed and WHY, not "fix things" or
"updates"
- [x] No emojis in code, docs, or commit messages
- [x] No private paths, personal email addresses, or internal jargon in
committed files
- [x] If this is a reverse-engineering finding: a reproducible probe
under `probes/examples/` and a dated addendum to
`docs/format-reconnaissance.md` are included
  - N/A: not a format 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] Any new test fixtures use synthetic values (`testuser`, `111111`,
`FY-20XX`, etc.) and contain no real-world PII
  - No fixtures.

## Breaking changes

None. The schema's structure is unchanged; only `description` strings
differ.

## Screenshots or output samples

`options` before: "The `rvt-ifc` switches that change the model. The
defaults are `rvt-ifc`'s." After: "The `rvt-ifc` switches this server
offers, some of those that change the model: `--placeholder`,
`--diagnostic-proxies` and `--family-extrusions` are not among them. The
defaults are `rvt-ifc`'s."

## Related issues

Closes #1919 once #1920 (item 1, the `rvt-doc --redact` fix, merged) and
this are on `main`.
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.

1 participant