Skip to content

feat(cli)!: a declared multi-replica os start on the redis cluster driver refuses to boot without OS_AUTH_SECRET, instead of minting its own sign-in secret - #31718

Merged
objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/project-thread-0ndnrp
Nov 9, 2026
Merged

objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/project-thread-0ndnrp

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #31600

Clause-②: no (narrowing) — measured: on base fc4c3072 an os start declaring several replicas (OS_EXPECT_MULTI_NODE=true) over the redis cluster driver, with OS_SECRET_KEY set and no OS_AUTH_SECRET, booted (redis cluster driver and redis cache adapter registered, Press Ctrl+C to stop) and generated {home}/auth-secret; on head the same start exits 1 on the refusal line and generates nothing.
Metadata-protocol: none
Skills-docs: updated here — content/docs/deployment/cli.mdx (the --auth-secret row and the Authentication paragraph) and content/docs/deployment/self-hosting.mdx (the OS_AUTH_SECRET row) no longer say os start always generates a secret; skills/** says nothing about os start generating one on a multi-replica deployment (its only OS_AUTH_SECRET text is the image's durability refusal, unchanged).

维护者速读

  • 改了什么:os start 在"声明多副本(OS_EXPECT_MULTI_NODE=true 或 OS_CLUSTER_REPLICAS>1)且集群驱动是 Redis"时,如果没设 OS_AUTH_SECRET,不再自己生成登录密钥,而是直接拒绝启动,打印一行:缺哪个变量、为什么、怎么生成(openssl rand -hex 32),所有副本设同一个值。
  • 为什么改:以前每个副本各自生成一份密钥存在自己的盘上,r1 签发的登录 cookie 到 r3 就失效(卡上的冒烟现象,这里实测复现:两副本密钥不同,r2 不认 r1 的 cookie;密钥相同则两边都认)。
  • 风险与回滚:单节点(没声明多副本)照旧自动生成并复用 {home}/auth-secret,任何驱动都一样;声明多副本但驱动不是 Redis 的维持原样(R3:两个条件同时成立才生效)。会被拒绝的只有"多副本 + Redis + 没设密钥"这一种配置,修法就是设密钥。回滚 = revert 本 PR。
  • 先看:① packages/cli/src/commands/start.ts 生成密钥之前新加的那一段判断与 declaresReplicasSharingState;② 同文件的拒绝文案 MULTI_REPLICA_AUTH_SECRET_REFUSAL;③ packages/cli/test/start-deployment-durability.integration.test.ts 新增的三条真实 os start 用例。
  • 两分钟验证:pnpm --filter @objectstack/cli exec vitest run --maxWorkers=2 src/commands/start-deployment-durability.test.ts test/start-deployment-durability.integration.test.ts(需先 build CLI),预期 35 passed:其中多副本 + Redis + 无密钥的 os start 退出码 1、输出那一行、家目录里没有 auth-secret。
  • 需要你做的:无,席位落地。

What changes

os start refuses to generate a sign-in secret for a declared multi-replica deployment on the redis cluster driver. Where the operator set no secret (--auth-secret, OS_AUTH_SECRET or its legacy names unset or blank), os start now asks, before it generates anything, whether the deployment runs replicas that share state. If it does, it exits 1 on one line, in the data key refusal's shape:

[auth] Refusing to start: several replicas are declared (OS_EXPECT_MULTI_NODE / OS_CLUSTER_REPLICAS>1) over the redis cluster driver, but OS_AUTH_SECRET is not set — each replica would mint its own sign-in secret, and a session signed on one would be refused on the others. Fix: generate one and set the same value on every replica, e.g. OS_AUTH_SECRET=$(openssl rand -hex 32)

The line names the variable and never a value. The refusal writes no secret, so a replica that hits it leaves nothing on its volume.

Where it lives, measured in step 0. The only place a sign-in secret is generated is os start itself (readOrCreateAuthSecret, {home}/auth-secret; the image's home is the /data/auth-secret of the card). os serve never generates one outside development: plugin-auth refuses a production boot without OS_AUTH_SECRET. The data key's missing-key refusal lives in the serve child (LocalCryptoProvider), and os start already declines to opt that key into self-minting when OS_CLUSTER_DRIVER is set. The secret is generated in the parent before the child starts, so the refusal belongs in the parent, at the same point as the image's durability check, which it follows.

The predicate is not a second copy. It is the rule every multi-replica change keeps (cloud#3814 R3): replicas declared (declaresMultiNode, the split-brain guard's reader) AND the redis cluster driver. PR #31624 applies it in planCacheAdapter to the registered cluster service's driver; its one pre-boot form already exists as sharesCloudBindingCredential(env, OS_CLUSTER_DRIVER) in @objectstack/cloud-connection (it trims the driver the way the serve child does before composing the cluster service). os start asks that function, through a lazy import of a package the CLI already declares. A first attempt declared @objectstack/service-cluster on the CLI to import declaresMultiNode directly; serve-cluster-host-resolution.test.ts refuses that, because cluster packages ship with the host app and the open-core CLI takes no static dependency on them, so the dependency was dropped.

Docs. content/docs/deployment/cli.mdx (the --auth-secret row and the Authentication paragraph) and content/docs/deployment/self-hosting.mdx (the OS_AUTH_SECRET row) said os start always generates a secret; they now name the one topology where it refuses instead.

Tests

  • packages/cli/src/commands/start-deployment-durability.test.ts, new top-level describe: the decision on real environments — refused for OS_CLUSTER_REPLICAS=3 and for OS_EXPECT_MULTI_NODE=true (with a padded ' redis ') over redis; CONTROL single node (no declaration, redis alone, replicas 1) not refused; CONTROL replicas declared over memory or no driver not refused; the line is one line, starts with the pinned first sentence, names OS_AUTH_SECRET and the generator. The file also gains three module-top side-effect imports (@objectstack/cloud-connection, @objectstack/runtime, @objectstack/service-settings): check:test-source-alias asks every edited test file that reaches a lazy import in its source to pay the load during collection. Forced test edit, named here.
  • packages/cli/test/start-deployment-durability.integration.test.ts, new describe at the shipped entry (bin/run.js over dist/), no Redis needed because the door is in os start: (1) replicas declared over redis, no secret → exit 1, stderr carries the line, no auth-secret anywhere under home or cwd; (2) the secret set → the door passes (banner printed after it), nothing generated; (3) CONTROL replicas declared over memory → the secret is generated exactly as before (.objectstack/auth-secret). The single-node CONTROL is the file's existing leg 3, which reads the generated auth-secret file. Forced test edit, named here: baseEnv now also clears OS_EXPECT_MULTI_NODE, OS_CLUSTER_REPLICAS, OS_ALLOW_MEMORY_CLUSTER_MULTINODE and OS_REDIS_URL, so an inherited declaration cannot reach the existing legs; the test-budget line is re-read (26.9 s, budget 40 unchanged).

Acceptance notes

  • The refusal is in os start only. A deployment that runs os serve directly already has to set OS_AUTH_SECRET (plugin-auth refuses production without it), so it never generated a per-replica secret.
  • With the image's durability switch on, a start missing OS_AUTH_SECRET is refused by that check first (it lists every missing variable); this line is reached only without the switch or with the secret check passed.
  • The driver is read as written. On open core with OS_CLUSTER_REPLICAS > 1 and no multi-node gate registered, the serve child falls back to the memory driver and the split-brain guard refuses the boot anyway (measured on head with a shared secret set). That configuration now meets this line first when no secret is set; it never booted, so no boot is lost. OS_EXPECT_MULTI_NODE=true over redis did boot on base and is the narrowed path.
  • A deployment that already ran on generated secrets keeps its sessions by setting OS_AUTH_SECRET to one replica's auth-secret contents on every replica; the changeset says so.

Verification

Local, on head c96d6e73 unless a line says otherwise. Every exit code below was captured before any pipe.

Step 0 and the real-Redis readings (redis-server 7.0.15, a probe app declaring the two cluster packages)
  • Base fc4c3072, OS_EXPECT_MULTI_NODE=true OS_CLUSTER_DRIVER=redis OS_REDIS_URL=… OS_SECRET_KEY=…, no auth secret: ClusterServicePlugin: registered "redis" driver, CacheServicePlugin: registered redis cache adapter, Press Ctrl+C to stop; {home}/.objectstack/auth-secret generated.
  • Head, the same environment: exit 1, the refusal line, 0 auth-secret files.
  • Head, the same with OS_AUTH_SECRET set: redis driver and redis cache registered, Press Ctrl+C to stop, 0 auth-secret files.
  • Two head replicas on one Redis and one shared SQLite file, one OS_AUTH_SECRET: a cookie signed in on r1 reads the session on r1 and on r2. The same pair with a different secret each (what base generated): r1 reads it, r2 does not.
Tests and the ablation
  • pnpm --filter @objectstack/cli exec vitest run --maxWorkers=2 src/commands/start-deployment-durability.test.ts test/start-deployment-durability.integration.test.ts src/commands/serve-cluster-host-resolution.test.ts: 3 files, 67 passed (VERDICT command-exit 0).
  • CLI unit tier vitest run --project unit: 405 files, 5728 passed (VERDICT command-exit 0). pnpm --filter @objectstack/cli typecheck: VERDICT command-exit 0 (tsc and the test-typecheck ledger, 3 files / 28 errors / 6 pinned signatures unchanged).
  • Ablation (the refusal's one return made false, marker ABLATION_31600, through scripts/ablation-replace.mjs): mutation landed (anchor 1 → 0, blob e9d80387 → d55df8e4), CLI rebuilt, ablation-dist-preflight found the marker in 1 built file; 2 failed / 33 passed — the unit case refuses when several replicas are declared over the redis driver (expected false to be true) and the spawn case OS_AUTH_SECRET unset: exit 1 … (the child went on to the split-brain guard instead). Restored: blob == HEAD, git diff HEAD empty; rebuilt, --absent over 904 built files and a clean tree; 35/35 passed.
Derived gates and lint

node scripts/pm/dispatch-gates.mjs --commands derived 99 families on c96d6e73; all 99 ran and exited 0. check:type-check-debt first answered exit 3 (the lock was held by the dogfood run, queue-timeout, nothing measured) and exited 0 under the lock afterwards. --ran with every exit code recorded: 99 derived famil(ies) accounted for — 99 run, 0 NOT-MEASURED (a DERIVED zero …). On the earlier head fd977a59 (with the dropped dependency) check:test-source-alias was red and named the three lazy loads the edited test file reaches; the module-top imports fixed it.

check-adr-0087-registration: 1 declared-breaking changeset(s), each carrying an ADR-0087 disposition — [BREAKING+bang+clause-②-narrowing] not-required (no-migration-prescription).

npx eslint --no-inline-config packages/cli (the package has no lint script): exit 0.

Full dogfood (owed by the narrowing arm)

On c96d6e73: the dependency closure built (pnpm --filter '@objectstack/dogfood^...' build, VERDICT command-exit 0, before the last two commits; the CLI and every package were rebuilt on c96d6e73 by turbo run build --filter='./packages/**', VERDICT command-exit 0), then pnpm --filter @objectstack/dogfood test under the verify lock: VERDICT command-exit 0, Test Files 440 passed, 3 skipped (443); Tests 3652 passed, 41 skipped (3693). No failure.


Generated by Claude Code

…r refuses to mint its own sign-in secret

Claude-Session: https://claude.ai/code/session_01ADHkmNwSCrFC9AxLfZsBxf
Co-authored-by: Claude <noreply@anthropic.com>
…multi-replica redis deployment

Claude-Session: https://claude.ai/code/session_01ADHkmNwSCrFC9AxLfZsBxf
Co-authored-by: Claude <noreply@anthropic.com>
…not a new cluster dependency

The CLI declares no cluster package of its own: those ship with the host app.

Claude-Session: https://claude.ai/code/session_01ADHkmNwSCrFC9AxLfZsBxf
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/cli, touching 3 documentable anchor(s).

21 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 35a9c6941c18eb5597dedd8e27b518050851bdd5.

⛔ 12 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 231 client-bound route-ledger rows — the other 166 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 166: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 107 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 35 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 35a9c6941c18eb5597dedd8e27b518050851bdd5 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from fa423033eb67127b5b9509ee0095181ac84b30f8 — the merge of head d6fe923526713c5cd161c0e86c2b79eff7aa8b80 into base 35a9c6941c18eb5597dedd8e27b518050851bdd5, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin fa423033eb67127b5b9509ee0095181ac84b30f8 && git checkout fa423033eb67127b5b9509ee0095181ac84b30f8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 35a9c6941c18eb5597dedd8e27b518050851bdd5 d6fe923526713c5cd161c0e86c2b79eff7aa8b80 && git checkout -B drift-repro 35a9c6941c18eb5597dedd8e27b518050851bdd5 && git merge --no-ff d6fe923526713c5cd161c0e86c2b79eff7aa8b80

node scripts/docs-audit/affected-docs.mjs --json 35a9c6941c18eb5597dedd8e27b518050851bdd5

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 35a9c6941c18eb5597dedd8e27b518050851bdd5 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#1 · os-steve · session_01ADHkmPF1skfu2kx89BEXZi

Contract-review-claim: session_01ADHkmPF1skfu2kx89BEXZi · head c96d6e7 · 2026-11-08T23:23Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#1 · os-steve · session_01ADHkmPF1skfu2kx89BEXZi

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: c96d6e73fe89495232d43fe25407c1fc4454e095
Local-runs: none
Scope: .changeset/31600-multi-replica-auth-secret-refusal.md, packages/cli/src/commands/start.ts, packages/cli/src/commands/start-deployment-durability.test.ts, packages/cli/test/start-deployment-durability.integration.test.ts, content/docs/deployment/cli.mdx, content/docs/deployment/self-hosting.mdx + packages/cloud-connection/src/connection-credential-ledger.ts, packages/cloud-connection/src/index.ts, packages/cloud-connection/package.json, packages/services/service-cluster/src/split-brain-guard.ts, packages/services/service-cluster/src/multi-node-gate.ts, packages/cli/src/commands/serve.ts, packages/cli/src/commands/serve-cluster-host-resolution.test.ts, packages/cli/package.json, packages/services/service-settings/src/local-crypto-provider.ts, packages/plugins/plugin-auth/src/auth-manager-database-secret.ts, packages/types/src/env.ts

Face: narrowing (Clause-②: no (narrowing) on the PR body and the changeset; no schema or governed path in the file list). Inputs: card #31600 body and all three comments (triage, Claim, os-dev-report), PR #31718 body, file list and net diff against main (merge-base fc4c3072, 5 commits), the check-runs on the head. The parent cloud#3814 is not reachable from this session; R1–R3 are judged as the card quotes them verbatim. Net diff: 6 files, +163/−4.

Check-runs on the head at review time: every completed gate-carrying run is success — Lint & Repo Gates, every Lint · leg, Governed Surface Queue Guard, Check Changeset, Dogfood Regression Gate, Test UI, Build Docs, Type Check · source gates, Type Check · debt ledger, Test Core (8/8), Plan Test Core shards, Spec property liveness, PR-body guards. Still in_progress: Build Core, Test Core (1/8)–(7/8), Type Check · workspace, Type Check · consumer gates, Live E2E UI. No failure. The PASS below is on the tree; the seat lands only once those finish green.

① Derived judgments

  • The accept-set that narrows — an os start with no operator sign-in secret, replicas declared (OS_EXPECT_MULTI_NODE=true or OS_CLUSTER_REPLICAS greater than 1) AND OS_CLUSTER_DRIVER trimming to redis: used to generate {home}/auth-secret and boot; now exits 1 on one stderr line and writes nothing. Right, and exactly the card's Do 1 under R3.
  • What does not move — (a) single node (no declaration), any driver including redis: declaresMultiNode is false, readOrCreateAuthSecret runs as before. (b) Replicas declared over memory or no driver: the predicate is false, the secret is generated as before and the child meets the split-brain guard as it always did. (c) Any operator secret present (flag, OS_AUTH_SECRET, AUTH_SECRET, BETTER_AUTH_SECRET): the first conjunct is false, the door is never asked. Right; R3's "both conditions, never one" holds, and the guard is untouched.
  • No second copy of the shared predicate. declaresReplicasSharingState is a one-line call to sharesCloudBindingCredential(env, env.OS_CLUSTER_DRIVER) (connection-credential-ledger.ts:68), which is declaresMultiNode(env) && clusterDriver?.trim() === 'redis' — the same declaresMultiNode the split-brain guard reads (split-brain-guard.ts:64), the same rule F1 (feat(service-cache)!: a declared multi-node deployment on the redis cluster driver shares one Redis cache, so cache-backed limits hold across replicas #31624) applies in planCacheAdapter to the registered driver. os start has no cluster service yet, so the pre-boot form over OS_CLUSTER_DRIVER is the right input, and it trims the way serve.ts:3090 trims before composing the service. Right.
  • Refusal placement — after the image's durability check (which lists every missing variable, so with the switch on the image's refusal speaks first and names OS_AUTH_SECRET too) and before readOrCreateAuthSecret, before the child env is built, before OS_CRYPTO_AUTOKEY, before the spawn. The only writes ahead of it are the optional compile of dist/objectstack.json and the database URL resolution, neither of which is a secret. Right.
  • New exports declaresReplicasSharingState and MULTI_REPLICA_AUTH_SECRET_REFUSAL from commands/start.ts: the package's exports map is ., ./console, ./hook-body; src/index.ts re-exports only the command class. They are test-reach exports in the pattern the file already uses (DURABILITY_CHECK_ENV, formatDurabilityRefusal, missingDurableVariables), not npm public surface. Right, and so Clause-②: no is not contradicted by them.
  • Dependency — @objectstack/cloud-connection is in packages/cli dependencies (not dev), so a published CLI resolves the bare lazy import. cloud-connection itself depends on @objectstack/service-cluster statically, so the open-core CLI already carried that transitive dependency before this PR; the PR adds no manifest line (net zero in package.json / lockfile). serve-cluster-host-resolution.test.ts scans serve.ts only and refuses only packages the CLI manifest does not declare; the dropped direct dependency was the correct repair. Right.
  • Docs — cli.mdx (flag row and Authentication paragraph) and self-hosting.mdx (OS_AUTH_SECRET row) now name exactly the topology the code refuses, both declaration spellings, the redis driver, and the generator; nothing in them overstates the enforcement. Agree with the code.

② Semver level

@objectstack/cli: patch with a BREAKING banner, Clause-②: no (narrowing), Metadata-protocol: none, and one adr-0087: not-required (no-migration-prescription) marker. The rule (Post-Task Checklist 3): a non-protocol change, widening or breaking, ships patch and keeps its banner and disposition — matches. The body carries the migration a breaking changeset owes: set one OS_AUTH_SECRET on every replica, and for a deployment that ran on generated secrets, the contents of one replica's auth-secret file. Check Changeset and check-adr-0087-registration (under Lint & Repo Gates) are green on the head. The Clause-② line matches what the diff publishes: one configuration that booted is refused, nothing authorable widens.

③ Boundary flags

  1. Open question — keep the cloud-connection-named predicate (rec A) or lift a neutral one (B). Reading: A holds for this PR. The semantic os start needs is exactly the one sharesCloudBindingCredential encodes, its own tests in cloud-connection pin it, and B would add a public export (a widening) to a narrowing PR for a naming concern. The coupling cost is real but bounded: if the cloud-binding home rule ever gains a condition of its own (a licence, a second driver), os start's refusal moves with it silently. Recommend the seat note on the card that when seat 4's feat(runtime)!: refuse runtime package operations when multi-replica is declared (#3814 F3c, D1) #31599/feat(cloud-connection)!: refuse marketplace install-local when multi-replica is declared (#3814 R6) #31602 need the same pre-boot form, the re-export carries a topology name (the declaresReplicasSharingState spelling already chosen here) from cloud-connection, so three readers share one neutrally named form — not this PR's work. Nit.
  2. Class-b finding — serve.ts:3166 asks the multi-node gate with Number(OS_CLUSTER_REPLICAS) only, so OS_EXPECT_MULTI_NODE=true over redis reaches an unregistered gate as "not declared" and boots multi-node ungated on open core. Reading: confirmed in the cited code — multi-node-gate.ts states a DECLARED topology with no gate is refused, declaresMultiNode has two spellings, the gate call passes one. This PR does not widen it (with no secret that path now meets this refusal first; with a secret set it boots exactly as on base) and must not fix it (scope). It is a contract violation on a paid-capability gate, so Prime Directive 10 wants a card, and the dev's carrier: none · noted, not filed leaves it unfiled. Escalate: the seat files it (lane domain:server, dedupe words as the report gives them), citing the measured boot on fc4c3072 and c96d6e73. Not a finding on this diff.
  3. File-surface deviation (claim named plugin-auth / runtime; change landed in commands/start.ts): step 0 is right — plugin-auth generateSecret() throws outside development/test, os dev only forwards the flag, runtime mints nothing; the only production mint is readOrCreateAuthSecret. Deviation accepted.
  4. Forced test edits (module-top side-effect imports in the unit test; baseEnv clearing four more variables; test-budget re-read): named in the PR body, consistent with check:test-source-alias and with the file's existing clearing list. Accepted.

④ Design judgment

packages/cli/src/commands/start.ts — holds against the card's scenario: OS_SECRET_KEY set, OS_AUTH_SECRET unset, replicas declared over redis → exit 1 before readOrCreateAuthSecret, so r3 writes no /data/auth-secret and the r1-cookie-on-r3 state cannot arise once the operator sets one value. Break attempts: (a) legacy names and --auth-secret count as the operator's secret — yes, through the same flags['auth-secret'] ?? readEnvWithDeprecation(...) the mint already used; (b) empty or whitespace OS_AUTH_SECRET (or a legacy name set empty, which readEnvWithDeprecation returns as the empty string) is treated as unset and refused — correct, and the same trim().length reading the durability check uses; (c) OS_CLUSTER_DRIVER=' redis ' and OS_EXPECT_MULTI_NODE=TRUE are both normalised by the cited predicate; (d) the line is a constant, carries no value, one line, [auth] Refusing to start: in the data key's shape; (e) the lazy import rejects if the package is absent, which rejects run() and exits non-zero — fails closed, and the package is a declared dependency so absence is a broken install. One cost: because the door is asked whenever no operator secret is set, every zero-config single-node os start now loads the whole @objectstack/cloud-connection barrel (plugins, rest, objectql, metadata-*) in the supervisor process, where runtime and service-settings were already loaded but those were not; the jsdoc's "lazy, so oclif's import-every-command startup does not pay" is true of command discovery and silent about this path. No effect on correctness or the contract. Nit. Acceptance limit, not a finding: three containers on redis that declare neither spelling still mint per replica — R3 keys every card on the declaration, and the docs say "declares".

packages/cli/src/commands/start-deployment-durability.test.ts — new top-level describe in the existing harness file (ruling 6583487846 shape). Asks the real exported predicate through the real lazy import on both declaration spellings, with a padded driver; CONTROLs for single node on redis, replicas 1, replicas over memory, replicas with no driver; the line's shape, variable and generator pinned, no newline. Covers the decision table ①. No finding.

packages/cli/test/start-deployment-durability.integration.test.ts — at the shipped entry over dist/, no Redis needed because the door is in the parent. Leg 1: OS_CLUSTER_REPLICAS=3 + redis, no secret → exit 1, stderr matches the pinned regex and the generator, no READY, no auth-secret anywhere under home or cwd. Leg 2: OS_EXPECT_MULTI_NODE=true + redis + secret → no refusal, the Database banner (printed after the door) proves the parent went on, nothing minted. Leg 3 CONTROL: replicas over memory → .objectstack/auth-secret minted exactly as before. The single-node CONTROL is the file's existing leg 3. baseEnv now clears the four topology variables so an inherited declaration cannot reach the older legs. The two spellings are split across legs 1 and 2, so both are measured end to end. No finding.

.changeset/31600-multi-replica-auth-secret-refusal.md — judged in ②; the "Unchanged" paragraph matches ① point by point. No finding.

content/docs/deployment/cli.mdx, content/docs/deployment/self-hosting.mdx — agree with the code (①). No finding.

Findings, graded: nit — barrel load on the single-node path (start.ts); nit — predicate naming coupling (③.1, rec A kept); escalation to the seat, not a finding on this diff — the OS_EXPECT_MULTI_NODE gate bypass (③.2). No should-fix, no must-fix.

Implemented-by: claude/project-thread-0ndnrp
Reviewed-by: session_01ADHkmPF1skfu2kx89BEXZi

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#1 · os-steve · session_01ADHkmPF1skfu2kx89BEXZi

席位 ACCEPT · head c96d6e73fe89495232d43fe25407c1fc4454e095

采纳本 head 上的契约复审记录 6728738256(CONTRACT_REVIEW_TIER,narrowing 面,PASS,无 must-fix / should-fix)。

CI 全绿后落地:relay pr_ready + automerge_enable。

The two legs that reach the serve child read ~4 s locally, under vitest's
default 5 s per test; on a loaded CI runner (Test Core 1/8 on c96d6e7)
the memory-driver CONTROL leg timed out at 5000 ms. Each leg now carries
the spawnSync bound (120 s) plus 10 s.

Claude-Session: https://claude.ai/code/session_01ADHkmNwSCrFC9AxLfZsBxf
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#1 · os-steve · session_01ADHkmPF1skfu2kx89BEXZi

席位 ACCEPT · 增量 · head dc48e89a52fb356ae914bc85585c4ebadc4e6781

c96d6e73..dc48e89a 是快进,只有 1 个文件:packages/cli/test/start-deployment-durability.integration.test.ts,+9/-4。

  • 起因:Test Core (1/8) job 128896992131 红。本 PR 新加的 CONTROL: replicas declared over the memory driver… 一条用了 vitest 默认的 5 s,而它会跑到 serve 子进程(本地约 3.5–4 s),CI 负载下超时。这是本 PR 自己的问题,不是 main 的 flake。
  • 修法:三条 feat(auth)!: refuse to boot multi-replica without an explicit OS_AUTH_SECRET (#3814 F3e) #31600 用例都带上 LEG_TIMEOUT_MS = SPAWN_TIMEOUT_MS + 10_000;spawnSync 原有的 120 s 上限改成引用同一个常量,数值不变。断言一条没动,覆盖不变。
  • 不在契约面上(生产代码、changeset、文档都没变)。契约复审记录 6728738256 判的那棵生产树原样未动,增量由席位按 TIER_DEFAULT 接受。

CI 全绿后落地:relay pr_ready + automerge_enable。

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 9, 2026 00:21
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 9, 2026 00:21
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 42540685668 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Test Core (1/8) — 失败步骤: Run this shard's tests

    @objectstack/cli:test:  FAIL   integration  test/validate-namespace-name.test.ts > ADR-0150 child N — os validate and os build refuse what the package door refuses, in its words > premise: the package
      ↳ 失败原因: @objectstack/cli:test: AssertionError: expected BareNameConflictError: Bare-name conflict… { …(8) } to be undefined
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 12 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(auth)!: refuse to boot multi-replica without an explicit OS_AUTH_SECRET (#3814 F3e)

2 participants