Skip to content

fix(protocol): make WorkspaceId Display collision-free - #444

Open
YuriNachos wants to merge 1 commit into
acsandmann:mainfrom
YuriNachos:YuriNachos/w3-rift-workspaceid
Open

fix(protocol): make WorkspaceId Display collision-free#444
YuriNachos wants to merge 1 commit into
acsandmann:mainfrom
YuriNachos:YuriNachos/w3-rift-workspaceid

Conversation

@YuriNachos

Copy link
Copy Markdown
Contributor

WorkspaceId's Display applied {:08} padding to the concatenated DECIMAL string of idx+version, so {idx:1,version:23} and {idx:12,version:3} both rendered "00000123" — losing positional info (idx is the low 32 bits, version the high 32 bits of the slotmap key per protocol_workspace_id). The collision flows to RIFT_WORKSPACE_ID and the Debug command's id_num.

Fix

Reconstruct the original 64-bit key: ((version as u64) << 32) | idx. Preserves the 8-char-zero-padded look, makes the string a stable unique key, transitively fixes id_num with zero other changes.

Test plan

cargo test -p rift-protocol — 7 passed, 0 failed, including a new collision-free test (assert_ne of the two colliding ids) and a round-trip assertion.

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.

1 participant