Skip to content

Commit cfc3b3d

Browse files
committed
fix(rest): one-holder dataset 409 names no other holder; pin module-address widening
The door's own sentence for an ambiguity narrowed to one admitted holder no longer counts holders or speaks of another package; pins assert the hidden holder is neither named nor implied (body keys, text, counts). The widening is pinned at ?package= and ?callerPackage= a module, both registration orders: the uncontended holder is not a candidate there and is never reached across to. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cz4f7zEQZ2C9GTG382
1 parent 7eae0de commit cfc3b3d

2 files changed

Lines changed: 53 additions & 3 deletions

File tree

‎packages/rest/src/analytics-dataset-admission-order.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,14 @@ export async function admitRefusedDatasetHolders(args: {
249249
// address (a runnable one would have been picked above): the vocabulary's
250250
// ambiguity sentence counts holders and tells the caller to address one,
251251
// which is no remedy here, so the sentence says what stands in the way.
252+
// ⛔ It speaks of that one package and the row only: a holder the caller
253+
// may not query is hidden, so nothing here says or counts that another
254+
// holder exists (no plural, no "other", no "no one package").
252255
const [only] = narrowed.candidates;
253256
const message = ambiguity && narrowed.candidates.length === 1 && only?.kind === 'package'
254-
? `The dataset "${refusal.name}" is held by package "${only.packageId}", and a row of the name that no one `
255-
+ 'package owns stands beside its item, so nothing can be read at its address until that row is saved '
256-
+ 'under one package (ADR-0150 D4).'
257+
? `The dataset "${refusal.name}" cannot be read at package "${only.packageId}": a stored row of the name `
258+
+ 'stands beside that package\'s item and is not saved under it, so nothing is run until the row is '
259+
+ 'saved under a package (ADR-0150 D4).'
257260
: packageScopedRefusalMessage(narrowed);
258261
return {
259262
kind: 'refused',

‎packages/rest/src/analytics-routes.test.ts‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,23 @@ describe('#32501 — the dataset doors at an exact pair address read the package
898898
dimensions: [{ name: 'region', field: 'region', type: 'string' }],
899899
measures: [{ name: 'revenue', aggregate: 'sum', field: 'amount' }],
900900
}, 'name' as never);
901+
/**
902+
* A 409 narrowed to the one module the caller may query neither names nor
903+
* implies the hidden one: the refusal carries its code and its sentence and
904+
* nothing else (no candidates, no reason, no details), and the sentence
905+
* counts no holders and speaks of no other, both, each or "no one" package.
906+
*/
907+
const hiddenHolderNotImplied = (answer: Awaited<ReturnType<typeof both>>, where: string) => {
908+
const single = JSON.parse(answer.single.text);
909+
const entry = JSON.parse(answer.batch.text);
910+
expect(Object.keys(single).sort(), where).toEqual(['code', 'message']);
911+
expect(Object.keys(entry).sort(), where).toEqual(['error', 'status']);
912+
expect(Object.keys(entry.error).sort(), where).toEqual(['code', 'message']);
913+
for (const message of [answer.single.message, answer.batch.message]) {
914+
expect(message, where).not.toMatch(/\b\d+\s+(packages?|holders?)\b/i);
915+
expect(message, where).not.toMatch(/\b(packages|holders|other|another|both|each|either|no one|ambiguous|picks?)\b/i);
916+
}
917+
};
901918
const judgedOverContention = async (query: Record<string, unknown>, what: string) => {
902919
refusedNamingModules(await both(query, admitting(['one_item', 'two_item'])), `${what}, admitted to both`);
903920
for (const [admitted, shown, hidden] of [['one_item', M1, M2], ['two_item', M2, M1]] as const) {
@@ -910,6 +927,7 @@ describe('#32501 — the dataset doors at an exact pair address read the package
910927
expect(answer.batch.message, where).toContain(`package "${shown}"`);
911928
expect(answer.single.text, where).not.toContain(hidden);
912929
expect(answer.batch.text, where).not.toContain(hidden);
930+
hiddenHolderNotImplied(answer, where);
913931
}
914932
const none = await both(query, admitting([]));
915933
const missing = await both(query, admitting([]), 'nowhere');
@@ -941,6 +959,35 @@ describe('#32501 — the dataset doors at an exact pair address read the package
941959
}
942960
});
943961

962+
// At a module's own address the uncontended holder is not a candidate: the
963+
// read refuses that module's name over the two modules only, so the widening
964+
// never reaches across to it. Running alpha there would be a pick at a
965+
// module's exact address; the caller admitted to alpha alone is answered what
966+
// a missing name answers, and one admitted beside a module is refused naming
967+
// that module alone. BASE (`main` ba35dfd78): 503 in every cell.
968+
it.each([['alpha first', [A, M1, M2]], ['alpha last', [M2, M1, A]]] as const)('[#32948] plugin-wired admission (%s): at a module\'s address the uncontended holder is not reached across to — alpha alone answers the missing name, alpha with a module refuses naming that module alone (BASE: 503)', async (_order, order) => {
969+
boot(order, true);
970+
contendingRow();
971+
for (const [query, what] of [[{ package: M1 }, '?package= a module'], [{ callerPackage: M2 }, '?callerPackage= a module']] as const) {
972+
const alone = await both(query, admitting(['alpha_item']));
973+
const missing = await both(query, admitting(['alpha_item']), 'nowhere');
974+
expect([alone.single.status, alone.single.code, alone.single.ran], `${what}, alpha only`).toEqual([404, 'NOT_FOUND', []]);
975+
expect(alone.single.text, `${what}, alpha only`).toBe(missing.single.text.replace(/nowhere/g, 'sales'));
976+
expect([alone.batch.status, alone.batch.entry, alone.batch.ran], `${what}, alpha only`).toEqual([200, 404, []]);
977+
expect(alone.batch.text, `${what}, alpha only`).toBe(missing.batch.text.replace(/nowhere/g, 'sales'));
978+
const beside = await both(query, admitting(['alpha_item', 'one_item']));
979+
const where = `${what}, alpha and one`;
980+
expect([beside.single.status, beside.single.code, beside.single.ran], where).toEqual([409, 'RESOURCE_CONFLICT', []]);
981+
expect([beside.batch.status, beside.batch.entry, beside.batch.code, beside.batch.ran], where).toEqual([200, 409, 'RESOURCE_CONFLICT', []]);
982+
for (const answer of [beside.single, beside.batch]) {
983+
expect(answer.message, where).toContain(`package "${M1}"`);
984+
expect(answer.text, where).not.toContain(A);
985+
expect(answer.text, where).not.toContain(M2);
986+
}
987+
hiddenHolderNotImplied(beside, where);
988+
}
989+
});
990+
944991
it.each([['one first', [M1, M2]], ['two first', [M2, M1]]] as const)('[#32948] CONTROL (%s): a package-less row beside the two modules is declined at each module\'s address, so the App pair is judged over the modules as with no row, before and after', async (_order, order) => {
945992
boot(order);
946993
registry.registerItem('dataset', {

0 commit comments

Comments
 (0)