Skip to content

test: make lean_coding no-preamble test actually pin the guarantee#1648

Merged
ohdearquant merged 1 commit into
feat/agent-lean-coding-profilefrom
test/1554-lean-preamble-guarantee
Jul 3, 2026
Merged

test: make lean_coding no-preamble test actually pin the guarantee#1648
ohdearquant merged 1 commit into
feat/agent-lean-coding-profilefrom
test/1554-lean-preamble-guarantee

Conversation

@ohdearquant

Copy link
Copy Markdown
Owner

Summary

test_system_message_no_lion_preamble (added on this branch, PR #1545) was vacuously true: it compared the variable name "LION_SYSTEM_MESSAGE" (a string literal) against build_system_message() output, and build_system_message() never includes the LION preamble regardless of lion_system anyway — the preamble is only prepended inside create_agent() (lionagi/agent/factory.py). The test would pass unconditionally, whether or not the factory-level guard actually worked.

  • Replaced it with test_lean_coding_no_lion_preamble_at_runtime, which drives a lean_coding spec through create_agent(spec, load_settings=False) (same pattern already used by test_create_agent_system_prompt_without_lion_system in tests/agent/test_factory.py) and asserts the rendered system message excludes LION_SYSTEM_MESSAGE.
  • No source changes — the guarantee itself (create_agent checking spec.lion_system before prepending) was already correct; only the test was broken.

Base is feat/agent-lean-coding-profile (PR #1545, draft) since that's where AgentSpec.lean_coding() and this test currently live — lean_coding is not yet on main.

Closes #1554

Test plan

  • pytest tests/agent/test_spec.py — 62 passed
  • pytest tests/agent/ (full directory) — 197 passed
  • ruff check — clean
  • Red-green: temporarily forced the preamble branch in factory.py locally (if spec.lion_system:if True:) — new test failed as expected; reverted, confirmed green again. Change never committed.

🤖 Generated with Claude Code

test_system_message_no_lion_preamble compared a hardcoded string literal
against build_system_message() output, but build_system_message() never
includes the LION preamble regardless of lion_system — the preamble is
only prepended inside create_agent(). The test always passed whether or
not the factory-level guard actually worked.

Replace it with test_lean_coding_no_lion_preamble_at_runtime, which drives
a lean_coding spec through create_agent() (load_settings=False) and
asserts the rendered system message excludes LION_SYSTEM_MESSAGE. Verified
red by temporarily forcing the preamble branch in factory.py locally,
then reverting once the failure was observed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ohdearquant ohdearquant merged commit 329e157 into feat/agent-lean-coding-profile Jul 3, 2026
@ohdearquant ohdearquant deleted the test/1554-lean-preamble-guarantee branch July 3, 2026 16:54
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