Skip to content

MCP-prep cleanup: signature in scan_project, drop lib.rs, clippy-clean#48

Merged
BETAER-08 merged 1 commit into
mainfrom
claude/amdb-mcp-prep-02hJT
May 8, 2026
Merged

MCP-prep cleanup: signature in scan_project, drop lib.rs, clippy-clean#48
BETAER-08 merged 1 commit into
mainfrom
claude/amdb-mcp-prep-02hJT

Conversation

@BETAER-08

Copy link
Copy Markdown
Owner

Summary

Three targeted cleanups requested before MCP deployment, plus the clippy follow-ups required to make cargo clippy -- -D warnings succeed.

Fixed

  • scan_project embedding text — was missing the Signature: {} line that update_file already had. Both code paths now produce identical embedding text, so a file re-scanned by the daemon won't get a different vector representation than the one written at init time.
  • Removed empty src/lib.rs — it was registering an unintended lib crate target alongside the [[bin]], producing build ambiguity. The binary already declares its modules in src/main.rs, so no other change was needed.
  • Renamed test_hybrid_search_incoming_edgetest_directional_graph_excludes_callers — the old name implied reverse-traversal behavior that v0.6.0 explicitly removed in generate(). The body keeps the same setup but the new name documents the actual contract: a callee focus (target_func in def.rs) does not drag callers (user.rs) in via --depth 1. Used fn caller() instead of fn main() to keep the call graph unambiguous.

Clippy hygiene (required by -D warnings)

  • Marked Indexer::update_file / Indexer::remove_file with #[allow(dead_code)] — they're a legitimate one-shot wrapper API around IndexWorker kept for callers who don't want to manage worker lifetime; not used internally.
  • Collapsed two if-in-if blocks in src/core/generator.rs into single && expressions.
  • Introduced pub type ParseResult = (Vec<CodeSymbol>, DependencyGraph, Vec<CodeRoute>, Vec<CodeWarning>); and used it as CodeParser::parse's return type to silence clippy::type_complexity.

Test plan

  • cargo clippy --all-targets -- -D warnings — clean
  • cargo build --release — 0 warnings, 0 errors
  • cargo test — blocked in this sandbox (same constraint as PR v0.6.0: Production-ready bug fixes and improvements #47: every integration test invokes amdb init, fastembed downloads Xenova/bge-small-en-v1.5 from HuggingFace, sandbox blocks huggingface.co with x-deny-reason: host_not_allowed). CI on ubuntu-latest should be able to run them.

Generated by Claude Code

…y-clean

- scan_project now embeds the signature line, matching update_file
- Remove empty src/lib.rs that was registering an unintended library target
- Rename test_hybrid_search_incoming_edge to test_directional_graph_excludes_callers
  to reflect the new directional-graph semantics
- Make clippy clean under -D warnings:
  - Mark Indexer::{update_file,remove_file} #[allow(dead_code)] (legitimate
    one-shot API surface alongside IndexWorker)
  - Collapse two nested if blocks in generator.rs
  - Introduce ParseResult type alias for CodeParser::parse return type

Copy link
Copy Markdown
Owner Author

CI failed with the same signature as #47Process completed with exit code 101 from the Cargo Test step, no test name surfaced via the annotations API, full logs require auth. None of the five files in this diff can plausibly change which tests pass/fail:

  • src/lib.rs deletion — verified no amdb:: import paths in src/ or tests/; tests invoke the binary via cargo_bin_cmd!, not the library crate
  • scan_project Signature line — one extra line in an embed() input string
  • ParseResult type alias — pure refactor
  • Two if collapses in generator.rs — logic-equivalent
  • Test rename + fn mainfn caller — same setup, same assertions

So I believe this is the same fastembed model-download flake that affected #47 (11 tests starting in parallel, fresh rust-cache miss → 11 simultaneous HF requests for Xenova/bge-small-en-v1.5). If you want me to address it, two low-risk options:

  1. Add args: --test-threads=1 to the Cargo Test step — serializes downloads to a single producer.
  2. Add a warmup step before Cargo Test, e.g. cargo run --release -- init . && rm -rf .database .amdb in a tiny seeded directory, so the model is in ~/.cache/fastembed-rs before the test binary spawns 11 children.

Let me know which (if either) you want and I'll push it.


Generated by Claude Code

@BETAER-08 BETAER-08 marked this pull request as ready for review May 8, 2026 16:33
Copilot AI review requested due to automatic review settings May 8, 2026 16:33
@BETAER-08 BETAER-08 merged commit d26b725 into main May 8, 2026
5 of 6 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR performs a small set of pre-deployment cleanups to ensure consistent embedding text generation, remove an unintended library crate target, and make the project clippy-clean under cargo clippy -- -D warnings.

Changes:

  • Align symbol embedding text between full-project indexing (scan_project) and incremental updates by including Signature: {} in the embedding payload.
  • Remove the empty src/lib.rs to avoid producing an unintended lib target alongside the amdb binary.
  • Clippy hygiene: simplify nested conditionals, rename/clarify an integration test, and reduce clippy::type_complexity by introducing ParseResult.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/integration_test.rs Renames and slightly refactors a focus/depth integration test to reflect directional graph semantics.
src/lib.rs Removes an empty library crate entrypoint to prevent unintended lib target creation.
src/core/parser.rs Introduces ParseResult alias and uses it for CodeParser::parse to address clippy type complexity.
src/core/indexer.rs Adds signature to the embedding text in scan_project; adds #[allow(dead_code)] for wrapper methods kept as a public API.
src/core/generator.rs Simplifies nested if blocks into single conditions to satisfy clippy/readability.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants