Skip to content

Commit 7c66dad

Browse files
committed
fix(shell): pinned instances default to Build Corpora, not Record Collector's flow
Real bug on the live deploy, not hypothetical: every fresh sign-in at augment.didi.sh landed on FLOWS[0] ('csvAugmentation' — Record Collector's flow), whose remotes (recordCollector, recordDbResolver, ...) are deliberately unreachable on a humain-vc-pinned instance — showing "remote exposes no mount function" as the very first thing a new user saw after successfully signing in. readStored() resolves at flows.svelte.ts's module-init time, before workspace.list has ever resolved, so it can only ever fall back to FLOWS[0] for a brand-new session — there was no way for it to know the instance is pinned to humain-vc. Added activeFlow.applyPinnedDefault(), called from a new $effect in App.svelte once workspace.pinned resolves true; only overrides when the user has never made an explicit flow choice (no localStorage key at all), and doesn't itself persist to localStorage, so it stays a soft default rather than overriding a real operator preference. Files changed: - shell/src/flows.svelte.ts - shell/src/App.svelte
1 parent 6792830 commit 7c66dad

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

shell/src/App.svelte

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@
7171
workspace.didi_auth_mode === 'required' && !workspace.user?.didi_id,
7272
);
7373
74+
// A pinned (single-tenant) instance should default to Build Corpora, not
75+
// FLOWS[0] (Improve a CSV — Record Collector's flow, whose remotes are
76+
// deliberately unreachable on a humain-vc-pinned deploy). `pinned` only
77+
// resolves after workspace.list, well after activeFlow's own module-init
78+
// default was already chosen — this effect catches up once it's known.
79+
// Real bug, not hypothetical: every fresh sign-in landed on Record
80+
// Collector / DB Resolver first, both showing "remote exposes no mount
81+
// function" on the deployed instance.
82+
$effect(() => {
83+
if (workspace.pinned) activeFlow.applyPinnedDefault();
84+
});
85+
7486
// ---- composite slots — active-member state ----------------------------
7587
// A composite slot hosts one-of-N remotes based on shared state. We
7688
// keep the active member id per composite as reactive state so the

shell/src/flows.svelte.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,26 @@ class ActiveFlowState {
9595
this.activeFlowId = id;
9696
if (typeof localStorage !== 'undefined') localStorage.setItem(STORAGE_KEY, id);
9797
}
98+
99+
/**
100+
* Called once App.svelte learns the instance is pinned (workspace.pinned
101+
* — a single-tenant deploy, per Build-Order Step 7). `readStored()` runs
102+
* at module-init time, before workspace.list has resolved, so it can
103+
* only ever fall back to FLOWS[0] ('csvAugmentation' — Record
104+
* Collector's flow) for a brand-new session; on a humain-vc-pinned
105+
* instance that flow's remotes are deliberately unreachable
106+
* (client-side, real bug: every fresh sign-in landed there first).
107+
* Only overrides when the user has never made an explicit choice
108+
* (no localStorage key at all) — an operator who deliberately picked a
109+
* different flow keeps that choice, and this never persists to
110+
* localStorage itself, so it stays a soft default, not a hard commit.
111+
*/
112+
applyPinnedDefault(): void {
113+
if (typeof localStorage !== 'undefined' && localStorage.getItem(STORAGE_KEY) !== null) return;
114+
if (this.activeFlowId === 'buildCorpora') return;
115+
if (!FLOWS.some((f) => f.id === 'buildCorpora')) return;
116+
this.activeFlowId = 'buildCorpora';
117+
}
98118
}
99119

100120
export const activeFlow = new ActiveFlowState();

0 commit comments

Comments
 (0)