Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/headroom-measurement.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The multipliers are the documented ones (https://platform.claude.com/docs/en/bui

## Variants

The matrix covers `cache` (headroom's default) and `token` modes, lower `--target-ratio` values, `--lossless` and `--no-ccr` (retrieval markers off), and the experimental `--intercept-tool-results` and `--read-maturation` behind their rollout channels. `--variant NAME` (repeatable) selects by name, and an unknown name is an error.
The matrix covers `cache` (headroom's default) and `token` modes, lower `--target-ratio` values, `--lossless` and `--no-ccr` (retrieval markers off), and the experimental `--intercept-tool-results` and `--read-maturation` behind their rollout channels. The matrix is generated, not listed: [combinatrix](https://www.npmjs.com/package/combinatrix) enumerates every combination of those settings that headroom's settings schema accepts, so a rule added to the schema changes the matrix with no edit here, and the rollout channel each experimental feature needs is derived from the schema as the least channel that unlocks it. `--variant NAME` (repeatable) selects by name, and an unknown name is an error.

## Limits

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"@types/node": "^26.5.1",
"@types/picomatch": "^4.0.3",
"@vitest/coverage-v8": "^4.1.12",
"combinatrix": "1.0.0",
"combinatrix": "2.0.1",
"conventional-changelog-conventionalcommits": "^10.4.0",
"esbuild": "^0.28.2",
"eslint": "^10.10.0",
Expand Down
28 changes: 23 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ allowBuilds:

minimumReleaseAgeExclude:
- '@exadev/eslint-config@2.12.1'
- 'combinatrix@1.0.0'
- combinatrix
- trilean

# @semantic-release/release-notes-generator pins conventional-changelog-writer to
# ^8.0.0, which predates the breaking Handlebars-to-render-function template rewrite that conventional-changelog-conventionalcommits@10.x now requires -- without this override, generateNotes silently produces an empty changelog body (just the version header, no Features/Bug Fixes sections). Confirmed upstream: https://github.com/semantic-release/release-notes-generator/issues/992
Expand Down
11 changes: 7 additions & 4 deletions scripts/headroom-measure-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,19 +468,22 @@ export function variantName(settings: Readonly<HeadroomSettings>): string {
return parts.length === 1 && settings.mode === undefined ? `${HEADROOM_DEFAULT_MODE} (default)` : parts.join(", ");
}

/** A list of at least one value, as combinatrix's `choice` takes it: every measured list starts with the unset case, so none is ever empty. */
type NonEmptyList<T> = readonly [T, ...T[]];

/** An optional feature is either left unset or switched on. */
const FEATURE_STATES = [undefined, true];
const FEATURE_STATES: NonEmptyList<boolean | undefined> = [undefined, true];

/** A setting's measured values when its default is the unset case: unset, then every value but the default. */
function unsetOrNonDefault<const V extends string>(values: readonly V[], defaultValue: V): (V | undefined)[] {
function unsetOrNonDefault<const V extends string>(values: readonly V[], defaultValue: V): NonEmptyList<V | undefined> {
return [undefined, ...values.filter((value) => value !== defaultValue)];
}

/** The measured values of each free setting, and the rollout channels a feature may need. */
const MEASURED_MODES = unsetOrNonDefault(HEADROOM_MODES, HEADROOM_DEFAULT_MODE);
const MEASURED_RATIOS = [undefined, ...MEASURED_TARGET_RATIOS];
const MEASURED_RATIOS: NonEmptyList<number | undefined> = [undefined, ...MEASURED_TARGET_RATIOS];
const MEASURED_CCR_MODES = unsetOrNonDefault(HEADROOM_CCR_MODES, HEADROOM_DEFAULT_CCR);
const ROLLOUT_CANDIDATES = [undefined, ...HEADROOM_ROLLOUT_CHANNELS];
const ROLLOUT_CANDIDATES: NonEmptyList<(typeof HEADROOM_ROLLOUT_CHANNELS)[number] | undefined> = [undefined, ...HEADROOM_ROLLOUT_CHANNELS];

/** The most variants the model can hold: the product of every dimension's domain, which no constraint can enlarge. */
const VARIANT_LIMIT = MEASURED_MODES.length * MEASURED_RATIOS.length * MEASURED_CCR_MODES.length * FEATURE_STATES.length ** EXPERIMENTAL_FEATURES.length * ROLLOUT_CANDIDATES.length;
Expand Down
Loading