Skip to content

fix(deps): clear security audit + clippy result_large_err failures - #163

Open
marlon-costa-dc wants to merge 2 commits into
mainfrom
bugfix/rustsec-2026-bumps
Open

fix(deps): clear security audit + clippy result_large_err failures#163
marlon-costa-dc wants to merge 2 commits into
mainfrom
bugfix/rustsec-2026-bumps

Conversation

@marlon-costa-dc

@marlon-costa-dc marlon-costa-dc commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Root fixes

  • crossbeam-epoch 0.9.18 -> 0.9.20 (RUSTSEC-2026-0204)
  • serial_test 3.4 -> 4.0.0: drops scc entirely, removing RUSTSEC-2026-0205 without an msrv bump (4.0.1 requires rustc 1.93.1; workspace validates under 1.92 and CI stable alike)
  • git2 0.20 -> 0.21 (RUSTSEC-2026-0183/0184); getters now return Result<Option<&str>>, call sites updated
  • quick-xml workspace pin 0.39 -> 0.41 for first-party crates
  • accept RUSTSEC-2026-0194/0195 in the audit ignore SSOT with evidence (vendored opendal pins quick-xml <0.41, XML services disabled in this workspace, DoS paths unreachable until next opendal bump)
  • box large error variants (CallToolResult, loco_rs::Error) across mcb-server handlers and mcb initializers (clippy result_large_err)
  • auth: typed AuthError domain error + map_auth_error boundary mapping (replaces loco_rs::Result in mcb-server auth)
  • mcb_bin: prefer workspace-built binary over PATH (mise shim broke validate in fresh worktrees)
  • hooks: unset leaked GIT_DIR/GIT_WORK_TREE in pre-commit gate — leaked vars redirected test fixture commits into this repository (stray 'Initial commit' commits, mass deletions, README gutted to a test stub)
  • contract snapshots refreshed for serde field ordering

Validation

  • cargo check --workspace --all-targets: 0 errors
  • make check WHAT=lint: green
  • make check WHAT=audit: green (4 allowed warnings, 0 vulnerabilities)
  • contract suite 27/27; nextest mcb-server+mcb-providers+mcb: 756/756
  • pre-push full gate green

Summary by cubic

Clears RustSec advisories and clippy result_large_err by updating key crates and boxing large errors. Also hardens admin auth, git hooks, and bootstrap error boundaries to stabilize builds and local gates.

  • Dependencies

    • Bumped crossbeam-epoch 0.9.18 → 0.9.20 (RUSTSEC-2026-0204).
    • Bumped serial_test 3.4 → 4.0.0; drops scc, removing RUSTSEC-2026-0205 without an MSRV bump.
    • Bumped git2 0.20 → 0.21; updated call sites for getters now returning Result<Option<&str>>.
    • Pinned quick-xml to 0.41 for first-party crates.
    • Accepted audit ignores for RUSTSEC-2026-0194/0195 with evidence: vendored opendal pins quick-xml < 0.41 and XML services are disabled, so DoS paths are unreachable.
  • Bug Fixes

    • Boxed large error variants (CallToolResult, loco_rs::Error) across server handlers and initializers.
    • Added typed AuthError and controller mapping to Loco errors; replaced loco_rs::Result in mcb-server auth.
    • mcb_bin: prefer workspace-built binary over PATH to avoid shim issues.
    • Pre-commit: unset leaked GIT_* env to prevent fixture commits into the repo.
    • CI: trigger pull_request synchronize to ensure gate validation runs on updates.
    • Refreshed contract snapshots for serde field ordering.

Written for commit 70330fc. Summary will update on new commits.

Review in cubic

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@cubic-dev-ai

cubic-dev-ai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Running ultrareview automatically — This PR removes 1792 files including CI workflows, dev configs, and infrastructure files while updating security-sensitive dependencies (git2, auth types) and error handling across the codebase — the blast radius of a missed bug could break CI, development setup, and production authentication.. I'll post findings when complete.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of invalid or missing administrator credentials, with clearer unauthorized responses.
    • Improved resilience when Git repositories, remotes, submodules, or required request fields contain incomplete or unavailable data.
    • Standardized error responses across configuration, session, search, and version-control operations.
  • Chores

    • Updated development and repository-processing components for improved compatibility.
    • Improved local command resolution and isolated pre-commit checks from inherited Git settings.

Walkthrough

The PR introduces local authentication errors, standardizes boxed MCP and bootstrap error propagation, adjusts Git metadata lookup handling, updates selected dependencies, and changes repository hook and binary-resolution behavior.

Changes

Server error handling

