Skip to content

fix(engine): a service read by address is re-added from Recent page by page - #3025

Merged
Mavrick-F merged 4 commits into
opengeos:mainfrom
ishiland:fix/recent-service-source
Nov 26, 2026
Merged

Mavrick-F merged 4 commits into
opengeos:mainfrom
ishiland:fix/recent-service-source

Conversation

@ishiland

@ishiland ishiland commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A layer added with layer.addUrl or layer.addDownload and "service": true is read page by page, but Recent kept only its address, name and layer. Adding it again from the Data Sources pane ran ui.addUrl without the flag, so the read stopped at the server's first page with no notice. A WCS coverage added with "coverage": true had the same gap: Recent dropped the flag and its coverageCrs, so a re-add read the GetCoverage address as an ordinary address, not as a coverage in the system it was asked in.

This keeps "service": "true", or "coverage": "true" with its coverageCrs, in the source's extra when the add had them (sources::added_by). sourcespane::open passes them back to ui.addUrl, which forwards all three to layer.addDownload, and sources.list gives addWith as layer.addUrl {url, service: true} or layer.addUrl {url, coverage: true, coverageCrs}. Source::flag reads a kept flag, so its spelling lives in one place, and the sources.save description lists the three keys. extra stays a small object of strings, as sources::clean keeps it. An older RustGIS keeps the keys when it reads and saves these sources, and adds such a source as a plain address, as it does today. A plain URL add keeps only its layer, as before.

Add From Service feature layers (serviceui.rs), the FEMA NFHL Features button in Web Data (webdataui.rs) and Open Data feature results (opendataui.rs) all go through ui.addUrl with "service": true, which passes the flag on to layer.addDownload, so this covers all three. It's the follow-up #2547 mentioned. The app's coverage add (From Service, WCS) goes through ui.addUrl with "coverage": true and coverageCrs too.

Surfaces: the Data Sources pane on the desktop and in the web app, which share sourcespane::open and the ui.addUrl paged read (built for wasm, not run in a browser); the command line, Python, the Assistant and MCP through sources.list's addWith, where Recent lasts for the session. The phone interface has no Data Sources pane. No command or parameter was added, so the ribbon, shortcuts and command search are unchanged. A re-added layer is undone or removed like any other.

