Skip to content

Commit c6558d0

Browse files
fix(metadata-protocol): the storage-sync-refused notice names no door (#35432)
<!-- claude-projects-attribution: {"github_login":"os-bill"} --> _Requested by **Bill** · [project thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wgPKDiLo5gfWzDLyAK6J6UjZ)_ Fixes #32958 Clause-②: no Metadata-protocol: none ## 维护者速读 1. 用户能看到什么变化:管理员在回滚、撤销提交或发布对象后,若数据库没能跟上对象结构,看到的警告不再说"这次保存"、也不再叫人"重新发布",而是给出在任何入口都管用的补救办法(重启服务,或再次正式写入该对象)。 2. 为什么做:删除对象扩展后存量数据未重算那张卡的剩余一项,提示文字在保存以外的入口上说错了话。 3. 出错会怎样:只是警告文字变化,规则编号和严重级别不变,最坏情况是措辞不顺,直接回滚即可。 4. 要你做什么:无,席位落地。 ## 席位核对 ### What changes - `objectStorageSyncRefusedNotice` (`packages/metadata-protocol/src/protocol-registry-hydration.ts`), that function only: message says "is registered and served" and "the columns this change added"; hint says to run the storage sync again: a restart, or the next live write of the object. Rule id, severity, `where`, `path` and the driver-reason quoting rule are unchanged. - Read first: that function; then the new pin file; then the one added assertion in `protocol.revert-commit-honest-outcome.test.ts`. ### Premise readings at origin/main 7ece020 - A1 holds: the message said "was saved and is served ... this save added"; the hint said "publish the object again". - A2: one builder. Callers that put its value on an answer: `saveMetaItem` publish mode (`protocol-save.ts`), `runPublishSideEffects` (`publishMetaItem`, `publishPackageDrafts`), `rollbackMetaItemUnaudited` and `revertCommit` (`protocol-package-commits.ts`). Callers that discard it: remote mutation apply (`protocol-class-head.ts`), batch object registration. The delete door (`deleteMetaItem`, `protocol-diff-delete-load.ts`) does not run the sync and does not raise this notice (it calls `fillStoredExpressionChange` without `storageRefused`), so the dispatch's "it also rides the delete door's answer" did not hold on this tree. - A3: no server test pinned the notice's wording; `protocol.publish-side-effects-canonical-type.test.ts` pins "publish the object again" on the separate `console.error` line (left alone, outside the fence). Two `ui/` tests carry a hand-written copy of the old text as fixture data; they parse nothing from the server. - A4: the save door in publish mode runs `ensureObjectStorage` on every live write, and rollback and revert run it too; a restart syncs every registered object. So both named remedies work from every door that raises it. "Publish again" was true only by way of the save door, so it is no longer named. ### Tests - New `protocol.storage-sync-refused-notice-wording.test.ts`: the notice names no save and no publish; CONTROL: it still names the object, the failure and both remedies. - `protocol.revert-commit-honest-outcome.test.ts`: the revert door's advisory equals the builder's value, whole, and names no save or publish. - Ablation (committed fix, `scripts/ablation-replace.mjs`, source import so no build): "this change added" back to "this save added" landed (anchor 1 to 0, blob 445e3e1 to 2753623b), 2 failed / 31 passed; restored to blob 445e3e1, `git diff HEAD` empty. <details><summary>Verification at a171c69</summary> - `pnpm --filter @objectstack/metadata-protocol test`: Test Files 359 passed, 9 skipped (368); Tests 23228 passed, 45 skipped. Lock VERDICT command-exit 0. - `pnpm --filter @objectstack/metadata-protocol typecheck` (tsc --noEmit, includes src test files): exit 0. - `dispatch-gates --commands` (68 commands): 66 exit 0 locally. `check:dual-build-cjs-loads` exit 3, NOT MEASURED (needs the whole workspace built), left to CI. `check:lean-entry-closure` exit 3 before the closure build, exit 0 after it. `check:test-source-alias` was red on the new file and is green after the module-top lint import. - `overlap-check --branch=HEAD`: VERDICT clean exit 0. </details> ### Acceptance notes - The delete door does not raise this notice, so nothing changed there. - Not changed, outside the fence: the operator-facing `console.error` line in `ensureObjectStorage` still says "was published" and "publish the object again". It is a server log line, not an answer, and a test pins it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Utp6CbP6iSEGkWb5fn8yqd Co-authored-by: Claude <noreply@anthropic.com>
1 parent a5ddeb6 commit c6558d0

4 files changed

Lines changed: 68 additions & 4 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
---
4+
5+
fix(metadata-protocol): the `object-storage-sync-refused` advisory reads true on every door that raises it
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The warning a refused storage sync puts on the answer is raised by the save, publish, rollback and revert doors, but its text spoke of "this save" and told every caller to "publish the object again". It now names no door ("the columns this change added"), and its hint names the remedies that work from each of them: restarting the server, or the next live write of the object, both of which run the storage sync again. The rule id, severity and the quoted driver reason are unchanged.

‎packages/metadata-protocol/src/protocol-registry-hydration.ts‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2519,6 +2519,11 @@ export function publishedColumnChangesNotAppliedNotice(
25192519
* `status`), the rule every report riding a 2xx on these doors follows
25202520
* ({@link clientFacingFailureText}); any other failure is named as being in
25212521
* the server log, where the `error` line carries it whole.
2522+
*
2523+
* [#32958] The text names no door: the save, publish, rollback and revert
2524+
* doors all raise it, so it says "this change" and its hint names only the
2525+
* remedies that work from each of them (a restart, or the next live write of
2526+
* the object, both of which run the sync again).
25222527
*/
25232528
export function objectStorageSyncRefusedNotice(name: string, err: unknown): RuntimeAuthoringIssue {
25242529
const reason = clientFacingFailureText(err, 'the reason is in the server log');
@@ -2528,12 +2533,12 @@ export function objectStorageSyncRefusedNotice(name: string, err: unknown): Runt
25282533
where: `object "${name}"`,
25292534
path: '',
25302535
message:
2531-
`object '${name}' was saved and is served, but its storage was NOT created or altered: `
2536+
`object '${name}' is registered and served, but its storage was NOT created or altered: `
25322537
+ `the datasource refused its schema sync (${reason}). Until the sync runs, reads and writes `
2533-
+ 'against it fail, or miss the columns this save added.',
2538+
+ 'against it fail, or miss the columns this change added.',
25342539
hint:
2535-
"Resolve the datasource's refusal, then publish the object again (which re-runs the sync), "
2536-
+ 'or restart the server, which syncs the storage of every registered object.',
2540+
"Resolve the datasource's refusal, then run the storage sync again: restarting the server syncs "
2541+
+ 'the storage of every registered object, and so does the next live write of this object.',
25372542
};
25382543
}
25392544

‎packages/metadata-protocol/src/protocol.revert-commit-honest-outcome.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
assertEngineFindOnePredicate,
3838
} from '@objectstack/metadata-core';
3939
import { ObjectStackProtocolImplementation } from './protocol.js';
40+
import { objectStorageSyncRefusedNotice } from './protocol-registry-hydration.js';
4041
// The object plane reaches `@objectstack/lint` only through a dynamic import; paid
4142
// here at module scope so the first load lands during collection, not inside a
4243
// clocked window (`pnpm check:test-source-alias`).
@@ -319,6 +320,11 @@ describe('[#33563] revertCommit reports a fault after an item\'s row write in fa
319320
expect(res.failed[0].error).toContain('its row was restored to the body of version 1');
320321
expect(res.failed[0].error).toContain("'object-storage-sync-refused' advisory");
321322
expect((res.advisories ?? []).map((a: any) => a.rule)).toContain('object-storage-sync-refused');
323+
// [#32958] The revert door answers the one builder's notice, whole: no
324+
// copy of its own, so the builder's door-neutral text is what it says.
325+
const notice = (res.advisories ?? []).find((a: any) => a.rule === 'object-storage-sync-refused');
326+
expect(notice).toEqual(objectStorageSyncRefusedNotice('ticket', new Error('the datasource is read-only')));
327+
expect(`${notice.message} ${notice.hint}`).not.toMatch(/\bsave|\bpublish/i);
322328
expect(storedLabel(rows)).toBe('Ticket');
323329
});
324330

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* [#32958] The `object-storage-sync-refused` notice reads true on every door
5+
* that raises it.
6+
*
7+
* One builder ({@link objectStorageSyncRefusedNotice}) serves the save door,
8+
* `publishMetaItem` and `publishPackageDrafts` (through `runPublishSideEffects`),
9+
* `rollbackMetaItem` and `revertCommit`. Its text used to speak of "this save"
10+
* and tell a caller of rollback or revert to "publish the object again". It
11+
* now names no door, and its hint names only the remedies that work from each
12+
* of them: a restart, or the next live write of the object.
13+
*
14+
* The door half (the revert door's advisory is this builder's value, whole)
15+
* is pinned beside its existing case in
16+
* `protocol.revert-commit-honest-outcome.test.ts`.
17+
*/
18+
19+
import { describe, expect, it } from 'vitest';
20+
import { OBJECT_STORAGE_SYNC_REFUSED, objectStorageSyncRefusedNotice } from './protocol-registry-hydration.js';
21+
// The source reaches `@objectstack/lint` only through a dynamic import; paid
22+
// here at module scope so the first load lands during collection, not inside a
23+
// clocked window (`pnpm check:test-source-alias`).
24+
import '@objectstack/lint';
25+
26+
describe('[#32958] the storage-sync-refused notice names no door', () => {
27+
const notice = objectStorageSyncRefusedNotice('ticket', new Error('the datasource is read-only'));
28+
const text = `${notice.message}\n${notice.hint}`;
29+
30+
it('speaks of no save and no publish, so a rollback, revert or publish answer reads true', () => {
31+
expect(notice.rule).toBe(OBJECT_STORAGE_SYNC_REFUSED);
32+
expect(text).not.toMatch(/\bsave/i);
33+
expect(text).not.toMatch(/\bpublish/i);
34+
});
35+
36+
it('CONTROL: it still says what failed and names the remedies (restart, the next live write)', () => {
37+
expect(notice.severity).toBe('warning');
38+
expect(notice.message).toContain("object 'ticket'");
39+
expect(notice.message).toContain('its storage was NOT created or altered');
40+
expect(notice.hint).toContain('restarting the server');
41+
expect(notice.hint).toContain('next live write of this object');
42+
});
43+
});

0 commit comments

Comments
 (0)