Skip to content

fix(chart): alembic hook Job for migrations.autoApply=false (AIFactory#2003) - #1493

Merged
olafkfreund merged 8 commits into
devfrom
fix/2003-chart-alembic-job
Oct 31, 2026
Merged

olafkfreund merged 8 commits into
devfrom
fix/2003-chart-alembic-job

Conversation

@olafkfreund

Copy link
Copy Markdown
Owner

Summary

Same fix as olafkfreund/AIFactory#2004 for olafkfreund/AIFactory#2003: charts/tfactory/values.yaml promised an alembic-upgrade Job for migrations.autoApply=false (the chart default), but no template created one, so a chart install never migrated.

Decision (lead): a Helm pre-install,pre-upgrade hook Job running alembic upgrade head with the app image and the same DATABASE_URL Secret as the web Deployment, rendered only when autoApply=false.

  • charts/tfactory/templates/job-migrations.yaml (new): hook weight -5, delete policy before-hook-creation,hook-succeeded, jobImage/jobBackoffLimit honoured, labels tfactory.selectorLabels + component: migrations (inside the NetworkPolicy; the Service also requires component: server, so never an endpoint), no chart ServiceAccount (does not exist at pre-install) and no token mount, /tmp emptyDir for the read-only root FS. Env is DATABASE_URL only: alembic/env.py reads nothing else.
  • values comment and README row now describe the hook and its precondition (DB Secret must exist before the first install, else pre-create it or install once with autoApply=true).
  • tests/helm/test_migrations_job.py: default render has the hook Job, autoApply=true renders none, jobImage override.

Artifacts (slug reused from AIFactory):

  • intent/2026-10-31-2003-chart-alembic-job.md
  • spec/2026-10-31-2003-chart-alembic-job.md
  • plan/2026-10-31-2003-chart-alembic-job.md

Coder: Claude ported all steps from AIFactory#2004 (mechanical port; Codex implemented the original there).

Verification: helm lint charts/tfactory passes; helm template renders one migrations Job by default, none with autoApply=true; pytest tests/helm -m helm passes locally. The kind install test already sets autoApply=true.

Refs olafkfreund/AIFactory#2003

🤖 Generated with Claude Code

https://claude.ai/code/session_01L5j1hQCdA4NmA4jiKDNBX4

olafkfreund and others added 7 commits October 31, 2026 13:17
…AIFactory#2003)

Pre-approved by the user for the 2026-10-31 wave.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5j1hQCdA4NmA4jiKDNBX4
…Factory#2003)

Pre-approved by the user for the 2026-10-31 wave.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5j1hQCdA4NmA4jiKDNBX4
…Factory#2003)

Pre-approved by the user for the 2026-10-31 wave.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5j1hQCdA4NmA4jiKDNBX4
…und/AIFactory#2003)

Plan steps 1-3, ported by Claude from AIFactory PR #2004.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5j1hQCdA4NmA4jiKDNBX4
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

TFactory coverage

54.91% on this PR vs 54.82% on its base (+0.09 pts).

PASS - Coverage 54.91% (unchanged vs base 54.82%)

Measured by the TFactory coverage gate on both the PR head and its base.

@olafkfreund
olafkfreund merged commit 2b0d9e1 into dev Oct 31, 2026
39 checks passed
@olafkfreund
olafkfreund deleted the fix/2003-chart-alembic-job branch October 31, 2026 14:18
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