Skip to content

fix: --show-config stops flagging documented [session] persist as an unknown TOML key (gh #112) - #115

Merged
dkedar7 merged 1 commit into
mainfrom
fix/112-session-persist-unknown-key
Aug 6, 2026
Merged

dkedar7 merged 1 commit into
mainfrom
fix/112-session-persist-unknown-key

Conversation

@dkedar7

@dkedar7 dkedar7 commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #112. langstage-cli --show-config contradicted itself about [session] persist: in one run it listed session.persist under "unknown TOML keys (ignored - a typo or wrong table?)" and, one line later, attributed persist = ... [toml (session.persist)] to that same key.

[session] persist is 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-core 1.0.32 added unknown-TOML-key detection (HostConfig.unknown_toml_keys()), which flags any TOML key that maps to no config field. persist is resolved out-of-band by cli._resolve_persist (flag > LANGSTAGE_PERSIST > [session] persist > default-on) and rendered by its own --show-config block (gh #102/#108), so it is deliberately not a CodeConfig dataclass field — hence absent from _toml_map() and false-flagged.

The fix

Register the dotted key session.persist in CodeConfig._TOML's known-key set. This is a map entry, not a dataclass field — core's resolve() / describe() / config_dict() all iterate dataclass fields, so this adds no phantom field and does not double-render persist; 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 Before After
[session] persist = false flagged as unknown ❌ not flagged ✓, persist = False [toml (session.persist)]
[session] perssist = true flagged still flagged ✓
[bogus] x = 1 flagged still flagged ✓

Tests

  • Full suite: 176 passed, ruff check + format --check clean.
  • Adds two regression tests in tests/test_show_config.py: documented [session] persist shows no unknown-key warning; typo'd [session] perssist and [bogus] x are still flagged.

🤖 Generated with Claude Code

https://claude.ai/code/session_011HWCfJii6gXd3XL3Gq3W8B

…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
@dkedar7
dkedar7 merged commit 1d959e8 into main Aug 6, 2026
6 checks passed
@dkedar7
dkedar7 deleted the fix/112-session-persist-unknown-key branch August 6, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant