Repository navigation
fix(labels): keep full feature ids in web label locks - #1302
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Full-width label keys crates/map/src/symbology.rs, crates/render/src/lib.rs |
LabelKey and rendering lookup keys use u64 feature IDs. The render test checks distinct IDs across locking and unlocking. |
Prune removed feature IDs crates/engine/src/lib.rs, crates/engine/src/tests.rs |
Lock pruning stores and compares feature IDs as u64. The engine test exercises full-width IDs through lock placement, pruning, and undo. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Suggested reviewers: jgregoriorincon
Merge Risk: 
Minimal · up to 02119
-
No actionable merge-blocking issue is identified. The changes address full-width label identity consistently; automated wasm32 regression coverage remains a documented follow-up.
Pre-merge checks: 
5
-
Full details: Description check
-
Explanation
The description includes all required sections: Summary, Testing, UI evidence, and Related issue. It explains the bug, implementation, compatibility impact, validation steps, and provides before-and-after UI evidence.
Full details: Linked Issues check
-
Explanation
Issue
#1135requires removed-feature lock entries to be pruned and feature IDs in LabelKey to remain full-width. The existing pruning path now stores and compares IDs as u64. LabelKey now uses u64, and renderer lock filtering, label placement, extrusion lookup, and synthetic keys use u64 without truncating feature IDs. Engine and renderer regressions cover deletion/reuse and IDs 1 and 4294967297.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 3 files. (1 skipped: 1 too large.)
-
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.
A rabbit checks each label key,
And keeps wide IDs as wide as can be.
Old locks lose IDs no longer in view,
While Alpha and Beta keep their names true.
The bunny hops off, pleased with the queue.
| /// A lock keeps source ids wider than a wasm32 pointer distinct, including when a label | ||
| /// that collided at lock time later has room to draw (#1135). | ||
| #[test] | ||
| fn locked_labels_keep_full_width_feature_ids() { |
There was a problem hiding this comment.
Coverage note (low severity, not a blocker): on the native test target usize is 64-bit, so this test, and the engine test changes, also pass on the pre-fix code. The truncation only happens on wasm32, and CI runs no tests there, only cargo build --target wasm32-unknown-unknown -p rustgis-web. So nothing in CI would catch this coming back. The Node probe in the PR description covers the wasm32 side once, but it isn't committed. Consider saying in the PR that these tests guard behaviour on native only, and that the wasm32 truncation check is manual.
There was a problem hiding this comment.
Clarified the PR description: these Rust tests run on native and also pass before the fix because usize is 64-bit there. The wasm32 truncation checks are manual: the source-extracted Node probe and the before/after browser run in an iframe. CI currently builds wasm32 without running these regressions there.
Code reviewI found no bugs, security issues, or performance problems in this change. I checked every use of Bugs: none found. Security: none. The lock is Performance: none. The change swaps integer widths and adds no work. Quality:
AGENTS.md: no violations found. The change is type-only, so the wasm build is unaffected. It adds no user-visible strings, no assets, and no new dependencies. The layering is unchanged. Already raised: 0 earlier concerns, since there are no prior review threads on this PR. Change sizeCompared: the whole PR against main (merge base 3360310 to PR head 02119b3).
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the |
Summary
On the web, label locks identify features through a
usize, so IDs1and4294967297become the same key. Locking while only Alpha fits, then zooming until Beta has room, incorrectly shows Beta although its label was never locked.Keep the feature ID as
u64throughout label placement, locked-class filtering, extrusion lookup and removed-feature lock pruning. The lock is runtime-only (serde(skip)), so the saved project format stays the same.The deletion/reused-ID case in this issue was fixed by #1271; this completes its remaining wasm32 truncation case.
Testing
cargo xtask ci: passes (formatting, workspace Clippy, tests, layers).cargo build --locked --target wasm32-unknown-unknown -p rustgis-web: passes.pre-commit run --all-files: passes.UI evidence
Real web app, two point features with IDs 1 and 4294967297. The existing hosted web app and this branch's local wasm build run inside the same iframe harness. Both lock at the same initial view, where only Alpha fits, then zoom in four steps. Before: Beta incorrectly appears. After: only Alpha remains labelled.
Before:
After:
Related issue
Closes #1135
Summary by CodeRabbit