Complete M16 action select circle parity
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { buildTaskContext } from "../../../tools/web/task-context-lib.mjs";
|
||||
import { buildTaskContext, CONTEXT_LIMITS } from "../../../tools/web/task-context-lib.mjs";
|
||||
import { validateContextBundle } from "../../../tools/web/context-governance.mjs";
|
||||
|
||||
test("current context satisfies document, task-card, and pointer budgets", () => {
|
||||
const bundle = buildTaskContext();
|
||||
const result = validateContextBundle(bundle);
|
||||
assert.deepEqual(result.violations, []);
|
||||
assert.ok(result.report.totalTokens <= 3500);
|
||||
assert.ok(result.report.estimatedContextTokens <= CONTEXT_LIMITS.contextTokens);
|
||||
assert.ok(result.report.serializedContextTokens <= CONTEXT_LIMITS.contextEnvelopeTokens);
|
||||
});
|
||||
|
||||
test("task cards cannot smuggle full plans or history into the default context", () => {
|
||||
@@ -45,3 +46,13 @@ test("governance rejects forged selection totals and unaudited exclusions", () =
|
||||
assert.ok(result.violations.some(({ code }) => code === "INPUT_EXCLUSION_REASON_UNKNOWN"));
|
||||
assert.ok(result.violations.some(({ code }) => code === "INPUT_SELECTION_ENTRY_INVALID"));
|
||||
});
|
||||
|
||||
test("governance reports a serialized context envelope that exceeds its reserved budget", () => {
|
||||
const bundle = buildTaskContext();
|
||||
const oversized = {
|
||||
...bundle,
|
||||
context: { ...bundle.context, commands: ["node "+"x".repeat(6000)] },
|
||||
};
|
||||
const result = validateContextBundle(oversized);
|
||||
assert.ok(result.violations.some(({ code }) => code === "CONTEXT_ENVELOPE_OVER_BUDGET"));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user