Skip to content

feat(ui): name tree-added datasets in Recent after their connection - #724

Merged
giswqs merged 1 commit into
opengeos:mainfrom
deniial00:connections-recent-naming
Oct 23, 2026
Merged

giswqs merged 1 commit into
opengeos:mainfrom
deniial00:connections-recent-naming

Conversation

@deniial00

@deniial00 deniial00 commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Recent naming from #699 (comment) (part of #699; this PR does not close it).

A dataset added from the Connections tree is now noted in Recent under the originating connection's name instead of a name derived from the address.

What changes

  • Only the Recent entry's name changes. The entry keeps the kind, address and extra the add produced (already cleaned/redacted by sources::clean), and the layer keeps its own name. Nothing is replaced with the connection endpoint.
  • Identity is unchanged: kind + address. Two connections with one address share an entry, and every dataset of one service shares one entry.
  • The name is a snapshot: renaming a connection changes it only when something is added from it again.
  • Covered paths: double-click add, right-click Add, Add Selected (each pick named for its own connection), and delayed completions that keep the originating connection through selection or rename: OGC API tilesets, WCS coverages (description, then GetCoverage download), feature/file downloads and COG probes, and STAC assets waiting on a signing token.
  • Failed, dropped or cancelled adds record nothing and rename nothing. Undo is unchanged: each add is still one command.
  • Delayed adds carry the name in tree-owned pending records (ServiceStep, ui.addUrl's probe/download records, the STAC token queue) and apply it only after the add succeeds. The _origin key is internal: it is rebuilt from a fixed key list, so a caller can't forge it, and it never reaches a command.
3-recent-named

Verification (exercised)

  • cargo xtask ci (fmt, clippy -D warnings, workspace tests, layers): exit 0, on the base this PR is rebased onto.
  • cargo build --target wasm32-unknown-unknown -p rustgis-web with a wasm-capable clang (Homebrew LLVM): exit 0.
  • New tests in connectiontree.rs: shared-entry dedup and re-add taking the current name; redaction unchanged; failed add leaves Recent untouched; Add Selected naming per connection; delayed local download (success named, 404 not recorded, even after a rename); OGC API tileset step (refused template adds nothing); a WCS coverage through a local server; and the whole path through the pane (open connection, double-click, Recent, click the Recent entry).

Limitations and overlaps

  • Reopen is not layer-exact for services. sourcespane::open (not in this PR's scope) reopens a service Recent entry from its address and type only and ignores extra.layer, so clicking it opens the service's layer list rather than selecting the stored layer. The entry does keep its kind, address and extra; data.md states this honestly. Fixing it needs a change in sourcespane.rs.
  • Add With Options… only opens the kind's dialog and records nothing. Naming those adds would need the dialog code, which this PR leaves alone.
  • tests/smoke.rs (one line, outside the listed paths, edit approved by the maintainer): connections_tree_browses_and_adds matched two "Local" nodes once Recent shows that name; it now picks the connection's own row (last match; Recent renders above Connections).

Summary by CodeRabbit

  • New Features
    • Datasets added from a connection now appear in Recent under that connection’s name. The name reflects the connection at the time of the latest successful addition; renaming a connection updates the Recent entry after another dataset is added.
    • Failed or cancelled additions do not appear in Recent. Entries for datasets with the same kind and address are shared.
  • Documentation
    • Updated the user guide to explain how connection names appear in Recent and when they change.

A dataset added from the Connections tree is noted in Recent under the
connection's name, keeping the source's kind, address and extra. Direct,
selected and delayed (service tilesets, WCS, downloads, STAC signing)
adds are covered; failed or dropped adds are not renamed.
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ 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: c1d04d47-7711-4265-b07f-67f6248f8f43
📥 Commits

Reviewing files that changed from the base of the PR and between 6f89228 and 6783571.

📒 Files selected for processing: 5
  • crates/ui-egui/src/connectiontree.rs
  • crates/ui-egui/src/lib.rs
  • crates/ui-egui/src/serviceui.rs
  • crates/ui-egui/tests/smoke.rs
  • docs/user-guide/data.md

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

📝 Walkthrough

Connection-originated additions now carry the connection name into Recent, including additions completed after URL probes, downloads, token signing, tile resolution, or coverage retrieval. Recent records the name on successful additions. Tests and documentation cover naming, renames, and unsuccessful or incomplete additions.

Changes: Connection-aware Recent entries

Layer / File(s) Summary
Origin-aware additions
crates/ui-egui/src/connectiontree.rs, crates/ui-egui/src/serviceui.rs, crates/ui-egui/tests/smoke.rs, docs/user-guide/data.md
Addition helpers accept a connection origin, and immediate connection-tree and service-layer paths pass it through. Tests cover Recent naming, retained source details, rename behavior, and reopening a service from Recent. The documentation describes entry sharing and when names are updated.
Deferred addition origin handling
crates/ui-egui/src/lib.rs, crates/ui-egui/src/serviceui.rs, crates/ui-egui/src/connectiontree.rs
URL, token-signing, tile, and coverage operations retain the connection origin through deferred work. Completion paths use it to name successful additions. Tests cover pending operations and successful or failed completion.

Priority: ⬇️ Low

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant ConnectionTree
  participant ServiceUI
  participant ServiceStep
  participant Recent
  ConnectionTree->>ServiceUI: Pass connection origin
  ServiceUI->>ServiceStep: Retain origin for deferred work
  ServiceStep->>ConnectionTree: Add resolved layer with origin
  ConnectionTree->>Recent: Record name after successful addition
Loading

Possibly related issues

  • Issue opengeos/RustGIS 699 concerns browsing and adding datasets from the Connections tree. This change updates how additions from that tree are recorded in Recent, but does not implement the proposed connection model.

Suggested reviewers: giswqs, jgregoriorincon

Merge Risk: ⚪ Minimal · up to 67835

Connection-added datasets can be named in Recent without the identified risk of renaming an unrelated entry. No merge-blocking issue was established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 79.31% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 29 functions across 4 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title "feat(ui): name tree-added datasets in Recent after their connection" matches the main change in the changeset. The diff routes Connections-tree additions (double-click, right-click Add, Add…
Description check Passed The description follows the repository template in substance. The Summary section explains what changes, why it changes (linked issue comment and #699), and the behavior details, including identity, s…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(ui): name tree-added datasets in Recent after their connection" matches the main change in the changeset. The diff routes Connections-tree additions (double-click, right-click Add, Add Selected, and delayed OGC tile, WCS coverage, feature download, COG probe, and STAC token paths) through a connection-aware add path. That path records the originating connection name in Recent only after a successful add. The title is specific, one sentence, and free of file lists or vague terms.

Full details: Description check

Explanation

The description follows the repository template in substance. The Summary section explains what changes, why it changes (linked issue comment and #699), and the behavior details, including identity, snapshots, failure handling, and scope limits. The Testing section lists exercised commands (cargo xtask ci, wasm32 build), the new tests, and a screenshot. The Related issue section is present and states that the PR is part of #699 and does not close it. The description also documents known limitations and an approved edit to tests/smoke.rs.

Full details: Docstring Coverage

Explanation

Docstring coverage is 79.31% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 29 functions across 4 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ 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 adds a layer to the tree,
Its connection name stays where it should be.
A download waits, then joins the flow,
While failed attempts leave Recent clear below.
Rename the source; old entries keep their name,
Add once more, and Recent records the change.

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I read the diff and the surrounding call sites. I found no blocking problems. I could not run the tests or CI here, so none of this was run.

Bugs

  • None found. The origin is handed to ui.addUrl out of band (run_add_url sets it, take_origin consumes it). Every early return in the ui.addUrl arm therefore clears it, and run_add_url also resets it after the call. The delayed paths (probe, download, STAC token, tileset step, WCS step) carry it explicitly and rename only after a successful add. The generation check in name_recent leaves Recent alone when nothing was noted. (confidence: medium-high)
  • Low risk: name_recent renames recent.first() after the generation check. That is right as long as Sources::note always puts the newest entry first, and the tests assume this. (confidence: low)

Security

  • No issues. The renamed entry reuses the already cleaned and redacted source, and a test checks that secrets in the address stay redacted. (confidence: medium)
  • The internal _origin key travels in the pending params (the probe and download queues). It is stripped before any command or recording sees the params. A caller that passes its own _origin to ui.addUrl in the download path could affect only the Recent entry's display name. (confidence: low)

Performance

  • None.

Quality

  • In the probe branch of ui.addUrl in crates/ui-egui/src/lib.rs, o.remove(ORIGIN) is followed by a conditional insert. The remove does clear a caller-supplied _origin when origin is None, so it is not dead code, but it could use a short comment. (confidence: low, nit)
  • The ORIGIN key is a string smuggled inside a JSON parameter object. A typed field on the probe/download queue tuples would be sturdier, but that is a larger change. (confidence: low)
  • The new tests bind real loopback sockets and poll with sleeps, with a 10 s deadline. This is acceptable, but could be slow or flaky on busy CI runners. (confidence: low)

AGENTS.md

  • No unwrap, expect or panic! in non-test code; the new tests carry #[allow(clippy::unwrap_used, clippy::expect_used)]. (confidence: high)
  • No new user-visible strings, so there is no tl! or i18n impact. (confidence: high)
  • No new dependencies, assets or wasm-breaking APIs. The tests use std::time and std::net, but they are test-only and native. (confidence: medium)
  • Docs were updated in docs/user-guide/data.md. (confidence: high)

Change size

Compared: the whole PR against main (merge base 6f89228 to PR head 6783571)

Metric Value
Files changed 5 (added 0, modified 5, removed 0, renamed 0)
Size before 397.0 KB
Size after 419.5 KB
Total size change +22.5 KB
File Before After Change
crates/ui-egui/src/connectiontree.rs 20.3 KB 39.9 KB +19.6 KB
crates/ui-egui/src/lib.rs 179.4 KB 180.8 KB +1.4 KB
docs/user-guide/data.md 53.2 KB 53.9 KB +0.7 KB
crates/ui-egui/src/serviceui.rs 9.7 KB 10.3 KB +0.6 KB
crates/ui-egui/tests/smoke.rs 134.4 KB 134.6 KB +0.1 KB

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

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

@deniial00
deniial00 marked this pull request as ready for review October 23, 2026 11:24
Comment thread crates/ui-egui/src/lib.rs
if let Some(origin) = &origin {
o.insert(connectiontree::ORIGIN.into(), json!(origin));
}
}

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.

Nit (low confidence, readability): ORIGIN is removed and then re-inserted. This is needed only because a caller could pass a stray _origin key in p. A short comment saying so, or a single match/insert or remove, would make that intent clearer. The same q[ORIGIN] = … pattern below doesn't strip a pre-existing key first, so the two paths are inconsistent. A user-supplied _origin in ui.addUrl params would also be taken by take_origin_key and used as the Recent name. That is harmless, but the key is effectively part of the command's parameter surface.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

The PR names a dataset added from a Connections-tree connection in Recent after that connection, and leaves the entry's kind, address and options as they were. I found no correctness or security bugs. I read the diff only and did not build or run the tests.

Bugs

  • None found.
  • The out-of-band origin hand-off in run_add_url/take_origin is set and cleared around app.run. The ui.addUrl handler takes it first, so an early return (the dialog case) can't leave it set for a later command. (Confidence: medium-high)
  • name_recent is guarded by a sources.generation comparison. A failed or deferred add is therefore not renamed, and deferred adds (probe, download, tileset or coverage step, STAC token) carry the name along. (Confidence: medium)
  • One assumption is not checked: name_recent takes recent.first() as the entry the session just noted. That holds only while Sources::note puts the newest entry first and bumps generation only for Recent. I did not read Sources to confirm. (Confidence: low)

Security

  • None found. The name goes through the same note path, so the cleaned and redacted address is unchanged. The test with token=SECRET covers this. (Confidence: medium)
  • _origin is stripped from the parameters before layer.addUrl or layer.addDownload run, so it doesn't reach recordings or the log. (Confidence: medium)

Performance

  • None. The only extra work is a clone of one Source per add.

Quality

  • crates/ui-egui/src/lib.rs:2047 (nit, low confidence): the probe path removes and re-inserts _origin, while the download path only inserts it. The two are inconsistent. A stray user-supplied _origin would also be read as a connection name. Details are in the inline comment.
  • The Signing struct replacing the 4-tuple is a clear improvement. (Confidence: n/a)
  • The new tests use real local sockets, polling and sleeps. Locating widgets by label (get_by_label("A")) and counting frames to let a double-click age out is fragile, and could be flaky if the egui timing changes. The until helper has a 10 s deadline, which bounds a hang. (Confidence: low-medium)

AGENTS.md

  • No unwrap, expect or panic in non-test code. The test module carries #[allow(clippy::unwrap_used, clippy::expect_used)].
  • The new connectiontree.rs functions and the ServiceStep variants are in ui-egui, so layering is fine, and no new dependency is added.
  • No new user-visible strings. The tl! text is unchanged, so no catalog update is needed.
  • Docs are updated in docs/user-guide/data.md.
  • The ui.addUrl handler adds a regression-style test for failed and delayed adds. hostile_params_never_panic is not obviously affected. (Confidence: medium)

Change size

Compared: the whole PR against main (merge base 6f89228 to PR head 6783571).

Metric Value
Files changed 5 (0 added, 5 modified, 0 removed, 0 renamed)
Size before 397.0 KB
Size after 419.5 KB
Total size change +22.5 KB
File Before After Change
crates/ui-egui/src/connectiontree.rs 20.3 KB 39.9 KB +19.6 KB
crates/ui-egui/src/lib.rs 179.4 KB 180.8 KB +1.4 KB
docs/user-guide/data.md 53.2 KB 53.9 KB +731 B
crates/ui-egui/src/serviceui.rs 9.7 KB 10.3 KB +650 B
crates/ui-egui/tests/smoke.rs 134.4 KB 134.5 KB +113 B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants