fix: le resultat d-une commande de page suit la meme regle que tout le reste

Balayage execute sur les deux proxys apres le correctif precedent : aucun membre
de la vue de collection ne rend plus la cible, mais une commande de page de
l-enveloppe qui rendrait la collection la rendait BRUTE. `nextPage` est declare
`() => void` et ne rend rien aujourd-hui, donc ce n-est pas un defaut vivant -
c-est la meme justification jamais executee, sur l-autre proxy, et c-est
exactement le motif qu-il fallait casser. Elle s-execute toujours ; seul son
retour est tenu a la regle.
This commit is contained in:
Sylvain Duchesne
2026-09-24 19:03:10 +02:00
parent d4b392a119
commit 98e46effc2
3 changed files with 40 additions and 5 deletions
+23
View File
@@ -257,6 +257,29 @@ test("useShape: deleting reaches only what the view shows", async () => {
expect([...(hook.raw() as Iterable<BaseType>)].map((o) => o["@graph"])).toEqual([hers]);
});
// The page commands forward, and their RESULT is held to the same rule as every other
// member. `nextPage` is declared `() => void` and yields nothing today, so this pins the
// RULE rather than a live defect - which is the point: "it returns void" was the written,
// never-executed ground on which `add` was forwarded, and `add` returns the collection.
test("useShape: a page command that handed something back would be refused, not forwarded", async () => {
const base = makeUseShapeHook({ paginated: true });
const leaky: FakeShapeHook = {
...base,
hook: ((shapeType, conf) => ({
...base.hook(shapeType, conf),
nextPage: (): void => base.raw() as undefined,
})) as UseShapeLike,
};
inject(leaky);
const hers = await documentOf("alice");
const his = await documentOf("bob");
base.items.push(noteIn(hers, "a1"), noteIn(his, "b1"));
setCurrentUser("bob");
const result: ShapeResult = useShape(NoteShape, EVERYTHING);
expect(() => result.nextPage?.()).toThrow(/not filtered/i);
});
// -- SAFE FOR A SHAPE NOBODY HAS SEEN --------------------------------------
/** What a later `@ng-org/orm` might hand back: the six members of `alpha.21` plus two