Skip to content

feat: harden model management and release gates - #53

Merged
saagar210 merged 4 commits into
masterfrom
codex/chore/aggressive-repo-cleanup
Mar 14, 2026
Merged

feat: harden model management and release gates#53
saagar210 merged 4 commits into
masterfrom
codex/chore/aggressive-repo-cleanup

Conversation

@saagar210

Copy link
Copy Markdown
Owner

What

  • add a managed local installation and status flow for the search API embedding model
  • block unverified custom GGUF loads by default and fix audit-log export validation
  • surface safer semantic-search setup in Settings and onboarding, and enforce release version parity

Why

  • remove implicit model downloads and tighten the model trust boundary
  • make semantic-search setup clearer and safer for operators
  • prevent version drift across the UI, Tauri bundle, Cargo metadata, and generated API artifacts

How

  • added a pinned local-only search-api embedding manager plus Tauri install/status commands and readiness checks
  • updated Settings to show separate desktop and search-api semantic model cards, verification state, and the advanced override for unverified local models
  • added version-parity CI checks, regenerated OpenAPI, and routed Python dependency auditing through the managed search-api environment

Testing

  • pnpm run check:version-parity
  • pnpm run ui:gate:static
  • pnpm test
  • bash scripts/search-api/run-python.sh -m pytest -q tests/test_managed_embedding_model.py tests/test_search_api_endpoints.py
  • cargo test --manifest-path src-tauri/Cargo.toml --test command_contracts --test path_validation --test permission_manifest
  • pnpm run ui:gate:regression
  • pnpm run perf:bundle
  • pnpm run perf:build
  • pnpm run perf:assets
  • pnpm run perf:workspace
  • pnpm run perf:memory
  • pnpm run perf:lhci:prod
  • env -u DATABASE_URL pnpm run perf:db
  • env -u DATABASE_URL pnpm run perf:db:enforce
  • env -u DATABASE_URL BASE_URL=http://localhost:3000 pnpm run perf:api
  • pnpm run perf:summary
  • pnpm run test:security:audit:rust
  • pnpm run test:security:audit:python
  • pnpm search-api:openapi:generate
  • pnpm search-api:openapi:check
  • node scripts/ci/require-tests-and-docs.mjs

Risk / Notes

  • lint-staged is currently misconfigured for ESLint 9 because the repo does not expose an eslint.config.* file to the hook path; the required project gates above were run successfully before packaging these commits
  • unrelated local worktree changes remain outside this PR and were intentionally not committed
  • local API perf ran on the workstation fallback path without pgvector, so the validated local perf path here is the BM25/hybrid-ready setup

Performance impact

  • no negative regressions were found in the checked local perf suite
  • current local summary: build 3188 ms, assets about 1.13 MB, workspace ready 82.7 ms, batch triage 865.92 ms, memory delta 0.006 MB

Lockfile rationale

  • src-tauri/Cargo.lock changed only to stay aligned with the checked-in Rust/package state and release metadata sync in this hardening pass

Screenshots

  • UI regression and accessibility gates passed locally
  • screenshots were not attached from this terminal-created PR

- add a managed search-api embedding install and status flow
- block unverified GGUF loads by default and harden readiness checks
- cover the new backend command and search-api paths with regression tests

Tests: pytest, cargo tests
- add separate Settings cards for desktop and search-api semantic models
- show model verification state and the advanced unverified-model override
- point onboarding to Settings instead of implying setup was already completed

Tests: vitest, UI gates
- add a version parity checker and wire it into CI and repo readiness
- sync package, Tauri, Cargo, and generated OpenAPI release metadata
- run Python dependency auditing through the managed search-api environment

Tests: parity, audits, OpenAPI check, perf gates
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on hardening the model management and release gates within the application. It enhances security by managing the search API embedding model locally and blocking unverified GGUF loads by default. The changes also improve the user experience by clarifying the semantic-search setup and enforcing version parity across different components.

Highlights

  • Managed Search API Embedding Model: Introduces a managed local installation and status flow for the search API embedding model, enhancing security and control.
  • GGUF Loading Hardening: Blocks unverified custom GGUF loads by default, requiring an explicit override for unverified local models, and fixes audit-log export validation.
  • Semantic Search Setup: Surfaces safer semantic-search setup in Settings and onboarding, and enforces release version parity across the UI, Tauri bundle, Cargo metadata, and generated API artifacts.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • docs/adr/0004-managed-semantic-search-models.md
    • Added an Architecture Decision Record (ADR) detailing the decision to manage semantic search models explicitly.
  • docs/runbooks/dependency-advisory-triage.md
    • Updated the dependency advisory triage runbook to use the pnpm run test:security:audit:python command.
  • index.html
    • Updated the index.html file to include meta description and title.
  • openapi/openapi.generated.json
    • Incremented the Search API version from 1.1.0 to 1.2.0.
  • package.json
    • Added a check:version-parity script and updated check:monorepo-readiness to include version parity checks.
    • Modified the test:security:audit:python script to use the run-python.sh script.
    • Added a version:sync script to sync versions across the project.
  • public/robots.txt
    • Added a robots.txt file to allow all user agents.
  • scripts/ci/check-version-parity.mjs
    • Added a script to check and sync version parity across package.json, tauri.conf.json, and Cargo.toml.
  • search-api/README.md
    • Added a pip-audit check to the search-api README.
  • search-api/embedding_service.py
    • Modified the EmbeddingService to load the managed search-api embedding model from local disk only.
  • search-api/hybrid_search.py
    • Modified the hybrid search to lazily load the reranker model and handle reranker unavailability.
  • search-api/managed_embedding_model.py
    • Added a module for managed embedding model installation and status for the search-api.
  • search-api/requirements-test.txt
    • Added pip-audit to the test requirements.
  • search-api/requirements.txt
    • Added huggingface-hub as a runtime dependency.
  • search-api/reranker.py
    • Modified the reranker to load the model with local_files_only and use a cache directory.
  • search-api/search_api.py
    • Modified the search API to check the status of the managed embedding model.
  • search-api/tests/test_managed_embedding_model.py
    • Added tests for the managed embedding model.
  • search-api/tests/test_search_api_endpoints.py
    • Added a test case to verify that the model component check reports missing managed embedding.
  • src-tauri/Cargo.lock
    • Updated the Cargo.lock file to align with the Rust/package state.
  • src-tauri/Cargo.toml
    • Updated the package version to 1.2.0.
  • src-tauri/build.rs
    • Refactored the build script to improve readability.
  • src-tauri/permissions/default.toml
    • Added permissions for new commands related to unverified local models and the search API embedding model.
    • Added permissions for new customization and workspace commands.
    • Added permission for reassigning runbook session scope.
  • src-tauri/src/commands/mod.rs
    • Added commands to get and set the allow_unverified_local_models setting.
    • Added tests for custom model verification status.
  • src-tauri/src/commands/search_api.rs
    • Added commands to get the search API embedding model status and install the model.
    • Added functions to run the search API embedding manager and parse its output.
  • src-tauri/src/commands/security_commands.rs
    • Replaced validate_within_home with validate_output_file_within_home for audit log export validation.
  • src-tauri/src/db/mod.rs
    • Added methods to get and set raw string setting values.
    • Refactored database operations for runbook templates and resolution kits to improve code clarity.
  • src-tauri/src/lib.rs
    • Registered new commands related to unverified local models and the search API embedding model.
  • src-tauri/src/llm.rs
    • Added a verification_status field to the ModelInfo struct.
  • src-tauri/tauri.conf.json
    • Updated the app version to 1.2.0.
    • Added the managed_embedding_model.py script to the resources.
  • src-tauri/tests/command_contracts.rs
    • Added a test case for the SearchApiEmbeddingModelStatus contract.
  • src-tauri/tests/path_validation.rs
    • Added tests for output file validation.
  • src-tauri/tests/permission_manifest.rs
    • Updated the permission manifest tests to handle new commands.
  • src-tauri/tests/security.rs
    • Updated the SSRF metadata endpoint test.
  • src/components/Settings/SettingsTab.css
    • Added CSS styles for verification badges, semantic model cards, and other UI elements.
    • Updated CSS styles for model cards and other UI elements.
  • src/components/Settings/SettingsTab.test.tsx
    • Added tests for the SettingsTab component, focusing on semantic search model cards and the advanced local-model toggle.
  • src/components/shared/OnboardingWizard.test.tsx
    • Added tests for the OnboardingWizard component, focusing on security setup and semantic-search model setup.
  • src/components/shared/OnboardingWizard.tsx
    • Updated the OnboardingWizard to treat security setup as informational and point users to Settings for semantic-search model setup.
  • src/hooks/useLlm.ts
    • Added a getModelInfo function to the useLlm hook.
    • Updated the useLlm hook to handle model verification status.
  • src/hooks/useSearchApiEmbedding.ts
    • Added a useSearchApiEmbedding hook to manage the search API embedding model status and installation.
  • src/types/index.ts
    • Added types for SearchApiEmbeddingModelStatus and updated existing types.
Ignored Files
  • Ignored by pattern: .github/workflows/** (2)
    • .github/workflows/ci.yml
    • .github/workflows/quality-gates.yml
Activity
  • Added a pinned local-only search-api embedding manager plus Tauri install/status commands and readiness checks
  • Updated Settings to show separate desktop and search-api semantic model cards, verification state, and the advanced override for unverified local models
  • Added version-parity CI checks, regenerated OpenAPI, and routed Python dependency auditing through the managed search-api environment
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces significant hardening for model management and release processes. Key changes include adding a managed local installation flow for the search API's embedding model to prevent runtime downloads, blocking unverified custom GGUF models by default to enhance security, and adding version parity checks to CI. The UI in Settings has also been updated to provide a clearer and safer setup for semantic search. My feedback focuses on improving logging consistency within the search API components for better observability in production environments.

Comment on lines 26 to +30
print(f"Embedding service initialized: {model_name}")
print(f" Dimension: {self.dimension}")
print(f" Device: {self.model.device}")
print(f" Uses prefix: {self.uses_prefix}")
print(f" Local path: {self.model_path}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For consistency with the rest of the application's logging, these print statements should be converted to logging.info calls. This ensures that initialization messages are properly captured and routed, which is important for monitoring and debugging. You will need to add import logging and logger = logging.getLogger(__name__) at the top of the file.

Suggested change
print(f"Embedding service initialized: {model_name}")
print(f" Dimension: {self.dimension}")
print(f" Device: {self.model.device}")
print(f" Uses prefix: {self.uses_prefix}")
print(f" Local path: {self.model_path}")
logger.info(f"Embedding service initialized: {model_name}")
logger.info(f" Dimension: {self.dimension}")
logger.info(f" Device: {self.model.device}")
logger.info(f" Uses prefix: {self.uses_prefix}")
logger.info(f" Local path: {self.model_path}")

Comment thread search-api/reranker.py
cache_folder=self.model_dir,
local_files_only=True,
)
print(f"Reranker initialized: {self.model_name}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For consistency with the rest of the application's logging, please use the logging module instead of print() for initialization messages. This ensures that logs are properly captured and routed, which is important for observability.

You'll need to add import logging and logger = logging.getLogger(__name__) at the top of the file.

Suggested change
print(f"Reranker initialized: {self.model_name}")
logger.info(f"Reranker initialized: {self.model_name}")

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 214d89e16c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +498 to +502
let _ = db.save_model_state(
"llm",
validated_path.to_string_lossy().as_ref(),
Some(info.id.as_str()),
None,

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 Badge Store custom model state in a form startup can reload

Saving custom GGUF loads into model_state with model_id = info.id makes startup auto-load attempt load_model with that ID, but startup only uses llm_model_id and load_model resolves built-in catalog IDs under the managed models directory. That means custom model sessions now record state that cannot be replayed, so restart auto-load silently fails and the previously loaded custom model is never restored.

Useful? React with 👍 / 👎.

Comment on lines +419 to +420
.arg("--app-data-dir")
.arg(app_data_dir_str)

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 Badge Respect app-data env override when running model manager

Passing --app-data-dir from get_app_data_dir() forces the manager to use the platform default path and bypasses the ASSISTSUPPORT_APP_DATA_DIR override supported by managed_embedding_model.py. In deployments/tests that set this env var to relocate data, Settings install/status writes and reads the wrong directory, while the search API continues checking the overridden directory and reports the model as missing.

Useful? React with 👍 / 👎.

- stub the managed embedding model status in the production smoke harness
- override vulnerable transitive audit dependencies and refresh the pnpm lockfile
- update the Linux Playwright snapshot to match the new Settings UI

Tests: pnpm audit; production smoke
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
B Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@saagar210
saagar210 merged commit bc02057 into master Mar 14, 2026
31 of 33 checks passed
@saagar210
saagar210 deleted the codex/chore/aggressive-repo-cleanup branch March 14, 2026 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant