Skip to content

feat(ifc): let callers set the Saved graph value limit - #2157

Draft
shifatrHtH wants to merge 2 commits into
DrunkOnJava:mainfrom
shifatrHtH:codex/saved-graph-value-limit
Draft

shifatrHtH wants to merge 2 commits into
DrunkOnJava:mainfrom
shifatrHtH:codex/saved-graph-value-limit

Conversation

@shifatrHtH

Copy link
Copy Markdown
Contributor

Summary

Rust callers can set a per-graph field-value limit for a Saved graphics attach request. Existing attach calls keep the one-million-value default.

Motivation

Applications that know their workload can set a limit for Saved decoding. A graph beyond the requested limit follows the existing per-element refusal and fallback behavior.

Changes

  • Add a request-scoped SavedMeshLimits option and preserve the other reader budgets.
  • Exercise explicit and legacy limits, fallback, and cancellation through the public Rust attach API.

Testing

  • Passed the local contributor gate with tools/check-local.sh and the Rust 1.87 all-targets check.
  • Ran the integration tests on Autodesk's 2023 Structural Basic and Architectural Basic sample projects. The structural sample attaches 77 Saved bodies at 20,291 field values and 94 at 20,292. The latter matches the entire legacy IFC model and attach report. A one-value budget keeps the normal fallback on the architectural sample. Repeated calls and a cancellation retry reproduce their reference results. The samples are Autodesk downloads used under the publisher's terms. Pinned public sample list
  • Verified byte-identical default IFCs and diagnostics against stock main on both Autodesk samples and VTT's public BIM4LCA concrete housing project (CC BY-SA 4.0). The stock and candidate reports against Revit's own BIM4LCA IFC match. The contributor gate passes the witness contract tests. BIM4LCA reference manifest

Put the two Autodesk samples in a local directory as 2023-rstbasicsampleproject.rvt and 2023-racbasicsampleproject.rvt.

RVT_SAMPLE_PROJECTS_DIR="$samples" cargo test --locked --profile ci --test integration -- saved_mesh_limits::

Performance benchmark applicability is N/A.

Audit-honesty checklist

  • Public API docs describe the per-graph limit and fallback.
  • The user-visible option has a changelog fragment.
  • The commit message describes the change and its reason.
  • The proposed changes contain generic code and public sample test references.

A reverse-engineering report or new format fixture is N/A.

Legal and contribution hygiene

  • This contribution is offered under Apache-2.0.
  • The implementation uses the existing public reader code and its graph-limit behavior.
  • Public sample tests use external downloads. The contribution contains source and test code only.

Breaking changes

None.

Screenshots or output samples

N/A. The testing section records the public sample results.

Related issues

Refs #2085.


See CONTRIBUTING.md for the contributor gate and fixture guidance.

Allow callers to budget field values per Saved graphics graph while
preserving the default attach behavior and fallback. Cover request limits
and cancellation on public Autodesk sample projects.

@DrunkOnJava DrunkOnJava left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@shifatrHtH, thank you for #2157. The change reads cleanly. The default stays at 1,000,000, and every existing call still goes through attach_scoped_with_control, the export pipeline's included (src/ifc/export_pipeline.rs:741 at eb268fdd), so no export moves, as your byte-identical runs show. It also fits where main stands: the 1,000,000 cap stays the default because it is also a guard against hostile input, and the cost of a file built to spend more has not been timed (2026-11-20). A caller who knows its files can now raise it.

The tests should also run in CI. CI sets RVT_SAMPLE_PROJECTS_DIR only for the Python tests (.github/workflows/ci.yml:1606 at eb268fdd), so these three skip there, as the contributing guide says corpus tests do when their path is absent. tools/fetch-autodesk-samples.sh already fetches Autodesk's sample projects from the pinned list for the Measure (.github/workflows/measure.yml). Could the three run where that fetch runs, with the two 2023 projects? If that does not fit, say so here and we will work out how CI gets them.

Question: the limit is reachable only through attach_scoped_with_limits_and_control. So run_export and the CLI keep 1,000,000 with no way to raise it, and the chairs in #2085 (1,789,525 values in their symbol) export only from Rust code that calls the attach directly. Is ExportOptions, with a CLI flag, meant as a follow-up to this pull request, or should it come in here?

Once the tests run in CI, the rvt-rs-review app's approval on a green head is what lands it.

@shifatrHtH

Copy link
Copy Markdown
Contributor Author

@DrunkOnJava, thanks for the review.

The tests should also run in CI.

Pushed 32b8e24. The Linux stable real-file job fetches the two pinned Autodesk 2023 projects using the same fetcher as Measure, verifies both files are present, and runs the three saved_mesh_limits tests explicitly. That job runs in both fast and full CI, so the draft head exercises them too. The sample files are fetched at run time. I ran the same fetch and filtered Cargo command locally. Both pins verified, all three tests ran and passed, and the workflow linter and contributor gate passed.

Is ExportOptions, with a CLI flag, meant as a follow-up

Yes. This PR covers the Rust attach API and its CI checks. I’d put the ExportOptions and CLI plumbing in a separate follow-up with its own tests for the one-million default and an explicit override.

@DrunkOnJava

Copy link
Copy Markdown
Owner

Thanks. Confirmed in the CI log for 32b8e24: the Linux stable real-file job fetched and verified both pinned 2023 projects, then ran all three saved_mesh_limits tests (3 passed, 3.99 s). ExportOptions and the CLI flag as a separate follow-up, with tests for the one-million default and an explicit override, is right.

One change before this is ready. The step downloads about 25 MB from Autodesk's host in the test job, which gates every pull request, so an outage there would fail unrelated pull requests even with the fetcher's retries. Please move it to corpus-tier2, beside the BIM4LCA and R2025 models, and follow their pattern:

  • restore the two files with actions/cache/restore, keyed on research/autodesk-sample-projects.tsv and the fetcher, and save them on main only;
  • when the download fails, warn NOT MEASURED and leave RVT_SAMPLE_PROJECTS_DIR unset, so the three tests skip;
  • a file that no longer matches its pin still fails the job.

The fetcher already tells the two apart: run against a scratch pin file, an unreachable host exits with curl's status (7) and a pin mismatch exits 1.

This branch has not been deployed

No deployments
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.

2 participants