Not covered, as before: Recent doesn't keep the layer's bounds, so a re-add skips the axis check against them (#1053). It doesn't keep the connection an add named either; a re-add finds the login by the address's origin (a session login, the one selected for that origin, or the only saved connection for it), so a source whose origin has several saved connections and none selected may be read without a login. Entries recorded before this change have no flag until the source is added again.

Testing

  • sourcespane::tests::a_service_read_by_address_is_read_in_pages_again_from_recent (ui-egui): adds a two-page OGC API items address as a service, then adds it again from Recent and checks the second layer has both pages. With the open change removed it fails (left: 1, right: 2, no second layer from a paged read); with the added_by change removed it fails the same way.
  • sourcespane::tests::a_coverage_is_added_again_from_recent_in_the_system_it_was_asked_in (ui-egui): records a coverage download through added_by and clean, opens it from Recent and checks the download it starts has coverage: true and coverageCrs: "EPSG:2056". It fails with either half of the coverage change removed (left: None: the address is probed as a plain one and no coverage download starts).
  • a_service_query_added_by_address_is_read_in_pages_without_the_app and a_coverage_answer_without_its_system_is_read_in_the_one_asked_for (engine) now also check the Recent entry's extra and addWith; each fails without its added_by change. The coverage test also saves a source with only coverageCrs and checks its addWith is layer.addUrl {url}; it fails without the coverage gate in add_with. sources::tests checks added_by keeps the flags through clean, keeps nothing for "service": false and no coverageCrs without coverage.
  • fmt and cargo clippy -p rustgis-engine -p rustgis-ui-egui --all-targets -- -D warnings pass. cargo test -p rustgis-engine -p rustgis-ui-egui --lib passes except tests::layout_title::a_wrapped_map_title_is_sized_for_its_drawn_lines, which fails the same way on main (db58210) on this machine (macOS). The first commit also ran cargo test --workspace --no-fail-fast with the same single failure.
  • cargo xtask layers, cargo xtask test-hygiene, cargo xtask commands (no change to command-surface.txt).
  • RUSTFLAGS='-D warnings' cargo build --locked --target wasm32-unknown-unknown -p rustgis-web.

UI evidence

No visible UI change.

Related issue

Closes #2553

Summary by CodeRabbit

  • Bug Fixes

    • Recent URL sources now retain enabled service or coverage settings when reopened, along with the coverage coordinate reference system when coverage is enabled.
    • Saved URL sources preserve their enabled options and coverage coordinate reference system in the command used to add them.
    • A coordinate reference system by itself no longer causes a URL source to be treated as a coverage source.
  • Documentation

    • Clarified the URL-source options available when saving a source.

…y page (opengeos#2553)

A layer added with layer.addUrl or layer.addDownload and "service": true is
read page by page, but Recent kept only its address, name and layer. Adding it
again from the Data Sources pane ran ui.addUrl without the flag, so the read
stopped at the server's first page.

Recent now keeps "service": "true" in the source's extra for such an add,
sources.list says to add it with layer.addUrl {url, service: true}, and the
pane passes the flag back. Add From Service feature layers, Web Data's FEMA
NFHL Features button and Open Data feature results all add this way.
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

URL sources now retain service and coverage options in Recent entries and add commands. Reopening a Recent URL source passes its saved flags and coverageCrs to ui.addUrl.

Changes: URL source Recent flow

Layer / File(s) Summary
Save and report URL metadata
crates/engine/src/sources.rs, crates/engine/src/cmd/sources.rs, crates/engine/src/tests.rs, crates/engine/src/tests/services_own.rs
added_by records enabled URL flags and records coverageCrs when coverage is enabled. shown includes saved flags and coverageCrs in the add command. Tests cover service metadata and coverage CRS retention.
Reopen Recent URL sources
crates/ui-egui/src/sourcespane.rs
open passes saved URL flags and coverageCrs to ui.addUrl. Tests cover reopening a paginated service and restoring WCS coverage options.

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

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: giswqs

Merge Risk: Minimal · up to da4b5

This change keeps the service and coverage options when a URL source is re-added from Recent, so paginated service layers and WCS coverages are restored correctly. No merge-blocking risk was identified. Older Recent entries do not gain the flags until they are added again.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a service read by address is re-added from Recent page by page. The changeset stores the service flag in extra, restores it through sourcespane::open, and reflects it …
Description check Passed The description follows the template. It has Summary, Testing, and Related issue sections, and it states No visible UI change under UI evidence, which the template allows when no visible UI change exi…
Linked Issues check Passed [#2553] requires that a service added by address with "service": true keeps the flag in Recent, that re-adding reads all pages, and that sources.list reports the flag in addWith. The engine diff in cr…
Out of Scope Changes check Passed The engine changes in crates/engine/src/sources.rs (URL_FLAGS, Source::flag, added_by) keep and report source flags in Recent. This is the mechanism #2553 proposes. The coverage and coverageCrs handli…
Full details: Title check

Explanation

The title names the main change: a service read by address is re-added from Recent page by page. The changeset stores the service flag in extra, restores it through sourcespane::open, and reflects it in addWith, which matches the title. Coverage handling is not in the title, but that is expected for a focused title.

Full details: Description check

Explanation

The description follows the template. It has Summary, Testing, and Related issue sections, and it states No visible UI change under UI evidence, which the template allows when no visible UI change exists. The Summary explains the change and its scope, the Testing section lists named tests and checks with results, and Closes #2553 links the issue.

Full details: Linked Issues check

Explanation

[#2553] requires that a service added by address with "service": true keeps the flag in Recent, that re-adding reads all pages, and that sources.list reports the flag in addWith. The engine diff in crates/engine/src/sources.rs was read at this head. added_by for layer.addUrl and layer.addDownload stores extra {"service": "true"} when the flag is true, and stores nothing for "service": false. clean keeps the flag, and the new Source::flag reads it. The new assertions in sources::tests cover these cases. The summary states that add_with in crates/engine/src/cmd/sources.rs reports layer.addUrl {url, service: true}; that file was not read directly. The crates/ui-egui/src/sourcespane.rs diff could not be read: the checkout reports its changed blobs as missing. Its forwarding of URL_FLAGS entries to ui.addUrl therefore rests on the supplied summary and the author's report that the paged re-add test fails when the open change is removed. Add From Service, Web Data and Open Data all call ui.addUrl with service: true, so the same path covers them. The coverage handling extends the same mechanism and does not contradict #2553.

Full details: Out of Scope Changes check

Explanation

The engine changes in crates/engine/src/sources.rs (URL_FLAGS, Source::flag, added_by) keep and report source flags in Recent. This is the mechanism #2553 proposes. The coverage and coverageCrs handling applies the same mechanism to the same gap: a re-add from Recent loses a flag that changes how the address is read. The issue does not name coverage, but the change is related and not shown to be unrelated. Test changes in sources.rs, tests.rs and services_own.rs check the behavior they cover. No new command or parameter is added. The PR states that bounds and connection are not kept (#1053); this is a documented exclusion, not a change. The crates/ui-egui/src/sourcespane.rs diff could not be read directly, so its scope rests on the supplied summary. No demonstrated unrelated change was found.

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 saves the service flag with care,
And keeps the coverage CRS there.
Recent opens pass the options through,
So pages load and coverage too.
The rabbit hops, its work now done,
With source details saved for everyone.

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: 5b056482-f4b4-4041-b870-62db3c93c3c6
Commits

Reviewing files that changed from the base of the PR and between aaad31c and da4b5c8.

Files selected for processing: 1

  • crates/ui-egui/src/sourcespane.rs

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

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

Copy link
Copy Markdown
Contributor

Code review

Reviewed the four changed files against pr-context/AGENTS.md, the surrounding code (sources.rs, cmd/sources.rs, policy/dispatch.rs, lib.rs, serviceui.rs, layer.rs, ui-egui/src/lib.rs), and the test helpers the new UI test uses. I could not build or run the tests (no shell in this review), so everything below is from reading the code.

Finding placement: 2 inline comments are buffered for posting (one bug, one nit group).

Bugs

  • Coverage adds lose their flag and CRS on re-add from Recent (medium confidence). added_by keeps only service for layer.addUrl and layer.addDownload. The app's coverage add (ui-egui/src/lib.rs ~6966, coverage: true with coverageCrs) and service.coverage are recorded as plain URLs, so re-adding them drops coverage and coverageCrs. That can read the coverage with a CRS assumed silently. This is the same family as the service fix and was not covered. Inline comment on crates/engine/src/sources.rs:929.

Security

  • None found. The new extra value is a fixed string, and clean still filters extra the same way.

Performance

  • None found. The change adds one flag check per add.

Quality

  • Duplicated "true" literal and an undocumented param key (nit, grouped). The flag's spelling appears in sources.rs, cmd/sources.rs:44 and sourcespane.rs:151. The sources.save params text (cmd/sources.rs:15) does not mention service in extra. Inline comment on crates/engine/src/cmd/sources.rs:44.
  • Left for the release quality pass if you prefer: no other changes.

AGENTS.md

  • None found. No new command or parameter, so command-surface.txt is unchanged. The new test follows the existing fetching::turn() pattern. The PR body covers the surfaces (desktop, web, CLI, Python, Assistant/MCP, undo).

Twins checked

  • Read routes: layer.addUrl and layer.addDownload are both handled. layer.addData, service.add, layer.addDatabase and the other added_by kinds do not take a service flag, so they need no change.
  • ui.addUrl paths: the desktop Data Sources pane, Add From Service, FEMA NFHL and Open Data all pass through ui.addUrl, and sourcespane::open is the only re-add path. The coverage case above is the one gap.
  • Not in the PR, pre-existing, noted only: a service that was added with a connection (serviceui.rs ~206) is recorded without it, so a re-add from Recent may not authenticate. Recent also drops bounds, as the PR body says.

Change size

Compared with main (merge base db58210 to PR head a697a32). Files changed: 4 (0 added, 4 modified, 0 removed, 0 renamed).

Measure Value
Size before 3.69 MB
Size after 3.69 MB
Total size change +3.5 KB
Path Before After Change
crates/ui-egui/src/sourcespane.rs 22.6 KB 24.8 KB +2.1 KB
crates/engine/src/sources.rs 87.3 KB 88.2 KB +922 B
crates/engine/src/tests.rs 3.58 MB 3.58 MB +340 B
crates/engine/src/cmd/sources.rs 4.4 KB 4.6 KB +161 B

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

📖 Docs preview

Commit da4b5c8 from a fork built, but isn't published until a maintainer adds the preview label (once per commit).

…was asked in (opengeos#2553)

A coverage added with layer.addUrl or layer.addDownload and "coverage": true
was kept in Recent as a plain address, without the flag or its coverageCrs.
Adding it again from the Data Sources pane read the GetCoverage address as an
ordinary download, not in the system it was asked in.

Recent now keeps "coverage" and, with it, "coverageCrs" in the source's extra,
as it keeps "service"; sources.list names them in addWith, and the pane passes
them back to ui.addUrl, which forwards both to layer.addDownload. Source::flag
reads a kept flag, so its spelling lives in one place, and the sources.save
description lists the three keys.
Comment thread crates/engine/src/cmd/sources.rs Resolved
impl Source {
/// Whether the add this source records had `flag` (one of [`URL_FLAGS`]).
pub fn flag(&self, flag: &str) -> bool {
self.extra.get(flag).and_then(Value::as_str) == Some(FLAG_ON)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

flag reads only the string "true", which is the form sources.save documents. clean() drops any non-string extra value without a notice, so a caller that writes JSON "extra": {"service": true} is saved as a plain address and its re-add reads only the first page, with no message. The documented form works, so this is quality rather than a bug. If JSON booleans should be accepted too, the fix is small: read the flag with bool_value here and have clean() keep a boolean URL_FLAGS key as "true". I didn't check whether sources.save notifies about dropped keys.

Category: quality

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll leave this as is. extra is documented and cleaned as a map of strings, and accepting booleans would widen what sources.save takes, which is outside #2553.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

Scope: PR #3025, "a service read by address is re-added from Recent page by page". It keeps the service and coverage/coverageCrs flags in a source's extra and replays them when the source is re-added from Recent. I read the full diff, the prior threads, and the surrounding code: sources::added_by, Session::invoke, policy/dispatch.rs, sourcespane::open, ui.addUrl's forwarding in ui-egui/src/lib.rs, and layer.addDownload's use of the flags.

Bugs

  • None found. Confidence that the core change is correct: high. The recorded extra matches what layer.addDownload reads (both use bool_value, and coverage_system runs only when coverage is set). ui.addUrl forwards all three keys. layer.addUrl and layer.addDownload share one arm in added_by, so both twins are covered. service.coverage runs layer.addDownload through invoke, so its Recent entry now carries the coverage flag too.

Security

  • None found. No new parsing of untrusted input beyond the existing clean() bounds. No unwraps or panics in non-test code.

Performance

  • None found.

Quality

  • cmd/sources.rs:47: add_with shows coverageCrs without requiring coverage, so a source saved with only coverageCrs gets a misleading addWith hint. Nothing is read wrongly. Inline suggestion posted. Confidence: medium.
  • sources.rs:520: flag reads only the string "true", and clean() silently drops a JSON true in extra. The documented form works. Inline comment posted. Confidence: low-medium; I did not check whether sources.save notifies about dropped keys.

AGENTS.md

  • None found. The new tests cover both ways, and the command-surface.txt snapshot is unaffected (the change is inside the help text and nested extra keys). No schema change: extra was already a free-form value.

Prior threads

  • Two earlier concerns were already raised: the coverage gap (now fixed in 979708c, which the author answered) and the "true" literal and sources.save description nit (also answered and fixed). I did not re-raise either. Two earlier concerns left alone, both already answered.

Change size

Compared with main (merge base db58210 to PR head 979708c), the whole PR.

Measure Value
Files changed 5 (0 added, 5 modified, 0 removed, 0 renamed)
Size before 3.71 MB
Size after 3.71 MB
Total size change +7.0 KB
Path Before After Change
crates/ui-egui/src/sourcespane.rs 22.6 KB 25.9 KB +3.3 KB
crates/engine/src/sources.rs 87.3 KB 89.6 KB +2.3 KB
crates/engine/src/cmd/sources.rs 4.4 KB 5.2 KB +0.7 KB
crates/engine/src/tests/services_own.rs 18.0 KB 18.6 KB +0.4 KB
crates/engine/src/tests.rs 3.58 MB 3.58 MB +0.3 KB

…engeos#2553)

A url source saved with sources.save and only "coverageCrs" in its extra got
the hint layer.addUrl {url, coverageCrs}, though layer.addUrl reads a
coverageCrs only with "coverage": true. The hint now names it only beside the
coverage flag, as added_by keeps it.
Comment thread crates/ui-egui/src/sourcespane.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

Bugs

  • None found. The Recent round-trip is consistent across added_by (records), Source::flag (reads), sourcespane::open (re-adds), add_with (shows the hint), and ui.addUrl/add_url (forwards service, coverage and coverageCrs). Confidence: medium-high. I did not run the tests, since I have no shell here.

Security

  • None found. clean() still bounds extra (8 keys, 512 chars, no secret-looking names), and the new keys are plain flags.

Performance

  • None found. The change adds a few bytes to each Recent entry and no per-layer data copies.

Quality

  • sourcespane.rs:156 (inline, posted): open passes coverageCrs without the coverage gate that added_by and add_with use. Harmless today, since the engine ignores it without coverage. Confidence: high.
  • Nit, not posted: add_with (cmd/sources.rs:47) checks coverageCrs with .is_some(), while open uses text(), which drops empty strings. A sources.save with "coverageCrs": "" would show a hint that open never sends. Minor. Confidence: high.

AGENTS.md

  • None found. sources.save's param text now lists the keys, as the Assistant and MCP need. The command surface is unchanged (help text only). The new tests use fixed expected values, and the UI-side test calls poll_pages a fixed number of times rather than waiting on a timer.

Checked, no finding

  • Twins: the diff changes only the layer.addUrl/layer.addDownload arm of added_by, so the file, database and service.add arms are unaffected. service.coverage (cmd/service.rs:1607) calls layer::add_url directly, not through Session::run, so it never reaches note_source and has no Recent entry. That is pre-existing and not a regression. Its whole: true is also not kept, but the app's own coverage add (lib.rs:6966) has no whole either, so re-adds match the original add there.
  • Wasm: URL_FLAGS, Source::flag, bool_value and added_by are not cfg-gated and are used from sourcespane.rs, which the web build also compiles. The new tests are cfg(test) only.
  • Prior threads: 4 earlier threads exist. I did not re-post the JSON-boolean concern (quality, answered by the author). The coverage-gap bug and the duplicated "true" literal were fixed in 979708c5. The addWith coverageCrs gate was fixed in aaad31c. Those 3 are resolved and I left them alone. The count of earlier concerns left alone: 4.

Change size

Compared with main (merge base db58210 to PR head aaad31c). Whole PR, not the latest push.

Measure Value
Files changed 5 (0 added, 5 modified, 0 removed, 0 renamed)
Size before 3.7 MB
Size after 3.7 MB
Total size change +7.3 KB
Path Before After Change
crates/ui-egui/src/sourcespane.rs 22.6 KB 25.9 KB +3.3 KB
crates/engine/src/sources.rs 87.3 KB 89.6 KB +2.3 KB
crates/engine/src/cmd/sources.rs 4.4 KB 5.2 KB +771 B
crates/engine/src/tests/services_own.rs 18.0 KB 18.6 KB +627 B
crates/engine/src/tests.rs 3.6 MB 3.6 MB +340 B

…engeos#2553)

sourcespane::open passed a source's coverageCrs to ui.addUrl even without
"coverage", unlike added_by and add_with. It now passes it only beside the
flag. No behaviour changes: add_url ignores coverageCrs without coverage, so
there is no new test.
@github-actions

Copy link
Copy Markdown
Contributor

Code review

I found no bugs, security problems, or performance issues in this PR. I posted no inline comments: the two quality points below are minor, so they're grouped here.

I checked the new flag path end to end: added_by records service/coverage/coverageCrs from layer.addUrl and layer.addDownload, clean() keeps them, Source::flag reads them, and sourcespane::open passes them to ui.addUrl. ui.addUrl forwards them to layer.addDownload, and layer.addDownload reads them with super::b, the same parser added_by uses through bool_value. The addWith hint and the new tests match the code. The sourcespane change is pure and only the test module uses the desktop-only fetcher, so the wasm build is unaffected.

Bugs: none found. Confidence: high.

Security: none found. The flags are fixed strings, and clean() still applies its key and value limits and the secret-key filter.

Performance: none found. add_with runs per listed source and does a few map lookups.

Quality:

  • cmd/sources.rs:35: the addWith hint writes coverageCrs as a bare key, with no EPSG:<code> form, while sources.save documents it that way. A small wording fix would help the Assistant and MCP. Confidence: medium.
  • Twin not covered by the PR: cmd/service.rs:1611 calls layer::add_url directly, not through Session::run. added_by has no service.coverage branch, so a coverage added with that command never reaches Recent and has no flag to keep. This predates the PR and is outside its diff. I'm noting it, not blocking on it. Confidence: medium.

AGENTS.md: no breaks found. Twins checked:

  • layer.addUrl and layer.addDownload are both handled in added_by.
  • service.add and service.import don't take these flags and are unchanged.
  • layer.addData is a file route with no URL flags.
  • ui.addUrl forwards all three keys, and the app's coverage and service callers (serviceui, webdataui, opendataui) use the same path.
  • The cfg(target_arch = "wasm32") branches are not changed.

Earlier review threads on this PR: five. I left all five alone. The JSON-boolean suggestion was declined by the author, and the other four were fixed and resolved.

Change size

Compared with the base branch (merge base db58210 to PR head da4b5c8).

Measure Value
Files changed 5 (0 added, 5 modified, 0 removed, 0 renamed)
Size before 3.7 MB
Size after 3.7 MB
Total size change +7.3 KB
Path Before After Change
crates/ui-egui/src/sourcespane.rs 22.6 KB 26.0 KB +3.4 KB
crates/engine/src/sources.rs 87.3 KB 89.6 KB +2.3 KB
crates/engine/src/cmd/sources.rs 4.4 KB 5.2 KB +771 B
crates/engine/src/tests/services_own.rs 18.0 KB 18.6 KB +627 B
crates/engine/src/tests.rs 3.58 MB 3.58 MB +340 B

@Mavrick-F
Mavrick-F added this pull request to the merge queue Nov 26, 2026
Merged via the queue into opengeos:main with commit 1e3f319 Nov 26, 2026
30 checks passed
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.

A service's features added by address are re-added from Recent as one page

2 participants