chore: Adopt Make as canonical task runner with working host + stage workflows#747
Merged
Merged
Conversation
c2e17d9 to
30d7752
Compare
…workflows Rewrites the Makefile from scratch to be the single entry point for dev operations. Targets are namespaced by surface (local-*, docker-*, db-*, stage-*, lint/install-hooks). `make help` lists everything; `make local-check-prereqs` verifies node 24, python 3.13, poetry, and docker before deeper recipes fail. Surfaces: - local-*: host-process workflow for rapid iteration. local-install cleans node_modules / .venv first, uses npm ci to keep the lockfile alpine-compatible, and bootstraps the venv with python3.13 explicitly so poetry doesn't fall back to a missing bare `python`. BACKEND_RUN sources dev/dev.env and overrides SQL_HOST=localhost so host Django reaches the published pgdb port instead of the docker-DNS pgdb name. - docker-*: dev-stack lifecycle (up/down/logs/watch). - db-*: schema + data ops with confirmation prompts on destructive paths (db-reset, db-reset-hard). - stage-*: production-shaped local simulation. stage-smoke is the primary tool - builds, ups, polls django + next probes, tears down, exits 0/1. stage-up / stage-down exist for debugging when smoke fails. All three fail fast with an actionable error if stage/stage.env is missing. Real stage deploy still lives in HfLA's incubator repo; stage-smoke only validates that the images and compose work locally. - lint / install-hooks: pre-commit becomes a backend dev dep so `make lint` runs the venv's pre-commit (4.6.0) instead of the host's potentially-stale system version. .pre-commit-config.yaml uses node: system to avoid nodeenv's broken v24 prebuilt download. Companion changes: - dev/dev.env.example swept of dead vars (MODE, DEVTOOL, ENVIRON, DATABASE) and BACKEND_INTERNAL_URL added so next.config.ts can drive /api/* and /admin/* rewrites in dev. SQL_PASSWORD placeholder typo fixed. - backend/.python-version dropped (stale 3.12.4 pin from pre-rewrite era). - pre-commit added to backend dev deps; poetry.lock refreshed. - local-clean uses rm -rf instead of swallowing permission errors silently. Patterns lifted from the BNC Makefile. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ADR-0014 records the call to make the repo-root Makefile the canonical surface for common dev commands. Covers the namespace conventions (local-* / docker-* / db-* / stage-*), the confirmation-prompt pattern on destructive ops, and the choice to delegate `make lint` to pre-commit rather than reimplement the lint suite. Index entry added under "Process" in docs/decisions/README.md. quickstart-guide.md rewritten around make targets rather than raw `docker compose ...` invocations. New sections cover database operations, running tests, stage smoke testing, shell access, and local utilities. The lint section leads with `make lint` (canonical) and keeps the individual-tool fallback for iterating on a single tool. Also fixes a stale 404 envelope example in the quickstart: was the pre-error-envelope shape (with `status_code` / `message` keys); now matches the actual `civic_exception_handler` shape per ADR-0013. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
30d7752 to
49721e9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
chore: Adopt Make as canonical task runner with working host + stage workflows
Branch:
chore/makefile-rewritestacked ondocs/public-adrs(#746), which is stacked on the pattern PR chain (#739-#745), which is stacked on the modernization chain (#734-#738). Retarget chain when each parent lands.This PR makes the repo-root
Makefilethe canonical surface for common dev commands (per ADR-0014). The previous Makefile was broken in several ways - referenced removed services, ran tests against the wrong app name, nameddb-shellfor what was actually Django's REPL. This rewrite establishes namespaced targets, fixes the recipes so they actually run end-to-end on a clean host, adds a host-process workflow plus a local stage smoke test, and switchesmake lintto use a venv-pinnedpre-commitinstead of whatever's on the host.Summary
9 files changed, ~520 lines net (the bulk is
poetry.lockreflowing for the new pre-commit dev dep). Two commits.Surfaces (commit 1)
Targets are namespaced by the surface they touch:
local-*- host-process workflow for rapid iteration.local-installcleansnode_modules/.venvfirst, usesnpm cito keep the lockfile alpine-compatible, and bootstraps the venv withpython3.13explicitly so poetry doesn't fall back to a missing barepythonbinary.BACKEND_RUNsourcesdev/dev.envand overridesSQL_HOST=localhostso host Django reaches the published pgdb port instead of the docker-DNSpgdbname.docker-*- dev-stack lifecycle (up/down/logs/watch).db-*- schema + data ops, withread-basedyesconfirmation prompts on destructive paths (db-reset,db-reset-hard).stage-*- production-shaped local simulation.stage-smokeis the primary tool: builds, ups, polls django (/api/healthcheck/) and next (/), tears down, exits 0/1.stage-up/stage-downexist for debugging when smoke fails. All three fail fast with an actionable error ifstage/stage.envis missing. Real stage deploy still lives in HfLA'sincubatorrepo;stage-smokeonly validates that the images and compose work locally.lint/install-hooks-pre-commitis now a backend dev dep (pyproject.toml), somake lintinvokes the venv'spre-commit 4.6.0instead of whatever system pre-commit happens to be installed. Resolves a stale-system-pre-commit issue surfaced during testing (Ubuntu's/usr/bin/pre-commit 2.17.0rejects thepre-commitstage name that the config uses).local-check-prereqsverifies node 24 / python3.13 / poetry / docker and exits non-zero on any miss. Surfaces missing prerequisites before deeper recipes fail with confusing errors.make helpis.DEFAULT_GOAL; lists everything with one-line summaries.Companion changes (commit 1)
dev/dev.env.exampleswept of dead vars (MODE,DEVTOOL,ENVIRON,DATABASE- all Webpack/Vite-era or Django scaffolding leftovers with zero reads). AddsBACKEND_INTERNAL_URL=http://django:8000sonext.config.tscan drive/api/*and/admin/*rewrites in dev.SQL_PASSWORDplaceholder typo (<same as POSTGRES_POSTGRES_PASSWORD>) fixed..pre-commit-config.yaml:default_language_version.nodeswitched from"24"tosystem. nodeenv'sv24prebuilt download URL doesn't resolve; we already require Node 24 on the host as a prereq, so reusing it is the right call.backend/pyproject.tomladdspre-commit = "^4.4.0"as a dev dep;backend/poetry.lockrefreshed.backend/.python-versiondeleted (stale3.12.4pin from the pre-rewrite era; project now requires^3.13).local-cleanno longer swallows permission errors - replaced the silentfind ... 2>/dev/null || truechain withrm -rfso root-owned residue from prior sessions surfaces clearly.Docs (commit 2)
ADR-0014 records the decision: namespace conventions, confirmation-prompt pattern,
make lintdelegating topre-commit(one source of truth across local and CI), variables at top,helpas default goal. Standard ADR shape; index entry under "Process" indocs/decisions/README.md.quickstart-guide.mdrewritten aroundmaketargets rather than rawdocker compose ...invocations. New sections: Database operations, Running tests, Stage smoke testing, Shell access, Local utilities. Lint section leads withmake lintand keeps the individual-tool fallback for iterating on a single tool.Also fixes a stale 404 envelope example in the quickstart: was the pre-error-envelope shape (with
status_code/messagekeys); now matches the actualcivic_exception_handlershape per ADR-0013.Test plan
make helprenders the categorized command reference.make local-check-prereqsreports all green when the host has node 24, python3.13, poetry, docker.make local-install(frontend + backend) succeeds end-to-end.npm cikeepspackage-lock.jsonbyte-identical to committed.make docker-upbuilds and starts all three containers cleanly.make db-up/db-migrate/db-makemigrations/db-grant-test-db-permsall green.make local-makemigrations/local-test-backend(10 tests OK) /local-test-frontend(11 pass / 3 skipped) /local-test(parent) all green.make lintruns the venv's pre-commit 4.6.0; all 12 hooks pass.make stage-smokebuilds stage images, brings up the stack, both probes return green, auto-tears down, exits 0. ~2 minutes from cold cache.make db-reset/db-reset-hardconfirm prompts work; volume destruction verified.make local-clean/local-kill-ports/docker-downclean up cleanly.Skipped (long-running or interactive; verified by inspection):
local-run-frontend,local-run-backend,local-superuser,docker-logs,docker-watch,docker-shell-*.Follow-ups (not blocking)
stage/stage.env.examplecarries the same deadENVIRONandDATABASEvarsdev.env.exampledid; cleanup deferred (tracked locally).pre-commit installagainst the host (system) pre-commit may want to upgrade out of Ubuntu's apt 2.17.0;make install-hooksnow uses the venv binary so the system version is no longer load-bearing for the project's hooks.make lint-faston top of this baseline.