Layer / File(s) Summary
Authentication and configuration error translation
crates/mcb-server/src/auth.rs, crates/mcb-server/src/controllers/admin*.rs, crates/mcb-server/src/controllers/web/config.rs
Adds AuthError, maps authentication failures to HTTP errors, and adapts boxed configuration errors.
Boxed MCP error contracts
crates/mcb-server/src/utils/mcp/*, crates/mcb-server/src/macros/handlers.rs, crates/mcb-server/src/handlers/memory/execution.rs, crates/mcb-server/src/handlers/vcs/responses.rs
Changes shared MCP helper and validation errors to Box<CallToolResult>.
MCP handler error propagation
crates/mcb-server/src/handlers/{memory,search,session,vcs}/*
Dereferences boxed tool errors on affected early-return paths.
Bootstrap error propagation
crates/mcb/src/initializers/mcp_server.rs
Boxes configuration, provider-resolution, and bootstrap errors, then unboxes them at route initialization.

VCS result handling

Layer / File(s) Summary
Git and submodule lookup handling
crates/mcb-providers/src/vcs/{git,submodule}.rs
Treats failed metadata lookups as unavailable values and skips unresolved submodules or tree entries.

Dependencies and tooling

Layer / File(s) Summary
Dependency and script updates
Cargo.toml, scripts/hooks/pre-commit, scripts/lib/mcb.sh
Updates dependency versions, clears inherited Git variables, changes binary lookup precedence, and extends audit ignores.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: Review effort 2/5, Possible security concern, Refactoring, Other

Suggested reviewers: marlonsc

Poem

I’m a bunny with errors boxed tight,
Hopping through branches from morning to night.
Auth gates now speak in a clearer tune,
Git paths behave beneath the moon.
Dependencies sparkle, hooks reset—
A tidy little burrow, no regrets!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the dependency and error-handling changes targeting audit and clippy failures.
Description check ✅ Passed The description is directly related to the dependency bumps, boxed errors, auth changes, and validation results in the diff.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/rustsec-2026-bumps

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

qodo-code-review Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Clear RustSec advisories and clippy result_large_err via deps + error boundaries

🐞 Bug fix ⚙️ Configuration changes 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Bump key Rust dependencies to address RustSec advisories and API changes.
• Fix clippy result_large_err by boxing large error variants across MCP handlers.
• Introduce typed auth errors and map them to Loco HTTP errors at controller boundaries.
Diagram

graph TD
  Deps["Workspace deps (Cargo.toml/lock)"] --> Git2{{"git2 0.21"}} --> Providers["mcb-providers VCS"] --> Server["mcb-server API"] --> Tests["contract snapshots"]
  Deps --> Xml{{"quick-xml 0.41"}} --> Server
  Server --> Auth["AuthError + mapping"] --> Server
  Scripts["hooks + mcb.sh"] --> Deps
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Suppress clippy `result_large_err` lint in affected modules
  • ➕ Fastest change with minimal signature churn
  • ➕ Avoids Box and deref changes at call sites
  • ➖ Masks a real performance/size footgun in public-ish error paths
  • ➖ Leaves the codebase inconsistent with the rest of the workspace lint posture
2. Introduce a dedicated small error wrapper type (enum with boxed payloads)
  • ➕ Keeps call-site ergonomics without pervasive Box plumbing
  • ➕ Centralizes error-size decisions and formatting
  • ➖ More new code and design surface area than needed for a dependency-driven fix
  • ➖ Still requires migration work, just concentrated differently
3. Keep auth returning `loco_rs::Error` end-to-end
  • ➕ Avoids domain/boundary split and mapping function
  • ➕ Less type surface area
  • ➖ Conflates domain auth failures with transport/framework concerns
  • ➖ Harder to unit test auth logic without Loco error coupling

Recommendation: The chosen approach (boxing large error variants and introducing a typed AuthError mapped at the controller boundary) is the best tradeoff here: it resolves clippy without weakening linting, keeps domain logic framework-agnostic, and constrains Loco-specific error mapping to the HTTP boundary. The main thing to watch in review is consistent boxing/deref patterns (Ok(*err)), ensuring no behavior changes in tool error payloads beyond size/formatting.

Files changed (47) +375 / -353

Enhancement (1) +29 / -11
auth.rsIntroduce typed AuthError and decouple auth from loco_rs::Result +29/-11

Introduce typed AuthError and decouple auth from loco_rs::Result

• Replaces 'loco_rs::Result' usage with a local 'AuthError' enum to represent Unauthorized vs Internal failures. Updates API-key extraction and hash verification helpers to return 'Result<_, AuthError>' and improves error construction via a helper.

crates/mcb-server/src/auth.rs

Bug fix (21) +101 / -67
git.rsAdapt git provider to git2 getter APIs returning Results +4/-4

Adapt git provider to git2 getter APIs returning Results

• Adjusts HEAD shorthand and remote URL extraction to handle 'Result<Option<&str>>' getters. Minor lint comment clarification and a tree walk name extraction updated to 'Ok(name)' semantics.

crates/mcb-providers/src/vcs/git.rs

submodule.rsHandle submodule URL getter result shape change +1/-1

Handle submodule URL getter result shape change

• Updates submodule URL extraction to match git2’s new 'Result<Option<_>>' return, preserving the orphaned-submodule behavior and warning path.

crates/mcb-providers/src/vcs/submodule.rs

admin.rsMap auth-domain errors to Loco HTTP errors at controller boundary +14/-4

Map auth-domain errors to Loco HTTP errors at controller boundary

• Converts admin endpoints to call 'authorize_admin_api_key' returning 'AuthError' and maps it to 'loco_rs::errors::Error'. Also updates admin config loading to use boxed 'loco_rs::Error' results to satisfy clippy size constraints.

crates/mcb-server/src/controllers/admin.rs

admin_config.rsBox loco errors from admin config loading +4/-4

Box loco errors from admin config loading

• Changes 'load_admin_config' to return 'Result<_, Box<loco_rs::Error>>' and boxes errors from config parsing and JSON serialization, addressing 'result_large_err'.

crates/mcb-server/src/controllers/admin_config.rs

config.rsAdjust config page to unwrap boxed loco error +1/-1

Adjust config page to unwrap boxed loco error

• Updates 'config_page' to convert the boxed Loco error back into the expected controller error type ('*e') at the boundary.

crates/mcb-server/src/controllers/web/config.rs

execution.rsBox CallToolResult in execution validation error path +3/-1

Box CallToolResult in execution validation error path

• Changes the validated execution data parser to return 'Result<_, Box<CallToolResult>>', reducing error size in the Result and aligning with the workspace clippy lint.

crates/mcb-server/src/handlers/memory/execution.rs

list_timeline.rsBox tool errors and deref on early returns in timeline handler +6/-4

Box tool errors and deref on early returns in timeline handler

• Updates helper return types to 'Box<CallToolResult>' and adjusts call sites to return 'Ok(*response)' when short-circuiting with tool-level errors.

crates/mcb-server/src/handlers/memory/list_timeline.rs

search.rsBox tool errors in search collection resolution +5/-5

Box tool errors in search collection resolution

• Changes several helpers to return boxed tool errors and updates early-return behavior to dereference boxed results before returning from the handler.

crates/mcb-server/src/handlers/search.rs

common.rsBox session argument tool errors +3/-2

Box session argument tool errors

• Updates session-id requirement helpers to return 'Box<CallToolResult>' and boxes the missing-session error to satisfy 'result_large_err'.

crates/mcb-server/src/handlers/session/common.rs

create.rsBox tool errors and deref early returns in session creation flow +6/-6

Box tool errors and deref early returns in session creation flow

• Updates agent type resolution and other early-return paths to use 'Box<CallToolResult>', with corresponding 'Ok(*error_result)' returns where needed.

crates/mcb-server/src/handlers/session/create.rs

get.rsDeref boxed tool errors on early return for get_session +1/-1

Deref boxed tool errors on early return for get_session

• Adjusts the missing-session-id early return to handle boxed tool errors ('Ok(*error_result)').

crates/mcb-server/src/handlers/session/get.rs

update.rsDeref boxed tool errors on early return for update_session +1/-1

Deref boxed tool errors on early return for update_session

• Adjusts the missing-session-id early return to handle boxed tool errors ('Ok(*error_result)').

crates/mcb-server/src/handlers/session/update.rs

analyze_impact.rsDeref boxed tool errors from repo_path in analyze_impact +1/-1

Deref boxed tool errors from repo_path in analyze_impact

• Updates early return when repository path resolution fails, reflecting the new boxed tool error type.

crates/mcb-server/src/handlers/vcs/analyze_impact.rs

compare_branches.rsDeref boxed tool errors from repo_path in compare_branches +1/-1

Deref boxed tool errors from repo_path in compare_branches

• Updates early return when repository path resolution fails, reflecting the new boxed tool error type.

crates/mcb-server/src/handlers/vcs/compare_branches.rs

index_repo.rsDeref boxed tool errors from repo_path in index_repository +1/-1

Deref boxed tool errors from repo_path in index_repository

• Updates early return when repository path resolution fails, reflecting the new boxed tool error type.

crates/mcb-server/src/handlers/vcs/index_repo.rs

responses.rsChange repo_path to return boxed tool errors +4/-4

Change repo_path to return boxed tool errors

• Updates 'repo_path' to return 'Result<PathBuf, Box<CallToolResult>>' and boxes its error returns, aligning with the broader clippy-driven error size fix.

crates/mcb-server/src/handlers/vcs/responses.rs

search_branch.rsBox query/repo_path tool errors and deref early returns +4/-3

Box query/repo_path tool errors and deref early returns

• Updates query parsing and repo path resolution to return boxed tool errors, and adjusts handler early returns accordingly.

crates/mcb-server/src/handlers/vcs/search_branch.rs

fields.rsBox tool errors in JSON field extraction helpers +8/-4

Box tool errors in JSON field extraction helpers

• Changes 'require_*' helpers to return 'Box<CallToolResult>' and boxes generated tool errors to reduce Result error size across call sites.

crates/mcb-server/src/utils/mcp/fields.rs

helpers.rsBox tool errors for require_data_map helper +4/-2

Box tool errors for require_data_map helper

• Updates 'require_data_map' to return 'Box<CallToolResult>' and boxes the missing-data error, matching the new tool-error conventions.

crates/mcb-server/src/utils/mcp/helpers.rs

mcp_server.rsBox loco errors during MCP server bootstrap/initializer wiring +25/-17

Box loco errors during MCP server bootstrap/initializer wiring

• Changes bootstrap helpers to return 'Result<_, Box<loco_rs::Error>>' and boxes error conversions for config/provider resolution and bootstrap construction. Updates the initializer boundary to map boxed errors back into the expected Loco error type.

crates/mcb/src/initializers/mcp_server.rs

pre-commitHarden pre-commit hook against leaked git environment variables +4/-0

Harden pre-commit hook against leaked git environment variables

• Unsets 'GIT_DIR', 'GIT_WORK_TREE', and related variables so fixture commits are applied to temporary repos rather than the workspace repo. Prevents accidental commits/deletions caused by inherited git environment state.

scripts/hooks/pre-commit

Tests (21) +188 / -188
contract__agent_contract_tests__agent_happy_path.snapRefresh agent contract snapshot formatting/field order +10/-10

Refresh agent contract snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output after dependency and code changes.

crates/mcb-server/tests/contract/snapshots/contract__agent_contract_tests__agent_happy_path.snap

contract__agent_contract_tests__agent_invalid_args.snapRefresh agent invalid-args snapshot formatting/field order +8/-8

Refresh agent invalid-args snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__agent_contract_tests__agent_invalid_args.snap

contract__agent_contract_tests__agent_store_without_session.snapRefresh agent store-without-session snapshot formatting/field order +10/-10

Refresh agent store-without-session snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__agent_contract_tests__agent_store_without_session.snap

contract__entity_contract_tests__entity_happy_path.snapRefresh entity happy-path snapshot formatting/field order +10/-10

Refresh entity happy-path snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__entity_contract_tests__entity_happy_path.snap

contract__entity_contract_tests__entity_invalid_args.snapRefresh entity invalid-args snapshot formatting/field order +8/-8

Refresh entity invalid-args snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__entity_contract_tests__entity_invalid_args.snap

contract__index_contract_tests__index_happy_path.snapRefresh index happy-path snapshot formatting/field order +8/-8

Refresh index happy-path snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__index_contract_tests__index_happy_path.snap

contract__index_contract_tests__index_invalid_args.snapRefresh index invalid-args snapshot formatting/field order +8/-8

Refresh index invalid-args snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__index_contract_tests__index_invalid_args.snap

contract__memory_contract_tests__memory_get_observation_ids_empty.snapRefresh memory get-by-ids(empty) snapshot formatting/field order +8/-8

Refresh memory get-by-ids(empty) snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__memory_contract_tests__memory_get_observation_ids_empty.snap

contract__memory_contract_tests__memory_get_observation_ids_none.snapRefresh memory get-by-ids(none) snapshot formatting/field order +8/-8

Refresh memory get-by-ids(none) snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__memory_contract_tests__memory_get_observation_ids_none.snap

contract__memory_contract_tests__memory_happy_path.snapRefresh memory happy-path snapshot formatting/field order +8/-8

Refresh memory happy-path snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__memory_contract_tests__memory_happy_path.snap

contract__memory_contract_tests__memory_invalid_args.snapRefresh memory invalid-args snapshot formatting/field order +8/-8

Refresh memory invalid-args snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__memory_contract_tests__memory_invalid_args.snap

contract__project_contract_tests__project_happy_path.snapRefresh project happy-path snapshot formatting/field order +12/-12

Refresh project happy-path snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__project_contract_tests__project_happy_path.snap

contract__project_contract_tests__project_invalid_args.snapRefresh project invalid-args snapshot formatting/field order +10/-10

Refresh project invalid-args snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__project_contract_tests__project_invalid_args.snap

contract__search_contract_tests__search_happy_path.snapRefresh search happy-path snapshot formatting/field order +10/-10

Refresh search happy-path snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__search_contract_tests__search_happy_path.snap

contract__search_contract_tests__search_invalid_args.snapRefresh search invalid-args snapshot formatting/field order +8/-8

Refresh search invalid-args snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__search_contract_tests__search_invalid_args.snap

contract__session_contract_tests__session_happy_path.snapRefresh session happy-path snapshot formatting/field order +10/-10

Refresh session happy-path snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__session_contract_tests__session_happy_path.snap

contract__session_contract_tests__session_invalid_args.snapRefresh session invalid-args snapshot formatting/field order +8/-8

Refresh session invalid-args snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__session_contract_tests__session_invalid_args.snap

contract__validate_contract_tests__validate_happy_path.snapRefresh validate happy-path snapshot formatting/field order +10/-10

Refresh validate happy-path snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__validate_contract_tests__validate_happy_path.snap

contract__validate_contract_tests__validate_invalid_args.snapRefresh validate invalid-args snapshot formatting/field order +8/-8

Refresh validate invalid-args snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__validate_contract_tests__validate_invalid_args.snap

contract__vcs_contract_tests__vcs_happy_path.snapRefresh VCS happy-path snapshot formatting/field order +10/-10

Refresh VCS happy-path snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__vcs_contract_tests__vcs_happy_path.snap

contract__vcs_contract_tests__vcs_invalid_args.snapRefresh VCS invalid-args snapshot formatting/field order +8/-8

Refresh VCS invalid-args snapshot formatting/field order

• Updates snapshot JSON field ordering/serialization formatting to match current serde output.

crates/mcb-server/tests/contract/snapshots/contract__vcs_contract_tests__vcs_invalid_args.snap

Documentation (1) +4 / -4
handlers.rsUpdate extract_field macro docs/behavior for boxed tool errors +4/-4

Update extract_field macro docs/behavior for boxed tool errors

• Updates documentation and macro expansion examples to match 'Box<CallToolResult>' and 'Ok(*error_result)' usage, ensuring handler boilerplate remains consistent.

crates/mcb-server/src/macros/handlers.rs

Other (3) +53 / -83
Cargo.lockRegenerate lockfile for dependency bumps and transitive removals +41/-77

Regenerate lockfile for dependency bumps and transitive removals

• Updates resolved versions for crossbeam-epoch, git2/libgit2-sys, quick-xml, serial_test, and various transitive crates. Removes 'scc'/'sdd' (via serial_test 4.x) and reflects new dependency graphs (e.g., git2 no longer pulling some TLS/url deps).

Cargo.lock

Cargo.tomlBump workspace dependency pins (serial_test, quick-xml, git2) +3/-3

Bump workspace dependency pins (serial_test, quick-xml, git2)

• Updates development dependency 'serial_test' to 4.0 and bumps 'quick-xml' and 'git2' pins to newer minor versions. These pins drive API adjustments and lockfile regeneration.

Cargo.toml

mcb.shPrefer workspace-built mcb binary and document/extend audit ignores +9/-3

Prefer workspace-built mcb binary and document/extend audit ignores

• Reorders binary resolution to prefer 'target/debug'/'target/release' before PATH to avoid shim/path issues. Extends the audit ignore SSOT with RUSTSEC-2026-0194/0195 and documents why the associated DoS paths are currently unreachable.

scripts/lib/mcb.sh

@qodo-code-review

qodo-code-review Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (5) 📘 Rule violations (5) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 36 rules

Grey Divider


Action required

1. git2 errors are swallowed 📘 Rule violation ☼ Reliability ⭐ New
Description
GitProvider::get_default_branch() and GitProvider::get_remote_url() now call
head.shorthand().ok() and remote.url().ok(), respectively, which discards the underlying
git2::Error and can mask real failures behind None/generic behavior (e.g., a misleading “no
HEAD” outcome). This violates the requirement (PR Compliance ID 1208751) to not silently swallow
errors in production paths without propagation, explicit handling, or logging.
Code

crates/mcb-providers/src/vcs/git.rs[64]

+            .and_then(|head| head.shorthand().ok().map(String::from))
Relevance

●●● Strong

Team prefers failing/logging over silent None; PR #87 accepted “don’t silently cache None”; PR #94
added warn logging.

PR-#87
PR-#94

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 1208751 forbids silently discarding errors, and the cited updated implementations
show exactly that pattern: get_default_branch invokes .ok() on the fallible head.shorthand()
call and get_remote_url invokes .ok() on the fallible remote.url() call (both now returning
Result<Option<&str>> after the git2 upgrade), which drops the git2::Error value without any
logging or propagation, turning failures into None/generic outcomes at runtime.

Rule 1208751: Errors must not be silently swallowed or hidden
crates/mcb-providers/src/vcs/git.rs[60-70]
crates/mcb-providers/src/vcs/git.rs[72-77]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GitProvider::get_default_branch()` and `GitProvider::get_remote_url()` currently use `.ok()` on fallible `git2` getters (`head.shorthand()` and `remote.url()`), which discards the underlying `git2::Error` and can mask non-benign failures (including replacing errors with a generic “no HEAD”/`None` outcome) with no logging or propagation.

## Issue Context
This behavior was introduced during the `git2` upgrade where previously-infallible getters became `Result<Option<&str>>`. Compliance (PR Compliance ID 1208751) requires that errors are not silently swallowed in production paths; they must be propagated, explicitly handled, or at least logged with sufficient context. If remote URL detection is intended to be best-effort, the failure should still be logged with context, or the API should be adjusted to return a `Result<Option<String>, Error>`.

## Fix Focus Areas
- crates/mcb-providers/src/vcs/git.rs[60-70]
- crates/mcb-providers/src/vcs/git.rs[72-77]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Empty mcb_bin output 🐞 Bug ≡ Correctness ⭐ New
Description
mcb_bin returns success when mcb is on PATH but prints nothing, so callers using
cmd="$(mcb_bin)" end up executing an empty command string and failing (e.g., mcb_validate). This
breaks validation tooling in environments where mcb is available only via PATH/shims.
Code

scripts/lib/mcb.sh[R56-60]

  [ -x "$MCB_ROOT/target/debug/mcb" ]   && { echo "$MCB_ROOT/target/debug/mcb";   return 0; }
+  [ -x "$MCB_ROOT/target/release/mcb" ] && { echo "$MCB_ROOT/target/release/mcb"; return 0; }
+  command -v mcb 2>/dev/null && return 0
  echo "cargo run --package mcb --"
}
Relevance

●● Moderate

No historical evidence found on scripts returning success with empty output / command-substitution
expectations.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
mcb_bin currently returns 0 without output in the PATH fallback branch, and mcb_validate relies
on capturing mcb_bin output to build the executable string it runs.

scripts/lib/mcb.sh[54-60]
scripts/lib/mcb.sh[73-80]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`scripts/lib/mcb.sh:mcb_bin` uses `command -v mcb 2>/dev/null && return 0` which exits successfully without emitting the resolved path. Callers (notably `mcb_validate`) capture `mcb_bin` output into a variable and execute it, so an empty output results in trying to run `validate` as a standalone command.

## Issue Context
`mcb_validate` does `cmd="$(mcb_bin)"` and then runs `$cmd validate ...`, which requires `mcb_bin` to always print an executable command string when it returns success.

## Fix Focus Areas
- scripts/lib/mcb.sh[54-81]

## Suggested change
Replace the PATH branch with something that prints the resolved command, e.g.:
```bash
local path
path="$(command -v mcb 2>/dev/null)" && { echo "$path"; return 0; }
```
This preserves the new precedence (debug/release first) while making the PATH fallback usable.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Cargo workspace deleted 🐞 Bug ≡ Correctness
Description
This PR deletes the root Cargo.toml, removing the workspace/package definition, so cargo
commands at the repository root can no longer build or test anything. It also deletes the CI
workflow file, removing the automated pipeline that previously enforced build/test/lint gates.
Code

Cargo.toml[L1-22]

-[workspace]
-resolver = "2"
-members = [
-    "crates/mcb",
-    "crates/mcb-utils",
-    "crates/mcb-domain",
-    "crates/mcb-infrastructure",
-    "crates/mcb-providers",
-    "crates/mcb-server",
-    "crates/mcb-validate",
-]
-exclude = ["third-party"]
-
-[workspace.package]
-repository = "https://github.com/marlonsc/mcb"
-authors = ["Marlon Costa <marlonsc@gmail.com>"]
-homepage = "https://github.com/marlonsc/mcb"
-license = "MIT"
-version = "0.3.1"
-rust-version = "1.92"
-edition = "2024"
-
Relevance

●●● Strong

Repo relies on root workspace+CI; PRs #103/#87 updated ci.yml to unblock required checks—deleting
them unlikely accepted.

PR-#103
PR-#87
PR-#107

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR branch retains a pre-commit workflow oriented around running project gates, while the diff
removes the Cargo workspace definition required for building/testing and deletes the CI workflow.

scripts/hooks/pre-commit[1-15]
README.md[1-1]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR removes the repository's Rust build entrypoints (root `Cargo.toml`, `Cargo.lock`) and removes the CI workflow file. After this change, the repo root is no longer a valid Cargo workspace, and CI gating is effectively removed.

## Issue Context
This looks inconsistent with keeping developer workflows like the pre-commit gate that still expects project build/lint/validate tooling.

## Fix Focus Areas
- Cargo.toml[1-30]
- Cargo.lock[1-20]
- .github/workflows/ci.yml[13-83]
- scripts/hooks/pre-commit[1-15]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (5)
4. unused_imports lint removed 📘 Rule violation ⚙ Maintainability
Description
The workspace lint unused_imports = "deny" was removed, allowing unused imports to compile without
a hard failure. This violates the requirement that unused imports remain disallowed.
Code

Cargo.toml[29]

-unused_imports = "deny"
Relevance

●●● Strong

Historical manifest maintenance keeps strict defaults; dropping unused_imports=deny likely not
accepted.

PR-#87

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 1208512 requires no unused imports and that the unused_imports lint remains
deny. The diff removes unused_imports = "deny" from the workspace lints in Cargo.toml.

Rule 1208512: No unused imports
Cargo.toml[29-29]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`unused_imports = "deny"` was removed from workspace lints, weakening enforcement against unused `use` statements.

## Issue Context
Compliance requires the unused-imports lint remain set to `deny`.

## Fix Focus Areas
- Cargo.toml[28-29]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. dead_code lint removed 📘 Rule violation ⚙ Maintainability
Description
The workspace lint dead_code = "deny" was removed, allowing new unused items to compile without a
hard failure. This violates the requirement that dead code must remain disallowed.
Code

Cargo.toml[27]

-dead_code = "deny"
Relevance

●●● Strong

Cargo.toml workspace is treated as strict standards config; removing deny lints likely rejected to
preserve hygiene.

PR-#87

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 1208459 requires that dead code is not allowed and that the dead_code lint
remains set to deny. The diff removes dead_code = "deny" from the workspace lints in
Cargo.toml.

Rule 1208459: No dead code (unused functions, structs, constants)
Cargo.toml[27-27]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`dead_code = "deny"` was removed from workspace lints, which permits introducing unused functions/structs/constants without failing the build.

## Issue Context
Compliance requires the `dead_code` lint to remain set to `deny`.

## Fix Focus Areas
- Cargo.toml[23-29]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. unsafe_code lint removed 📘 Rule violation ⛨ Security
Description
The workspace lint unsafe_code = "deny" was removed, so unsafe blocks can slip into non-test
Rust code without a hard failure. This violates the requirement that unsafe usage is forbidden and
the deny lint must remain in place.
Code

Cargo.toml[24]

-unsafe_code = "deny"
Relevance

●●● Strong

Repo emphasizes safety/security (e.g., removed unsafe atty dep); likely keep unsafe_code=deny in
workspace lints.

PR-#57

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 1208417 requires that no unsafe code blocks appear and that the project-level
unsafe_code = "deny" lint remains enabled. The diff removes unsafe_code = "deny" from
Cargo.toml workspace lints.

Rule 1208417: No unsafe code blocks
Cargo.toml[24-24]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`unsafe_code = "deny"` was removed from the workspace lints, weakening the guarantee that no `unsafe` code can be introduced.

## Issue Context
Compliance requires zero `unsafe` usage in Rust production code and explicitly requires keeping the project-level `unsafe_code = "deny"` lint in place.

## Fix Focus Areas
- Cargo.toml[23-30]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. Late git env cleanup 🐞 Bug ≡ Correctness
Description
scripts/hooks/pre-commit unsets GIT_DIR/GIT_WORK_TREE only after running `git rev-parse
--show-toplevel`, so leaked Git env vars can still influence the initial repository resolution and
cd into the wrong worktree/repo.
Code

scripts/hooks/pre-commit[R8-11]

+# Hooks inherit GIT_DIR/GIT_WORK_TREE from the invoking git process; leaked
+# vars redirect fixture commits into this repository (they must hit temp repos).
+unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_OBJECT_DIRECTORY \
+  GIT_ALTERNATE_OBJECT_DIRECTORIES GIT_COMMON_DIR || true
Relevance

●● Moderate

No historical evidence: scripts/hooks/pre-commit file path not found in repository/tooling history.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The hook executes cd "$(git rev-parse --show-toplevel)" before the newly-added unset ... block,
so any leaked GIT_* variables can still affect the initial git resolution and working directory
selection.

scripts/hooks/pre-commit[6-12]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The pre-commit hook runs `git rev-parse --show-toplevel` before unsetting leaked `GIT_*` variables. If those variables are polluted, the very first `git` call can resolve against the wrong repo/worktree, making the subsequent cleanup ineffective.

## Issue Context
The newly-added `unset GIT_DIR GIT_WORK_TREE ...` block is intended to prevent fixture/test Git environment leakage from redirecting operations.

## Fix Focus Areas
- scripts/hooks/pre-commit[6-12]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. Deleted tooling still referenced 🐞 Bug ☼ Reliability
Description
The pre-commit hook still calls bash scripts/lib/mcb.sh guard --staged and make check ..., but
this PR deletes scripts/lib/mcb.sh and Makefile (and also removes Cargo.toml), so the hook and
common workflows will fail immediately.
Code

scripts/lib/mcb.sh[L1-16]

-#!/usr/bin/env bash
-# scripts/lib/mcb.sh — canonical tooling monopoly for MCB.
-# ONE source for cross-cutting concerns: exit codes, logging, colors, the
-# APPLY=Y mutation gate, SSOT readers (version, binary, audit ignores), the
-# banned-pattern guard, and the agent bash-guard. No script, makefile, hook, or
-# CI job calls cargo/git directly — everything flows through here.
-#
-# Use as a library:   source scripts/lib/mcb.sh ; mcb_require_cmd cargo
-# Use as a dispatcher: bash scripts/lib/mcb.sh <command> [args...]
-#
-# Note: strict mode (set -euo pipefail) is enabled ONLY in the direct-execution
-# dispatcher at the bottom, never at source time — sourcing must not flip the
-# caller's shell options (make sets its own -euo pipefail; docs scripts source us).
-[ -n "${_MCB_SH_LOADED:-}" ] && return 0
-_MCB_SH_LOADED=1
-
Relevance

●● Moderate

No historical evidence: scripts/lib/mcb.sh and referenced hook path not found in repo history/tools.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The pre-commit hook directly invokes scripts/lib/mcb.sh and make check, so deleting those
entrypoints in the same PR will cause the hook to error at runtime (missing script / missing Make
targets).

scripts/hooks/pre-commit[12-14]
README.md[1-1]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`scripts/hooks/pre-commit` depends on repo tooling (`scripts/lib/mcb.sh` and `make check ...`). This PR deletes that tooling (and the Rust workspace entrypoints), which makes the hook and developer/CI workflows fail.

## Issue Context
The remaining hook invokes the deleted script and Make targets.

## Fix Focus Areas
- scripts/hooks/pre-commit[12-14]
- scripts/lib/mcb.sh[1-136]
- Makefile[1-20]
- Cargo.toml[1-30]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

9. Submodule URL errors hidden 🐞 Bug ◔ Observability ⭐ New
Description
build_submodule_info treats both Ok(None) and Err(_) from submodule.url() as an “orphaned
submodule (no URL)” and skips the submodule. This misreports URL-read/parsing failures (e.g.,
invalid UTF-8) and makes real configuration problems harder to diagnose while producing incomplete
submodule traversal.
Code

crates/mcb-providers/src/vcs/submodule.rs[R197-200]

+        let Ok(Some(url)) = submodule.url().map(|u| u.map(str::to_owned)) else {
            mcb_domain::warn!(
                "submodule",
                "Orphaned submodule (no URL in .gitmodules), skipping",
Relevance

●●● Strong

Historical feedback favors distinguishing real errors from “missing” states; PR #87 accepted
avoiding silent None/skip behavior.

PR-#87

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The else branch on let Ok(Some(url)) = ... is taken for both Ok(None) and Err(_), but the
logged message only describes the missing-URL case.

crates/mcb-providers/src/vcs/submodule.rs[186-204]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new pattern match collapses `submodule.url()` error cases into the same branch as `Ok(None)`, logging an “orphaned submodule” warning and skipping. This hides the underlying error reason.

## Issue Context
`submodule.url()` now returns a `Result<Option<_>, _>` and can fail. Error cases should not be logged as “no URL in .gitmodules”.

## Fix Focus Areas
- crates/mcb-providers/src/vcs/submodule.rs[186-210]

## Suggested change
Use an explicit match to separate cases:
- `Ok(Some(url))` -> proceed
- `Ok(None)` -> log orphaned/no-url
- `Err(e)` -> log a different message including `e` (and consider whether to skip or propagate depending on desired behavior)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


10. third-party/ submodules removed 📘 Rule violation § Compliance
Description
This PR modifies content under third-party/ by deleting multiple vendored submodule entries,
without an explicit request authorizing third-party changes. This violates the rule restricting
edits under third-party/.
Code

third-party/edgevec[1]

-Subproject commit 11977efbef83e05e469e04110a331e62f09a0f92
Relevance

●● Moderate

No historical evidence: third-party/ directory not found in repository via tools; unclear
enforcement norms.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 1207169 forbids modifications under third-party/ unless explicitly requested. The
diff shows deletion of third-party/edgevec (and other third-party/* submodules), which
constitutes a third-party/ change without explicit authorization in the PR request text.

Rule 1207169: Do not modify files under third-party/ unless explicitly requested
third-party/edgevec[1-1]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Files under `third-party/` were modified (deleted), but the PR description does not explicitly request or authorize third-party changes.

## Issue Context
Compliance requires avoiding modifications under `third-party/` unless explicitly requested.

## Fix Focus Areas
- third-party/edgevec[1-1]
- third-party/loco[1-1]
- third-party/milvus-sdk-rust[1-1]
- third-party/rust-code-analysis[1-1]
- third-party/sea-orm-pro[1-1]
- third-party/sea-orm[1-1]
- third-party/sea-query[1-1]
- third-party/sea-schema[1-1]
- third-party/sea-streamer[1-1]
- third-party/seaography[1-1]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Previous review results

Review updated until commit 70330fc ⚖️ Balanced

Results up to commit a28d2b6 ⚖️ Balanced


No changes from previous review

Results up to commit d218ccd ⚖️ Balanced


🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. Cargo workspace deleted 🐞 Bug ≡ Correctness
Description
This PR deletes the root Cargo.toml, removing the workspace/package definition, so cargo
commands at the repository root can no longer build or test anything. It also deletes the CI
workflow file, removing the automated pipeline that previously enforced build/test/lint gates.
Code

Cargo.toml[L1-22]

-[workspace]
-resolver = "2"
-members = [
-    "crates/mcb",
-    "crates/mcb-utils",
-    "crates/mcb-domain",
-    "crates/mcb-infrastructure",
-    "crates/mcb-providers",
-    "crates/mcb-server",
-    "crates/mcb-validate",
-]
-exclude = ["third-party"]
-
-[workspace.package]
-repository = "https://github.com/marlonsc/mcb"
-authors = ["Marlon Costa <marlonsc@gmail.com>"]
-homepage = "https://github.com/marlonsc/mcb"
-license = "MIT"
-version = "0.3.1"
-rust-version = "1.92"
-edition = "2024"
-
Relevance

●●● Strong

Repo relies on root workspace+CI; PRs #103/#87 updated ci.yml to unblock required checks—deleting
them unlikely accepted.

PR-#103
PR-#87
PR-#107

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR branch retains a pre-commit workflow oriented around running project gates, while the diff
removes the Cargo workspace definition required for building/testing and deletes the CI workflow.

scripts/hooks/pre-commit[1-15]
README.md[1-1]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR removes the repository's Rust build entrypoints (root `Cargo.toml`, `Cargo.lock`) and removes the CI workflow file. After this change, the repo root is no longer a valid Cargo workspace, and CI gating is effectively removed.

## Issue Context
This looks inconsistent with keeping developer workflows like the pre-commit gate that still expects project build/lint/validate tooling.

## Fix Focus Areas
- Cargo.toml[1-30]
- Cargo.lock[1-20]
- .github/workflows/ci.yml[13-83]
- scripts/hooks/pre-commit[1-15]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Qodo Logo

Comment thread Cargo.toml
edition = "2024"

[workspace.lints.rust]
unsafe_code = "deny"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

1. unsafe_code lint removed 📘 Rule violation ⛨ Security

The workspace lint unsafe_code = "deny" was removed, so unsafe blocks can slip into non-test
Rust code without a hard failure. This violates the requirement that unsafe usage is forbidden and
the deny lint must remain in place.
Agent Prompt
## Issue description
`unsafe_code = "deny"` was removed from the workspace lints, weakening the guarantee that no `unsafe` code can be introduced.

## Issue Context
Compliance requires zero `unsafe` usage in Rust production code and explicitly requires keeping the project-level `unsafe_code = "deny"` lint in place.

## Fix Focus Areas
- Cargo.toml[23-30]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread Cargo.toml
unsafe_code = "deny"
missing_docs = "warn"
non_ascii_idents = "deny"
dead_code = "deny"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

2. dead_code lint removed 📘 Rule violation ⚙ Maintainability

The workspace lint dead_code = "deny" was removed, allowing new unused items to compile without a
hard failure. This violates the requirement that dead code must remain disallowed.
Agent Prompt
## Issue description
`dead_code = "deny"` was removed from workspace lints, which permits introducing unused functions/structs/constants without failing the build.

## Issue Context
Compliance requires the `dead_code` lint to remain set to `deny`.

## Fix Focus Areas
- Cargo.toml[23-29]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread Cargo.toml
non_ascii_idents = "deny"
dead_code = "deny"
unused_variables = "deny"
unused_imports = "deny"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

3. unused_imports lint removed 📘 Rule violation ⚙ Maintainability

The workspace lint unused_imports = "deny" was removed, allowing unused imports to compile without
a hard failure. This violates the requirement that unused imports remain disallowed.
Agent Prompt
## Issue description
`unused_imports = "deny"` was removed from workspace lints, weakening enforcement against unused `use` statements.

## Issue Context
Compliance requires the unused-imports lint remain set to `deny`.

## Fix Focus Areas
- Cargo.toml[28-29]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread third-party/edgevec
@@ -1 +0,0 @@
Subproject commit 11977efbef83e05e469e04110a331e62f09a0f92

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remediation recommended

4. third-party/ submodules removed 📘 Rule violation § Compliance

This PR modifies content under third-party/ by deleting multiple vendored submodule entries,
without an explicit request authorizing third-party changes. This violates the rule restricting
edits under third-party/.
Agent Prompt
## Issue description
Files under `third-party/` were modified (deleted), but the PR description does not explicitly request or authorize third-party changes.

## Issue Context
Compliance requires avoiding modifications under `third-party/` unless explicitly requested.

## Fix Focus Areas
- third-party/edgevec[1-1]
- third-party/loco[1-1]
- third-party/milvus-sdk-rust[1-1]
- third-party/rust-code-analysis[1-1]
- third-party/sea-orm-pro[1-1]
- third-party/sea-orm[1-1]
- third-party/sea-query[1-1]
- third-party/sea-schema[1-1]
- third-party/sea-streamer[1-1]
- third-party/seaography[1-1]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread scripts/hooks/pre-commit
Comment on lines +8 to +11
# Hooks inherit GIT_DIR/GIT_WORK_TREE from the invoking git process; leaked
# vars redirect fixture commits into this repository (they must hit temp repos).
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_OBJECT_DIRECTORY \
GIT_ALTERNATE_OBJECT_DIRECTORIES GIT_COMMON_DIR || true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

5. Late git env cleanup 🐞 Bug ≡ Correctness

scripts/hooks/pre-commit unsets GIT_DIR/GIT_WORK_TREE only after running `git rev-parse
--show-toplevel`, so leaked Git env vars can still influence the initial repository resolution and
cd into the wrong worktree/repo.
Agent Prompt
## Issue description
The pre-commit hook runs `git rev-parse --show-toplevel` before unsetting leaked `GIT_*` variables. If those variables are polluted, the very first `git` call can resolve against the wrong repo/worktree, making the subsequent cleanup ineffective.

## Issue Context
The newly-added `unset GIT_DIR GIT_WORK_TREE ...` block is intended to prevent fixture/test Git environment leakage from redirecting operations.

## Fix Focus Areas
- scripts/hooks/pre-commit[6-12]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread scripts/lib/mcb.sh
Comment on lines -1 to -16
#!/usr/bin/env bash
# scripts/lib/mcb.sh — canonical tooling monopoly for MCB.
# ONE source for cross-cutting concerns: exit codes, logging, colors, the
# APPLY=Y mutation gate, SSOT readers (version, binary, audit ignores), the
# banned-pattern guard, and the agent bash-guard. No script, makefile, hook, or
# CI job calls cargo/git directly — everything flows through here.
#
# Use as a library: source scripts/lib/mcb.sh ; mcb_require_cmd cargo
# Use as a dispatcher: bash scripts/lib/mcb.sh <command> [args...]
#
# Note: strict mode (set -euo pipefail) is enabled ONLY in the direct-execution
# dispatcher at the bottom, never at source time — sourcing must not flip the
# caller's shell options (make sets its own -euo pipefail; docs scripts source us).
[ -n "${_MCB_SH_LOADED:-}" ] && return 0
_MCB_SH_LOADED=1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

6. Deleted tooling still referenced 🐞 Bug ☼ Reliability

The pre-commit hook still calls bash scripts/lib/mcb.sh guard --staged and make check ..., but
this PR deletes scripts/lib/mcb.sh and Makefile (and also removes Cargo.toml), so the hook and
common workflows will fail immediately.
Agent Prompt
## Issue description
`scripts/hooks/pre-commit` depends on repo tooling (`scripts/lib/mcb.sh` and `make check ...`). This PR deletes that tooling (and the Rust workspace entrypoints), which makes the hook and developer/CI workflows fail.

## Issue Context
The remaining hook invokes the deleted script and Make targets.

## Fix Focus Areas
- scripts/hooks/pre-commit[12-14]
- scripts/lib/mcb.sh[1-136]
- Makefile[1-20]
- Cargo.toml[1-30]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Line 1: Update the README top-level heading from the placeholder “Test Repo”
to the project’s existing canonical name, preserving the heading format and
leaving the rest of the documentation unchanged.

In `@scripts/hooks/pre-commit`:
- Around line 8-11: Move the inherited Git-variable cleanup block before the
`git rev-parse --show-toplevel` invocation in the pre-commit hook, ensuring
`GIT_DIR`, `GIT_WORK_TREE`, `GIT_INDEX_FILE`, `GIT_OBJECT_DIRECTORY`,
`GIT_ALTERNATE_OBJECT_DIRECTORIES`, and `GIT_COMMON_DIR` are unset before
resolving the repository root.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: cubic · AI code reviewer

Comment thread README.md Outdated
## License

[MIT](./LICENSE) — Open source, free for commercial and personal use.
# Test Repo

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Restore the canonical project name.

# Test Repo is a placeholder and misidentifies the project for users, documentation tooling, and repository previews. Restore the existing project title.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` at line 1, Update the README top-level heading from the
placeholder “Test Repo” to the project’s existing canonical name, preserving the
heading format and leaving the rest of the documentation unchanged.

Comment thread scripts/hooks/pre-commit
Comment on lines +8 to +11
# Hooks inherit GIT_DIR/GIT_WORK_TREE from the invoking git process; leaked
# vars redirect fixture commits into this repository (they must hit temp repos).
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_OBJECT_DIRECTORY \
GIT_ALTERNATE_OBJECT_DIRECTORIES GIT_COMMON_DIR || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
git -C "$tmp" init -q
GIT_DIR="$tmp/.git" GIT_WORK_TREE="$tmp" git rev-parse --show-toplevel

Repository: marlonsc/mcb

Length of output: 170


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Files named pre-commit:"
fd -a 'pre-commit' . | sed 's#^\./##'

echo
if [ -f scripts/hooks/pre-commit ]; then
  echo "scripts/hooks/pre-commit with line numbers around first 30 lines:"
  sed -n '1,40p' scripts/hooks/pre-commit | nl -ba
fi

echo
echo "Git variable occurrences in scripts/hooks/pre-commit:"
rg -n '(GIT_|git rev-parse|--show-toplevel|cd |unset)' scripts/hooks/pre-commit || true

Repository: marlonsc/mcb

Length of output: 326


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "scripts/hooks/pre-commit contents:"
awk '{ printf "%6d\t%s\n", NR, $0 }' scripts/hooks/pre-commit

echo
echo "Git variable occurrences:"
grep -nE '(GIT_|git rev-parse|--show-toplevel|cd |unset)' scripts/hooks/pre-commit || true

Repository: marlonsc/mcb

Length of output: 1433


🏁 Script executed:

#!/bin/bash
set -euo pipefail

tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT

git -C "$tmp" init -q

tmp_prefix="$(cd "$tmp" && git rev-parse --show-cdup)"
leaked_prefix="${tmp}
${tmp}

"
echo "tmp_prefix=$tmp_prefix"
echo "has_leaked_prefix_match=$([[ $leaked_prefix ==  *"${tmp_prefix}"* ]] && echo yes || echo no)"

echo
echo "direct prefix check:"
python3 - <<'PY'
import tempfile, subprocess, os, textwrap
with tempfile.TemporaryDirectory() as tmp:
    subprocess.check_call(["git", "-C", tmp, "init", "-q"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
    prefix=subprocess.check_output(["git", "-C", tmp, "rev-parse", "--show-cdup"], text=True).rstrip("\n")
    leaked="{}\n{}\n".format(tmp, tmp)
    print("prefix={}".format(repr(prefix)))
    print("contains_prefix={}".format(leaked.endswith(prefix)))
PY

Repository: marlonsc/mcb

Length of output: 243


🌐 Web query:

Git GIT_WORK_TREE documentation git rev-parse --show-toplevel GIT_WORK_TREE

💡 Result:

The GIT_WORK_TREE environment variable and the git rev-parse --show-toplevel command are both used to interact with or query the root of a Git working tree [1][2][3]. GIT_WORK_TREE The GIT_WORK_TREE environment variable defines the root directory of the working tree for a repository [1][4]. It is particularly useful when you need to specify a working tree location that is different from the default (which is either the current directory or the directory containing the.git folder) [1][5]. Setting this variable (or using the --work-tree option) informs Git of the working tree's location, which is necessary if you are not currently inside that directory [1]. It can be set as an absolute path or a path relative to the current working directory [1][6]. git rev-parse --show-toplevel The git rev-parse --show-toplevel command outputs the absolute path of the top-level directory of the current working tree [2][7][3]. If this command is run outside of a valid Git working tree, it will report an error [2][8]. When GIT_WORK_TREE is set, git rev-parse --show-toplevel will correctly identify and report that specified path as the top level, provided the Git environment is correctly configured [9]. Relationship When GIT_WORK_TREE is defined, it explicitly overrides default repository discovery mechanisms (such as searching for a.git subdirectory) [1][5]. Consequently, git rev-parse --show-toplevel relies on this configuration to determine the root path [9]. Together, these tools allow for robust scripting where Git commands can be executed from various directories while consistently referencing the correct repository root [2][10][3].

Citations:


Sanitize inherited Git variables before resolving the repository root.

Line 7 invokes git rev-parse --show-toplevel before lines 10-11 unset the inherited variables. If those variables point to another repository, the hook can cd into that repository instead of the repository containing the pre-commit hook. Move the unset block before line 7.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/hooks/pre-commit` around lines 8 - 11, Move the inherited
Git-variable cleanup block before the `git rev-parse --show-toplevel` invocation
in the pre-commit hook, ensuring `GIT_DIR`, `GIT_WORK_TREE`, `GIT_INDEX_FILE`,
`GIT_OBJECT_DIRECTORY`, `GIT_ALTERNATE_OBJECT_DIRECTORIES`, and `GIT_COMMON_DIR`
are unset before resolving the repository root.

@cubic-dev-ai cubic-dev-ai Bot 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.

Ultrareview completed in 12m 25s

3 issues found across 1792 files

Confidence score: 3/5

  • README.md appears to have been replaced by a test fixture heading, which would remove core onboarding and operational docs (install/config/architecture/contributing) for users and contributors; this is a concrete usability regression if merged as-is — restore the full public README content before merge.
  • In scripts/hooks/pre-commit, environment handling around Git context looks fragile: resolving git rev-parse --show-toplevel before sanitizing GIT_DIR/GIT_WORK_TREE can target the wrong repository, and clearing GIT_INDEX_FILE before guard --staged can mis-handle alternate-index commits; together this can cause incorrect hook behavior and inconsistent commit validation — move Git env sanitization earlier and preserve GIT_INDEX_FILE through staged checks.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/hooks/pre-commit">

<violation number="1" location="scripts/hooks/pre-commit:10">
P2: Commits made through an alternate index can bypass (or be incorrectly rejected by) the staged guard because this clears `GIT_INDEX_FILE` before `guard --staged` runs. The hook should retain that variable through the staged guard, then clear it before the lint/validation gates that create fixture repositories.</violation>

<violation number="2" location="scripts/hooks/pre-commit:10">
P1: The first `git` resolution can still run with leaked `GIT_*` environment variables, so `git rev-parse --show-toplevel` may resolve the wrong repository before cleanup happens. Moving the `GIT_DIR`/`GIT_WORK_TREE` sanitization ahead of any `git` invocation would make this guard effective.</violation>
</file>

<file name="README.md">

<violation number="1" location="README.md:1">
P1: The repository's public README is reduced to a test-fixture heading, so users and contributors no longer have installation, configuration, tool, architecture, or contribution documentation. This looks like the fixture-write corruption described in the PR rather than an intended dependency/security fix; restore the project README content.</violation>
</file>

Note: This PR contains a large number of files. cubic only reviews up to 200 files per PR, so some files may not have been reviewed. cubic prioritizes the most important files to review.
Shadow auto-approve: would not auto-approve because issues were found.

Fix all with cubic | Re-trigger cubic

Comment thread README.md Outdated
## License

[MIT](./LICENSE) — Open source, free for commercial and personal use.
# Test Repo

@cubic-dev-ai cubic-dev-ai Bot Jul 30, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: The repository's public README is reduced to a test-fixture heading, so users and contributors no longer have installation, configuration, tool, architecture, or contribution documentation. This looks like the fixture-write corruption described in the PR rather than an intended dependency/security fix; restore the project README content.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At README.md, line 1:

<comment>The repository's public README is reduced to a test-fixture heading, so users and contributors no longer have installation, configuration, tool, architecture, or contribution documentation. This looks like the fixture-write corruption described in the PR rather than an intended dependency/security fix; restore the project README content.</comment>

<file context>
@@ -1,181 +1 @@
-## License
-
-[MIT](./LICENSE) — Open source, free for commercial and personal use.
+# Test Repo
</file context>
Fix with cubic

Comment thread scripts/hooks/pre-commit
@@ -5,6 +5,10 @@
# the retroactive baseline; `make guard` (full tree) is the CI/manual scan.
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
# Hooks inherit GIT_DIR/GIT_WORK_TREE from the invoking git process; leaked
# vars redirect fixture commits into this repository (they must hit temp repos).
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_OBJECT_DIRECTORY \

@cubic-dev-ai cubic-dev-ai Bot Jul 30, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: The first git resolution can still run with leaked GIT_* environment variables, so git rev-parse --show-toplevel may resolve the wrong repository before cleanup happens. Moving the GIT_DIR/GIT_WORK_TREE sanitization ahead of any git invocation would make this guard effective.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/hooks/pre-commit, line 10:

<comment>The first `git` resolution can still run with leaked `GIT_*` environment variables, so `git rev-parse --show-toplevel` may resolve the wrong repository before cleanup happens. Moving the `GIT_DIR`/`GIT_WORK_TREE` sanitization ahead of any `git` invocation would make this guard effective.</comment>

<file context>
@@ -5,6 +5,10 @@
 cd "$(git rev-parse --show-toplevel)"
+# Hooks inherit GIT_DIR/GIT_WORK_TREE from the invoking git process; leaked
+# vars redirect fixture commits into this repository (they must hit temp repos).
+unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_OBJECT_DIRECTORY \
+  GIT_ALTERNATE_OBJECT_DIRECTORIES GIT_COMMON_DIR || true
 echo "→ guard (staged)…";   bash scripts/lib/mcb.sh guard --staged
</file context>
Fix with cubic

Comment thread scripts/hooks/pre-commit
@@ -5,6 +5,10 @@
# the retroactive baseline; `make guard` (full tree) is the CI/manual scan.
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
# Hooks inherit GIT_DIR/GIT_WORK_TREE from the invoking git process; leaked
# vars redirect fixture commits into this repository (they must hit temp repos).
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_OBJECT_DIRECTORY \

@cubic-dev-ai cubic-dev-ai Bot Jul 30, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: Commits made through an alternate index can bypass (or be incorrectly rejected by) the staged guard because this clears GIT_INDEX_FILE before guard --staged runs. The hook should retain that variable through the staged guard, then clear it before the lint/validation gates that create fixture repositories.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/hooks/pre-commit, line 10:

<comment>Commits made through an alternate index can bypass (or be incorrectly rejected by) the staged guard because this clears `GIT_INDEX_FILE` before `guard --staged` runs. The hook should retain that variable through the staged guard, then clear it before the lint/validation gates that create fixture repositories.</comment>

<file context>
@@ -5,6 +5,10 @@
 cd "$(git rev-parse --show-toplevel)"
+# Hooks inherit GIT_DIR/GIT_WORK_TREE from the invoking git process; leaked
+# vars redirect fixture commits into this repository (they must hit temp repos).
+unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_OBJECT_DIRECTORY \
+  GIT_ALTERNATE_OBJECT_DIRECTORIES GIT_COMMON_DIR || true
 echo "→ guard (staged)…";   bash scripts/lib/mcb.sh guard --staged
</file context>
Fix with cubic

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit a28d2b6

Comment thread Cargo.toml
Comment on lines -1 to -22
[workspace]
resolver = "2"
members = [
"crates/mcb",
"crates/mcb-utils",
"crates/mcb-domain",
"crates/mcb-infrastructure",
"crates/mcb-providers",
"crates/mcb-server",
"crates/mcb-validate",
]
exclude = ["third-party"]

[workspace.package]
repository = "https://github.com/marlonsc/mcb"
authors = ["Marlon Costa <marlonsc@gmail.com>"]
homepage = "https://github.com/marlonsc/mcb"
license = "MIT"
version = "0.3.1"
rust-version = "1.92"
edition = "2024"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

1. Cargo workspace deleted 🐞 Bug ≡ Correctness

This PR deletes the root Cargo.toml, removing the workspace/package definition, so cargo
commands at the repository root can no longer build or test anything. It also deletes the CI
workflow file, removing the automated pipeline that previously enforced build/test/lint gates.
Agent Prompt
## Issue description
The PR removes the repository's Rust build entrypoints (root `Cargo.toml`, `Cargo.lock`) and removes the CI workflow file. After this change, the repo root is no longer a valid Cargo workspace, and CI gating is effectively removed.

## Issue Context
This looks inconsistent with keeping developer workflows like the pre-commit gate that still expects project build/lint/validate tooling.

## Fix Focus Areas
- Cargo.toml[1-30]
- Cargo.lock[1-20]
- .github/workflows/ci.yml[13-83]
- scripts/hooks/pre-commit[1-15]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit d218ccd

Test User added 2 commits July 30, 2026 08:27
- crossbeam-epoch 0.9.18 -> 0.9.20 (RUSTSEC-2026-0204)
- serial_test 3.4 -> 4.0.0: drops scc entirely, removing RUSTSEC-2026-0205
  without an msrv bump (4.0.1 requires rustc 1.93.1; workspace validates
  under 1.92 and CI stable alike)
- git2 0.20 -> 0.21 (RUSTSEC-2026-0183/0184); getters now return
  Result<Option<&str>>, call sites updated (git.rs, submodule.rs)
- quick-xml workspace pin 0.39 -> 0.41 for first-party crates
- accept RUSTSEC-2026-0194/0195 in the audit ignore SSOT with evidence:
  vendored opendal pins quick-xml <0.41 and its XML services are disabled
  in this workspace, so the DoS paths are unreachable until the next
  opendal bump
- box large error variants (CallToolResult, loco_rs::Error) across
  mcb-server handlers and mcb initializers (result_large_err)
- auth: typed AuthError domain error + map_auth_error boundary mapping
  (replaces loco_rs::Result in mcb-server auth, ported from the v0.4.0
  feature line)
- mcb_bin: prefer workspace-built binary over PATH (mise shim broke
  validate in fresh worktrees)
- contract snapshots refreshed for serde field ordering

Validated: cargo check --workspace --all-targets 0 errors; make check
WHAT=lint and WHAT=audit green; contract suite 27/27; nextest
mcb-server+mcb-providers+mcb 756/756 on this content.
git exports GIT_DIR/GIT_WORK_TREE to hook processes; the gate's test
fixtures then commit into this repository instead of their temp repos
(observed as stray 'Initial commit' commits, mass file deletions staged
from fixture cleanups, and README gutted to a test stub). Sanitize the
git-hook environment before running the canonical gates.
// INTENTIONAL: Best-effort default branch detection; falls back to None
.ok()
.and_then(|head| head.shorthand().map(String::from))
.and_then(|head| head.shorthand().ok().map(String::from))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

1. Git2 errors are swallowed 📘 Rule violation ☼ Reliability

GitProvider::get_default_branch() and GitProvider::get_remote_url() now call
head.shorthand().ok() and remote.url().ok(), respectively, which discards the underlying
git2::Error and can mask real failures behind None/generic behavior (e.g., a misleading “no
HEAD” outcome). This violates the requirement (PR Compliance ID 1208751) to not silently swallow
errors in production paths without propagation, explicit handling, or logging.
Agent Prompt
## Issue description
`GitProvider::get_default_branch()` and `GitProvider::get_remote_url()` currently use `.ok()` on fallible `git2` getters (`head.shorthand()` and `remote.url()`), which discards the underlying `git2::Error` and can mask non-benign failures (including replacing errors with a generic “no HEAD”/`None` outcome) with no logging or propagation.

## Issue Context
This behavior was introduced during the `git2` upgrade where previously-infallible getters became `Result<Option<&str>>`. Compliance (PR Compliance ID 1208751) requires that errors are not silently swallowed in production paths; they must be propagated, explicitly handled, or at least logged with sufficient context. If remote URL detection is intended to be best-effort, the failure should still be logged with context, or the API should be adjusted to return a `Result<Option<String>, Error>`.

## Fix Focus Areas
- crates/mcb-providers/src/vcs/git.rs[60-70]
- crates/mcb-providers/src/vcs/git.rs[72-77]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread scripts/lib/mcb.sh
Comment on lines 56 to 60
[ -x "$MCB_ROOT/target/debug/mcb" ] && { echo "$MCB_ROOT/target/debug/mcb"; return 0; }
[ -x "$MCB_ROOT/target/release/mcb" ] && { echo "$MCB_ROOT/target/release/mcb"; return 0; }
command -v mcb 2>/dev/null && return 0
echo "cargo run --package mcb --"
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

2. Empty mcb_bin output 🐞 Bug ≡ Correctness

mcb_bin returns success when mcb is on PATH but prints nothing, so callers using
cmd="$(mcb_bin)" end up executing an empty command string and failing (e.g., mcb_validate). This
breaks validation tooling in environments where mcb is available only via PATH/shims.
Agent Prompt
## Issue description
`scripts/lib/mcb.sh:mcb_bin` uses `command -v mcb 2>/dev/null && return 0` which exits successfully without emitting the resolved path. Callers (notably `mcb_validate`) capture `mcb_bin` output into a variable and execute it, so an empty output results in trying to run `validate` as a standalone command.

## Issue Context
`mcb_validate` does `cmd="$(mcb_bin)"` and then runs `$cmd validate ...`, which requires `mcb_bin` to always print an executable command string when it returns success.

## Fix Focus Areas
- scripts/lib/mcb.sh[54-81]

## Suggested change
Replace the PATH branch with something that prints the resolved command, e.g.:
```bash
local path
path="$(command -v mcb 2>/dev/null)" && { echo "$path"; return 0; }
```
This preserves the new precedence (debug/release first) while making the PATH fallback usable.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +197 to 200
let Ok(Some(url)) = submodule.url().map(|u| u.map(str::to_owned)) else {
mcb_domain::warn!(
"submodule",
"Orphaned submodule (no URL in .gitmodules), skipping",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remediation recommended

3. Submodule url errors hidden 🐞 Bug ◔ Observability

build_submodule_info treats both Ok(None) and Err(_) from submodule.url() as an “orphaned
submodule (no URL)” and skips the submodule. This misreports URL-read/parsing failures (e.g.,
invalid UTF-8) and makes real configuration problems harder to diagnose while producing incomplete
submodule traversal.
Agent Prompt
## Issue description
The new pattern match collapses `submodule.url()` error cases into the same branch as `Ok(None)`, logging an “orphaned submodule” warning and skipping. This hides the underlying error reason.

## Issue Context
`submodule.url()` now returns a `Result<Option<_>, _>` and can fail. Error cases should not be logged as “no URL in .gitmodules”.

## Fix Focus Areas
- crates/mcb-providers/src/vcs/submodule.rs[186-210]

## Suggested change
Use an explicit match to separate cases:
- `Ok(Some(url))` -> proceed
- `Ok(None)` -> log orphaned/no-url
- `Err(e)` -> log a different message including `e` (and consider whether to skip or propagate depending on desired behavior)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 70330fc

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
crates/mcb-providers/src/vcs/git.rs (1)

60-66: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression tests for the new failure paths.

Cover failed default-branch resolution, missing/blank origin remote metadata, and tree entries with names that cannot be decoded. These paths intentionally differ from earlier error-propagation behavior and need focused coverage to guard future regressions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/mcb-providers/src/vcs/git.rs` around lines 60 - 66, Add focused
regression tests for get_default_branch covering failed HEAD/default-branch
resolution, remote handling with missing or blank origin metadata, and tree
entries whose names cannot be decoded. Assert each path’s intended fallback or
error behavior, using existing repository/test helpers and preserving the
changed best-effort semantics.

Source: Coding guidelines

crates/mcb-providers/src/vcs/submodule.rs (1)

197-204: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Distinguish missing submodule URLs from URL lookup errors.

git2::Submodule::url() returns Result<Option<&str>, Error> in this crate version, so Err(...) represents a lookup/failure case rather than a missing .gitmodules URL. Match it separately when skipping so the log isn’t always reported as an orphan.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/mcb-providers/src/vcs/submodule.rs` around lines 197 - 204, Update the
submodule URL handling around submodule.url() to distinguish Ok(None), which
should retain the orphaned-submodule warning and skip behavior, from Err(error),
which should use an appropriate lookup-failure warning including the error
details before returning None. Preserve the existing owned URL handling for
Ok(Some(url)).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/mcb-server/src/controllers/admin_config.rs`:
- Around line 14-20: Update load_admin_config to obtain config_root exclusively
from mcb_infrastructure::config::resolve_admin_config_root(), removing the
environment-variable lookup and DEFAULT_PRO_ADMIN_CONFIG_DIR fallback. Keep the
existing ConfigParser loading and error conversion behavior unchanged.

---

Outside diff comments:
In `@crates/mcb-providers/src/vcs/git.rs`:
- Around line 60-66: Add focused regression tests for get_default_branch
covering failed HEAD/default-branch resolution, remote handling with missing or
blank origin metadata, and tree entries whose names cannot be decoded. Assert
each path’s intended fallback or error behavior, using existing repository/test
helpers and preserving the changed best-effort semantics.

In `@crates/mcb-providers/src/vcs/submodule.rs`:
- Around line 197-204: Update the submodule URL handling around submodule.url()
to distinguish Ok(None), which should retain the orphaned-submodule warning and
skip behavior, from Err(error), which should use an appropriate lookup-failure
warning including the error details before returning None. Preserve the existing
owned URL handling for Ok(Some(url)).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 448abf05-a7cd-4d91-9d40-5c594f36ac6f

📥 Commits

Reviewing files that changed from the base of the PR and between a28d2b6 and 70330fc.

⛔ Files ignored due to path filters (22)
  • Cargo.lock is excluded by !**/*.lock
  • crates/mcb-server/tests/contract/snapshots/contract__agent_contract_tests__agent_happy_path.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__agent_contract_tests__agent_invalid_args.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__agent_contract_tests__agent_store_without_session.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__entity_contract_tests__entity_happy_path.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__entity_contract_tests__entity_invalid_args.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__index_contract_tests__index_happy_path.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__index_contract_tests__index_invalid_args.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__memory_contract_tests__memory_get_observation_ids_empty.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__memory_contract_tests__memory_get_observation_ids_none.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__memory_contract_tests__memory_happy_path.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__memory_contract_tests__memory_invalid_args.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__project_contract_tests__project_happy_path.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__project_contract_tests__project_invalid_args.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__search_contract_tests__search_happy_path.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__search_contract_tests__search_invalid_args.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__session_contract_tests__session_happy_path.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__session_contract_tests__session_invalid_args.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__validate_contract_tests__validate_happy_path.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__validate_contract_tests__validate_invalid_args.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__vcs_contract_tests__vcs_happy_path.snap is excluded by !**/*.snap
  • crates/mcb-server/tests/contract/snapshots/contract__vcs_contract_tests__vcs_invalid_args.snap is excluded by !**/*.snap
📒 Files selected for processing (25)
  • Cargo.toml
  • crates/mcb-providers/src/vcs/git.rs
  • crates/mcb-providers/src/vcs/submodule.rs
  • crates/mcb-server/src/auth.rs
  • crates/mcb-server/src/controllers/admin.rs
  • crates/mcb-server/src/controllers/admin_config.rs
  • crates/mcb-server/src/controllers/web/config.rs
  • crates/mcb-server/src/handlers/memory/execution.rs
  • crates/mcb-server/src/handlers/memory/list_timeline.rs
  • crates/mcb-server/src/handlers/search.rs
  • crates/mcb-server/src/handlers/session/common.rs
  • crates/mcb-server/src/handlers/session/create.rs
  • crates/mcb-server/src/handlers/session/get.rs
  • crates/mcb-server/src/handlers/session/update.rs
  • crates/mcb-server/src/handlers/vcs/analyze_impact.rs
  • crates/mcb-server/src/handlers/vcs/compare_branches.rs
  • crates/mcb-server/src/handlers/vcs/index_repo.rs
  • crates/mcb-server/src/handlers/vcs/responses.rs
  • crates/mcb-server/src/handlers/vcs/search_branch.rs
  • crates/mcb-server/src/macros/handlers.rs
  • crates/mcb-server/src/utils/mcp/fields.rs
  • crates/mcb-server/src/utils/mcp/helpers.rs
  • crates/mcb/src/initializers/mcp_server.rs
  • scripts/hooks/pre-commit
  • scripts/lib/mcb.sh
