fix: --show-config stops flagging documented [session] persist as an unknown TOML key (gh #112) - #115
Merged
Merged
Conversation
…own (gh #112) langstage-core 1.0.32 added unknown-TOML-key detection surfaced in --show-config. persist is resolved out-of-band by _resolve_persist and is deliberately NOT a CodeConfig dataclass field, so the detector wrongly listed the documented, honored `session.persist` under "unknown TOML keys" — in the same output that attributes `persist = ... [toml (session.persist)]` to it. Register `session.persist` in CodeConfig._TOML's known-key set (a map entry, not a field). resolve()/describe()/config_dict() iterate dataclass fields, so this neither creates a phantom field nor double-renders persist; persist stays resolved and rendered out-of-band exactly as before. A [session] passthrough would have silenced the whole table and hidden real typos, so this registers the single dotted key instead — a typo like [session] perssist or [bogus] x is still flagged. Adds regression tests: [session] persist = true shows no unknown-key warning, while [session] perssist / [bogus] x are still flagged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011HWCfJii6gXd3XL3Gq3W8B
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #112.
langstage-cli --show-configcontradicted itself about[session] persist: in one run it listedsession.persistunder "unknown TOML keys (ignored - a typo or wrong table?)" and, one line later, attributedpersist = ... [toml (session.persist)]to that same key.[session] persistis a documented key (README: disable persistence with[session] persist = false) and it is honored — so the "unknown/typo/ignored" warning is a false positive on the very diagnostic verb a user runs to trust their config.Root cause
langstage-core1.0.32 added unknown-TOML-key detection (HostConfig.unknown_toml_keys()), which flags any TOML key that maps to no config field.persistis resolved out-of-band bycli._resolve_persist(flag >LANGSTAGE_PERSIST>[session] persist> default-on) and rendered by its own--show-configblock (gh #102/#108), so it is deliberately not aCodeConfigdataclass field — hence absent from_toml_map()and false-flagged.The fix
Register the dotted key
session.persistinCodeConfig._TOML's known-key set. This is a map entry, not a dataclass field — core'sresolve()/describe()/config_dict()all iterate dataclass fields, so this adds no phantom field and does not double-renderpersist; it stays resolved and rendered out-of-band exactly as before.A
_TOML_PASSTHROUGH[session]table was rejected on purpose: it would silence the whole table and hide real typos. Registering the single key keeps the detector honest — a typo like[session] perssist(or any unknown table[bogus] x) is still flagged.Verification
langstage.toml[session] persist = falsepersist = False [toml (session.persist)][session] perssist = true[bogus] x = 1Tests
check+format --checkclean.tests/test_show_config.py: documented[session] persistshows no unknown-key warning; typo'd[session] perssistand[bogus] xare still flagged.🤖 Generated with Claude Code
https://claude.ai/code/session_011HWCfJii6gXd3XL3Gq3W8B