diff --git a/.changeset/doctor-optional-absent-is-not-a-pass.md b/.changeset/doctor-optional-absent-is-not-a-pass.md new file mode 100644 index 000000000..43af18459 --- /dev/null +++ b/.changeset/doctor-optional-absent-is-not-a-pass.md @@ -0,0 +1,10 @@ +--- +'stash': patch +--- + +`stash doctor` no longer reports "All checks passed." when `@cipherstash/stack` +is absent. The package is an optional peer, so running `doctor` before `stash +init` skips the encryption check entirely — the row already said so, but the +outro claimed a pass for a check that never ran. It now ends with "stash doctor +could not run every check.", the same line an unprobeable install gets, and +still exits 0: an absent optional package is recoverable, not a failure. diff --git a/packages/cli/src/commands/doctor/index.ts b/packages/cli/src/commands/doctor/index.ts index 56d31a14c..0e2b466c5 100644 --- a/packages/cli/src/commands/doctor/index.ts +++ b/packages/cli/src/commands/doctor/index.ts @@ -40,7 +40,7 @@ interface Probe { const PROBES: Probe[] = [ { - label: 'Encryption engine (@cipherstash/stack → protect-ffi)', + label: messages.doctor.encryptionProbeLabel, pkg: '@cipherstash/stack', subpath: './diagnostics', optional: true, @@ -55,7 +55,7 @@ const PROBES: Probe[] = [ }, }, { - label: 'Auth (@cipherstash/auth)', + label: messages.doctor.authProbeLabel, pkg: '@cipherstash/auth', async force() { // No counterpart call needed. This package's entry is `module.exports = @@ -177,7 +177,12 @@ export async function doctorCommand(): Promise { ? messages.doctor.notInstalledOptional : messages.doctor.notInstalled, ) - if (!probe.optional) failed = true + // The row stays green — absence before `stash init` is expected, and + // the detail already says so — but the check did not RUN, which is the + // same thing the too-old arm below records. Without this the outro said + // every check passed while one of the two never executed. + if (probe.optional) incomplete = true + else failed = true } else if (isSubpathUnavailable(err, probe)) { report('warn', probe.label, messages.doctor.cannotProbe) incomplete = true diff --git a/packages/cli/src/messages.ts b/packages/cli/src/messages.ts index fc9e77251..e04f826b8 100644 --- a/packages/cli/src/messages.ts +++ b/packages/cli/src/messages.ts @@ -26,6 +26,15 @@ export const messages = { title: 'stash doctor', /** Leader of the platform check line; the `-` is appended. */ platformLabel: 'Platform', + /** + * Probe row labels. Here rather than inline in `commands/doctor/index.ts` + * because both E2E suites match a row as `