Skip to content

fix(answer): align template standards#644

Open
mberlofa wants to merge 2 commits into
mainfrom
fix/answer-template-standards
Open

fix(answer): align template standards#644
mberlofa wants to merge 2 commits into
mainfrom
fix/answer-template-standards

Conversation

@mberlofa

@mberlofa mberlofa commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add the canonical answer.validate helper and validate.yaml gate
  • validate ambiguous database settings, backup settings, ingress hosts, and selector label overrides
  • convert NOTES.txt to numbered operational sections
  • make external database and ExternalSecrets CI scenarios self-contained for k3d

Validation

  • node scripts/charts/template-standards-check.js --chart answer --json
  • helm unittest charts/answer
  • helm lint --strict charts/answer
  • make standards-check CHART=answer
  • make validate-chart CHART=answer TIMEOUT=1200: FULLY VALIDATED (18 layers)
  • make site-sync-check CHART=answer
  • make release-check REPO=charts
  • make attribution-check REPO=charts

Site PR: helmforgedev/site#324
Issue: #633

Summary by CodeRabbit

  • New Features
    • Added Helm chart validation to fail fast on common misconfigurations.
    • Improved installation notes with clearer, numbered sections.
  • Bug Fixes
    • Updated CI PostgreSQL connectivity to use a disposable in-cluster PostgreSQL endpoint with an explicit port.
    • Updated external secrets wiring to match the new PostgreSQL endpoint and added bundled PostgreSQL Service/Deployment manifests for CI.
    • Added safeguards for ingress host presence and restricted selector label overrides.
  • Tests
    • Added validation test cases covering database selection, backup endpoint, ingress hosts, and pod label constraints.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Standards Check (GR-079) — PASS

Every changed chart fully passes standards-check.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a927f650-d5a6-4ff8-b902-e5db30eec5de

📥 Commits

Reviewing files that changed from the base of the PR and between 02f25d5 and bcb6147.

📒 Files selected for processing (3)
  • charts/answer/ci/external-db-values.yaml
  • charts/answer/ci/external-secrets.yaml
  • charts/answer/templates/_helpers.tpl
🚧 Files skipped from review as they are similar to previous changes (3)
  • charts/answer/ci/external-secrets.yaml
  • charts/answer/templates/_helpers.tpl
  • charts/answer/ci/external-db-values.yaml

📝 Walkthrough

Walkthrough

This PR adds Helm chart validation wiring and tests, updates CI values to use an in-cluster PostgreSQL pod, and restructures NOTES.txt into numbered sections.

Changes

Chart Value Validation

Layer / File(s) Summary
Validation helper template and wiring
charts/answer/templates/_helpers.tpl, charts/answer/templates/validate.yaml
Adds answer.validate helper enforcing ingress host and pod label constraints, and validate.yaml includes it.
Validation test suite
charts/answer/tests/validation_test.yaml
Adds failure-mode tests for ambiguous database selection, missing backup S3 endpoint, missing ingress hosts, and podLabels overrides.

CI External Database Wiring

Layer / File(s) Summary
External DB values and PostgreSQL manifests
charts/answer/ci/external-db-values.yaml
Changes host and port to a local postgresql service and adds Service and Deployment manifests for a disposable PostgreSQL pod.
External secrets rewiring
charts/answer/ci/external-secrets.yaml
Updates host and port, switches secretStoreRef to a fake ClusterSecretStore with new remoteRef keys, and adds matching PostgreSQL Service and Deployment manifests.

NOTES.txt Restructuring

Layer / File(s) Summary
Numbered section headers
charts/answer/templates/NOTES.txt
Converts uppercase headers and ASCII banners into numbered sections from 1. Summary through 8. Resources.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main goal of aligning the Answer chart with template standards.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/answer-template-standards

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

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🟢 Security Scan: answer

Framework Score
MITRE + NSA + SOC2 88.60029%

✅ Security posture acceptable.

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

🧹 Nitpick comments (2)
charts/answer/templates/_helpers.tpl (1)

334-337: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Minor: unused local variable and redundant guard.

$databaseMode is assigned but never referenced afterward — the include is only used for its side effect (fail), similar to $_ used at Line 336. Consider using $_ here too for consistency and to signal intent.

Also, the if .Values.backup.enabled guard here duplicates the check already performed inside answer.backupEnabled (Line 268), so it's not incorrect but is redundant.