📜 Review details
🧰 Additional context used
📓 Path-based instructions (9)
**/*.rs

📄 CodeRabbit inference engine (.windsurfrules)

**/*.rs: Error handling: Use Error::vcs("msg") constructors, never unwrap()/expect() in production code
Lints: Set unsafe_code = "deny" and dead_code = "deny". Zero clippy warnings required
Testing: Run make test (1700+ tests). New logic must include tests
MVI 200: Keep source files under approximately 200 lines; split into submodules when growing larger

**/*.rs: Use thiserror constructors for error handling (e.g., Error::vcs("msg")) and never use unwrap() in production code
Use linkme for compile-time dependency injection and Handle pattern for hot-swap dependency injection, as specified in ADR-050
Keep source files under ~200 lines; split into submodules when growing beyond that size
Fix all warnings and clippy issues and leave tests passing after every change cycle

**/*.rs: Use the most restrictive type that compiles in Rust. No Any, no bare object, no suppression of type errors. Fix types at the source.
Depend on abstractions (protocols/interfaces); inject collaborators; no hidden globals or hard-wired construction inside business logic.
Use the most restrictive type that compiles. No Any, no bare object, no suppression of type errors. Fix types at the source; depend on declared contracts.
Enforce dependency rules: mcb-domain has zero internal dependencies; mcb-providers implements domain ports; mcb-infrastructure handles composition; mcb-server is entrypoint; mcb-utils is a leaf crate.
Keep imports ordered: std, external crates, mcb_* crates, local modules.

