Skip to content

Commit 7f3789a

Browse files
committed
fix(doctor): keystore check was reading non-existent .wallets field
The check was named 'keystore' and read 'keystore.wallets'. Neither was accurate: - The KeyStore interface (core/src/keystore.ts:14) stores .projects, not .wallets. The .wallets lookup always returned undefined, so walletCount was always 0, so the check always warned 'keystore empty' even on fully-configured installs. - The wallet itself lives in ~/.config/run402/allowance.json (verified by the allowance check directly above), not in the project keystore. - The hint 'Run run402 init to generate a wallet' was wrong on two counts: the wallet was already there, and what's actually empty is the per-project keys map populated by 'run402 projects provision'. Fix: rename the check to 'projects', read .projects, report informationally as 'ok' (empty project store is normal for fresh installs), and rewrite the hint to point at 'projects provision'.
1 parent 9ff5e83 commit 7f3789a

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

cli/lib/doctor.mjs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,25 @@ export async function run(sub, args = []) {
9696
});
9797
}
9898

99-
// 3. Keystore.
99+
// 3. Project keystore. The wallet itself lives in allowance.json (verified
100+
// by check 2 above); this checks the per-project keys (anon_key /
101+
// service_key) that `run402 projects provision` writes. An empty store is
102+
// normal for fresh installs that haven't provisioned a project yet, so
103+
// report informationally as `ok` rather than warning.
100104
try {
101105
const keystore = loadKeyStore();
102-
const walletCount = Object.keys(keystore?.wallets ?? {}).length;
106+
const projectCount = Object.keys(keystore?.projects ?? {}).length;
103107
checks.push({
104-
name: "keystore",
105-
status: walletCount > 0 ? "ok" : "empty",
106-
value: { wallet_count: walletCount },
107-
...(walletCount === 0 && {
108-
hint: "Run 'run402 init' to generate a wallet.",
108+
name: "projects",
109+
status: "ok",
110+
value: { project_count: projectCount },
111+
...(projectCount === 0 && {
112+
hint: "No projects yet — run 'run402 projects provision' to create one (wallet is already set up).",
109113
}),
110114
});
111115
} catch (err) {
112116
checks.push({
113-
name: "keystore",
117+
name: "projects",
114118
status: "error",
115119
message: err instanceof Error ? err.message : String(err),
116120
});

0 commit comments

Comments
 (0)