Skip to content

refactor(skills): extract shared MERGE_SYSTEM_PROMPT and build_merge_messages#4861

Merged
bug-ops merged 3 commits into
mainfrom
merge-system-prompt-dry
Jun 5, 2026
Merged

refactor(skills): extract shared MERGE_SYSTEM_PROMPT and build_merge_messages#4861
bug-ops merged 3 commits into
mainfrom
merge-system-prompt-dry

Conversation

@bug-ops

@bug-ops bug-ops commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • MERGE_SYSTEM_PROMPT and the merge_prompt format block were duplicated verbatim in miner.rs (lines 35–41, 391–397) and trace_extractor.rs (lines 78–84, 477–483).
  • New pub(crate) module crates/zeph-skills/src/merge_prompts.rs provides a single MERGE_SYSTEM_PROMPT constant and a build_merge_messages() helper that both callers now share.
  • No behavioral change — pure DRY refactor.

Changes

  • crates/zeph-skills/src/merge_prompts.rs — new module with MERGE_SYSTEM_PROMPT const, build_merge_messages() helper, and 3 unit tests.
  • crates/zeph-skills/src/lib.rspub(crate) mod merge_prompts; added in alphabetical order.
  • crates/zeph-skills/src/miner.rs — removed local MERGE_SYSTEM_PROMPT const and inline format! + vec![]; replaced with build_merge_messages(...) call.
  • crates/zeph-skills/src/trace_extractor.rs — same.

Test plan

  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace -- -D warnings — clean
  • cargo nextest run --workspace --lib --bins — 10504 passed, 21 skipped

Closes #4857

@github-actions github-actions Bot added refactor Code refactoring without functional changes size/M Medium PR (51-200 lines) skills zeph-skills crate rust Rust code changes labels Jun 5, 2026
@bug-ops bug-ops enabled auto-merge (squash) June 5, 2026 20:02
@bug-ops bug-ops force-pushed the merge-system-prompt-dry branch from e3d497f to bd65fb8 Compare June 5, 2026 20:02
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jun 5, 2026
bug-ops added 3 commits June 5, 2026 22:11
…messages

MERGE_SYSTEM_PROMPT and the merge_prompt format block were duplicated
verbatim in miner.rs and trace_extractor.rs. Extract them into a new
pub(crate) module merge_prompts with a build_merge_messages() helper
that both callers now share. No behavioral change.

Closes #4857
pub(crate) items are unreachable from doc-test context (external crate).
Change the fence from rust to ignore to prevent CI doc-test failures.
@bug-ops bug-ops force-pushed the merge-system-prompt-dry branch from e21a6b2 to 9c6e597 Compare June 5, 2026 20:11
@bug-ops bug-ops merged commit 8c963f0 into main Jun 5, 2026
32 checks passed
@bug-ops bug-ops deleted the merge-system-prompt-dry branch June 5, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation refactor Code refactoring without functional changes rust Rust code changes size/M Medium PR (51-200 lines) skills zeph-skills crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(skills): MERGE_SYSTEM_PROMPT and merge_prompt format duplicated across miner.rs and trace_extractor.rs

1 participant