Files:

  • crates/mcb-server/src/handlers/memory/execution.rs
  • crates/mcb-server/src/controllers/web/config.rs
  • crates/mcb-server/src/handlers/session/get.rs
  • crates/mcb-server/src/handlers/vcs/search_branch.rs
  • crates/mcb-server/src/handlers/vcs/analyze_impact.rs
  • crates/mcb-server/src/controllers/admin_config.rs
  • crates/mcb-server/src/utils/mcp/fields.rs
  • crates/mcb-server/src/utils/mcp/helpers.rs
  • crates/mcb-server/src/handlers/vcs/compare_branches.rs
  • crates/mcb-server/src/handlers/session/update.rs
  • crates/mcb-server/src/handlers/memory/list_timeline.rs
  • crates/mcb-server/src/handlers/vcs/index_repo.rs
  • crates/mcb-server/src/macros/handlers.rs
  • crates/mcb-providers/src/vcs/submodule.rs
  • crates/mcb-providers/src/vcs/git.rs
  • crates/mcb-server/src/handlers/search.rs
  • crates/mcb-server/src/handlers/session/common.rs
  • crates/mcb-server/src/handlers/vcs/responses.rs
  • crates/mcb-server/src/handlers/session/create.rs
  • crates/mcb-server/src/controllers/admin.rs
  • crates/mcb/src/initializers/mcp_server.rs
  • crates/mcb-server/src/auth.rs
