Harden the Revit assignment plan against missing objects and huge plans

- The command repository rejects user plans that link objects missing in
  the latest import, so the generic command route cannot bypass the rule.
- The plan schema limits the total number of objects to 10,000.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Julian Appel 2026-10-30 21:51:07 +01:00
parent 191455c745
commit fd7dcbb100
4 changed files with 56 additions and 2 deletions

View file

@ -184,6 +184,14 @@ describe("Revit assignment plan route", () => {
400
);
assert.equal((await call("POST", path, user, { ...plan(circuitListId), rows: [] })).status, 400);
const tooManyObjects = Array.from({ length: 10 }, (_, row) => ({
kind: "new-row",
circuitId: "c",
objectIds: Array.from({ length: 1001 }, (_, index) => `o-${row}-${index}`),
}));
const oversized = await call("POST", path, user, { ...plan(circuitListId), rows: tooManyObjects });
assert.equal(oversized.status, 400);
assert.match(await oversized.text(), /höchstens 10000 Revit-Objekte/);
});
it("rejects a circuit list of another project and unknown objects", async () => {