Skip to content

cli-std: <cli> llm content rots — derive fact sections from in-binary sources of truth and gate the rest (llms.txt becomes generated) - #72

Open
chrischeng-c4 wants to merge 1 commit into
mainfrom
issue/9
Open

chrischeng-c4 wants to merge 1 commit into
mainfrom
issue/9

Conversation

@chrischeng-c4

Copy link
Copy Markdown
Contributor

Closes #9

Summary of Changes

  • crates/cli-std/src/application/llm.rs:
    • Implemented pub fn assert_snapshot_matches(committed: &str, generated: &str, regen_hint: &str) to compare committed documentation snapshots against generated output.
    • Implemented normalize_snapshot helper which normalizes \r\n to \n and ensures a single trailing newline.
    • On mismatch, panics with a message reporting the 1-indexed differing line number and the regeneration hint command.
  • crates/cli-std/src/api/llm.rs:
    • Re-exported assert_snapshot_matches next to assert_topics_render.
    • Updated module doc to describe assert_snapshot_matches.
  • crates/cli-std/src/application/llm/tests.rs:
    • Added unit tests verifying equal strings pass, line-ending and trailing-newline differences pass, and differing lines panic with the line number and hint.
  • crates/cli-std/CONTRIBUTING.md:
    • Added ## CLI llm convention detailing fact-bearing content as TopicSection::Generated, prohibition of hand-written restatement of derivable facts, generated llms.txt gated by assert_snapshot_matches, and mandatory test conformance assertions.

Local Unit Tests Passed

  • cargo test --locked -p cli-std (45 unit tests passed, 7 doc tests passed)
  • cargo test -p service-backup --lib (21 unit tests passed)
  • cargo clippy --locked -p cli-std --all-targets -- -D warnings (clean)
  • cargo fmt --check --package cli-std (clean)
  • cargo doc --locked -p cli-std --no-deps (clean)

Cloud CI Verification Needed (Not Run Locally)

Per confirmed user test policy, functional CLI contracts, server/network/Raft/cluster tests, and end-to-end performance benchmarks are reserved for cloud CI:

  • MR Cloud CI: Affected functional/e2e tests, multi-process integration tests, and performance regression checks.
  • Release Matrix: Full functional and performance acceptance matrix.

…m convention

Add `assert_snapshot_matches` to `cli_std::llm` to compare committed snapshots
against generated content, normalizing line endings and a single trailing
newline. Re-export the helper in `api::llm` and add unit tests. Document the
CLI llm convention in `crates/cli-std/CONTRIBUTING.md`.
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.

cli-std: <cli> llm content rots — derive fact sections from in-binary sources of truth and gate the rest (llms.txt becomes generated)

1 participant