**/*.{rs,toml}

📄 CodeRabbit inference engine (AGENTS.md)

No TODOs, stubs, fakes, fallbacks, compat wrappers, or 'temporary' workarounds. No suppression directives (# type: ignore, blanket # noqa, @ts-ignore, eslint-disable, etc.) and no escape-hatch typing (Any, bare object, unchecked casts) unless carrying a one-line documented justification.

Files:

  • crates/mcb-server/src/handlers/memory/execution.rs
  • crates/mcb-server/src/controllers/web/config.rs
  • crates/mcb-server/src/handlers/session/get.rs
  • crates/mcb-server/src/handlers/vcs/search_branch.rs
  • crates/mcb-server/src/handlers/vcs/analyze_impact.rs
  • crates/mcb-server/src/controllers/admin_config.rs
  • crates/mcb-server/src/utils/mcp/fields.rs
  • crates/mcb-server/src/utils/mcp/helpers.rs
  • crates/mcb-server/src/handlers/vcs/compare_branches.rs
  • crates/mcb-server/src/handlers/session/update.rs
  • crates/mcb-server/src/handlers/memory/list_timeline.rs
  • Cargo.toml
  • crates/mcb-server/src/handlers/vcs/index_repo.rs
  • crates/mcb-server/src/macros/handlers.rs
  • crates/mcb-providers/src/vcs/submodule.rs
  • crates/mcb-providers/src/vcs/git.rs
  • crates/mcb-server/src/handlers/search.rs
  • crates/mcb-server/src/handlers/session/common.rs
  • crates/mcb-server/src/handlers/vcs/responses.rs
  • crates/mcb-server/src/handlers/session/create.rs
  • crates/mcb-server/src/controllers/admin.rs
  • crates/mcb/src/initializers/mcp_server.rs
  • crates/mcb-server/src/auth.rs
crates/mcb-server/src/handlers/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Do not import lower-level concrete providers directly into handlers. Add or reuse a domain port, wire the adapter in infrastructure, and resolve through the catalog/context.

Files:

  • crates/mcb-server/src/handlers/memory/execution.rs
  • crates/mcb-server/src/handlers/session/get.rs
  • crates/mcb-server/src/handlers/vcs/search_branch.rs
  • crates/mcb-server/src/handlers/vcs/analyze_impact.rs
  • crates/mcb-server/src/handlers/vcs/compare_branches.rs
  • crates/mcb-server/src/handlers/session/update.rs
  • crates/mcb-server/src/handlers/memory/list_timeline.rs
  • crates/mcb-server/src/handlers/vcs/index_repo.rs
  • crates/mcb-server/src/handlers/search.rs
  • crates/mcb-server/src/handlers/session/common.rs
  • crates/mcb-server/src/handlers/vcs/responses.rs
  • crates/mcb-server/src/handlers/session/create.rs
**/*.{rs,yaml}