Nit fix
-{{- $databaseMode := include "answer.databaseMode" . -}}
+{{- $_ := include "answer.databaseMode" . -}}
🤖 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 `@charts/answer/templates/_helpers.tpl` around lines 334 - 337, The helper
block has an unused local assignment and a redundant outer guard: in the
`_helpers.tpl` template, `answer.databaseMode` is included only for its side
effect, so bind it to `$_` instead of `$databaseMode` to make that intent clear,
and consider removing the extra `.Values.backup.enabled` `if` since
`answer.backupEnabled` already performs the same check.
charts/answer/ci/external-db-values.yaml (1)

48-67: 🩺 Stability & Availability | 🔵 Trivial

Optional: no readiness gating between Answer and this PostgreSQL pod.

The disposable Postgres pod has no readiness probe, and nothing ordered ensures it accepts connections before the Answer pod attempts AUTO_INSTALL/DB connect. If Answer doesn't retry the initial connection, this CI scenario can be flaky. Consider a readinessProbe (e.g. pg_isready) on this container and/or confirming Answer retries the DB handshake.

Note: the emptyDir mount at /var/lib/postgresql is correct for the postgres:18 image (its VOLUME/PGDATA moved to /var/lib/postgresql/18/docker under that parent), so no change is needed there.

🤖 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 `@charts/answer/ci/external-db-values.yaml` around lines 48 - 67, The
disposable PostgreSQL pod in the external DB values has no readiness gating, so
Answer may try AUTO_INSTALL or connect before the database is accepting
connections. Add a readinessProbe to the postgresql container (for example using
pg_isready) and, if needed, ensure the Answer deployment’s startup logic can
retry the initial DB handshake; use the existing postgresql container spec in
external-db-values.yaml to place the change without altering the emptyDir mount.
🤖 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.

Nitpick comments:
In `@charts/answer/ci/external-db-values.yaml`:
- Around line 48-67: The disposable PostgreSQL pod in the external DB values has
no readiness gating, so Answer may try AUTO_INSTALL or connect before the
database is accepting connections. Add a readinessProbe to the postgresql
container (for example using pg_isready) and, if needed, ensure the Answer
deployment’s startup logic can retry the initial DB handshake; use the existing
postgresql container spec in external-db-values.yaml to place the change without
altering the emptyDir mount.

In `@charts/answer/templates/_helpers.tpl`:
- Around line 334-337: The helper block has an unused local assignment and a
redundant outer guard: in the `_helpers.tpl` template, `answer.databaseMode` is
included only for its side effect, so bind it to `$_` instead of `$databaseMode`
to make that intent clear, and consider removing the extra
`.Values.backup.enabled` `if` since `answer.backupEnabled` already performs the
same check.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 024fe4f7-8777-4a1e-831d-de89734454bb

📥 Commits

Reviewing files that changed from the base of the PR and between 0d8168f and 2dbcc16.

📒 Files selected for processing (6)
  • charts/answer/ci/external-db-values.yaml
  • charts/answer/ci/external-secrets.yaml
  • charts/answer/templates/NOTES.txt
  • charts/answer/templates/_helpers.tpl
  • charts/answer/templates/validate.yaml
  • charts/answer/tests/validation_test.yaml

@mberlofa mberlofa force-pushed the fix/answer-template-standards branch from 2dbcc16 to 02f25d5 Compare July 4, 2026 18:54
@mberlofa

mberlofa commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Addressed both CodeRabbit review-body nitpicks.

Changes:

  • Replaced the unused $databaseMode local with $_ and removed the redundant outer backup.enabled guard around answer.backupEnabled evaluation.
  • Added pg_isready readiness probes to the disposable PostgreSQL containers in both ci/external-db-values.yaml and ci/external-secrets.yaml, keeping the external DB CI scenarios aligned.

Validation:

  • make validate-chart CHART=answer passed
  • Result: answer: FULLY VALIDATED (18 layers), including all k3d GR-027 scenarios and the disposable PostgreSQL deployments
  • make release-check REPO=charts passed with only the expected post-merge release confirmation warning
  • make attribution-check REPO=charts passed
  • git diff --check passed

Note: these CodeRabbit items were posted in the review summary/body, not as active review threads, so there are no thread IDs to reply to or resolve for them.

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