Skip to content

format: a log can be made quiet, or full of errors - #35

Merged
donislawdev merged 1 commit into
mainfrom
format/log-level-mix
Sep 1, 2026
Merged

format: a log can be made quiet, or full of errors#35
donislawdev merged 1 commit into
mainfrom
format/log-level-mix

Conversation

@donislawdev

Copy link
Copy Markdown
Owner

Adds level_mix to the log format: realistic, quiet, errors, debug. It decides which severities appear, the way status_mix already decides which response codes do.

tfg generate --format log --size 64kb --set entry_format=plain --set level_mix=quiet

No existing file changes by a byte. The default is realistic, which is the mix these logs have always carried, moved rather than rewritten so the same seed draws the same levels. Checked against a binary built from main: six shapes by three seeds, eighteen of eighteen identical.

The part that is not obvious from the declaration

The chosen set moves the minimum. The shortest entry a shape can write has to leave room for the longest severity it might draw, and quiet draws only INFO, a shorter word than ERROR.

shape realistic quiet
plain 41 B 40 B
json-lines 83 B 82 B

An arithmetic reading the whole vocabulary instead of the set in force would be wrong in the safe direction - a floor the format can beat, announced as if it could not. Neither the size guard nor the determinism guard would ever see that. So longestLevel takes the options, and the guard asks for the announced minimum and for one byte below it rather than repeating the arithmetic itself.

Refusals

Only plain and json-lines carry a severity. Asking for a mix beside one of the other four is refused by a message naming both settings, rather than accepted in silence. The refusal fires on a real choice and not on the key arriving, because a window sends every setting it draws and a value equal to the default was never stated.

What was checked

  • D11 against a main binary: 18 of 18 byte for byte
  • exact size: 36 runs for each of the eight shape and mix pairs
  • the announced minimum is accepted and one byte below it is refused, 8 of 8
  • refusal on the four shapes without a severity, each naming both settings
  • every shape still reachable with every setting sent at its default
  • a value outside the closed set exits 4
  • 26 affected guards green, three of which ask the window itself
  • four new mutations, all caught
  • end to end through a recipe, not only through flags

New guard: TestTheLogSeverityMixIsDrawnAndSetsTheMinimum.

This closes the log format. The two settings still listed as missing have recorded reasons rather than no time behind them: an entry count disagrees with the exact size contract, and a start and end pair cannot work when the run does not know the entry count in advance.

🤖 Generated with Claude Code

Adds level_mix to the log format, with realistic, quiet, errors and debug
to choose from. It decides which severities appear, the way status_mix
already decides which response codes do. The default is realistic, the
mix these logs have always carried, so no existing file changes by a
byte - checked against a binary built from main, six shapes by three
seeds, eighteen of eighteen identical.

Only the plain and json-lines shapes carry a severity, so asking for a
mix beside one of the other four is refused by a message naming both
settings rather than accepted in silence. The refusal fires on a real
choice and not on the key arriving, because a window sends every setting
it draws and a value equal to the default was never stated.

The part that is not obvious from reading the declaration: the chosen
set moves the MINIMUM. The shortest entry a shape can write has to leave
room for the longest severity it might draw, and quiet draws only INFO,
which is a shorter word than ERROR. Measured: plain 41 B against 40,
json-lines 83 against 82. An arithmetic reading the whole vocabulary
instead of the set in force would be wrong in the safe direction - a
floor the format can beat, announced as if it could not - so neither the
size guard nor the determinism guard would ever see it. longestLevel
takes the options for that reason, and the guard asks for the announced
minimum and for one byte below it rather than repeating the arithmetic.

That closes the log format. The two settings still listed as missing
have recorded reasons rather than no time behind them: an entry count
disagrees with the exact size contract, and a start and end pair cannot
work when the run does not know the entry count in advance.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@donislawdev
donislawdev merged commit be8ec6e into main Sep 1, 2026
18 checks passed
@donislawdev
donislawdev deleted the format/log-level-mix branch September 1, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant