From a171c69bee50976e165ee57d6ad16b622917312b Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 19 Nov 2026 08:55:44 +0000 Subject: [PATCH] fix(metadata-protocol): the storage-sync-refused notice names no door The object-storage-sync-refused advisory rides the save, publish, rollback and revert answers; its text no longer speaks of "this save" or tells every caller to publish again. The hint names the remedies that work from each door: a restart, or the next live write of the object. Claude-Session: https://claude.ai/code/session_01Utp6CbP6iSEGkWb5fn8yqd Co-authored-by: Claude --- .../32958-storage-sync-notice-wording.md | 10 +++++ .../src/protocol-registry-hydration.ts | 13 ++++-- ...tocol.revert-commit-honest-outcome.test.ts | 6 +++ ...torage-sync-refused-notice-wording.test.ts | 43 +++++++++++++++++++ 4 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 .changeset/32958-storage-sync-notice-wording.md create mode 100644 packages/metadata-protocol/src/protocol.storage-sync-refused-notice-wording.test.ts diff --git a/.changeset/32958-storage-sync-notice-wording.md b/.changeset/32958-storage-sync-notice-wording.md new file mode 100644 index 00000000000..3ef98e70206 --- /dev/null +++ b/.changeset/32958-storage-sync-notice-wording.md @@ -0,0 +1,10 @@ +--- +'@objectstack/metadata-protocol': patch +--- + +fix(metadata-protocol): the `object-storage-sync-refused` advisory reads true on every door that raises it + +Clause-②: no +Metadata-protocol: none + +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. diff --git a/packages/metadata-protocol/src/protocol-registry-hydration.ts b/packages/metadata-protocol/src/protocol-registry-hydration.ts index 6c4a6af7639..445e3e1a8f8 100644 --- a/packages/metadata-protocol/src/protocol-registry-hydration.ts +++ b/packages/metadata-protocol/src/protocol-registry-hydration.ts @@ -2519,6 +2519,11 @@ export function publishedColumnChangesNotAppliedNotice( * `status`), the rule every report riding a 2xx on these doors follows * ({@link clientFacingFailureText}); any other failure is named as being in * the server log, where the `error` line carries it whole. + * + * [#32958] The text names no door: the save, publish, rollback and revert + * doors all raise it, so it says "this change" and its hint names only the + * remedies that work from each of them (a restart, or the next live write of + * the object, both of which run the sync again). */ export function objectStorageSyncRefusedNotice(name: string, err: unknown): RuntimeAuthoringIssue { const reason = clientFacingFailureText(err, 'the reason is in the server log'); @@ -2528,12 +2533,12 @@ export function objectStorageSyncRefusedNotice(name: string, err: unknown): Runt where: `object "${name}"`, path: '', message: - `object '${name}' was saved and is served, but its storage was NOT created or altered: ` + `object '${name}' is registered and served, but its storage was NOT created or altered: ` + `the datasource refused its schema sync (${reason}). Until the sync runs, reads and writes ` - + 'against it fail, or miss the columns this save added.', + + 'against it fail, or miss the columns this change added.', hint: - "Resolve the datasource's refusal, then publish the object again (which re-runs the sync), " - + 'or restart the server, which syncs the storage of every registered object.', + "Resolve the datasource's refusal, then run the storage sync again: restarting the server syncs " + + 'the storage of every registered object, and so does the next live write of this object.', }; } diff --git a/packages/metadata-protocol/src/protocol.revert-commit-honest-outcome.test.ts b/packages/metadata-protocol/src/protocol.revert-commit-honest-outcome.test.ts index 9c57c09ac6c..605925e7f5e 100644 --- a/packages/metadata-protocol/src/protocol.revert-commit-honest-outcome.test.ts +++ b/packages/metadata-protocol/src/protocol.revert-commit-honest-outcome.test.ts @@ -37,6 +37,7 @@ import { assertEngineFindOnePredicate, } from '@objectstack/metadata-core'; import { ObjectStackProtocolImplementation } from './protocol.js'; +import { objectStorageSyncRefusedNotice } from './protocol-registry-hydration.js'; // The object plane reaches `@objectstack/lint` only through a dynamic import; paid // here at module scope so the first load lands during collection, not inside a // 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 expect(res.failed[0].error).toContain('its row was restored to the body of version 1'); expect(res.failed[0].error).toContain("'object-storage-sync-refused' advisory"); expect((res.advisories ?? []).map((a: any) => a.rule)).toContain('object-storage-sync-refused'); + // [#32958] The revert door answers the one builder's notice, whole: no + // copy of its own, so the builder's door-neutral text is what it says. + const notice = (res.advisories ?? []).find((a: any) => a.rule === 'object-storage-sync-refused'); + expect(notice).toEqual(objectStorageSyncRefusedNotice('ticket', new Error('the datasource is read-only'))); + expect(`${notice.message} ${notice.hint}`).not.toMatch(/\bsave|\bpublish/i); expect(storedLabel(rows)).toBe('Ticket'); }); diff --git a/packages/metadata-protocol/src/protocol.storage-sync-refused-notice-wording.test.ts b/packages/metadata-protocol/src/protocol.storage-sync-refused-notice-wording.test.ts new file mode 100644 index 00000000000..aac437e2ea5 --- /dev/null +++ b/packages/metadata-protocol/src/protocol.storage-sync-refused-notice-wording.test.ts @@ -0,0 +1,43 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * [#32958] The `object-storage-sync-refused` notice reads true on every door + * that raises it. + * + * One builder ({@link objectStorageSyncRefusedNotice}) serves the save door, + * `publishMetaItem` and `publishPackageDrafts` (through `runPublishSideEffects`), + * `rollbackMetaItem` and `revertCommit`. Its text used to speak of "this save" + * and tell a caller of rollback or revert to "publish the object again". It + * now names no door, and its hint names only the remedies that work from each + * of them: a restart, or the next live write of the object. + * + * The door half (the revert door's advisory is this builder's value, whole) + * is pinned beside its existing case in + * `protocol.revert-commit-honest-outcome.test.ts`. + */ + +import { describe, expect, it } from 'vitest'; +import { OBJECT_STORAGE_SYNC_REFUSED, objectStorageSyncRefusedNotice } from './protocol-registry-hydration.js'; +// The source reaches `@objectstack/lint` only through a dynamic import; paid +// here at module scope so the first load lands during collection, not inside a +// clocked window (`pnpm check:test-source-alias`). +import '@objectstack/lint'; + +describe('[#32958] the storage-sync-refused notice names no door', () => { + const notice = objectStorageSyncRefusedNotice('ticket', new Error('the datasource is read-only')); + const text = `${notice.message}\n${notice.hint}`; + + it('speaks of no save and no publish, so a rollback, revert or publish answer reads true', () => { + expect(notice.rule).toBe(OBJECT_STORAGE_SYNC_REFUSED); + expect(text).not.toMatch(/\bsave/i); + expect(text).not.toMatch(/\bpublish/i); + }); + + it('CONTROL: it still says what failed and names the remedies (restart, the next live write)', () => { + expect(notice.severity).toBe('warning'); + expect(notice.message).toContain("object 'ticket'"); + expect(notice.message).toContain('its storage was NOT created or altered'); + expect(notice.hint).toContain('restarting the server'); + expect(notice.hint).toContain('next live write of this object'); + }); +});