Project Context for AI Agents
This file contains critical rules and patterns that AI agents must follow when implementing code in this project. Focus on unobvious details that agents might otherwise miss.
Technology Stack & Versions
Infrastructure as Code
- Terraform
>= 1.7.4— local backend atterraform/main/state/terraform.tfstate - Providers (pinned in
terraform/main/providers.tf): scott-the-programmer/minikube~> 0.6.0hashicorp/kubernetes~> 2.26.0hashicorp/helm~> 2.12.1oboukili/argocd6.0.3
Cluster & GitOps
- Minikube — Kubernetes
v1.33.4, driverdocker(switched from qemu2/socket_vmnet per sprint-change-proposal-2026-06-20 — IT firewall blocks VM-driver SSH). Host access needssudo minikube tunnel -p data+/etc/hosts→127.0.0.1argocd.data airflow.data(the docker tunnel binds localhost, not the node IP). Seedocs/runbooks/clean-state-bring-up.md. - ArgoCD — apps & projects provisioned via Terraform (
modules/k8s/argocd/{project,application,server}); apps use an automatedsyncPolicy(prune + self-heal) so they self-reconcile.
Data Platform Workloads
- Apache Airflow
3.2.2— official Apache Helm chart1.22.0, wrapped athelms/airflow(config under theairflow:alias invalues.yaml). CeleryExecutor + Redis; components:api-server,scheduler, standalonedag-processor,triggerer,worker. SimpleAuthManager admin; DAGs via gitSync (main,airflowsubPath). Secrets are Terraform-managed k8s Secrets. - PostgreSQL
14.2.4— Bitnami Helm chart (dbmini_data_platform, usermini); images sourced frombitnamilegacy/*.
Python (DAGs)
- Python
>=3.12,<3.13, managed with Poetry - black
^24.2.0(line-length 120), isort (black profile), flake8^7.0.0(+ flake8-pyproject), mypy^1.8.0(strict), pytest^8.0.2+ pytest-cov
Docs & CI
- MkDocs → GitHub Pages (
.github/workflows/ci-mkdocs.yml) - terraform-docs + helm-docs auto-inject into
readme.md/README.md - pre-commit orchestrates per-area hooks (terraform, python, helms)
Critical Implementation Rules
Terraform Conventions
- Numbered file ordering — files within a module/main are prefixed to convey order:
00-variables.tf,01-*.tf…99-outputs.tf. Follow this when adding files. - Modular structure — reusable infra lives under
terraform/modules/k8s/*(minicluster,namespace,argocd/{project,application,server}). Compose interraform/main/, don't inline resources there. - Local state — backend is local (
terraform/main/state/). Do not assume remote state. - Provider config flows from the cluster module — kubernetes/helm providers are wired
from
module.clusteroutputs in01-cluster.tf.
Auto-Generated Docs — DO NOT HAND-EDIT
- Terraform
readme.mdand HelmREADME.mdcontent between<!-- BEGIN_TF_DOCS -->/<!-- END_TF_DOCS -->markers is generated by terraform-docs / helm-docs viascripts/*_docs.sh. Edit.tfvariable descriptions orREADME.md.gotmplinstead; regeneration runs in pre-commit.
Airflow DAG Authoring (Airflow 3 / airflow.sdk)
- All DAGs MUST subclass
ChesterDag(mini_dags/chester/dag.py), not rawDAG. It enforces defaults:catchup=False,retries=1, no failure/retry emails,retry_delay=1m. Seemini_dags/dags/example.pyfor the canonical pattern. - DAGs use the context-manager form (
with ChesterDag(...) as dag:). - Airflow 3 SDK imports:
from airflow.sdk import DAG;ScheduleArgcomes fromairflow.sdk.definitions.dag(not re-exported at theairflow.sdktop level in 3.2.2). Use theschedule=argument (noschedule_interval/timetable).
Python Code Quality
- mypy is strict:
disallow_untyped_defs+disallow_incomplete_defs— every function needs full type annotations.airflow.*imports are exempted from missing-import errors (configured inpyproject.tomloverrides). - black line-length 120 (not default 88); isort uses the black profile.
- flake8 ignores
E203,E266,E501,B008,W503, max-cognitive-complexity 12.
Workflow
- pre-commit gates everything — it runs per-directory sub-hooks (terraform, python
via
cd airflow, helms) plus doc regeneration. Run before committing. - Commit messages follow a gitmoji + type convention, e.g.
feat: :wrench: Deploy Postgres instance.
Platform Operational Gotchas (Airflow 3 / k8s 1.33 — landed)
helms/airflowis the OFFICIAL Apache chart1.22.0(Airflow 3.2.2) wrapped under theairflow:alias — no longer a custom mini chart. All config lives invalues.yaml.- Host access (docker driver):
sudo minikube tunnel -p data+/etc/hosts→127.0.0.1(NOT the node IP). The tunnel must be restarted after any cluster recreate. - Clean bring-up is two-phase (argocd-provider bootstrap):
-target=module.cluster,module.argocdfirst (tunnel), then fullterraform apply. Seedocs/runbooks/clean-state-bring-up.md. - SimpleAuth admin password is auto-generated/ephemeral — read it from the api-server logs.
- DB migrate runs as an ArgoCD
hook: Syncjob (useHelmHooks: false); never re-enable Helm hooks.
Usage Guidelines
For AI Agents: - Read this file before implementing any code. - Follow ALL rules exactly as documented; when in doubt, prefer the more restrictive option. - Update this file if new patterns emerge.
For Humans: - Keep this file lean and focused on agent needs. - Update when the technology stack changes (e.g. after the Airflow 3.0 / k8s 1.33 upgrades land). - Review periodically and remove rules that become obvious over time.
Last Updated: 2026-06-21