Skip to content

fix(engine): a saved step that opens a project from its text requires what the project requires - #3608

Merged
jgregoriorincon merged 19 commits into
opengeos:mainfrom
jgregoriorincon:fix/3462-inline-document-capabilities
Dec 2, 2026
Merged

jgregoriorincon merged 19 commits into
opengeos:mainfrom
jgregoriorincon:fix/3462-inline-document-capabilities

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A saved step that opens a project from its text (project.openText, project.fromTemplate) now requires every capability that project requires.

Before, each capability's check decided on its own whether to read that text, and 45 of the 51 command checks never did. A task, model or script step could open a project that uses a setting an older release doesn't know (several extent indicators in a map frame, a colorbar's text size, a graticule colour, …). The saved outer project didn't require it, so the older release opened the step, dropped the setting and saved the rest without a word.

  • One read per step: the text is read once, as the project is read without repair (Project::from_peer_raw), and its required_capabilities() are added to what the step already requires. Text that isn't a project requires nothing (except past the depth limit below).
  • The same walk is used where a saved step is read: a task's steps, a recorded model's steps and graph, a script's lines (a notebook's code cells and the history included) and a project's own containers.
  • The eight per-capability checks that read a project's text for these two commands (extent numbers, north arrow and scale bar fonts, legend one row and patch size, generalised relief, kept class order, label obstacles) are removed: each read the project again, so a project that opened a project that opened one cost about three times more at every level (31 s at 680 KB, 357 s at 2.7 MB, nested 11 and 13 deep). It is now 7 ms and 21 ms. A style, layer or map given inline is still read by them, as before.
  • A project opened by a step of a project opened by a step is read down to 32 levels, each text once at each depth (what is kept is a digest of where it came from, never the decoded text). A text that holds a project escapes it, so only so much nests; a data template (base64, a zip) isn't longer, hence the depth. A step that opens a project at that depth requires every capability a release knows, so an older release refuses it rather than dropping what it can't see. The same goes once a walk has read more bytes of opened texts than a fixed 64 MiB (the same on every computer, since what a project requires is saved in it, and small enough that a walk at the limit costs about a quarter of a second: reading a project costs about 4 ms per MB with real structure, 1 ms for a text-heavy one, measured 15 ms for 16 MB and 61 ms for 64 MB). A data template that can't be decoded requires everything too, so the limits of the computer saving the project don't change the header (one broken template makes older releases refuse the project, not just that step: deliberate, and the safe side), so a chain of templates that each inflate to a gigabyte can't make a save read them all. This bounds the walk of these two commands only: the checks that read a style, layer or map given inline still start again from the top when that text is a project, as they did before; that is for the PR of [Bug]: Inline styles, layers, maps, projects and templates with a label weight, clearance or duplicate setting don't require their capability #3589.

Surfaces: saved tasks, models, scripts and notebooks of the desktop and web apps, rustgis-cli, Python, the Assistant and MCP. Nothing visible changes; a project saved with such a step now carries more entries in its requires header, so an older release refuses it instead of dropping settings.