📄 CodeRabbit inference engine (AGENTS.md)

Do not hardcode configuration values in code. Add fields to the typed config model and populate every profile (development.yaml, test.yaml, production.yaml).

Files:

  • crates/mcb-server/src/handlers/memory/execution.rs
  • crates/mcb-server/src/controllers/web/config.rs
  • crates/mcb-server/src/handlers/session/get.rs
  • crates/mcb-server/src/handlers/vcs/search_branch.rs
  • crates/mcb-server/src/handlers/vcs/analyze_impact.rs
  • crates/mcb-server/src/controllers/admin_config.rs
  • crates/mcb-server/src/utils/mcp/fields.rs
  • crates/mcb-server/src/utils/mcp/helpers.rs
  • crates/mcb-server/src/handlers/vcs/compare_branches.rs
  • crates/mcb-server/src/handlers/session/update.rs
  • crates/mcb-server/src/handlers/memory/list_timeline.rs
  • crates/mcb-server/src/handlers/vcs/index_repo.rs
  • crates/mcb-server/src/macros/handlers.rs
  • crates/mcb-providers/src/vcs/submodule.rs
  • crates/mcb-providers/src/vcs/git.rs
  • crates/mcb-server/src/handlers/search.rs
  • crates/mcb-server/src/handlers/session/common.rs
  • crates/mcb-server/src/handlers/vcs/responses.rs
  • crates/mcb-server/src/handlers/session/create.rs
  • crates/mcb-server/src/controllers/admin.rs
  • crates/mcb/src/initializers/mcp_server.rs
  • crates/mcb-server/src/auth.rs
