Skip to content

fix(engine): read nothing an inline project names when asking what it requires - #3533

Merged
jgregoriorincon merged 3 commits into
opengeos:mainfrom
jgregoriorincon:fix/3530-inline-project-reads
Dec 1, 2026
Merged

jgregoriorincon merged 3 commits into
opengeos:mainfrom
jgregoriorincon:fix/3530-inline-project-reads

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Saving a project with a project.openText step could request a raster that the step's inline project reads in place from a server, although the step doesn't run. To find out which capabilities the saved project requires, four checks loaded the inline project with Project::from_json, which repairs it and so reads what it names: generalised Shaded Relief, extent indicator numbers, north arrow font and scale bar font.

They now ask through one function, inline_project_requires, which reads the project without repair (Project::from_peer_raw), as the one-row legend check already did (#3489). The one-row check uses it too.

One difference in what is required: the project is asked as written, so what loading it would cut, such as a layout past the most a project keeps, now counts: at worst an older release is asked for something loading would have dropped, never the other way round.

No command, parameter or description changes: this is the engine's check when a project is saved.

Testing

  • the_checks_of_an_inline_project_read_nothing_it_names: each of the four checks, with and without its feature, on the project as saved, without its requires header and nested in a task step, called directly and from a script. A local listener receives nothing. It failed before the fix on a received connection.
  • an_inline_project_requires_what_loading_it_would_cut: a north arrow font in a layout past the limit. It failed before the fix.
  • cargo nextest run -p rustgis-engine -E 'test(/capabilities/) + test(hostile_params_never_panic)': 81 passed.
  • fmt, clippy of rustgis-engine, doctests, layers and schema checks, cargo xtask test-hygiene. Workspace nextest: 11875 of 11883 passed locally; the 8 failures are in rustgis-geolibre (7) and line_strokes_editor_edits_one_class, outside this change.
  • rustgis-cli run --project outer.rgis --save out.rgis, 20 runs each, with a logging server as in the issue: no request in any case after the fix (8 to 12 of 20 before, with extent numbers or a font); the saved requires is unchanged.

UI evidence

No visible UI change.

Related issue

Closes #3530

Summary by CodeRabbit

  • Bug Fixes
    • Improved recognition of supported features in saved and headerless projects, including projects with nested content.
    • Projects with malformed text or content that is not retained when loaded are less likely to be incorrectly identified as supporting a feature.
    • Checking project features no longer requires reading referenced raster data, helping avoid unnecessary data access.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Four inline-project capability checks now use raw project parsing instead of project loading. Tests cover saved, headerless, nested, malformed, and over-limit project text, and verify that capability checks do not read named rasters.

Changes: Inline-project capability checks

Layer / File(s) Summary
Raw parsing and capability checks
crates/engine/src/project_capabilities.rs
A shared helper parses inline project text with Project::from_peer_raw. Generalization, one-row legend, extent-number, and layout-font checks use the helper. Tests cover project text variants, capability data beyond the retained layout limit, and named-raster reads.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related issues

  • opengeos/RustGIS#3462 — This PR changes the Shaded Relief and extent-number checks for inline projects. The issue’s other capability gaps remain outside this change.
  • opengeos/RustGIS#3476 — This PR changes the extent-number and layout-font checks for inline projects. The issue’s other capability gaps remain outside this change.

Possibly related PRs

  • opengeos/RustGIS#3434 — This PR changes the inline Shaded Relief capability check introduced by that PR.

Suggested reviewers: elpidioassinaturas, giswqs

Merge Risk: Minimal · up to 69a75

Saving a project no longer reads resources named by an inline project in a step that does not run. The change is small, tested, and easy to revert. No actionable merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the four inline-project capability checks and the one-row legend check now read the project without repair, so they read nothing the project names. It is specific and …
Description check Passed The description follows the template sections (Summary, Testing, UI evidence, Related issue). Summary explains the problem and the fix. Testing lists specific tests, commands, and CLI verification wit…
Linked Issues check Passed [#3530] requires that saving a project reads nothing that a saved step's inline project.openText project names. The four checks (text_generalizes, text_numbers_extents, and text_gives_font for…
Out of Scope Changes check Passed The changes stay in the saving-time capability checks in crates/engine/src/project_capabilities.rs: the shared helper inline_project_requires, the four inline checks, the one-row legend check, and…
Full details: Title check

Explanation

The title names the main change: the four inline-project capability checks and the one-row legend check now read the project without repair, so they read nothing the project names. It is specific and matches the changeset (inline_project_requires, Project::from_peer_raw in project_capabilities.rs).

Full details: Description check

Explanation

The description follows the template sections (Summary, Testing, UI evidence, Related issue). Summary explains the problem and the fix. Testing lists specific tests, commands, and CLI verification with results. UI evidence states 'No visible UI change.' as the template requires. Related issue links #3530.

Full details: Linked Issues check

Explanation

[#3530] requires that saving a project reads nothing that a saved step's inline project.openText project names. The four checks (text_generalizes, text_numbers_extents, and text_gives_font for the north arrow and scale bar fonts) now route through inline_project_requires, which parses with Project::from_peer_raw and does not repair the project. The one-row legend check uses the same helper, as it did before (#3489). The raw summary at the reviewed head states that invalid text returns None and that callers require Some(true), so invalid text does not match a capability. The PR description reports that the_checks_of_an_inline_project_read_nothing_it_names and an_inline_project_requires_what_loading_it_would_cut failed before the fix and pass after it, and that a 20-run CLI check with a logging server shows no requests after the fix. The head file crates/engine/src/project_capabilities.rs is present, but the read was truncated before the text_* function bodies. Diff inspection for the whole PR and for the incremental change since the previous reviewed head failed because changed blobs were missing. The PASS therefore rests on the summary, the PR description test evidence, and the head file header. The changes since the previous head (3b6135d to 69a7597) were not read directly.

Full details: Out of Scope Changes check

Explanation

The changes stay in the saving-time capability checks in crates/engine/src/project_capabilities.rs: the shared helper inline_project_requires, the four inline checks, the one-row legend check, and their tests. The raw summary lists no changed exported declarations. The PR description reports no command, parameter, description, or UI change. The behavior change, that requirements in content loading would cut now count, follows from reading the inline project as written, which [#3530] requests. The incremental change since the previous reviewed head could not be read because the diff tool reported missing blobs. This PASS relies on the summary and PR description for that change.

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 the project text,
And finds no raster to request.
Raw parsing keeps the checks in line,
While nested layouts still combine.
The malformed text gets no green light,
Then hops away beneath the moonlight.

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: 49838c4d-4e85-4b20-ac31-9bc46de2cd80
Commits

Reviewing files that changed from the base of the PR and between 3b6135d and 69a7597.

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; 6 remain after this review.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Code review

Reviewed crates/engine/src/project_capabilities.rs (the only changed file). The four text_* checks now use inline_project_requires, which parses with Project::from_peer_raw. The one-row check already did. No earlier review threads exist, so none were left alone. I could not run the tests (no shell in this review), so the results below come from reading the code.

Bugs

  • Unverified, low confidence: from_peer_raw skips durable::restore, which from_json applied. For text saved in the same session, restore puts back addresses that were cleaned on save. If any capability check reads those addresses, requires can change. Posted inline. The author should confirm that no capability reads an address or path, or add a test.

Security

  • None found.

Performance

  • None. Each check still parses the inline text once, as before.

Quality

  • The listener loop's unwrap_err() panics on an accepted connection and drops the "the raster was read" message. Suggested fix posted inline.
  • The an_inline_project_requires_what_loading_it_would_cut test does not assert its own premise that loading would cut the 201st layout. Posted inline.
  • Nits, not posted:
    • inline_project_requires(...) == Some(true) appears at four call sites. A bool-returning helper, or unwrap_or(false), would read more plainly.
    • Doc comments on text_numbers_extents, text_gives_font and text_lays_a_legend_in_one_row wrap awkwardly.
    • The "not read" test watches for 1 s (20 × 50 ms), so it only catches a read that starts inside that window.

AGENTS.md

  • No rule breaks found. Checked:
    • No unwrap/expect in non-test code; the new helper sits in mod tests.
    • No saved-format change, so no schema regeneration is needed.
    • No command added or removed, so the command-surface snapshot is unaffected.
    • Engine-only change, so wasm, layering and UI rules do not apply.
    • test-wait is present on the timer loop.
  • Twins checked:
    • All four text_* checks (generalise, extent numbers, north-arrow font, scale-bar font) and the one-row check now go through inline_project_requires.
    • No other text-reading check in the file calls from_json.
    • The project.openText and script.run routes share these helpers.
    • The layout.import and report.existingTemplate routes are not text-parsed and are untouched.

Change size

Compared with the base branch (merge base 809e96f to PR head 3b6135d).

Measure Value
Files changed 1 (modified 1, added 0, removed 0, renamed 0)
Size before 286.4 KB
Size after 291.7 KB
Total size change +5.3 KB
Path Before After Change
crates/engine/src/project_capabilities.rs 286.4 KB 291.7 KB +5.3 KB

@jgregoriorincon
jgregoriorincon marked this pull request as draft December 1, 2026 12:32
@jgregoriorincon

Copy link
Copy Markdown
Contributor Author

On the unposted nits: == Some(true) stays, as the generalisation check needs the None to fall back to its JSON walk; the comment wrapping is cosmetic; and the one-second window is the same as the existing one-row read test's.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Code review

Reviewed the single changed file, crates/engine/src/project_capabilities.rs, plus the from_peer_raw / read_json path it now relies on. I found no bugs, security issues, performance problems or AGENTS.md breaks. No inline comments posted.

Bugs

  • None found. I checked the switch from Project::from_json to from_peer_raw (read_json with restore = false, normalize = false). The identity, format and import checks in read_json run on both paths, and normalize_opened and repair return no Result, so from_peer_raw accepts everything from_json accepts. The fallback to holds_generalize in text_generalizes is therefore never bypassed in a case it used to cover. Confidence: high.
  • Intended over-requirement: from_peer_raw does not apply the MAX_LAYOUTS truncation, so a layout past the limit now counts. This is conservative, as the PR says. Confidence: high.

Security

  • None found.

Performance

  • None found. Each check parses the inline project once, as before. from_peer_raw skips the repair step, so it is no heavier than the old path.

Quality

  • None new. The two earlier quality threads were addressed in 69a7597 and are resolved or outdated.

AGENTS.md

  • None found. Checked: no unwrap or expect outside tests; the fixture path resolves; the test-wait comment is present; the assert_eq! sides differ; saved_text and required_capabilities have no user-visible strings, no i18n, and no schema or command-surface change; the engine is not wasm-specific. The engine's Session::notify path is not touched by this change.

Twins

  • Checked the other project.openText checks in project_capabilities.rs (lines 331, 388, 706, 791, 1309, 1332). Only the four changed checks and the one-row check use the inline parse; text_keeps_class_order and the others do not call from_json in non-test code. No project.importText or project.openData command exists in the engine.

Earlier concerns

  • I left 1 earlier concern alone because it is already raised and unanswered: the durable::restore question on project_capabilities.rs:724 (github-actions, CONTRIBUTOR, unresolved). The code it points at has not changed, and the author has not replied.
  • I also left alone 2 earlier threads that the author fixed in 69a7597: the unwrap_err assertion and the missing MAX_LAYOUTS check in the reload test.

Change size

Compared: the whole PR against main (merge base 809e96f to PR head 69a7597).

Measure Value
Files changed 1 (added 0, modified 1, removed 0, renamed 0)
Size before 286.4 KB
Size after 291.8 KB
Total size change +5.4 KB
Path Before After Change
crates/engine/src/project_capabilities.rs 286.4 KB 291.8 KB +5.4 KB

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3533/
Web app https://preview.rustgis.app/pr-3533/app/
Commit 69a7597

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 1, 2026 13:05
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Code review

I found no bugs, security issues or performance problems in this change. I posted no inline comments because I had nothing worth raising inline. I could not compile or run the tests here (no shell), so the verdict rests on reading the code.

What I checked

  • The four checks that used Project::from_json (generalised Shaded Relief, extent numbers, north arrow font, scale bar font) now go through inline_project_requires, which uses Project::from_peer_raw. No from_json call remains in the production code of project_capabilities.rs.
  • from_peer_raw (project.rs:2049) skips restore and normalisation but keeps the same parse, format and offline-identity checks, so the refusal set is the same. The Option handling keeps the old fallbacks: text_generalizes still falls through to holds_generalize, and the other three return false.
  • Twins: text_lays_a_legend_in_one_row, text_numbers_extents, text_gives_font (used for both fonts) and text_generalizes all share the new helper. text_keeps_class_order parses JSON directly and was not affected. The project.openText and script.run routes share the same checks.
  • The rustfmt width (140) holds for the changed lines.
  • The new tests use only existing helpers (wait_in_place_reads, unread_in_place, allow_named, saved_text, CommandCheck). #[test] code keeps the crate's unwrap convention, and the sleep carries // test-wait:.
  • The change is confined to the engine's check, so project.schema.json, the fixtures and command-surface.txt need no update.

Bugs: none confirmed.

  • Low confidence (about 20%): the PR says a raw read never requires less than loading would, which is only true if repair cannot add a capability-bearing value. repair and clamp() mostly lower or remove values. I did not verify Layout::clamp or Report::clamp, so I can't rule out a case where repair sets a value that adds a requirement.

Security: none.

Performance: none. The raw read parses the same text once, and skipping truncation only means a few more layouts are walked.

Quality: nothing that needs changing now. The doc comment at project_capabilities.rs:29-32 reflows awkwardly ("either way it is written"), but that wording predates this change.

AGENTS.md: no breaks found. Surfaces are unchanged (no command, parameter, schema or ribbon change), and the new tests follow the test-hygiene rules.

Prior reviews: three threads, all resolved. Two were fixed in 69a7597 (the test now asserts that loading keeps MAX_LAYOUTS layouts, and the unwrap_err panic is gone). The third, on restore, was answered by the author and I accepted the answer for the five capabilities, since they read layout kinds and renderers, not addresses. I left all three alone.

Change size

Compared with the base branch: the whole PR against main (merge base 809e96f to PR head 69a7597).

Measure Value
Files changed 1 (modified 1, added 0, removed 0, renamed 0)
Size before 286.4 KB
Size after 291.8 KB
Total size change +5.4 KB
Path Before After Change
crates/engine/src/project_capabilities.rs 286.4 KB 291.8 KB +5.4 KB

@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Dec 1, 2026
Merged via the queue into opengeos:main with commit def6c67 Dec 1, 2026
31 checks passed
@jgregoriorincon
jgregoriorincon deleted the fix/3530-inline-project-reads branch December 1, 2026 13:43
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]: Saving a step that opens an inline project reads the rasters it names

1 participant