Not in this PR (own PRs, same cause): model.import and notebook.open (#3476), and a style, layer or map given inline (#3589). A step that names a project file by path isn't read here: a saved project file carries its own requires header, which an older release checks when it opens it.

Testing

  • New tests in crates/engine/src/tests/capabilities_inline_project.rs, written first and seen failing (project.openText of layout_extent_indicators.rgis without its header required nothing):
  • Existing tests that called the removed arms directly (project.openText, project.fromTemplate) now ask what a saved model step requires; their cases are unchanged, and the sample of a project.fromTemplate that requires label-obstacles is covered by the fixtures test.
  • the_deepest_chain_of_opened_projects_fits_a_small_stack builds a real chain of 33 base64 templates, each opening the next, and reads it, with a budget of bytes that no chain reaches so that the depth limit is what stops the walk (it checks that a text was read at each of the 32 depths), on a thread with 1 MiB of stack (Windows' main thread) in a debug build. Reading a project costs about 4 ms per MB (the 5.4 MB read in a 13-deep nest took 21 ms); what a walk keeps of what it read is a 64-byte digest per text, and the parsed projects of the levels it is inside of. Memory, measured on a chain of 3 base64 templates around a project with a 10 MB name (a 23 MB text, a debug build): the walk peaked 32 MB above what the opened project already held, about 1.4 times the text, in 64 ms. A text a project opens past the 64 MiB budget (a template embedding a raster of about 50 MB, say) makes the project require everything, so an older release refuses it: rare, and the safe side.
  • cargo fmt --check, workspace-scoped clippy on rustgis-engine, doctests, the layering check and cargo xtask schema --check pass. nextest: all of rustgis-engine passes; 8 failures are in other crates (7 in rustgis-geolibre, 1 in the rustgis-ui-egui smoke tests) and fail the same on main without this change.

UI evidence

No visible UI change.

Related issue

Closes #3462
Part of #3476

… what the project requires (opengeos#3462)

Each capability's check decided on its own whether to read the text of a
project.openText or project.fromTemplate step, and 45 of 51 never did, so a
task, model or script could open a project using a setting an older release
doesn't know and save the rest without a word. The text is now read once per
step, as the project is read without repair, and the project's own
capabilities are added to the step's, down to 32 projects deep.

The eight checks that did read a project's text for these two commands no
longer do: each read the project again, and a project opening a project that
opens one cost about three times more at every level (31 s at 680 KB, 357 s at
2.7 MB). It is now 7 ms and 21 ms.

Part of opengeos#3476
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Capability detection now includes requirements from projects opened through saved commands, including nested project text. The scan merges duplicate-free results, caches repeated text, and stops opening projects at depth 32.

Changes: Embedded project capability detection

Layer / File(s) Summary
Recursive capability scan
crates/engine/src/project_capabilities.rs
Capability checks use closure-based traversal. The scan reads projects opened through project.openText and project.fromTemplate, including nested script commands, and merges their requirements up to depth 32.
Command predicate updates
crates/engine/src/project_capabilities.rs
Several command-specific checks no longer parse opened project text. Checks for inline style, layer, map, layout imports, and scripts remain where applicable.
Capability detection coverage
crates/engine/src/project_capabilities.rs, crates/engine/src/tests.rs, crates/engine/src/tests/capabilities_inline_project.rs
Tests cover project opens and templates across saved command forms, nested text, caching, the depth limit, and invalid or empty project text.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant SavedCommand
  participant CapabilityScan
  participant ProjectParser
  SavedCommand->>CapabilityScan: provide project.openText or project.fromTemplate
  CapabilityScan->>ProjectParser: parse project text without repair
  ProjectParser->>CapabilityScan: return project requirements
  CapabilityScan->>CapabilityScan: merge unique requirements and scan nested commands
Loading

Possibly related issues

  • opengeos/RustGIS#3476 — The change covers project.openText and project.fromTemplate; it does not cover model.import or notebook.open.
  • opengeos/RustGIS#3598 — The opened-project scan collects requirements for projects opened through project.openText.
  • opengeos/RustGIS#3589 — The scan covers opened project text, while inline style, layer, and map checks remain separate.

Possibly related PRs

  • opengeos/RustGIS#2835 — Both changes extend capability detection through the shared walk of saved commands and related model, task, history, or script content.

Suggested reviewers: elpidioassinaturas, giswqs

Merge Risk: Minimal · previous review ec71b

Saved steps that open a project from text now require every capability that project needs, so older releases refuse the saved project rather than silently dropping unsupported settings. No merge-blocking risk is identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main behavior change: a saved step that opens a project from text now requires the capabilities that project requires. It matches the summary, the objectives, and issue #3462. The …
Linked Issues check Passed [#3462] The issue requires a saved task, model or script step that runs project.openText (and, by the PR, project.fromTemplate) to require every capability of the opened project, including `layout…
Out of Scope Changes check Passed The readable head content of project_capabilities.rs shows the opened-project walk, the digest-keyed Seen cache, the depth cap MAX_OPENED_DEPTH = 32, and the merge_opened helper. These serve #…
Description check Passed The description follows the template's Summary, Testing, UI evidence and Related issue sections. It explains the problem, the one-read-per-step fix, the depth limit and byte budget, and the removed pe…
Full details: Title check

Explanation

The title names the main behavior change: a saved step that opens a project from text now requires the capabilities that project requires. It matches the summary, the objectives, and issue #3462. The title follows the conventional commit form and is specific enough for history scanning. It is 95 characters, which is somewhat long, but the title stays clear.

Full details: Linked Issues check

Explanation

[#3462] The issue requires a saved task, model or script step that runs project.openText (and, by the PR, project.fromTemplate) to require every capability of the opened project, including layout-extent-indicators for the reproduced case. At the reviewed head ec71b52, crates/engine/src/project_capabilities.rs adds collect_opened_project. For project.openText it reads text. For project.fromTemplate it reads data first, then text. It parses the source with Project::from_peer_raw and collects required_capabilities_at(depth + 1, seen) of the opened project. Project::required_capabilities_at calls uses_commands, which walks models, tasks, gp history, notebooks and script lines. task_capabilities runs the same walk for task steps. merge_opened adds the results to the outer project's requirements. Text that is not a project yields nothing. The #3462 case is covered by this path, because the opened project's own maps yield layout-extent-indicators through the existing checks. Limits: the test file capabilities_inline_project.rs was not run, and the removal of the eight per-capability arms was not read line by line in the incremental diff. The code read at head does not contradict the PR's claims.

Full details: Out of Scope Changes check

Explanation

The readable head content of project_capabilities.rs shows the opened-project walk, the digest-keyed Seen cache, the depth cap MAX_OPENED_DEPTH = 32, and the merge_opened helper. These serve #3462 and the single-walk goal of the PR. The walk does not add model.import, notebook.open, or inline style, layer or map handling, which the PR excludes. crates/engine/src/tests.rs registers the capabilities_inline_project test module, which supports the same objective. At depth 32 the code requires every entry of CAPABILITIES, as the PR description now states. Limits: the full diff of the other changed files, including the removed per-capability arms, was not read in full. No unrelated change was found in the readable evidence.

Full details: Description check

Explanation

The description follows the template's Summary, Testing, UI evidence and Related issue sections. It explains the problem, the one-read-per-step fix, the depth limit and byte budget, and the removed per-capability checks. It lists the new tests and the verification run, including the eight unrelated nextest failures. It states 'No visible UI change' and links the issues (Closes #3462, Part of #3476). The description is detailed and matches the objectives. It is dense in places, but no required section is missing.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks each project’s text,
And finds the capabilities next.
Through nested commands, paths unwind,
Cached by depth and digest, lined.
At thirty-two, the scan will cease,
And ask for all known keys in peace.
The rabbit hops away with ease.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 8d751f64-b705-4b8c-9fee-da956a20a965
Commits

Reviewing files that changed from the base of the PR and between afbc88f and ec71b52.

Files selected for processing: 1

  • crates/engine/src/project_capabilities.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review.

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Code review

Scope: 3 files, +246/−99 lines. I read the diff, the surrounding project_capabilities.rs code, project.rs (from_peer_raw), cmd/project.rs (open_text), cmd/items.rs (read_text, inline_text, fromTemplate), and the new test file. I could not build or run the tests here (no shell), so the findings below come from reading the code. There were no earlier review threads, so no concerns were skipped as already raised.

Bugs

  • Silent truncation at the depth cap (crates/engine/src/project_capabilities.rs:198, posted inline). Past MAX_OPENED_DEPTH (32), a project opened by a saved step contributes no requires. That is the same silent-drop failure this PR fixes, and AGENTS.md's "Never silent" rule covers it. The cap is reachable with base64 zip data nesting at a few MB. The new test asserts the empty result instead of a notice. Confidence: high that the silent drop is real; medium on how easily the cap is reached in practice, since I did not run it.

Security

  • None found. The walk parses attacker-controlled text, but it is bounded by the depth cap, and data/text in project.fromTemplate go through inline_text, which enforces max_file(). project.openText has no size check in the walk, which matches what open_text does, so this is not new.

Performance

  • Low concern: every project.openText and project.fromTemplate text is now fully parsed on each required_capabilities() call, instead of being skipped by the cheap contains prefilters. The PR's own measurements (7 ms and 21 ms) suggest this is acceptable.
  • Low concern: identical data templates in several steps are decompressed once per step. This is linear in steps × size and is lower than the old 8× per step, so it is not a regression.

Quality

AGENTS.md

  • No rule break found, apart from the silent cap, which is filed under Bugs. I did not verify cargo xtask schema; the PR states it passes.

Twins checked

Change size

Compared: the whole PR against main (merge base a458559 to PR head c06b661).

Measure Value
Files changed 3 (1 added, 2 modified, 0 removed, 0 renamed)
Size before 4.16 MB
Size after 4.17 MB
Total size change +5.5 KB
Path Before After Change
crates/engine/src/tests.rs 3.87 MB 3.87 MB +151 B
crates/engine/src/project_capabilities.rs 301.8 KB 302.8 KB +1.0 KB
crates/engine/src/tests/capabilities_inline_project.rs 0 B 4.4 KB +4.4 KB

@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3608/
Web app https://preview.rustgis.app/pr-3608/app/
Commit 7b2f5ef

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 preview label (once per commit).

@jgregoriorincon
jgregoriorincon marked this pull request as ready for review December 2, 2026 12:21
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Code review

Inline comments are on crates/engine/src/project_capabilities.rs at lines 198 and 213. Both are high-stakes enough that I'd resolve them before merge.

Bugs

  • Silent under-requirement past the depth cap (project_capabilities.rs:198). Once MAX_OPENED_DEPTH is reached, the walk returns false without a notice or error. A project nested deeper than that can then be saved without its header entries, which is the silent loss this PR exists to prevent. Confidence: low to medium, since the nesting is contrived. Category: bug.

Security

  • Unbounded work on hostile input (project_capabilities.rs:213). The walk reads each opened project once per occurrence, not once per level. Two steps that project.fromTemplate the same base64 zip can branch at every level, and deflate keeps the file small, so a small input can make the walk visit an enormous number of projects. The "each once" claim holds only for chains. The depth test uses a manufactured depth and doesn't exercise a branching tree. Confidence: medium; I reasoned this from the code and didn't run it. Category: security. Performance impact is the same issue.

Quality

  • collect_opened_project always returns false and is used as a visitor. The name suggests a predicate, and the doc comment is long and repeats itself. A rename and a shorter comment would help. Confidence: high. Category: quality.
  • The walk reads with Project::from_peer_raw, while open_text loads with from_json_within or from_import_json_within. The PR's claim that the walk matches the runtime reader only holds if normalisation can't add a capability. I didn't find a case where it does. Confidence: low. Category: quality.

AGENTS.md

  • No violations found. There are no unwrap, expect, panic, or unsafe calls in non-test code, and the new tests cover both the positive and negative cases.

Twins checked

Earlier concerns: none. The review thread list for this PR was empty.

Change size

Compared with main, merge base a458559 to PR head c06b661.

Files changed Added Modified Removed Renamed
3 1 2 0 0
Size before Size after Total change
4.16 MB 4.17 MB +5.5 KB
Path Before After Change
crates/engine/src/tests/capabilities_inline_project.rs 0 B 4.4 KB +4.4 KB
crates/engine/src/project_capabilities.rs 301.8 KB 302.8 KB +1.0 KB
crates/engine/src/tests.rs 3.87 MB 3.87 MB +151 B

…tep (opengeos#3462)

Two steps opening the same zip of a template, which deflate stores once,
branched at every level of the nest, so a small file made the walk read
about k^depth projects. What each text required is now kept for the
walk, by its depth, length and hash.
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Code review

I read the diff, the staged AGENTS.md, the prior threads and the changed code in context. I could not run the tests, clippy or the wasm build (no shell here), so everything below comes from reading the code.

Bugs

  • Cache keyed only by a 64-bit hash (low confidence, inline comment posted at project_capabilities.rs:228). collect_opened_project keys its per-walk cache by (depth, len, DefaultHasher). Two different texts of the same length and depth that collide share one entry, so one can inherit the other's capabilities, and an older reader could then drop a setting silently. Keying on the text itself removes the case.
  • No other defects found in the new walk. I checked the RefCell borrows (none is held across the recursive call), the unwrap/panic use (test code only), and the inline_text error paths (an error means the step fails at run time, so nothing is saved from it).

Security

  • None new.

Performance

  • Every project.openText / project.fromTemplate text is now fully parsed on each walk (low confidence). The removed per-capability checks had a cheap contains prefilter, so most texts were never parsed before. Each save, task check and model check now parses each opened project once. This is probably acceptable, but it's worth measuring on a 2–3 MB embedded project.
  • Base64 data is decoded per step occurrence, not cached (low confidence). The cache covers only the parse. Decoding and decompressing a zip is repeated for every step that opens it. This is still far fewer decodes than before (about 8 per step, removed), so it is not a regression, but a file with thousands of steps sharing one large zip still does thousands of decompressions.

Quality

  • opened_projects_are_read_only_so_deep doesn't test nesting. It calls the function at a chosen depth on a fixture that has no nested steps, so it checks the cut-off only. Its name and doc comment suggest it checks the walk down to 32 levels. A nested chain in the test would match the claim.
  • collect_opened_project always returns false. The doc comment explains why, but the signature is awkward for a reader.
  • The doc comments are long and carry history (PR numbers, what used to happen). They could be shorter.

AGENTS.md

Earlier concerns I left alone

  • 2 earlier concerns left alone:
    • The silent skip at the depth cap is already raised. The author answered that refusal needs a walk that can fail, and I found no new evidence against that answer.
    • The branching read cost is already raised and was fixed in 0671cfc. I checked that the cache now bounds reads to once per distinct text and depth.

Change size

Compared with the base branch (merge base a458559 to PR head 0671cfc).

Measure Value
Files changed 3 (1 added, 2 modified, 0 removed, 0 renamed)
Size before 4.16 MB
Size after 4.17 MB
Total size change +8.0 KB
File Before After Change
crates/engine/src/tests/capabilities_inline_project.rs 0 B 4.4 KB +4.4 KB
crates/engine/src/project_capabilities.rs 301.8 KB 305.3 KB +3.4 KB
crates/engine/src/tests.rs 3.87 MB 3.87 MB +151 B

… it (opengeos#3462)

Two texts of the same length and depth whose 64-bit digests collide shared
one entry, so one could inherit the other's capabilities. The cache is now
keyed by the depth and the text itself.
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Code review

I read the diff, the staged AGENTS.md, the prior review threads, and the surrounding engine code. I could not build or run the tests here (no shell), so the findings below rest on reading the code.

Bugs: none new. I checked the walk for re-entrant RefCell borrows (each borrow/borrow_mut is released before the recursive call, so none can overlap), for panics on hostile input (no unwrap in non-test code), and for coverage gaps. The walk reaches every replayable container: models (steps and graph tool nodes), tasks, gp_history, notebook code cells, and script.run lines. The per-capability arms that read these two commands' text were removed everywhere they were used (task_capabilities, model_capabilities, required_capabilities). I found no remaining caller of the removed functions.

Security: none. Nothing new is parsed beyond what from_peer_raw and inline_text already handle.

Performance (1, medium confidence, inline):

  • project_capabilities.rs:225: the cache lookup copies every opened text, including cache hits. Decoded data texts are also kept for the whole walk, where they were previously dropped after each read. Suggested fix: key by depth, then look up borrowed.

Quality (1, low severity, inline):

  • project_capabilities.rs:199 and the test doc at :2194: "each distinct text once" and "however deep" overstate the behaviour. The cache is keyed by depth, so the same text read at two depths is parsed twice.
  • Minor nits, not posted: collect_opened_project returns a bool that is always false purely to act as a visitor predicate. A separate visitor type would read more clearly. The doc comments around line 90 are over 120 columns.

AGENTS.md: none. Surfaces are covered in the PR body. The change touches no command ids or parameters, so the command-surface snapshot is unaffected. The requires header content changes, but the schema shape does not, and the author reports cargo xtask schema --check passing. Nothing in the change is desktop-only, so the wasm build is unaffected.

Twins checked:

Already raised, left alone (3 threads):

  • The silent skip at the depth cap (project_capabilities.rs:208 thread). It is still in the code, and the author replied with a reason. I have no new evidence against that reply, so I did not re-post it.
  • The branching blow-up (:213) and the digest-key collision (:228). Both are resolved and fixed in this head: the cache is memoised per (depth, text) and compared on the full text.

Change size

Compared: the whole PR against main (merge base a458559 to PR head cbc1e15).

Measure Value
Files changed 3 (1 added, 2 modified, 0 removed, 0 renamed)
Size before 4.16 MB
Size after 4.17 MB
Total size change +7.8 KB
Path Before After Change
crates/engine/src/tests/capabilities_inline_project.rs 0 B 4.4 KB +4.4 KB
crates/engine/src/project_capabilities.rs 301.8 KB 305.1 KB +3.3 KB
crates/engine/src/tests.rs 3.87 MB 3.87 MB +151 B

…e is per depth (opengeos#3462)

A hit in the walk's cache copied the whole opened text first, since the key
was built before the lookup. It is now keyed by depth and then the text,
looked up borrowed and copied on insert only. The docs say a text is read
once at each depth, which is what the cache does.
…thing past the depth limit (opengeos#3462)

The walk kept every decoded text until it ended, so steps opening zips that
inflate to a gigabyte held that much on every save. It keeps a SHA-256 of
the step's text or data now, looked up before anything is decoded. Past
32 levels a step that opens a text requires every capability a release
knows, so an older release refuses it instead of dropping what it can't see.
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Code review

Scope: The PR makes project.openText, project.fromTemplate and the nested steps that open a project from text (task, model, script line, notebook, project task) require what that project requires. It replaces eight per-capability text checks with one bounded, cached walk. I read the full diff, the surrounding project_capabilities.rs, project.rs (from_peer_raw, read_json), cmd/items.rs (inline_text), and cmd/project.rs (open_text). I could not build or run tests, since I have no shell.

Bugs

None found.

What I checked and ruled out:

  • Walk vs. open: The walk parses with from_peer_raw, which runs the same validation as the open path, and skips only normalisation and map truncation. So it never refuses what the command accepts. Over-requiring is the intended direction.
  • Decoded text along a chain: The decoded text is dropped inside the and_then closure before the recursive call, so nested texts are not held together. Each level still keeps its parsed Project alive, which is inherent to the walk.
  • RefCell borrows: No overlapping borrows. The cache is borrowed and released before recursion, and each walk has its own found cell.
  • Depth cap: The prior "silent skip" thread no longer applies. At the cap, the walk requires all of CAPABILITIES, so an older release refuses the file rather than dropping settings.
  • inline_text ordering: data is preferred in both the walk and inline_text, so the tag and source match.

Security

None found. The walk is depth-bounded (32), the per-walk cache is keyed by a SHA-256 of the source, and it never panics on junk parameters.

Performance

  • Per-visit copy and hash of the source (inline, project_capabilities.rs:233). format! copies the whole opened text on every visit, cache hits included. Confidence: medium that it is a real cost, low that it matters in practice. Category: performance.

Quality

  • Doc and PR body contradict the depth-cap behaviour (inline, project_capabilities.rs:209). Text that isn't a project requires nothing, except past the cap, where any text requires everything. The test pins the exception. Confidence: high. Category: quality.

AGENTS.md

No breaks found.

  • No new capability, so schema/project.schema.json should not change. The PR body says cargo xtask schema --check passes.
  • No command added or renamed, so command-surface.txt is unaffected.
  • rustgis_plugins::package is an unconditional pub mod, so the walk builds for wasm. I did not build wasm.
  • Twins checked:

Prior reviews

Five earlier threads are on this PR. I left all five alone:

  • The depth-cap silent skip is outdated and now handled by requiring everything.
  • The doc overclaim, the branching blow-up, the digest collision, and the decoded-text copy are fixed.

Change size

Compared with the base branch (merge base a458559 to PR head afbc88f), across the whole PR.

Measure Value
Files changed 3 (1 added, 2 modified, 0 removed, 0 renamed)
Size before 4.16 MB
Size after 4.17 MB
Total size change +10.4 KB
Path Before After Change
crates/engine/src/project_capabilities.rs 301.8 KB 307.8 KB +5.9 KB
crates/engine/src/tests/capabilities_inline_project.rs 0 B 4.4 KB +4.4 KB
crates/engine/src/tests.rs 3.87 MB 3.87 MB +151 B

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Code review

Scope: 3 files: project_capabilities.rs (+225/−99), a new tests/capabilities_inline_project.rs (+95), and tests.rs (+4). The PR makes a saved project.openText / project.fromTemplate step require what the project it opens requires, by walking the opened text once per depth with a digest cache and a 32-level cap. I read the diff, the staged AGENTS.md and metadata, and the surrounding code (read_text, inline_text, read_json, script_uses, command_uses, inline_project_requires). I could not build or run tests here (no shell), so the points below come from reading the code.

Bugs

  • None confirmed. I checked the borrow pattern in collect_opened_project (the seen and found RefCell borrows don't overlap across the recursive call), the removed text_* helpers (no dangling references, and the helpers still used are still used), the command_uses / script_uses signature changes (all call sites updated), and the data-before-text order against read_text and project.fromTemplate. All consistent.

Security

  • None found. The walk runs on hostile input, and its only unbounded cost is the performance point below.

Performance

  • Decoded-byte cost of nested data templates is unbudgeted (medium confidence). Each level inflates up to 1 GiB natively and parses it, the walk runs on the UI thread at every save and task check, and the cache only collapses identical texts. See the inline comment on project_capabilities.rs:238.

Quality

AGENTS.md

  • None found. Checked against the rules: no unwrap or expect in non-test code (the test module's unwrap is fine). The depth limit requires everything rather than dropping quietly, so "Never silent" holds. The change adds no new capability name, so the schema and fixture rules look unaffected (I could not run cargo xtask schema --check).
  • Twins checked: project.openText and project.fromTemplate are both covered. project.importQgis and project.importGeolibre take foreign project text and don't carry RustGIS steps, so they are not affected. layout.import and report.existingTemplate already go through imported_layout_uses. model.import and notebook.open are out of scope per the PR body ([Bug]: Saved steps that open or import an inline document don't require most layout capabilities #3476), and project.open by path is documented as read through its own header.

Prior review threads

  • The PR has 7 earlier review threads, all resolved and outdated, and the PR author replied to each with a fix or a reasoned decline. I did not re-raise any of them. The cache-collision, text-copy, depth-cap and doc-wording concerns are addressed by the current code.

Change size

Compared with the base branch (merge base a458559 to PR head ec71b52). Files changed: 3 (1 added, 2 modified, 0 removed, 0 renamed). Size before 4.16 MB (4,366,126 B), after 4.17 MB (4,377,040 B), change +10.7 KB (+10,914 B).

Path Before After Change
crates/engine/src/project_capabilities.rs 301.8 KB 308.0 KB +6.1 KB
crates/engine/src/tests/capabilities_inline_project.rs 0 B 4.4 KB +4.4 KB
crates/engine/src/tests.rs 3.87 MB 3.87 MB +151 B

…pengeos#3462)

The depth limit bounds the length of a chain of templates, not their size:
32 zips that each inflate to a gigabyte are tens of megabytes in the file.
A walk counts the bytes of the texts it reads, and past what a project may
hold a step that opens a text requires everything, as at the depth limit.
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Code review

I read the full diff, the base-branch AGENTS.md, and the prior review threads. I could not build or run the tests here (no shell), so the findings below come from reading the code.

Bugs

None new that I'd call a clear defect.

Security

  • The byte budget does not bound inflation (crates/engine/src/project_capabilities.rs:243, confidence high on the code path, medium-high on impact). inline_text decodes and zip-inflates a data template before the budget check at line 248. Once the budget is spent, each later distinct data template is still fully inflated (up to 1 GiB each via zip::MAX_TOTAL) on the UI thread. Only the parse is skipped. The PR's claim that a walk reads "the budget plus one text" is wrong for data. The earlier thread's reply ("instead of being inflated and parsed") doesn't address this, so I re-raised it with the new evidence. The test a_walk_reads_only_so_many_bytes only uses text, so it can't catch this.

Performance

None new. The walk is now one pass, the cache is keyed by a digest, and decoded text isn't kept between steps.

Quality

  • Nits, grouped on project_capabilities.rs:181: test-only PARSED counter in production code, Seen/read naming, repeated std::collections::HashMap, and an overlong doc line around "The same goes past the bytes…".

AGENTS.md

None found. I checked:

  • Never crash: no unwrap/expect/panic in non-test code; saturating_add and get-style access are used.
  • Never silent: over-budget and depth-limit cases require every capability, so an older release refuses rather than drops. This matches the rule.
  • Twins: project.openText and project.fromTemplate are both covered by the walk (data before text, as the command reads them). project.importGeolibre and project.importQgis are other formats, not RustGIS project text, so they don't apply. model.import and notebook.open are declared out of scope ([Bug]: Saved steps that open or import an inline document don't require most layout capabilities #3476). Other read routes (project.open by path) use the file header, as the PR says.
  • wasm: sha256_hex is in rustgis-plugins, which engine depends on normally. The diff adds no cfg split.

Prior threads: 8 existed. I re-raised 1 (the byte budget), and left 7 alone because they are answered and the code matches the answer.

Change size

Compared with the base branch (merge base a458559 to PR head 06ac65c).

Measure Value
Files changed 3 (1 added, 2 modified, 0 removed, 0 renamed)
Size before 4.16 MB
Size after 4.18 MB
Total size change +12.7 KB
Path Before After Change
crates/engine/src/project_capabilities.rs 301.8 KB 310.0 KB +8.2 KB
crates/engine/src/tests/capabilities_inline_project.rs 0 B 4.4 KB +4.4 KB
crates/engine/src/tests.rs 3.87 MB 3.87 MB +151 B

…#3462)

The budget of bytes was checked after a template was inflated, so each later
one was still inflated whole and only its parse was skipped. Once the budget
is spent a text is not decoded: the step requires everything.
…eos#3462)

A walk could read 512 MiB of opened texts, about two seconds on the calling
thread at every save. The budget is a fixed 64 MiB now, a quarter of a
second at the limit and the same on every computer.
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Code review

PR #3608 makes a saved step that opens a project from its text (project.openText, project.fromTemplate) require what that project requires. The walk is in crates/engine/src/project_capabilities.rs, and the change to the eight per-capability checks is consistent. I did not build or run the tests; the findings below come from reading the diff and the surrounding code.

Bugs

  • Budget mismatch with compatibility effect (project_capabilities.rs:217): the walk's budget is 64 MiB, but the PR description says BYTES_FLOOR, 512 MiB, and all its measurements were taken at 512 MiB. Past the budget the outer project requires every capability, so a template embedding a raster of about 50 MB or more would make older releases refuse a file they could open. Confidence: medium on the effect, high on the mismatch.
  • Possible escape through script.run nodes in inline graphs (project_capabilities.rs:1747): inline_graph_uses skips script.run nodes, so a project opened by a script inside a model.run graph in a task, gp history or notebook is never walked. This predates the PR for every check. Confidence: low, since I have not verified that a graph node can run script.run.

Security

  • None found.

Performance

  • Zip inflation not bounded by the walk's budget (project_capabilities.rs:276): data templates are inflated up to zip::MAX_TOTAL (1 GiB natively) before the budget check, on the UI thread, once per walk. Bounding the decode with read_matching_within would give the same result. Confidence: medium. I have not measured the peak.

Quality

  • The inline_text_within doc ("the largest file it takes given") is wrong for zips. This is in the same comment as the performance finding above.
  • The PR description's budget figures and "512 MiB" need updating to match the code. This is covered by the first bug above.

AGENTS.md

  • No breaks found in the changed code. Non-test code has no unwrap, expect or unsafe, and no new command or parameter was added. I could not run cargo xtask schema to confirm that the requires change needs no schema update.

Earlier review threads: There are 21. I re-raised none verbatim. Two of my comments build on earlier threads and say what is new: the budget (the constant changed from the 512 MiB the thread discussed) and the 1 GiB decode (the earlier answer relied on MAX_TOTAL, which bounds size, not the work). I left the other 19 alone, including the unanswered thread on the time to walk at the budget. Its figure is now about 256 ms by the code's own comment, which the PR should state.

Change size

Compared with the base branch (the whole PR, merge base a458559 to PR head 779b473).

Measure Value
Files changed 4 (1 added, 3 modified, 0 removed, 0 renamed)
Size before 4.3 MB
Size after 4.3 MB
Total size change +18.7 KB
Path Before After Change
crates/engine/src/project_capabilities.rs 301.8 KB 314.6 KB +12.8 KB
crates/engine/src/tests/capabilities_inline_project.rs 0 B 5.5 KB +5.5 KB
crates/engine/src/cmd/items.rs 111.5 KB 111.7 KB +284 B
crates/engine/src/tests.rs 3.9 MB 3.9 MB +151 B

…pengeos#3462)

inline_text_within bounded the base64 only, so a package was inflated up to
1 GiB before the walk's budget applied. The package is read within the
limit it is given, and a template past it requires everything.
Comment thread crates/engine/src/cmd/items.rs Resolved
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Code review

I read the full diff, the staged PR metadata and prior review threads, and checked the walk against the surrounding code: zip::read_within, inline_text/max_file, script_uses/command_uses, model_uses, text_generalizes, and open_text. I did not build or run the tests (no shell here), so the points below come from reading the code. Confidence is stated per item.

Bugs

  • Zip budget change reaches the existing inline read route (medium confidence, inline comment posted). inline_text_within now caps a zip's inflation at min(max_file(), MAX_TOTAL). Before, it used MAX_TOTAL (1 GiB natively). That affects read_text, report.rs:1750 and the leaf checks, not only the walk. On low-memory machines a template that inflates to 512 MiB–1 GiB and opened before is now refused. The path route (package_text, line 479) still uses MAX_TOTAL, so the two routes disagree on the same zip. The PR description does not mention the change.
  • Noted, not new, disclosed in the PR (low–medium confidence, not posted). The leaf checks for style.add/layer.addLayerFile/map.import call required_capabilities() fresh for each inline project (text_generalizes, text_sets_obstacles → inline_project_requires). A chain that alternates project.openText with style.add inline data resets the depth and byte limits at each level, and the cost may grow exponentially. The PR states this path is left for [Bug]: Inline styles, layers, maps, projects and templates with a label weight, clearance or duplicate setting don't require their capability #3589, so I count it as known, not as a finding of this change.

Security

  • None found. The new walk's allocations are bounded by the 64 MiB budget and the depth cap, and the base64 length is checked before decoding. The new production code has no unwrap/expect/unsafe.

Performance

  • Nothing new beyond the save-time parse cost and per-visit hashing raised in earlier threads. The cache removes repeat parses of the same digest at the same depth.

Quality

  • The stack test likely doesn't reach depth 32 (medium confidence, inline comment posted). the_deepest_chain_of_opened_projects_fits_a_small_stack builds a 33-level base64 chain. By my estimate the 64 MiB byte budget stops the walk around level 5, so the test doesn't exercise the 32-level stack it is meant to prove. The > 50 assertion passes either way.
  • Twins checked: project.openText/project.fromTemplate both go through the walk and its tests. project.importGeolibre and project.importQgis convert foreign formats and aren't twins. layer.addLayerFile, style.add, map.import and layer.add* keep the leaf checks, which the walk covers through required_capabilities(). Task and model saves use the same walk.

AGENTS.md

  • None found. No new command, so no command-surface.txt change. No saved-format change, so no schema change needed. The walk is platform-neutral, so no wasm issue. The PR description accounts for the surfaces it reaches.

I left 23 earlier threads alone. They are either answered by the author or already reflected in the current code, such as the 64 MiB budget, the fixed budget, the cache key, and the removed text checks. The stack-test point above is new evidence on an answered thread, not a repeat.

Change size

Compared: the whole PR against main (merge base a458559 to PR head 8742b0a).

Measure Value
Files changed 4 (1 added, 3 modified, 0 removed, 0 renamed)
Size before 4.27 MB
Size after 4.29 MB
Total size change +20.2 KB
Path Before After Change
crates/engine/src/project_capabilities.rs 301.8 KB 315.6 KB +13.8 KB
crates/engine/src/tests/capabilities_inline_project.rs 0 B 5.5 KB +5.5 KB
crates/engine/src/cmd/items.rs 111.4 KB 112.2 KB +752 B
crates/engine/src/tests.rs 3.87 MB 3.87 MB +151 B

…st reach the depth limit (opengeos#3462)

The zip budget of the walk also cut what the other readers of inline_text
take, so a package that inflated past the limit of the computer for a file
but under the zip limit was refused inline and read by path. inline_text
takes the inflation limit apart from the text's. The stack test moves next
to the walk, with a budget no chain reaches, and asserts that a text was
read at each depth. A very large limit no longer overflows.
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Code review

I found no new bugs in this pass. I posted one inline quality comment (the depth test's required > 50 assertion, project_capabilities.rs:2389). The rest are nits below, which I left out of the inline comments.

Bugs

  • None new. I checked the walk's recursion and RefCell borrows, the depth and byte limits, the digest cache, and the inline_text_within and package_text_within routing. Confidence: medium-high. I could not compile or run the tests here.

Security

  • None found. The walk's hashing and budgets are bounded by the parsed texts, so repeated visits don't open a new cost path.

Performance

  • None new. The remaining concern is the per-save walk on the UI thread, bounded at 64 MiB. Earlier threads already covered it and the author answered with measurements, so I left it alone.

Quality

  • project_capabilities.rs:2389 (posted): required > 50 accepts a walk that drops up to half the names. Compare with the full CAPABILITIES set, as the other walk tests do.
  • Nit: the doc line at project_capabilities.rs:2566 runs past the file's usual width, and the earlier wrapping nit applied only to the walk's own docs.

AGENTS.md

  • None found. Checked: no unwrap/expect/unsafe in non-test code, the new behaviour is covered by tests, no command or parameter was added (so command-surface.txt is unchanged), and the requires header is the only saved-output change. No new fixture was needed because the reader was not changed.

Twins and surfaces checked

  • project.openText reads only text. Its package flag changes secret restoration, not what is read, so the walk's from_peer_raw read is the same JSON.
  • project.fromTemplate goes through read_text, which takes data before text, the same order as the walk. path is not read, as the description says.
  • Other routes: project.open by path, project.importGeolibre, model.import and notebook.open are outside this walk. The PR names the last two as deferred to [Bug]: Saved steps that open or import an inline document don't require most layout capabilities #3476.
  • Saved-command containers in Project (tasks, models, gp history, notebooks) are all reached by uses_commands.
  • The diff adds no cfg(wasm32) branches. MAX_TOTAL differs on wasm (256 MiB), but the code uses the same constant in both builds.

Prior threads

  • 25 threads existed. I left all 25 alone and did not re-post any. Most are addressed in code (the MAX_TOTAL zip limit, the cache key, the depth and budget changes, the deterministic budget, the test budget). The rest are answered with measurements or reasoning.

Change size

Compared: the whole PR against main (merge base a458559 to PR head f355ec4).

Measure Value
Files changed 4 (1 added, 3 modified, 0 removed, 0 renamed)
Size before 4.27 MB
Size after 4.29 MB
Total size change +21.7 KB
Path Before After Change
crates/engine/src/project_capabilities.rs 301.8 KB 318.2 KB +16.4 KB
crates/engine/src/tests/capabilities_inline_project.rs 0 B 4.4 KB +4.4 KB
crates/engine/src/cmd/items.rs 111.4 KB 112.2 KB +805 B
crates/engine/src/tests.rs 3.87 MB 3.87 MB +151 B

Comment thread crates/engine/src/cmd/items.rs Resolved
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Code review

I reviewed the saved-step walk in project_capabilities.rs (collect_opened_project, OpenedReads, and their callers in required_capabilities_at, task_capabilities and model_capabilities), the inline_text_within and package_text_within split in cmd/items.rs, and the new tests. I could not run the tests, since there is no shell here. Test results and memory and time figures are the author's measurements.

Bugs: none new. I checked the RefCell borrows in the walk and found no overlapping borrow. The zip budget refuses an oversized package rather than truncating it. from_peer_raw runs the same format and duplicate-id checks as the commands, so a text the walk reads as empty is one the command also refuses. The walk's script_uses cut at MAX_SCRIPT_LINES matches the runner, which refuses longer scripts. Graph nodes naming script.run are skipped in inline_graph_uses, and tool_of never runs them, so that skip is safe. Confidence: high.

Security: none. The walk parses saved text without reading any path, connection or reach. The #3530 test still covers this for the leaf checks, and the walk has no separate test for it. Confidence: medium-high.

Performance: nothing new. The earlier thread on parsing each opened text on every save is still open and still applies. The author measured it and declined to gate it. I did not re-raise it, since the code it points at has not changed.

Quality:

  • Inline on cmd/items.rs:2163: the inline_text_within doc is ambiguous about which limit it means. The suggested rewording is attached. Category: quality.

AGENTS.md: none found. No unwrap, expect or panic was added to non-test code, and no unsafe was added. No command was added, so the command surface snapshot is unaffected. The change alters the values in requires, not the saved structure, so the schema needs no regeneration. No cfg(target_arch = "wasm32") branch changed.

Twins checked:

  • project.openText and project.fromTemplate: all eight removed arms are covered by the walk.
  • project.open takes only a path, which the PR says is not read by design.
  • task.import is covered through task_capabilities, which task_json uses to write requires.
  • model.import and notebook.open are deferred to [Bug]: Saved steps that open or import an inline document don't require most layout capabilities #3476, as the PR states.
  • script.run takes only inline text.
  • layer.add*, service.add, project.importQgis and project.importGeolibre do not carry project text that the walk reads.

Earlier concerns: there are about 26 earlier threads on this PR. I did not re-raise any of them. One thread on the test's required > 50 assertion is still marked outdated and unresolved. The current test compares full sets, so the point is addressed.

Change size

Compared with the base branch (merge base a458559 to PR head 17983bc).

Measure Value
Files changed 4 (1 added, 3 modified, 0 removed, 0 renamed)
Size before 4.3 MB
Size after 4.3 MB
Total size change +21.8 KB
Path Before After Change
crates/engine/src/project_capabilities.rs 301.8 KB 318.4 KB +16.5 KB
crates/engine/src/tests/capabilities_inline_project.rs 0 B 4.4 KB +4.4 KB
crates/engine/src/cmd/items.rs 111.5 KB 112.2 KB +805 B
crates/engine/src/tests.rs 3.9 MB 3.9 MB +151 B

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Code review

I read the full diff, the base AGENTS.md, the change-size stats, and all the prior threads. Nothing new is a crash, data-loss or security defect. The walk is deterministic, bounded by depth and bytes, and each earlier concern has either a fix or a reasoned answer. I posted one inline comment, below. I left about 25 earlier threads alone, since they're resolved or answered and nothing I found changes them.

What I checked

Bugs

  • None new.

Security

  • None.

Performance

  • None new. The per-save parse cost and the per-visit hashing are already covered by threads the author answered with measurements.

Quality

  • Nit, not posted: task_capabilities and model_capabilities still name their local seen, though the type is now OpenedReads. Confidence high.

AGENTS.md

  • The walk is a long step with no Cancel check, and its doc doesn't say so. Inline comment posted on project_capabilities.rs:240. Confidence low to medium.

Verified by reading only: I did not build or run the tests. The PR reports cargo fmt, clippy and the layering check as passing, and the 8 nextest failures outside rustgis-engine as also failing on main.

Change size

Compared: the whole PR against main (merge base a458559 to PR head 170e565).

Measure Value
Files changed 4 (1 added, 3 modified, 0 removed, 0 renamed)
Size before 4.27 MB
Size after 4.29 MB
Total size change +21.9 KB
Path Before After Change
crates/engine/src/project_capabilities.rs 301.8 KB 318.4 KB +16.5 KB
crates/engine/src/tests/capabilities_inline_project.rs 0 B 4.4 KB +4.4 KB
crates/engine/src/cmd/items.rs 111.4 KB 112.3 KB +837 B
crates/engine/src/tests.rs 3.87 MB 3.87 MB +151 B

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Code review

I read the PR diff, the staged metadata, and the surrounding code (zip.rs, project.rs, cmd/project.rs open_text, the script_uses/command_uses walkers and from_peer_raw). I could not build or run the tests in this environment, so everything below is from reading.

Bugs: None new. I checked the following and found them sound:

  • read_matching_within errors when the budget is exceeded and never truncates, so the walk's "can't decode, require everything" path is reached correctly.
  • The cache is keyed by depth and a SHA-256 of the source, and reads are not borrowed across the recursive call, so there is no RefCell double-borrow.
  • script.run recursion is bounded by script_line refusing nested scripts.
  • inline_text still inflates zips up to MAX_TOTAL, so the one-argument reader is unchanged.
  • project.openText reads only text, matching the walk. project.fromTemplate prefers data, matching inline_text.

Security: None found.

Performance:

  • The SHA-256 of a step's source runs before the budget and spent checks, so an oversized text is hashed on every save even though its answer is known. Low confidence, and minor in impact. Posted inline on project_capabilities.rs:266.

Quality: None new. The earlier quality points are answered in the threads.

AGENTS.md: None new. The walk's no-Cancel doc, the wasm and #[cfg] paths, and the schema/ expectations look consistent with the rules. The schema is unchanged, which fits a header change with no new capability names.

Twins checked:

Earlier concerns left alone: 28 review threads were already raised on this PR, and the author replied to each. I did not repeat them. Several were fixed in later commits, and the rest were answered with measurements or reasoning I could verify.

Change size

Compared against main (merge base a458559 to PR head 6c90ffa).

Measure Value
Files changed 4 (1 added, 3 modified, 0 removed, 0 renamed)
Size before 4.3 MB
Size after 4.3 MB
Total size change +22.0 KB
Path Before After Change
crates/engine/src/project_capabilities.rs 301.8 KB 318.5 KB +16.7 KB
crates/engine/src/tests/capabilities_inline_project.rs 0 B 4.4 KB +4.4 KB
crates/engine/src/cmd/items.rs 111.4 KB 112.3 KB +837 B
crates/engine/src/tests.rs 3.9 MB 3.9 MB +151 B

…ng it (opengeos#3462)

The SHA-256 of a step's source ran before the budget was looked at, so a
text past the whole budget was hashed in full on every save. Its answer is
known: it requires everything.
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Code review

I read the diff, the base-branch AGENTS.md and the 29 earlier review threads. I also checked the changed code against the call sites it touches: inline_text, project.openText and project.fromTemplate in cmd/project.rs and cmd/items.rs, zip::read_within, Project::read_json, and offline.bringBack in cmd/field.rs. I found no new bug, security problem or AGENTS.md violation that I could confirm, so I posted no inline comments.

Bugs

  • None new. Over-budget zips return an error from zip.rs read_within rather than truncating, so the walk's "requires everything" path is reached and nothing is cut silently. The walk no longer uses max_bytes(); inline_text_within gets the walk's own budget. The RefCell borrows don't overlap across the recursion. Confidence: high.

Security

  • None found. The walk parses with from_peer_raw, which passes no directory and no reach, so nested texts read no files and no network. Confidence: high.

Performance

Quality

  • A data template that fails for a reason every release shares (not base64, a zip with no project, not UTF-8) makes the walk require everything. Older releases then refuse the whole project over a step that fails anyway. The PR calls this deliberate. I'd question whether format failures, unlike budget failures, should require nothing. This is a design question, not a defect. Confidence: medium.

AGENTS.md

  • No unwrap, expect, panic or unsafe in non-test code in the changed files.
  • The walk has no Cancel check and its doc says so, as the rule requires for a long step.
  • Wasm: rustgis_plugins::package::sha256_hex is not cfg-gated, and the engine depends on plugins on every target. No wasm-cfg branch changed. MAX_TOTAL differs on wasm, but the walk's 64 MiB budget is below both limits, so the answer is the same on every target.
  • Never silent: over-budget or over-depth projects now require everything, so older releases refuse them by name. Nothing is dropped, and no notice is given at save time. I don't count that as a violation.
  • Twins checked:
    • The two commands' read routes are all covered: model step, task step, script line, project task, gp history and notebooks.
    • project.importGeolibre and project.importQgis read foreign formats, not RustGIS project text.
    • offline.bringBack reads a project from a zip (data or path) at cmd/field.rs:1493 and is not walked. That package carries its own requires header, which its reader checks, so I found no silent loss.
    • model.import and notebook.open are deferred to [Bug]: Saved steps that open or import an inline document don't require most layout capabilities #3476 by the PR.
  • The command surface is unchanged: no command is added, removed or renamed. The schema structure is unchanged; only the contents of the requires header differ.

Prior concerns: 29 threads, 28 resolved and 1 open. I left the open one alone. I checked the fixes for the budget mismatch, zip inflation before the budget, the inline_text limit change and the computer-dependent header against the code, and each is in place.

Change size

Compared: the whole PR against main (merge base a458559 to PR head 7b2f5ef).

Measure Value
Files changed 4 (1 added, 3 modified, 0 removed, 0 renamed)
Size before 4.27 MB
Size after 4.30 MB
Total size change +23.3 KB
File Before After Change
crates/engine/src/project_capabilities.rs 301.8 KB 319.8 KB +17.9 KB
crates/engine/src/tests/capabilities_inline_project.rs 0 B 4.4 KB +4.4 KB
crates/engine/src/cmd/items.rs 111.4 KB 112.3 KB +837 B
crates/engine/src/tests.rs 3.87 MB 3.87 MB +151 B

@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Dec 2, 2026
Merged via the queue into opengeos:main with commit e1b5334 Dec 2, 2026
30 checks passed
@jgregoriorincon
jgregoriorincon deleted the fix/3462-inline-document-capabilities branch December 2, 2026 16:31
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.

[Bug]: A saved step that opens a project from its text doesn't require the project's layout capabilities

1 participant