CultNet TS: the registry's refusal message names the schema id

Stryker left one survivor on 9adea366: emptying the refusal message. For a
same-type claimant the message did not name the schema id at all. It now
names the claimant's schema id in every case, and the refusal test checks
that it does. The message is built from document types and the schema id
only; registration carries no record, so no record value can reach it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-30 17:47:55 +02:00
commit 9f66852d22
2 changed files with 2 additions and 1 deletions

View file

@ -63,7 +63,7 @@ export class CultNetDocumentRegistry {
: undefined;
if (claimed) {
throw new SchemaConflictError(schemaId, [schemaNameForBinding(holder), schemaName], "",
`CultNet ${claimed} is already bound to type "${holder.definition.type}" and cannot also be bound to type "${binding.definition.type}".`);
`CultNet ${claimed} is already bound to type "${holder.definition.type}"; type "${binding.definition.type}" (schema id "${schemaId}") cannot also be bound.`);
}
}
this.#bindings.set(binding.definition.type, binding);

View file

@ -1663,6 +1663,7 @@ test("CultNet document registry binds one type per schema and refuses a second,
assert.equal(error.schemaId, ownerFirst ? schemaId : "id.note");
assert.deepEqual(error.schemaNames, ownerFirst ? names : [...names].reverse());
assert.equal(error.recordKey, "");
assert.ok(error.message.includes(`schema id "${error.schemaId}"`), error.message);
return true;
});
// The refused binding left nothing behind: the schema still resolves to the first type.