Skip to content

refactor: apply conventions across session, permission, tool, and util - #249

Merged
hakula139 merged 6 commits into
mainfrom
refactor/services-conventions
Oct 16, 2026
Merged

hakula139 merged 6 commits into
mainfrom
refactor/services-conventions

Conversation

@hakula139

@hakula139 hakula139 commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Session, permission, tool, and utility code repeated state handling and used inconsistent layouts and test conventions. Shared helpers now own those operations, every session-listing caller uses the typed list_paged(limit, scope) API, and first-prompt titles respect their terminal-column cap for CJK text.

  • Session: group actor batch state, centralize request acknowledgments, walk transcripts through one owner, share sanitization ID collection, derive the persistence byte limit and failure message from one MiB constant, and build listing rows once with named column widths. Consolidate redundant chain and shutdown tests while preserving their behavioral coverage.
  • Permission: share lexical path normalization after checking relative working directories and search-walk decisions, simplify wildcard compilation, and remove references to unimplemented controls. Classifier work remains tracked in Use a cheap model classifier to decide ambiguous calls in auto mode #131.
  • Tools: name create and overwrite modes, share search-root resolution and result markers, make stream trimming explicit, and align test names and fixtures with their contracts.
  • Utilities and file tracking: share mutex recovery and generic plural selection without count conversions, extract snapshot verification, keep tracker types beside their implementations, and consolidate duplicate tests with exact assertions.

Not applied

  • Multiline expected outputs already use indoc!.
  • Resolver matching has only an all flag, so there is no all / archived pair to replace there.
  • Read view tests call result_view directly. Their section banner now names that function.

Left for a follow-up

  • The XDG base helper reaches configuration and client modules and remains deferred.
  • The archive-notice split and resolver error capitalization remain deferred with their TUI and slash callers.

Test plan

  • Permission regressions cover relative cwd traversal and search-walk agreement.
  • Targeted file tracker, utility, tool, and session tests pass, including the CJK title regression and exact log truncation boundaries.
  • cargo fmt --all --check, cargo build, and cargo clippy --all-targets -- -D warnings.
  • cargo test: 2,635 unit tests (1 ignored) and 5 CLI tests pass. cargo llvm-cov passes with no uncovered changed executable lines locally.
  • pnpm format, pnpm lint, and pnpm spellcheck.
  • Pre-commit hooks pass. No snapshot or release-fixture changes.
  • A real CLI process against a mock rejected request preserves the git branch and exact user message in the session.
  • CI passes on Linux, macOS, and Windows. Codecov confirms that all modified coverable lines are covered.

@hakula139 hakula139 added this to the v0.1.0 milestone Oct 16, 2026
@hakula139 hakula139 added refactor Restructured code that preserves behavior (refactor) area: session Touches session storage, listing, or resume area: permission Touches permission rules, modes, or the approval gate area: tools Touches the built-in tools such as bash, read, edit, grep, and glob labels Oct 16, 2026
@hakula139 hakula139 self-assigned this Oct 16, 2026
@codecov

codecov Bot commented Oct 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@hakula139
hakula139 force-pushed the refactor/services-conventions branch from 539d41b to 9aa773d Compare October 16, 2026 07:07
@hakula139
hakula139 merged commit 7be77fd into main Oct 16, 2026
10 checks passed
@hakula139
hakula139 deleted the refactor/services-conventions branch October 16, 2026 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: permission Touches permission rules, modes, or the approval gate area: session Touches session storage, listing, or resume area: tools Touches the built-in tools such as bash, read, edit, grep, and glob refactor Restructured code that preserves behavior (refactor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant