Skip to content

refactor: PR #1966 cleanup — consolidate text, tree-sitter, add README, group Agent fields, add state tests#1972

Merged
bug-ops merged 7 commits intomainfrom
batch-1967-1971
Mar 18, 2026
Merged

refactor: PR #1966 cleanup — consolidate text, tree-sitter, add README, group Agent fields, add state tests#1972
bug-ops merged 7 commits intomainfrom
batch-1967-1971

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 18, 2026

Summary

Batch refactoring to address 5 follow-up issues from PR #1966 (structural code organization):

  1. refactor: consolidate truncate_chars between zeph-core and zeph-common #1967 — Consolidate truncate_chars duplication between zeph-core and zeph-common

    • Added zeph-common as zeph-core dependency
    • Deleted zeph-core::text.rs (identical to zeph-common version)
    • Re-exported via pub use zeph_common::text
    • All 13+ call sites continue working
  2. refactor: reduce tree-sitter query duplication between zeph-tools and zeph-index #1968 — Reduce tree-sitter query duplication between zeph-tools and zeph-index

    • Extracted 5 shared symbol query constants to zeph-common::treesitter
    • Added compile_query + lang_for_ext helpers to zeph-common
    • Feature-gated behind optional treesitter feature to avoid heavy deps
    • zeph-tools and zeph-index now import from shared source
    • Lang enum and method queries remain in zeph-index
  3. chore: add missing README.md for zeph-common crate #1969 — Add missing README.md for zeph-common crate

  4. refactor: group remaining loose Agent fields into sub-structs #1971 — Group remaining loose Agent fields into sub-structs

    • Created FeedbackState { detector, judge }
    • Moved rate_limiter into existing RuntimeConfig
    • ~30 call sites updated across agent/{mod,builder,tool_execution}
    • Leaves focus/sidequest as loose fields (self-contained modules, feature complexity avoided)
  5. refactor: add unit tests for agent state sub-structs #1970 — Add unit tests for agent state sub-structs

    • New tests/agent/state/tests.rs with construction, Default, and field access tests
    • InstructionState, ExperimentState, CompressionState, MessageState, SessionState, RuntimeConfig (with rate_limiter), FeedbackState
    • +33 tests (6127 → 6160)
    • Feature-gated tests verify both experiments and context-compression paths

Test Results

  • ✅ 6160 tests pass (cargo nextest --features full)
  • ✅ Clippy clean with --features full
  • ✅ Nightly fmt clean

Implementation Notes

  • Single PR for all 5 issues (small related refactoring, avoids churn)
  • 7 commits: 5 per issue + style/fmt + changelog
  • Layered architecture preserved
  • No public API changes
  • All critic recommendations implemented and verified

bug-ops added 7 commits March 18, 2026 18:53
…#1967

Add zeph-common as zeph-core dependency, delete duplicate text.rs,
re-export via pub use zeph_common::text so existing crate::text:: paths
remain valid.
…esitter' feature — closes #1968

Add zeph-common::treesitter module with 5 shared symbol query constants
(RUST/PYTHON/JS/TS/GO_SYM_Q), compile_query helper, and lang_for_ext.
Feature-gated behind 'treesitter'. zeph-tools and zeph-index now import
from zeph-common::treesitter instead of maintaining their own copies.
Lang enum and method queries remain in zeph-index.
…e rate_limiter into RuntimeConfig — closes #1971

Add FeedbackState { detector, judge } grouping feedback_detector and
judge_detector. Move rate_limiter into RuntimeConfig alongside other
runtime policy fields. Update all ~30 call sites across mod.rs,
builder.rs, and tool_execution/native.rs.
…1970

Add agent/state/tests.rs with construction and field access tests for
InstructionState, ExperimentState, MessageState, SessionState,
RuntimeConfig (including rate_limiter), FeedbackState, and
CompressionState (#[cfg(feature = "context-compression")]).
ExperimentState has cfg-gated field tests behind #[cfg(feature = "experiments")].
Tests pass both without extra features (1940 tests) and with
experiments,context-compression (2098 tests).
@github-actions github-actions bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate dependencies Dependency updates refactor Code refactoring without functional changes size/XL Extra large PR (500+ lines) labels Mar 18, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 18, 2026 18:20
@bug-ops bug-ops merged commit 9ce7a24 into main Mar 18, 2026
24 checks passed
@bug-ops bug-ops deleted the batch-1967-1971 branch March 18, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate dependencies Dependency updates documentation Improvements or additions to documentation refactor Code refactoring without functional changes rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

1 participant