Skip to content

Commit 5ec4b17

Browse files
committed
fix(service-settings): keep the ledger object name inline at its two counted sites
Two gate findings from the derived roster, both on the new code: `check:doc-authoring` — the tracker id had been spelled inside the operator-facing failure string. A runtime string reaches authors and operators, none of whom can resolve `#NNNN`; the id stays in the adjacent source comments, where the reader who can resolve it is already looking. `check:tenant-audit-census` — folding the pre-existing `getSchema` and `insert` spellings onto the new module constant moved a corpus-scale ratchet (inline 109 to 108, const 40 to 41) and a hand-written prose count in `content/docs/permissions/`, a tree this change has no business in. Both spellings are restored verbatim; the constant is used only by the new mount probe, and says why. Claude-Session: https://claude.ai/code/session_01QGMBhvUoyD8t5zY8xHQhnP Co-authored-by: Claude <noreply@anthropic.com>
1 parent d7f6302 commit 5ec4b17

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

‎packages/services/service-settings/src/config-change-audit.ts‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,21 @@ export const CONFIG_CHANGE_OBJECT_NAME = 'sys_setting';
112112
export const CONFIG_CHANGE_ACTION = 'config_change';
113113

114114
/**
115-
* The platform audit ledger this sink writes to.
115+
* The platform audit ledger the mount probe asks about.
116116
*
117117
* Module-local on purpose. `CONFIG_CHANGE_ACTION` and
118118
* `CONFIG_CHANGE_OBJECT_NAME` are published because a host that binds its own
119119
* engine has to be able to reproduce the ROW; the ledger's own name is not part
120-
* of that row and publishing it would widen this module's exported surface for
121-
* nothing. Named rather than spelled inline because three places now depend on
122-
* meaning the same table: the mount probe, the `organization_id` field probe and
123-
* the insert.
120+
* of that row, and publishing it would widen this module's exported surface for
121+
* nothing.
122+
*
123+
* ⛔ The two pre-existing spellings below — the `organization_id` field probe
124+
* and the insert itself — are deliberately left INLINE rather than folded onto
125+
* this constant. They are counted sites in `content/docs/permissions/tenant-audit-census.mdx`
126+
* ("object name spelled inline" vs "named through a const"), so folding them
127+
* moves a corpus-scale ratchet and a hand-written prose count in a docs tree
128+
* this change has no business in. The consolidation is worth doing; it is not
129+
* worth doing here.
124130
*/
125131
const AUDIT_LEDGER_OBJECT_NAME = 'sys_audit_log';
126132

@@ -179,7 +185,7 @@ function makeFieldProbe(engine: IDataEngine): (field: string) => boolean {
179185
// `getSchema` is not on `IDataEngine`; it is an ObjectQL member every
180186
// real engine carries. Guarded rather than declared, so a lean engine
181187
// double stays assignable.
182-
const schema: any = (engine as any).getSchema?.(AUDIT_LEDGER_OBJECT_NAME);
188+
const schema: any = (engine as any).getSchema?.('sys_audit_log');
183189
const declared = schema?.fields;
184190
if (declared && typeof declared === 'object' && !Array.isArray(declared)) {
185191
fields = new Set<string>(Object.keys(declared));
@@ -317,7 +323,7 @@ export function buildConfigChangeAuditSink(
317323
};
318324
if (declares('organization_id')) row.organization_id = entry.tenantId ?? null;
319325

320-
await eng.insert(AUDIT_LEDGER_OBJECT_NAME, row, { context: SYSTEM_CTX });
326+
await eng.insert('sys_audit_log', row, { context: SYSTEM_CTX });
321327
} catch (err: any) {
322328
// Reported once per process, not once per settings write: a failure here
323329
// is systemic (the ledger is mounted but unreachable — DDL never ran,
@@ -333,8 +339,8 @@ export function buildConfigChangeAuditSink(
333339
'until this is fixed (reported once per process). Cause: ' +
334340
detail +
335341
'. Fix: `sys_audit_log` IS registered on this deployment but the insert failed, so this is ' +
336-
'not the un-mounted case (#18368) — confirm the table was provisioned (schema sync) and the ' +
337-
'ledger datasource is reachable. `sys_setting_audit` still carries the settings-specific trail.';
342+
'not the un-mounted case — confirm the table was provisioned (schema sync) and the ledger ' +
343+
'datasource is reachable. `sys_setting_audit` still carries the settings-specific trail.';
338344
try {
339345
// [#18368] The durability channel. The expectation — a host that
340346
// never mounted the ledger — is skipped above and never reaches here,

0 commit comments

Comments
 (0)