Skip to content

fix(ui): dedup ALIASES + user.identities by alias name (#114)#118

Merged
iduartgomez merged 1 commit intomainfrom
fix/dedup-aliases-by-name-114
May 6, 2026
Merged

fix(ui): dedup ALIASES + user.identities by alias name (#114)#118
iduartgomez merged 1 commit intomainfrom
fix/dedup-aliases-by-name-114

Conversation

@iduartgomez
Copy link
Copy Markdown
Contributor

Summary

Closes #114 (test artifact) — does NOT close #117 (production warning).

Within a single browser session, a stale GetIdentities echo can race a manual CreateIdentity for the same alias name. Both paths previously pushed into ALIASES (thread_local) and user.identities (Signal) without checking, surfacing two rows for the same alias and two distinct inbox-contract subscriptions.

The delegate is single-valued per alias name (manager.identities is a HashMap whose insert overwrites), so server-side this was never duplicated — purely a UI state-mgmt bug.

Fix: dedup-by-alias on push in both set_alias (manual create) and the new-entry branch of set_aliases (delegate echo restore).

Why this doesn't address #117

#117 is the latent production scenario where a user explicitly clicks "Create Identity" with a name they already use. The delegate already overwrites the keypair (existing behavior, predates this PR), so the prior identity's inbox messages become unreadable. That's data loss — needs a confirm dialog or refusal at the UI layer. Out of scope here.

Test plan

iduartgomez added a commit that referenced this pull request May 6, 2026
* ci: clear apt lock between Playwright install-deps retries

`timeout 240 npx playwright install-deps` SIGTERMs the npx wrapper
but the spawned `apt-get update` keeps running and holds
/var/lib/apt/lists/lock. Subsequent retry attempts then fail in <1s
with "Could not get lock" — all 3 attempts burn within seconds and
the step fails permanently.

Reap the leftover apt-get and clear the lock files between attempts,
and bump the retry sleep from 10s to 30s so the previous process has
time to fully exit.

Surfaced as a recurring infra flake on PR runs (e.g. PR #118).

* ci: bump Playwright install-deps timeout 240s → 600s

The previous 240s budget was below the typical ubicloud apt-mirror
time (apt-get update alone runs 4-5min on these runners). All three
retry attempts in the run on PR #119 timed out at 240s, even though
the prior fix correctly clears the lock between retries.

Bump per-attempt timeout to 10min and drop retries 3 → 2, keeping
the worst-case wall time around 20min (step cap also bumped to 25).

* ci: bypass slow apt-get update by installing chromium deps directly

`npx playwright install-deps chromium` invokes `apt-get update` which
hangs 10min+ on ubicloud's apt mirror, blowing past any reasonable
timeout. Install the chromium package list directly with a plain
`apt-get install -y` (skipping update entirely).

Package list extracted from
node_modules/playwright-core/lib/server/registry/nativeDeps.js
under `ubuntu24.04-x64.chromium`. If Playwright bumps the list a
future cache-miss build will fail and we'll catch it.
Within one browser session, a stale GetIdentities echo can race a
manual CreateIdentity for the same alias name. Both paths pushed
into ALIASES (thread_local) and user.identities (Signal) without
checking what was already there, surfacing two rows for the same
alias and (more importantly) two distinct inbox-contract subscriptions.

The delegate is single-valued per alias name — `manager.identities`
is a HashMap whose `insert` overwrites. So old keys are already
gone server-side; the UI duplication is purely a state-management
bug on our side.

Fix: in `Identity::set_alias` (manual create path) and the new-entry
branch of `Identity::set_aliases` (delegate echo restore path),
look up the alias first and replace in place if present, rather than
unconditionally pushing.

This fixes the iso-harness test artifact (#114) where 3 Playwright
tests sharing one delegate created 3 "alice" rows in test 3.

Note: this does NOT add a UI guard against the user explicitly
creating "alice" twice — that's a latent production data-loss bug
tracked in #117 and needs a confirm dialog or refusal flow.
@iduartgomez iduartgomez force-pushed the fix/dedup-aliases-by-name-114 branch from 534f499 to b4619f0 Compare May 6, 2026 11:39
@iduartgomez iduartgomez merged commit 139d321 into main May 6, 2026
4 checks passed
@iduartgomez iduartgomez deleted the fix/dedup-aliases-by-name-114 branch May 6, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant