Skip to content

feat(cluster): settings changes reach every replica (settings lane) - #31785

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-5sumzg
Nov 9, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-5sumzg

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #31597

Clause-②: yes (widening)
Metadata-protocol: none

Measured on the built declarations at head: @objectstack/service-settings dist/index.d.ts gains SETTINGS_CHANGE_CLUSTER_CHANNEL, the ClusterSettingsChangePayload type and three public methods on SettingsService (attachSettingsChangePubSub(), detachSettingsChangePubSub(), resyncSettingsChangePubSub()); none of the five names occurs in that package's source at base 9e1f1f90. @objectstack/service-cluster gains only private members. Nothing is removed, renamed or made required. The claim read no; the measurement says yes (widening). No metadata an author writes changes.

维护者速读

  • 改了什么:多副本(声明副本数大于 1 且使用 Redis 集群驱动)时,在一个副本上改了设置,其他副本也会立刻重新读取并生效,包括认证安全姿态。
  • 为什么改:以前只有处理写请求的那个副本会重建配置,其他副本要到重启才看到新设置;实测一个副本已拒绝未验证邮箱的登录,另一个副本 95 秒后仍放行。
  • 风险与回滚:单节点(未声明多副本或非 Redis 驱动)行为完全不变;广播消息只带命名空间和键,不带任何值或密钥。回滚即撤销本 PR。
  • 先看:service-settings/src/settings-service.ts 的集群收发段(attachSettingsChangePubSub 起)、service-cluster/src/metadata-cluster-bridge-plugin.ts 的第五条通道 attachSettingsLane、新测试 settings-cluster-lane.test.ts。
  • 两分钟验证:pnpm --filter @objectstack/service-settings exec vitest run src/settings-cluster-lane.test.ts,预期 10 个用例全部通过(两个内核共享一条总线,A 写入后 B 一秒内生效)。
  • 需要你做的:无,席位落地。

What changes

  • A fifth cluster lane (@objectstack/service-cluster). MetadataClusterBridgePlugin gains attachSettingsLane, shaped like lanes 1 to 4: it duck-types the settings service's attachSettingsChangePubSub(pubsub, nodeId) seam at kernel:bootstrapped (one phase after lanes 1 to 4, because the settings service binds its engine at kernel:ready and a peer's change must not reach a subscriber before that; check:settings-bind-window caught the first spelling at kernel:ready), reports bridged settings.changed → cluster.pubsub at info, and detaches on kernel:shutdown (a throwing detach of another lane does not strand it). Unlike lanes 1 to 4, which skip only the in-process driver, lane 5 attaches only behind declaresMultiReplicaOnRedis(process.env, cluster.driver): OS_CLUSTER_REPLICAS greater than 1 (or OS_EXPECT_MULTI_NODE=true) AND the redis driver (R3). The split-brain guard is untouched.
  • Send and receive (@objectstack/service-settings). The write door (setMany, which set and every reset go through) publishes after its local settings:changed. The payload is spelled field by field in publishSettingsChange: { originNode, namespace, key, scope, action, at }, the fields the local event already carries, never a value, ciphertext handle or secret. A peer drops its own originNode, validates the address, and emits its own local settings:changed, so each subscriber re-reads the shared store. The receive path only emits; it never publishes, so there is no echo. A publish failure is a warning and never fails the write. Channel settings.changed (SETTINGS_CHANGE_CLUSTER_CHANNEL, in the new settings-cluster-channel.ts), partitioned per namespace.
  • Joins F3a's cluster.resync. The lane registers resyncSettingsChangePubSub through registerLaneResync, so when the driver's connection returns after an outage every registered namespace is announced locally once (key: '*', the shape the engine bind already uses) and every subscriber re-reads. A no-op until a transport is attached; local only, never published.
  • No single-node change. The engine bind's per-namespace announcement moved into a private emitEveryNamespace() that the resync reuses; the events it emits are unchanged. Every other emit site is untouched.
  • Docs. content/docs/kernel/cluster.mdx §6.2 lists lane 5, its address-only payload, its resync, and its narrower attach condition.

Tests

  • service-settings/src/settings-cluster-lane.test.ts (new): two LiteKernel replicas, each with its own SettingsService over its own real ObjectQL engine, both engines over one shared Map driver (the shared database), joined by one bus that delivers every publish to every subscriber (publisher included). Each kernel runs the real MetadataClusterBridgePlugin and a cluster service naming the redis driver. The auth-posture subscriber has plugin-auth's binding shape: subscribe('auth'), then re-read require_email_verification.

    • ⭐ A set on A turns B's posture within one second (vi.waitFor, 1000 ms), read from the shared store; a reset travels the same way.
    • The broadcast's keys are exactly action, at, key, namespace, originNode, scope, and the serialized payload does not contain the written value; B reads the value from the store.
    • No echo: one write puts exactly one message on the bus, and the writer and the peer each hear it once.
    • cluster.resync: a write lost during a bus outage reaches B on reconnect; nothing more goes on the wire.
    • After kernel:shutdown a replica neither publishes nor hears.
    • CONTROL: redis with no declaration emits exactly the events a lone SettingsService emits today and nothing crosses; declared replicas over postgres get no lane; a reconnect on an unattached replica and a resync with no transport announce nothing; own-origin and malformed messages are ignored.
  • service-cluster/src/metadata-cluster-bridge-plugin.test.ts: a lane-5 describe (binds at kernel:bootstrapped, not at kernel:ready; attach with the cluster's pubsub and node id; CONTROL undeclared on redis; one replica; a non-redis remote driver; the memory driver; missing service or seam; a throwing attach; shutdown detach; resync once per outage and CONTROL undeclared). The harness gains a settings slot defaulting to none, so every earlier case reads as before.

  • Forced test edits: none.

  • Test resolution: the new suite boots the cluster bridge, so service-settings gains @objectstack/service-cluster as a devDependency, aliased to source in its vitest.config.ts like its other workspace imports.

  • Ablations (each through scripts/ablation-replace.mjs; every mutation landed, went red, and every restore left git diff HEAD empty; the suites resolve the mutated files from source, so no rebuild leg):

    Ablation Red
    A1: the write publishes the event plus its value 1 (the payload key set)
    A2: the receive path publishes what it received (echo) 4 (the bus storms; 683 local events)
    A3: the loopback guard removed 2 (the writer hears itself twice)
    A4: lane 5's R3 guard replaced by the in-process guard 3 of 10 in the two-kernel suite, 4 of 42 in the bridge suite
    A5: lane 5's shutdown detach removed 1 in each suite
    A6: the resync no-transport guard removed 1

Acceptance notes

Verification

All on head 260046945 after a fresh pnpm install --frozen-lockfile and turbo run build --filter='./packages/**' (exit 0):

  • pnpm --filter @objectstack/service-settings --filter @objectstack/service-cluster run test: service-settings 75 files / 1430 tests, service-cluster 11 files / 154 tests, all passed.
  • run typecheck for both: exit 0 (service-cluster's check:test-typecheck included).
  • Lint: root eslint --no-inline-config on both package directories, exit 0.
  • dispatch-gates.mjs --commands derived 114 commands on the final head 260046945; each was run, all 114 exited 0, and --ran reconciled: 114 derived, 114 run, 0 NOT-MEASURED, 0 UNRUN. The first round (on a6384788) went red on check:settings-bind-window (lane 5 read the settings service in a kernel:ready hook, inside the pre-bind window); the fix moved the attach to kernel:bootstrapped. check-plugin-teardown-shape --self-test needed its pinned fixture fetched (git fetch origin 621a4876…) before it could run.
  • Ablations re-run on 260046945: the table above holds on the final head.
  • origin/main moved to c2bb879fe during the round; none of its 43 files overlaps this diff, so main was not merged.

Generated by Claude Code

A fifth MetadataClusterBridgePlugin lane, settings.changed: a settings
write publishes its address (namespace, key, scope, action, time; never a
value) and peers emit their own local settings:changed, so every
subscriber re-reads the shared store. Attaches only where several replicas
are declared over the redis driver. Joins cluster.resync.

Claude-Session: https://claude.ai/code/session_01ADHkmNwiZZUkMiBsD19UEZ
Co-authored-by: Claude <noreply@anthropic.com>
…e settings engine bind

A peer change delivered before the settings service bound its engine would
have every subscriber read the in-memory defaults (check:settings-bind-window).

Claude-Session: https://claude.ai/code/session_01ADHkmNwiZZUkMiBsD19UEZ
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l dependencies Pull requests that update a dependency file 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 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/service-cluster, @objectstack/service-settings, touching 20 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/services/service-settings/vitest.config.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

7 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/concepts/metadata-lifecycle.mdx (via MetadataClusterBridgePlugin (symbol, a top-level class), originNode (symbol, a field of interface ClusterSettingsChangePayload))
  • content/docs/data-modeling/drivers.mdx (via SettingsService (symbol, a top-level class))
  • content/docs/kernel/cluster.mdx (via ClusterSettingsChangePayload (symbol, a top-level interface; a top-level type), MetadataClusterBridgePlugin (symbol, a top-level class), SETTINGS_CHANGE_CLUSTER_CHANNEL (symbol, a top-level const object), SettingsService (symbol, a top-level class), originNode (symbol, a field of interface ClusterSettingsChangePayload), settings.changed (literal, a string literal in SETTINGS_CHANGE_CLUSTER_CHANNEL; a string literal in attachSettingsLane))
  • content/docs/kernel/runtime-services/settings-service.mdx (via setMany (symbol, a method of class SettingsService))
  • content/docs/kernel/services-checklist.mdx (via MetadataClusterBridgePlugin (symbol, a top-level class))
  • content/docs/protocol/kernel/config-resolution.mdx (via SettingsService (symbol, a top-level class), setMany (symbol, a method of class SettingsService))
  • content/docs/protocol/kernel/index.mdx (via SettingsService (symbol, a top-level class))

⛔ 2 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v14.mdx (via setMany (symbol, a method of class SettingsService))
  • content/docs/releases/v18/18-1.mdx (via bindEngine (symbol, a method of class SettingsService))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/services/service-settings/vitest.config.ts) — pages documenting those are invisible to this run
  • 2 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 — 14 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 e253f3ab09717234fedae8e4d7a193cd1a12b0da → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 8c75993bf71d7ea72cb589a9a0da6d5c22ee099c — the merge of head 2600469454ec3e8ff7f063b0260a432708b9e21c into base e253f3ab09717234fedae8e4d7a193cd1a12b0da, 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 8c75993bf71d7ea72cb589a9a0da6d5c22ee099c && git checkout 8c75993bf71d7ea72cb589a9a0da6d5c22ee099c
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e253f3ab09717234fedae8e4d7a193cd1a12b0da 2600469454ec3e8ff7f063b0260a432708b9e21c && git checkout -B drift-repro e253f3ab09717234fedae8e4d7a193cd1a12b0da && git merge --no-ff 2600469454ec3e8ff7f063b0260a432708b9e21c

node scripts/docs-audit/affected-docs.mjs --json e253f3ab09717234fedae8e4d7a193cd1a12b0da

⚠️ 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 e253f3ab09717234fedae8e4d7a193cd1a12b0da → 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

席位 ACCEPT · head 2600469454ec3e8ff7f063b0260a432708b9e21c

#31597 (#3814 F3b, the settings lane). The changeset reads Clause-②: yes (widening) / Metadata-protocol: none, and the paths give no review face. The seat reviewed it at TIER_DEFAULT. Not governed.

  • Lane 5 (attachSettingsLane): it is duck-typed like lanes 1 to 4, so service-cluster takes no runtime dependency on service-settings. It attaches only under declaresMultiReplicaOnRedis (R3), so the single-node default emits exactly what it emitted before, and the split-brain guard is unchanged. It binds at kernel:bootstrapped, after the settings service binds its engine at kernel:ready (check:settings-bind-window). subscribeResync subscribes once, and the handler reads the lane list when it fires, so a lane attached later still resyncs. Shutdown detaches it.
  • The wire carries an address, never a value: originNode, namespace, key, scope, action and time. A receiver drops its own originNode and malformed payloads, emits only its local settings:changed, and never republishes. SettingsService keeps no value cache (checked), so each subscriber's re-read reaches the shared store. A publish failure logs a warning and never fails the write.
  • Resync: resyncSettingsChangePubSub announces every registered namespace locally once (key: '*') after an outage. It is a no-op when the lane is not attached.
  • Names (seat's call): accepted as built. settings.changed, SETTINGS_CHANGE_CLUSTER_CHANNEL, ClusterSettingsChangePayload, and attach/detach/resyncSettingsChangePubSub follow lanes 1 to 4's family.
  • Deviations accepted: (1) the claim said Clause-② no, but the build measured yes (widening: new exports), so the claim is restated on 6731817522; (2) the file surface grew to the channel module, its exports, and a service-cluster devDependency with a vitest alias and lockfile for the lane suite (restated on the same claim); (3) lane 5 binds one phase later than lanes 1 to 4 (reason above); (4) no assignee on the PR.
  • Changeset: patch for both packages, following Metadata-protocol: none. Gate reconcile: 114/114, 0 NOT-MEASURED. Ablations A1 to A6 went red and were restored on the final head.

Landing: once CI is all green, check K, then relay pr_ready + automerge_enable. #31722 (the same bridge file and cluster.mdx §6.2) merges main after this lands.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 9, 2026 04:16
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 9, 2026 04:16
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 01cbbba Nov 9, 2026
69 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-5sumzg branch November 9, 2026 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation size/l 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(cluster): settings changes reach every replica (settings lane) (#3814 F3b)

1 participant