From 2823f34c7daaac5b7a2998e41ea3fa92202b4078 Mon Sep 17 00:00:00 2001 From: dtzp555 Date: Sun, 26 Jul 2026 22:11:45 +1000 Subject: [PATCH] fix(docs,test): restore the dropped Opus 4.8 line; assert the window CEILING MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two review findings from the independent Iron-Rule-10 reviewer, both confirmed before applying: 1. docs/lan-mode.md: the sample `ocp update` output lost `ocp/claude-opus-4-8` entirely — the edit substituted the id instead of inserting the new one, so the block listed 6 bullets while line 219 of the same document claims "7 models available". Self-contradictory. Restored; the block is 7 again. 2. test-features.mjs: "every contextWindow is 200000" was too rigid and contradicted ADR 0009, which states the budget "scales automatically — no code change". Asserting every entry turned that documented no-code-change path into a must-edit-tests path, and would have failed on a future entry with a legitimately SMALLER window. Now asserts the MAX instead: raising the ceiling (the actual hazard, since the budget is global) still fails, while a smaller-window model stays legal. Verified the reformulation is strictly better, not just different: - raise a window to 1000000 -> 2 failures (ceiling + derivePromptCharBudget SPOT) - add a legitimate 128k model -> 452 passed, 0 failed (old test would have failed here) Tests: 452 passed, 0 failed. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_017gbqUZ8HfBZpjjbzQ85oH8 --- docs/lan-mode.md | 1 + test-features.mjs | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/lan-mode.md b/docs/lan-mode.md index 7bb1990..de19cc0 100644 --- a/docs/lan-mode.md +++ b/docs/lan-mode.md @@ -247,6 +247,7 @@ OCP Connect v1.3.0 Provider: ocp Models: • ocp/claude-opus-5 + • ocp/claude-opus-4-8 • ocp/claude-opus-4-7 • ocp/claude-opus-4-6 • ocp/claude-sonnet-5 diff --git a/test-features.mjs b/test-features.mjs index a3a55bc..7ccf82b 100644 --- a/test-features.mjs +++ b/test-features.mjs @@ -4089,15 +4089,18 @@ test("models.json: claude-opus-5 is present in models[] (the entry this PR adds) }); // The prompt-char budget is GLOBAL (max across every entry × 3 chars/token), not -// per-model — see lib/prompt.mjs derivePromptCharBudget. A future entry declaring a -// native 1M window would therefore raise the truncation ceiling for claude-haiku-4-5 -// too (genuinely 200k), turning OCP-side truncation into an upstream API rejection. -// Adding one is a deliberate ADR-level change; this pins the current invariant. -test("models.json: every contextWindow is 200000 (global prompt-budget invariant)", () => { - for (const m of _spotModels.models) { - assert.equal(m.contextWindow, 200000, - `${m.id} declares contextWindow=${m.contextWindow}; a non-200k entry re-scales MAX_PROMPT_CHARS for ALL models (see lib/prompt.mjs)`); - } +// per-model — see lib/prompt.mjs derivePromptCharBudget. An entry declaring a native 1M +// window would therefore raise the truncation ceiling for claude-haiku-4-5 too (genuinely +// 200k), turning OCP-side truncation into an upstream API rejection. +// +// Asserts the MAX, deliberately, not every entry: ADR 0009 states the budget "scales +// automatically — no code change", so a future entry with a SMALLER window (say a 128k +// model) must stay legal and must not fail this suite. Only raising the ceiling is the +// hazard, and that is an ADR-level decision requiring per-model budgets first. +test("models.json: max contextWindow is 200000 (global prompt-budget ceiling)", () => { + const windows = _spotModels.models.map(m => m.contextWindow); + assert.equal(Math.max(...windows), 200000, + `max contextWindow re-scales MAX_PROMPT_CHARS for ALL models incl. the 200k-native haiku (see lib/prompt.mjs + ADR 0009)`); }); test("models.json: every aliases value resolves to a real models[].id (referential integrity)", () => {