Skip to content

fix(agent): address review feedback on file modification tracking#118

Merged
pablof7z merged 1 commit into
masterfrom
fix/issue-113-review-feedback
May 30, 2026
Merged

fix(agent): address review feedback on file modification tracking#118
pablof7z merged 1 commit into
masterfrom
fix/issue-113-review-feedback

Conversation

@pablof7z

Copy link
Copy Markdown
Collaborator

Addresses review feedback on #116 (file modification tracking).

Blocking fixes

  1. Eliminate duplicated resolve_path / expand_env_vars. file_modifications.rs carried local copies of both helpers that already live in tools/fs.rs (same crate). resolve_path is now pub(crate) in tools/fs.rs and imported via crate::tools::fs::resolve_path; the local copies are deleted. expand_env_vars stays private to fs.rs since it has no cross-module caller after the dedup.

  2. Stop swallowing errors in render_reminder. The ConversationStore::open and get_file_snapshots_for_agent calls used .ok()?, which collapsed a real DB failure into the same None as "no snapshots." Both now log via tracing::warn! before returning None.

  3. Distinguish unreadable from unchanged in render_file_block. std::fs::read(...).ok()? meant a deleted or unreadable file silently vanished from the report. A NotFound error now emits a "File was deleted." modification block (a deletion is itself an external change worth reporting); any other read error is logged; only a genuine hash match returns None.

Style fixes

  • Collapsed multi-paragraph module/struct/function doc comments to a single line; dropped WHAT-only docs on trivial private fns (hash_bytes, parse_write_path), keeping only WHY comments.
  • Removed the // ===…=== section banner this PR had added to store.rs (the record_file_snapshot doc already conveys the upsert behavior). Pre-existing banners elsewhere in store.rs were left untouched.

Verification

  • cargo build -p tenex-agent — clean (no new warnings; deletion of the local helpers leaves no unused import)
  • cargo test -p tenex-agent — 58 passed (incl. all 4 file_modifications tests)
  • cargo test -p tenex-conversations — 19 passed

🤖 Generated with Claude Code

Addresses review feedback on #116.

- Deduplicate path resolution: file_modifications now reuses
  crate::tools::fs::resolve_path instead of carrying local copies of
  resolve_path / expand_env_vars.
- render_reminder logs and bails on real DB errors instead of swallowing
  them via .ok()?, so an open/query failure is no longer indistinguishable
  from "no snapshots".
- render_file_block distinguishes a deleted file (reported as an external
  modification) and an unreadable file (logged) from an unchanged file,
  instead of collapsing all three to None.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@claude

claude Bot commented May 30, 2026

Copy link
Copy Markdown

Code Review

Overview

Clean follow-up to #116. All three blocking issues are correctly resolved: path-resolution deduplication, error logging in render_reminder, and deletion detection in render_file_block. The doc-comment trimming also aligns well with the project's only-WHY-comments rule.


What is done well

Deduplication via pub(crate) — making resolve_path crate-visible in tools/fs.rs and importing it is the right fix. No wrapper, no re-export, just a single canonical implementation. expand_env_vars correctly stays private since it has no cross-module caller after the cleanup.

Error logging — replacing .ok()? with match … tracing::warn! in render_reminder means DB failures are now observable without changing the graceful-degradation behavior (returning None so the agent loop continues).

Deletion handlingNotFound in render_file_block now produces a real <file-modification> block rather than silently suppressing what is a meaningful external change. The three-way dispatch (deleted → Some(deletion), unreadable → logged + None, unchanged → None) is correct.

Comment reduction — dropping WHAT-only docs on hash_bytes, parse_write_path, and the section banner in store.rs is exactly right per the project conventions.


Minor issues

1. No test for the deletion path (file_modifications.rs)

The new NotFound → deletion block branch is the most behaviorally interesting change here, and the diff shows no new test for it. The existing 4 tests are unchanged and almost certainly do not cover this case. Given how easy it is to test — write a snapshot, delete the file, call render_reminder — this is worth adding before merge to prevent future regression.

2. render_file_block doc comment is slightly stale (file_modifications.rs:141)

The new single-line doc says: "Render a single <file-modification> block for a snapshot whose on-disk content differs from the recorded hash." The function now also renders a block when the file no longer exists, which does not involve hashing at all. A small wording tweak or dropping the doc entirely (the function name and signature are self-explanatory) would resolve this.

3. Long single-line doc on render_reminder (file_modifications.rs:93)

The collapsed doc runs well past 100 characters. Either split it at the or None clause or trim it further and let the function name carry the weight.


Summary

No blocking issues. Fix 1 (missing test) is the most worth addressing before merge; the other two are nits. The core logic changes are correct and the codebase is cleaner after this PR.

@pablof7z pablof7z merged commit 86b14d3 into master May 30, 2026
1 check passed
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