Skip to content

test: Add comprehensive tests for DiscoveredFile::compute_hash#162

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/add-comprehensive-tests-walker-module
Draft

test: Add comprehensive tests for DiscoveredFile::compute_hash#162
Copilot wants to merge 3 commits intomainfrom
copilot/add-comprehensive-tests-walker-module

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 6, 2026

Added unit tests for the DiscoveredFile::compute_hash method, which computes SHA-256 hashes of file contents for change detection.

Test Coverage

  • Hash properties: Format validation (64-char hex), deterministic behavior, content uniqueness
  • Edge cases: Empty files, non-existent files (error handling), large files (10KB+), binary data
  • Content handling: Unicode/emoji, different line endings (LF vs CRLF), null bytes

Example

let discovered_file = DiscoveredFile {
    path: PathBuf::from("test.rs"),
    language: Language::Rust,
};

// Returns SHA-256 hex string or io::Error if file doesn't exist
let hash = discovered_file.compute_hash()?;
assert_eq!(hash.len(), 64);

All tests added to existing tests_walker.rs following repository conventions.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 192.168.1.100
    • Triggering command: /home/REDACTED/work/mother/mother/target/debug/deps/mother_cli-d349731c4bc5c110 /home/REDACTED/work/mother/mother/target/debug/deps/mother_cli-d349731c4bc5c110 --test-threads=4 debuginfo=2 --warn=unreachable_pub (packet block)
  • invalid-host
    • Triggering command: /home/REDACTED/work/mother/mother/target/debug/deps/mother_cli-d349731c4bc5c110 /home/REDACTED/work/mother/mother/target/debug/deps/mother_cli-d349731c4bc5c110 --test-threads=4 debuginfo=2 --warn=unreachable_pub (dns block)
  • invalid-uri
    • Triggering command: /home/REDACTED/work/mother/mother/target/debug/deps/mother_cli-d349731c4bc5c110 /home/REDACTED/work/mother/mother/target/debug/deps/mother_cli-d349731c4bc5c110 --test-threads=4 debuginfo=2 --warn=unreachable_pub (dns block)
  • neo4j.example.com
    • Triggering command: /home/REDACTED/work/mother/mother/target/debug/deps/mother_cli-d349731c4bc5c110 /home/REDACTED/work/mother/mother/target/debug/deps/mother_cli-d349731c4bc5c110 --test-threads=4 debuginfo=2 --warn=unreachable_pub (dns block)
  • neo4j.production.example.com
    • Triggering command: /home/REDACTED/work/mother/mother/target/debug/deps/mother_cli-d349731c4bc5c110 /home/REDACTED/work/mother/mother/target/debug/deps/mother_cli-d349731c4bc5c110 --test-threads=4 debuginfo=2 --warn=unreachable_pub (dns block)
  • nonexistent.host.that.does.not.exist
    • Triggering command: /home/REDACTED/work/mother/mother/target/debug/deps/mother_cli-d349731c4bc5c110 /home/REDACTED/work/mother/mother/target/debug/deps/mother_cli-d349731c4bc5c110 --test-threads=4 debuginfo=2 --warn=unreachable_pub (dns block)
  • not-a-valid-uri
    • Triggering command: /home/REDACTED/work/mother/mother/target/debug/deps/mother_cli-d349731c4bc5c110 /home/REDACTED/work/mother/mother/target/debug/deps/mother_cli-d349731c4bc5c110 --test-threads=4 debuginfo=2 --warn=unreachable_pub (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Add comprehensive tests for the walker-discoveredfile module.

Issues to Resolve

CRITICAL REQUIREMENTS

1. TEST THROUGH PUBLIC API ONLY

  • Do NOT make private methods public just for testing
  • Test internal logic through public entrypoint functions
  • If a function is private, test it via the public function that calls it

2. VERIFY LOGIC CORRECTNESS

  • READ and UNDERSTAND the implementation before writing tests
  • Check if the logic makes sense and is correct
  • If you find bugs, note them but still test current behavior

3. TEST FILE LOCATION AND NAMING

  • Unit tests: walker_discoveredfile/tests/tests_*.rs (tests folder inside module)
  • Integration tests: tests/walker_discoveredfile/tests_*.rs (module folder inside root tests/)
  • Use prefix tests_ for all test files (e.g., tests_selection_range.rs)
  • All tests for this batch go in the appropriate folder
  • Example unit test: server/selection_range.rsserver/tests/tests_selection_range.rs
  • Example integration test: server/selection_range.rstests/server/tests_selection_range.rs

4. QUALITY TESTS ONLY

  • NO TODO comments or placeholder tests
  • Test edge cases: empty inputs, error conditions, boundaries
  • Descriptive test names explaining what's tested

5. CLOSE ALL ISSUES IN ONE COMMIT

Commit message: test: Add comprehensive tests for walker-discoveredfile (closes #52)

6. VERIFY BEFORE PR

  • make run-guidelines must pass
  • Then create PR

Create a single PR resolving all 1 issues.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 6, 2026 12:43
Co-authored-by: jade-codes <9397730+jade-codes@users.noreply.github.com>
Co-authored-by: jade-codes <9397730+jade-codes@users.noreply.github.com>
Copilot AI changed the title [WIP] Add comprehensive tests for walker-discoveredfile module test: Add comprehensive tests for DiscoveredFile::compute_hash Jan 6, 2026
Copilot AI requested a review from jade-codes January 6, 2026 12:49
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.

2 participants