Skip to content

fix(gem4gov-cli): handle empty data store lists and missing data store names - #336

Merged
Calvin-Cheng1 merged 1 commit into
mainfrom
fix/gem4gov-cli-empty-data-stores
Oct 22, 2026
Merged

Calvin-Cheng1 merged 1 commit into
mainfrom
fix/gem4gov-cli-empty-data-stores

Conversation

@aghassemlouei

@aghassemlouei aghassemlouei commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Description

Guards empty data store lists and missing data store name fields in blueprints/gemini-enterprise/gem4gov-cli/data_stores.py so gem4gov does not crash when no valid search data stores exist or when a data store payload omits name, and adds a container HEALTHCHECK instruction (/_stcore/health) to blueprints/gemini-enterprise/analytics/Dockerfile to resolve Trivy DS-0026.

Split out from #286 (authored by @ForeverYoung48) so repository lint hygiene (#286) and these gemini-enterprise fixes can be reviewed and merged independently.

Fixes: N/A (split out from #286)

  • Guard name.split('/')[-1] in validate_data_store() so missing name fields fall back to data_store_id.
  • Return None early with an informational message in list_data_stores() when no valid search data stores exist before calling click.IntRange(1, len(valid_data_stores)).
  • Add HEALTHCHECK (http://127.0.0.1:8080/_stcore/health) to blueprints/gemini-enterprise/analytics/Dockerfile (DS-0026).
  • Add unit tests in tests/gem4gov_cli/test_data_stores.py covering missing name payloads, empty/filtered dataStores responses, and the analytics Dockerfile HEALTHCHECK instruction.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Deployment & Compliance Impact

  • Applicable Regimes:
    • US Region Restricted (e.g., Access Policy constraint)
    • FedRAMP Moderate
    • FedRAMP High
    • DoD IL4
    • DoD IL5
    • General / All
  • NIST 800-53r5 Controls: SI-6 (Security and Privacy Function Verification) via container health check probe on blueprints/gemini-enterprise/analytics/Dockerfile.

Checklist

Code Quality & Reusability

  • My code adheres to the Maximize Reusability principle. I have not redefined common elements and have reused existing base configurations and modules where possible.
  • I have checked that no existing module or configuration in modules/ or fast/stages-aw/ can be leveraged for this change.
  • My code follows the established naming conventions outlined in docs/naming-convention.md.

Documentation

  • I have updated the README.md of the modified module or blueprint.
  • I have added/updated documentation for inputs (variables) and outputs.

Security

  • My change adheres to GCP security best practices and the principle of least privilege.
  • I have ensured compliance with the targeted regime (FedRAMP Moderate, FedRAMP High, IL4, IL5, etc.).

Testing

  • I have tested my changes locally.
  • I have included details of my testing in this PR.

Testing Performed

  • uv run --locked pytest tests/gem4gov_cli/test_data_stores.py: 13 unit tests passed (test_validate_data_store_missing_name_falls_back_to_id, test_list_data_stores_empty_returns_none_without_prompt, test_analytics_dockerfile_defines_healthcheck, plus 10 existing tests).
  • uv run --locked ruff check blueprints/gemini-enterprise/gem4gov-cli/data_stores.py tests/gem4gov_cli/test_data_stores.py and uv run --locked ruff format --check: 0 issues.
  • bash tools/lint.sh and bash tools/run_tests.sh: all checks and test suites passed.

@aghassemlouei aghassemlouei added Bug Something isn't working Gemini - Government Gemini for Government (G4G) related Priority - Medium Standard features and non-blocking bugs; important for the current milestone but not urgent Level of Effort - Low Quick, well-defined tasks with no unknowns; takes a few hours up to one day to complete Scope - Blueprint Related to solution blueprints in the blueprints directory labels Oct 22, 2026
@github-actions github-actions Bot added the Gemini - Enterprise Gemini Enterprise (GE) related label Oct 22, 2026
@aghassemlouei
aghassemlouei marked this pull request as ready for review October 22, 2026 01:53
@aghassemlouei
aghassemlouei force-pushed the fix/gem4gov-cli-empty-data-stores branch from 52f1cab to a29b94a Compare October 22, 2026 01:54
…e names

- Guard `name.split('/')[-1]` in `validate_data_store()` so missing
  `name` fields fall back to `data_store_id`.
- Return `None` early with an informational message in
  `list_data_stores()` when no valid search data stores exist before
  calling `click.IntRange(1, len(valid_data_stores))`.
- Add `HEALTHCHECK` instruction (`/_stcore/health`) to
  `blueprints/gemini-enterprise/analytics/Dockerfile` (Trivy `DS-0026`).
- Add unit tests in `tests/gem4gov_cli/test_data_stores.py` covering
  all three fixes.
@aghassemlouei
aghassemlouei force-pushed the fix/gem4gov-cli-empty-data-stores branch from a29b94a to 66dc9d9 Compare October 22, 2026 01:57
@aghassemlouei aghassemlouei added the Security Something is insecure or can be secured label Oct 22, 2026
@aghassemlouei

Copy link
Copy Markdown
Member Author

@digitalresistor - Just tagging you here to mention that this gem4gov cli is far from ideal. We would love to add as many HashiCorp resources as possible rather than relying on this but any ideas you have would be greatly appreciated.

@Calvin-Cheng1
Calvin-Cheng1 merged commit 80b7d4a into main Oct 22, 2026
23 checks passed
@Calvin-Cheng1
Calvin-Cheng1 deleted the fix/gem4gov-cli-empty-data-stores branch October 22, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Gemini - Enterprise Gemini Enterprise (GE) related Gemini - Government Gemini for Government (G4G) related Level of Effort - Low Quick, well-defined tasks with no unknowns; takes a few hours up to one day to complete Priority - Medium Standard features and non-blocking bugs; important for the current milestone but not urgent Scope - Blueprint Related to solution blueprints in the blueprints directory Security Something is insecure or can be secured

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants