Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/32958-storage-sync-notice-wording.md
Original file line number Diff line number Diff line change
@@ -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.
13 changes: 9 additions & 4 deletions packages/metadata-protocol/src/protocol-registry-hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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.',
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`).
Expand Down Expand Up @@ -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');
});

Expand Down
Original file line number Diff line number Diff line change
@@ -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');
});
});
Loading