ui/order-draft: silence hydrate path on non-UUID game ids + Phase 10 e2e fixture upgrade
Phase 14's auto-sync calls `uuidToHiLo` on every layout boot. The existing Phase 10 e2e specs use a placeholder string `test-shell` as the game id, which throws in the FBS request encoder and surfaced as a noisy `console.warn` plus a flaky webkit-desktop test on the local-ci ARM runner. `OrderDraftStore.hydrateFromServer` and `scheduleSync` now skip when the active game id isn't a real UUID — the auto-sync path is inert for fixture data and the placeholder-warning is gone. The Phase 10 spec switches to a deterministic UUID (`10101010-1010-1010-1010-101010101010`) so future Phase 14+ specs don't have to special-case it. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -131,6 +131,14 @@ export class OrderDraftStore {
|
||||
}): Promise<void> {
|
||||
if (this.status !== "ready") return;
|
||||
this.client = opts.client;
|
||||
// Guard against placeholder game ids the Phase 10 e2e specs
|
||||
// still use — auto-sync needs a real UUID for the FBS request
|
||||
// envelope, and a parser exception here would only be visible
|
||||
// as a noisy `console.warn` deep in the layout boot path.
|
||||
if (!isUuid(this.gameId)) {
|
||||
this.syncStatus = "idle";
|
||||
return;
|
||||
}
|
||||
this.syncStatus = "syncing";
|
||||
this.syncError = null;
|
||||
try {
|
||||
@@ -232,6 +240,9 @@ export class OrderDraftStore {
|
||||
|
||||
private scheduleSync(): void {
|
||||
if (this.client === null) return;
|
||||
// Same UUID guard as `hydrateFromServer` — placeholder game
|
||||
// ids in test fixtures must not blow up the auto-sync path.
|
||||
if (!isUuid(this.gameId)) return;
|
||||
if (this.syncing !== null) {
|
||||
this.pending = true;
|
||||
return;
|
||||
@@ -379,6 +390,12 @@ export class OrderDraftStore {
|
||||
}
|
||||
}
|
||||
|
||||
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
||||
|
||||
function isUuid(value: string): boolean {
|
||||
return UUID_RE.test(value);
|
||||
}
|
||||
|
||||
function validateCommand(cmd: OrderCommand): CommandStatus {
|
||||
switch (cmd.kind) {
|
||||
case "planetRename":
|
||||
|
||||
Reference in New Issue
Block a user