Constraints given twice are a 400, so the record names the one input the worker read
The worker reads one path; with inline constraints and constraints_path both sent, the daemon preferred the path but the record kept the inline list. Two inputs are now refused before anything is written, in the daemon's fixed-text 400 shape, echoing nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0426a7ce3a
commit
16e585d0b9
2 changed files with 3325 additions and 3294 deletions
|
|
@ -1480,6 +1480,30 @@ test("loop asks for the seamless window, and the window is the FBX's frame range
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("constraints given twice are refused before anything is written or spawned", async () => {
|
||||||
|
const daemon = await startDaemon();
|
||||||
|
try {
|
||||||
|
const inline = [{ type: "root2d" }];
|
||||||
|
for (const bad of [
|
||||||
|
{ constraints: inline, constraints_path: "/canary/a.json" },
|
||||||
|
{ constraints: inline, constraintsPath: "/canary/a.json" },
|
||||||
|
{ constraints: "/canary/a.json", constraints_path: "/canary/b.json" },
|
||||||
|
{ constraints_path: "/canary/a.json", constraintsPath: "/canary/b.json" },
|
||||||
|
]) {
|
||||||
|
const answer = await generate(daemon, exportRequest(bad));
|
||||||
|
assert.equal(answer.status, 400, JSON.stringify(bad));
|
||||||
|
assert.deepEqual(answer.body, { ok: false, error: "Invalid constraints request." });
|
||||||
|
assert.ok(!answer.raw.includes("canary"), "the refusal repeated the input");
|
||||||
|
}
|
||||||
|
assert.equal(existsSync(path.join(daemon.stateRoot, "artifacts")), false, "no artifact directory was made");
|
||||||
|
assert.deepEqual(jobFiles(daemon), []);
|
||||||
|
assert.deepEqual(daemon.spawns(), [], "no worker was started");
|
||||||
|
assert.equal((await generate(daemon, exportRequest({ constraints_path: "/some/where.json" }))).status, 200, "one input is fine");
|
||||||
|
} finally {
|
||||||
|
await daemon.stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test("loop is a boolean and needs fbx, refused before anything is written or spawned", async () => {
|
test("loop is a boolean and needs fbx, refused before anything is written or spawned", async () => {
|
||||||
const daemon = await startDaemon();
|
const daemon = await startDaemon();
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -887,6 +887,13 @@ async function generate(request, response) {
|
||||||
bvhStandardTpose: fbx || boolValue(askedTpose),
|
bvhStandardTpose: fbx || boolValue(askedTpose),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// One way to give constraints: the worker reads exactly one path, so two inputs would leave the record naming
|
||||||
|
// constraints that did not make the clip.
|
||||||
|
if ([body.constraints, body.constraints_path, body.constraintsPath].filter((given) => given !== undefined).length > 1) {
|
||||||
|
json(response, 400, { ok: false, error: "Invalid constraints request." });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const bodyMeta = typeof body.meta === "object" && body.meta ? body.meta : {};
|
const bodyMeta = typeof body.meta === "object" && body.meta ? body.meta : {};
|
||||||
const askedSeed = firstDefined(body.seed, bodyMeta.seed);
|
const askedSeed = firstDefined(body.seed, bodyMeta.seed);
|
||||||
if (askedSeed !== undefined && !(Number.isInteger(askedSeed) && askedSeed >= 0 && askedSeed < SEED_LIMIT)) {
|
if (askedSeed !== undefined && !(Number.isInteger(askedSeed) && askedSeed >= 0 && askedSeed < SEED_LIMIT)) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue