Repository navigation
feat(model): models and web tools can list what they require (#1405 item 2) - #2124
Conversation
…s#1405 item 2) A model or web tool file may carry `requires`, as a project can since opengeos#1975: `model.import` refuses one that lists a capability this RustGIS doesn't know, naming it, before the graph or steps are read. A saved workflow can so say what an older engine can't run instead of being misread. The check is opengeos#1975's, shared through `project::check_requires`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
| return Err("this model or web tool has an unsupported version. Update RustGIS to import it.".into()); | ||
| } | ||
| } | ||
| crate::project::check_requires(v.get("requires"), "model or web tool", "import")?; |
There was a problem hiding this comment.
Latent round-trip gap (confidence: medium, not reachable today). check_file accepts a known capability in requires, but nothing carries that list past import. model.import passes only name and graph/steps to model.new (cmd/sharing.rs:181-185), Model has no field for it, and the writer at model.rs:970 emits only $schema, version, name, graph. So once a capability is added to CAPABILITIES, a file that requires it imports, and the next save or export silently drops the requirement. That is the loss kept_as_written guards against for projects.
It does nothing yet because CAPABILITIES is empty, so any non-empty list is refused. Before the first capability is added, either keep requires on the imported model, or refuse a known capability that the model can't keep. A test with a stub known capability would pin this down.
There was a problem hiding this comment.
Not changed. This matches projects since #1975: a format 2 project that requires only known capabilities opens and saves again as format 1 without requires. CAPABILITIES is the list this RustGIS reads and saves again without loss. So when a capability is added, that same change makes the writer emit it whenever the saved model uses the feature, and a model that doesn't use it needs nothing listed. Keeping an imported list wouldn't help, since it would go stale as soon as the model is edited. The pairing is said where CAPABILITIES is documented (docs/maintaining.md › Saved files and settings: "added to CAPABILITIES where it is read").
Code reviewBugs
Security
Performance
Quality
AGENTS.md
Confidence: the findings above are medium to high. I did not compile or run the tests; the checks were by reading. Quality items are grouped here, not posted inline, per the review guidance. Prior reviews: none on this PR, so no earlier concerns were left alone. Change sizeCompared with main (merge base 1ec28d3 to PR head ca0612f).
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the |
…stGIS to import it The refusals for a requires list that is too long or not names said "open" for models and web tools too; they now say what the caller does, as the unknown-name refusal already did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review summary: the wording point is fixed in the next push. A model or web tool whose |
Code reviewBugs: None found. I checked the Security: None found. Input stays bounded through the existing Performance: None found. Confidence: high. Quality:
AGENTS.md:
Prior review threads: One thread ( Inline comments: None posted. The only in-diff finding is a nit, and the substantive doc issue is outside the diff. Change sizeCompared: the whole PR against main (merge base 1ec28d3 to PR head 9cef117).
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Follow-up review: |
Code reviewI read the full diff, the staged AGENTS.md, and the surrounding code: Bugs: none found. The refactor keeps the existing Security: none found. The new input is bounded by the existing Performance: none found. Confidence: high. Quality (nits, for the release quality pass):
AGENTS.md: no violations found. The change adds no non-test Prior reviews: 1 concern left alone. The thread on the Change sizeCompared with the base branch (the whole PR, merge base 1ec28d3 to PR head 2fa04d1).
|
|
Latest review: the unreachable-message and |
Summary
A model (
*.model.json) or web tool (.rgistool) can now list what it needs inrequires, as a project can since #1975.model.importrefuses one that lists a capability this RustGIS doesn't know, naming it, before it reads the graph or steps:That gives saved workflows the way to declare requirements #1405 item 2 asks for. Writers don't change, and nothing lists a capability yet. A later change that an older engine would misread (a new node kind, a new step meaning) adds its name to
CAPABILITIESand to the files that use it.project::check_requiresreadsrequiresfrom the parsed file with the same bounded reader, so the same refusals apply: at most 256 entries, long names cut, a list that isn't names refused.check_formatnow uses the same helper, and its messages are unchanged.requiresis accepted beside the other top-level fields, so[]or a list of known names imports as before.docs/maintaining.md› Saved files and settings now says models and web tools checkrequires. Tasks, presentations, notebooks, and models inside a task's steps still don't check it.This adds an optional field to a saved file whose absence means today's behaviour, so one maintainer can approve it (
docs/maintaining.md› Who approves a coordinate-first change).Testing
model_import_refuses_unsupported_files_without_changing_sessioncovers a model and a web tool that require an unknown capability (each name said once) and arequiresthat isn't a list. Each is refused with the session unchanged.model_import_preserves_supported_and_legacy_filescovers both writers' output with"requires": [], which still imports.requirestests from feat(project): read project format 2, refusing one that requires a capability this RustGIS doesn't know (#1853 piece 1) #1975 still pass after the refactor (format_2…,requires_tests,file_compatibility…,project_save).-D warnings), workspace tests, layers, wasm build and licences.UI evidence
No visible change.
Related issue
Closes the remaining part of #1405 item 2.
🤖 Generated with Claude Code
Summary by CodeRabbit