Repository navigation
test(core): add unit tests for computeTierDemand and allocateTiers (fixes #447) - #459
Conversation
|
Reviewed head The 73-line test-only diff covers #447's demand sums, floor/ceiling allocation, hard-demand admission, missing tier, inverted policy, and zero-budget cases. I compared the assertions with Verification: all five reported checks passed. I inspected build-check-test job 133224839401, including the new file's 8 passing tests and the successful check job. This is implementation/diff and CI-log review, not an independent local rerun; I did not reproduce the reported mutation test or local environment/type errors. No other submitted review or unresolved review thread was present. Automated merge remains withheld because branch-protection detail reads return 403 to this integration, so required merge policy cannot be fully verified. No rerun or merge was initiated. |
Fixes #447.
Test-only PR, no source changes. Adds
packages/coding-agent/test/context-budget-v2-tiers.test.ts(8 vitest cases) forcomputeTierDemand/allocateTiersincore/context-budget-v2-tiers.ts:computeTierDemand: empty plan gives zeros; system sum (demand 150 / hard 100)allocateTierswith available=1000 andDEFAULT_TIER_POLICY_V2: system {floor 250, ceiling 450, allocated 150}; history soft demand capped at floor (allocated 100); tools hard demand above ceiling (allocated 200, ceiling 120)Verification: all 8 tests pass locally; bite-check (changing
allocateTiersto ignore hard demand) fails exactly 1 test. Biome check clean on the new file;tsgo --noEmitshows only 2 pre-existing errors in untouched files. Localnpm run checkstops atcheck:dep-tree, a pre-existing environment artifact; CI is the real gate.