feat(skl,cml): --context-window auto model→window probe (v5.12 B8b) [skip-docs]
Completes the deferred B8 half. `--context-window auto` now probes the configured model and calibrates SKL/CML budgets to its real window instead of always falling back to the conservative advisory anchor. - lib/context-window.mjs: pure modelToContextWindow() maps known 1M-tier model IDs (Fable 5, Opus 4.8/4.7/4.6, Sonnet 4.6 — verified June 2026 — plus the explicit [1m] tier tag, dated/provider-prefixed IDs, and the opus/sonnet/fable aliases) to the 1M window; unknown/unconfirmed -> null (caller keeps the conservative anchor). resolveContextWindow() auto branch now probes opts.model: recognized -> auto-probed (not advisory); unknown or unpinned -> auto-unresolved (advisory, pre-B8b behavior). - lib/active-model.mjs (new): resolveActiveModel() reads the model the way Claude Code resolves it — shell ANTHROPIC_MODEL override, then settings cascade local > project > user. Injectable env, hermetic under test HOME. - scan-orchestrator: resolves the active model only when the flag is `auto` and threads it into resolveContextWindow; posture inherits via runAllScanners. Default (no flag) and explicit --context-window <n> paths ignore the model and stay byte-stable; frozen v5.0.0 + SC-5 snapshots untouched. TDD: 17 new tests (context-window mapping/probe + active-model cascade). Suite 1296 green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ad1eceb76a
commit
cf75249b5e
5 changed files with 308 additions and 8 deletions
|
|
@ -15,6 +15,7 @@ import { discoverConfigFiles, discoverConfigFilesMulti, discoverFullMachinePaths
|
|||
import { loadSuppressions, applySuppressions, formatSuppressionSummary } from './lib/suppression.mjs';
|
||||
import { humanizeEnvelope } from './lib/humanizer.mjs';
|
||||
import { resolveContextWindow } from './lib/context-window.mjs';
|
||||
import { resolveActiveModel } from './lib/active-model.mjs';
|
||||
|
||||
// Scanner registry — import order determines execution order
|
||||
import { scan as scanClaudeMd } from './claude-md-linter.mjs';
|
||||
|
|
@ -98,7 +99,13 @@ export async function runAllScanners(targetPath, opts = {}) {
|
|||
// B8 — resolve the context window once and thread it to budget-aware scanners
|
||||
// (SKL, CML). Undefined opts.contextWindow → conservative 200k anchor, which is
|
||||
// byte-identical to the pre-B8 default; other scanners ignore the third arg.
|
||||
const contextWindow = resolveContextWindow(opts.contextWindow);
|
||||
// B8b — `--context-window auto` probes the configured model (settings cascade /
|
||||
// ANTHROPIC_MODEL) so a 1M-tier host self-calibrates; unknown/unpinned → advisory.
|
||||
let probedModel = null;
|
||||
if (String(opts.contextWindow ?? '').trim().toLowerCase() === 'auto') {
|
||||
probedModel = await resolveActiveModel(resolvedPath, { env: process.env });
|
||||
}
|
||||
const contextWindow = resolveContextWindow(opts.contextWindow, { model: probedModel });
|
||||
|
||||
// Shared file discovery — scanners reuse this
|
||||
let discovery;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue