[Bug]: A locked label can attach to a new feature that reuses a deleted feature's id
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start with Dataset::push in crates/data/src/lib.rs and trace how feature IDs are assigned, removed, and used in label lock entries. Compare the monotonic ID and lock pruning approaches described in the issue, and check how project serialization and undo preserve those values. Done when a newly added feature has no label while the lock is active, and LabelKey IDs remain distinct on wasm32.
Written by the indexing model from the issue text.
Description
Before you start
- I searched the existing issues and did not find a duplicate.
- This is a bug report, not a usage question (questions belong in Discussions).
What happened?
With labels locked, a feature added after deleting the feature with the highest id shows its label, although it wasn't placed when the lock was taken.
Dataset::push gives a new feature max(id) + 1 (crates/data/src/lib.rs:340). Since #1134 a lock names each label by its feature's id, so the new feature takes the deleted one's id, matches its lock entry and is drawn there without a collision check. This isn't a regression: with row keys the new feature took the same row, so it had the same key. #1134 fixes the cases where rows move and leaves this one. Found in review of #1134.
Related: LabelKey keeps the feature id as usize, so on wasm32 (the web app) two ids that differ by a multiple of 2^32 share a key. That truncation already applied to streamed layers before #1134.
Steps to reproduce
- Load this CSV as XY points and label them by
name. Gamma sits apart, so both labels show:name,x,y Alpha,0,0 Gamma,10,10 - In the Labeling tab, turn on Lock.
- Delete Gamma (the highest id).
- Add a new point anywhere with the edit tools and give it a name.
- The new point's label shows, at the lock's place for Gamma, although it wasn't placed when the lock was taken.
Expected behavior
While labels are locked, a feature added after locking has no label, as any other new feature does; unlocking and locking again places it.
Ways to get there:
- A monotonic next id in
Dataset, so a deleted feature's id is never handed out again. This touches serialization and every reader that numbers features. - Or prune the lock entries of removed ids on each path that removes features (delete, cut, merge, geoprocessing updates, reloads). Undo restores the lock with the project, so it stays correct.
For the wasm32 truncation, widen the id in LabelKey to u64.
How are you running RustGIS?
- Desktop app (downloaded release)
- Desktop app (built from source)
- Web app (https://web.rustgis.app)
- Command line (rustgis-cli)
Version
0d5a23a5 (#1134)
Operating system, browser and graphics
Any (found by reading the code in review)
- Dominant language
- Rust
- Stars
- 1.9k
- Forks
- 268
- Avg merge
- 3h 37m
- Merged PRs (30d)
- 797
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from opengeos/RustGIS
-
[Feature]: Interface themes as JSON files, with an interface scalePossibly taken @Wolren claimed this today. Open
Difficulty 5/5 Over a week Newbie friendliness 1/100
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
opengeos/RustGIS#1144 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
-
[Bug]: Clip and Select by Location compare every feature with every overlay polygon: minutes where an indexed tool takes secondsPossibly taken @Mavrick-F claimed this today. Openbug
opengeos/RustGIS#1142 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
opengeos/RustGIS#1111 · 8 comments ·
Maintainers usually reply within 1 day
All issues in opengeos/RustGIS
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
priority middle
Difficulty 1/5 Under an hour Newbie friendliness 62/100
KATO-Hiro/AtCoderClans#12940 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
o8 next debug build aborts on Glass to Dark appearance switch (nil identifier messaged before check)Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
hurttlocker/o8#5112 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day