crates/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

crates/**/*.rs: Use Error constructors and Result aliases from mcb-domain; do not build raw domain errors by hand.
Use ? for propagation. No unwrap(), expect(), panic!(), todo!(), or unimplemented!() in production paths.
Keep first-party source files compact; split modules before they become difficult to review.

Files:

  • crates/mcb-server/src/handlers/memory/execution.rs
  • crates/mcb-server/src/controllers/web/config.rs
  • crates/mcb-server/src/handlers/session/get.rs
  • crates/mcb-server/src/handlers/vcs/search_branch.rs
  • crates/mcb-server/src/handlers/vcs/analyze_impact.rs
  • crates/mcb-server/src/controllers/admin_config.rs
  • crates/mcb-server/src/utils/mcp/fields.rs
  • crates/mcb-server/src/utils/mcp/helpers.rs
  • crates/mcb-server/src/handlers/vcs/compare_branches.rs
  • crates/mcb-server/src/handlers/session/update.rs
  • crates/mcb-server/src/handlers/memory/list_timeline.rs
  • crates/mcb-server/src/handlers/vcs/index_repo.rs
  • crates/mcb-server/src/macros/handlers.rs
  • crates/mcb-providers/src/vcs/submodule.rs
  • crates/mcb-providers/src/vcs/git.rs
  • crates/mcb-server/src/handlers/search.rs
  • crates/mcb-server/src/handlers/session/common.rs
  • crates/mcb-server/src/handlers/vcs/responses.rs
  • crates/mcb-server/src/handlers/session/create.rs
  • crates/mcb-server/src/controllers/admin.rs
  • crates/mcb/src/initializers/mcp_server.rs
  • crates/mcb-server/src/auth.rs
crates/mcb-server/src/{args,handlers,tools}/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

crates/mcb-server/src/{args,handlers,tools}/**/*.rs: When changing an MCP tool: (1) Update args schema and validator, (2) Update handler, (3) Update docs/MCP_TOOLS.md if public contract changed, (4) Add or update focused tests.
MCP tool args schemas are split across crates/mcb-server/src/args/, handlers across crates/mcb-server/src/handlers/, and tool logic across crates/mcb-server/src/tools/.

Files:

  • crates/mcb-server/src/handlers/memory/execution.rs
  • crates/mcb-server/src/handlers/session/get.rs
  • crates/mcb-server/src/handlers/vcs/search_branch.rs
  • crates/mcb-server/src/handlers/vcs/analyze_impact.rs
  • crates/mcb-server/src/handlers/vcs/compare_branches.rs
  • crates/mcb-server/src/handlers/session/update.rs
  • crates/mcb-server/src/handlers/memory/list_timeline.rs
  • crates/mcb-server/src/handlers/vcs/index_repo.rs
  • crates/mcb-server/src/handlers/search.rs
  • crates/mcb-server/src/handlers/session/common.rs
  • crates/mcb-server/src/handlers/vcs/responses.rs
  • crates/mcb-server/src/handlers/session/create.rs
crates/mcb-server/src/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Prefer existing macros and patterns: tool_action!, tool_schema!, tool_enum!, register_tool!, linkme distributed slices, and the Handle pattern.

Files:

  • crates/mcb-server/src/handlers/memory/execution.rs
  • crates/mcb-server/src/controllers/web/config.rs
  • crates/mcb-server/src/handlers/session/get.rs
  • crates/mcb-server/src/handlers/vcs/search_branch.rs
  • crates/mcb-server/src/handlers/vcs/analyze_impact.rs
  • crates/mcb-server/src/controllers/admin_config.rs
  • crates/mcb-server/src/utils/mcp/fields.rs
  • crates/mcb-server/src/utils/mcp/helpers.rs
  • crates/mcb-server/src/handlers/vcs/compare_branches.rs
  • crates/mcb-server/src/handlers/session/update.rs
  • crates/mcb-server/src/handlers/memory/list_timeline.rs
  • crates/mcb-server/src/handlers/vcs/index_repo.rs
  • crates/mcb-server/src/macros/handlers.rs
  • crates/mcb-server/src/handlers/search.rs
  • crates/mcb-server/src/handlers/session/common.rs
  • crates/mcb-server/src/handlers/vcs/responses.rs
  • crates/mcb-server/src/handlers/session/create.rs
  • crates/mcb-server/src/controllers/admin.rs
  • crates/mcb-server/src/auth.rs
**/*.toml

📄 CodeRabbit inference engine (.cursor/rules/mcb.mdc)

Enforce strict Rust lints: unsafe_code = "deny", dead_code = "deny", unused_imports = "deny"

Files:

  • Cargo.toml
Cargo.toml

📄 CodeRabbit inference engine (AGENTS.md)

Version, MSRV, workspace members, lint policy are defined in Cargo.toml. When a static document disagrees with Cargo.toml or code, trust the executable source first and update the doc.

Files:

  • Cargo.toml
🧠 Learnings (1)
📚 Learning: 2026-03-01T22:45:33.850Z
Learnt from: marlon-costa-dc
Repo: marlonsc/mcb PR: 113
File: crates/mcb-server/src/controllers/admin_config.rs:15-17
Timestamp: 2026-03-01T22:45:33.850Z
Learning: In Rust files that use sea_orm_pro::ConfigParser for reading admin_config.yaml, do not reuse Loco's ConfigLoader. Use the Admin ConfigParser path: create a ConfigParser with ConfigParser::new().load_config() to load the YAML with its own schema. Resolve the config root with mcb_infrastructure::config::resolve_admin_config_root() instead of hardcoding paths. This pattern applies to controller modules under crates/mcb-server/src/controllers/ and any similar admin_config loading logic that relies on the admin_config.yaml.

Applied to files:

  • crates/mcb-server/src/controllers/web/config.rs
  • crates/mcb-server/src/controllers/admin_config.rs
  • crates/mcb-server/src/controllers/admin.rs
🔇 Additional comments (24)
crates/mcb-providers/src/vcs/git.rs (1)

72-77: LGTM!

Also applies to: 111-111

crates/mcb-server/src/auth.rs (1)

14-37: LGTM!

Also applies to: 61-61, 70-70, 84-84, 117-121, 131-131, 140-145, 155-155

crates/mcb-server/src/controllers/admin.rs (1)

44-46: LGTM!

Also applies to: 65-66, 117-124, 134-134

crates/mcb-server/src/controllers/admin_config.rs (1)

1-1: LGTM!

crates/mcb-server/src/controllers/web/config.rs (1)

41-41: LGTM!

crates/mcb-server/src/handlers/memory/execution.rs (1)

35-37: LGTM!

crates/mcb-server/src/utils/mcp/fields.rs (1)

12-51: LGTM!

crates/mcb-server/src/utils/mcp/helpers.rs (1)

120-126: LGTM!

crates/mcb-server/src/handlers/session/common.rs (1)

13-20: LGTM!

crates/mcb-server/src/handlers/vcs/search_branch.rs (1)

18-24: LGTM!

Also applies to: 55-61

crates/mcb-server/src/handlers/vcs/responses.rs (1)

141-150: LGTM!

crates/mcb-server/src/macros/handlers.rs (1)

9-17: LGTM!

Also applies to: 30-30

scripts/hooks/pre-commit (1)

8-11: Move Git-variable cleanup before repository discovery.

The hook still runs git rev-parse --show-toplevel before unsetting inherited Git variables, so leaked GIT_DIR or GIT_WORK_TREE can redirect it to the wrong repository. Move this block before Line 7. This repeats the unresolved prior review finding.

Cargo.toml (1)

273-273: LGTM!

Also applies to: 287-293

scripts/lib/mcb.sh (1)

56-70: LGTM!

crates/mcb-server/src/handlers/memory/list_timeline.rs (1)

68-83: LGTM!

Also applies to: 95-95

crates/mcb-server/src/handlers/search.rs (1)

90-104: LGTM!

Also applies to: 118-118

crates/mcb-server/src/handlers/session/create.rs (1)

83-93: LGTM!

Also applies to: 139-147, 157-157

crates/mcb-server/src/handlers/session/get.rs (1)

27-27: LGTM!

crates/mcb-server/src/handlers/session/update.rs (1)

31-31: LGTM!

crates/mcb-server/src/handlers/vcs/analyze_impact.rs (1)

27-27: LGTM!

crates/mcb-server/src/handlers/vcs/compare_branches.rs (1)

25-25: LGTM!

crates/mcb-server/src/handlers/vcs/index_repo.rs (1)

25-25: LGTM!

crates/mcb/src/initializers/mcp_server.rs (1)

212-240: LGTM!

Also applies to: 244-266, 282-314, 359-359

Comment on lines +14 to +20
pub fn load_admin_config() -> Result<serde_json::Value, Box<loco_rs::Error>> {
let config_root = std::env::var("MCB_PRO_ADMIN_CONFIG_DIR")
.unwrap_or_else(|_| DEFAULT_PRO_ADMIN_CONFIG_DIR.to_owned());
let cfg = sea_orm_pro::ConfigParser::new()
.load_config(&config_root)
.map_err(|e| loco_rs::Error::string(&e.to_string()))?;
serde_json::to_value(cfg).map_err(|e| loco_rs::Error::string(&e.to_string()))
.map_err(|e| Box::new(loco_rs::Error::string(&e.to_string())))?;
serde_json::to_value(cfg).map_err(|e| Box::new(loco_rs::Error::string(&e.to_string())))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Resolve the admin configuration root through the typed infrastructure helper.

The hard-coded DEFAULT_PRO_ADMIN_CONFIG_DIR fallback bypasses the canonical configuration-root resolution and can load the wrong admin_config.yaml in deployments where MCB_PRO_ADMIN_CONFIG_DIR is unset. Replace this path selection with mcb_infrastructure::config::resolve_admin_config_root().

As per coding guidelines, configuration values must not be hard-coded in Rust. Based on learnings, admin configuration must use the ConfigParser path together with resolve_admin_config_root() rather than hardcoded paths.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/mcb-server/src/controllers/admin_config.rs` around lines 14 - 20,
Update load_admin_config to obtain config_root exclusively from
mcb_infrastructure::config::resolve_admin_config_root(), removing the
environment-variable lookup and DEFAULT_PRO_ADMIN_CONFIG_DIR fallback. Keep the
existing ConfigParser loading and error conversion behavior unchanged.

Sources: Coding guidelines, Learnings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant