Repository navigation
Description
Delivery phase
Local MVP (ADR 0006), milestone L1, the first of three implementation PRs. By the explicit ADR 0006 exception, this is one issue and one PR, which may span several sessions with incremental commits. Ownership is backend/ops plus shared root tooling (compose.yaml or a new app overlay, dev, Makefile, README). The frontend only receives a container definition; apps/frontend/src is unchanged.
Goal
One documented host command, ./dev app-up (wrapped by make up), starts the whole local application. It runs PostgreSQL, migrations, a published synthetic release, the Firebase Auth Emulator with a verified demo user, the FastAPI service and the frontend. Data persists across restarts.
Context and authority
Read AGENTS.md, the PRD, the specification (§0.3, §3.1 "Single-command application run", §4, §5.8, §7, §8 as revised by ADR 0006, and §9.2), docs/adr/0006-local-only-mvp.md, docs/engineering/roadmap.md (L1), docs/engineering/b3-ingestion.md, docs/engineering/b4-publication.md and docs/engineering/development-environment.md. Do not read the archive or reference folders.
Existing pieces, checked at 401dc06:
compose.yaml(projectlca-diff-dev) has the profilesbackend(postgres, volumepostgres-data, no host port),apiandauth.apiandauthhave no healthchecks yet.compose.etl.yamlandcompose.publication.yaml(postgres-target, volumepublication-data).apps/api/Dockerfile: lean image that asserts pyspark and airflow are absent. Its CMD does not migrate.apps/api/emulator/: runs with no--import, so emulator state is lost on restart.db/bootstrap.sql: roleslca_migrator,lca_import,lca_publisherandlca_api(read-only).- Alembic
db/migrations/versions/0001–0003. lca-import promote|publish|rollback(data_pipeline/src/lca_etl/cli.py,publication.py). Promotion reads only a ready B3 artifactmanifest.jsonplus aTargetJSON (environment: local, absolutefile://archive_uri,LCA_TARGET_IMPORT_DATABASE_URL/LCA_TARGET_PUBLISH_DATABASE_URL).- API settings (
LCA_prefix) already support explicitLCA_CORS_ORIGINS, emulator host validation and/api/v1/healthand/api/v1/ready. - The frontend supports only
VITE_SERVICE_MODE=mock(apps/frontend/src/app/composition.ts). There is no frontend Dockerfile. data_pipeline/tests/fixtures.pyis a test-only generator. It has 7 processes (1 excluded as multi-output), a singleSynthetic/Nested/Leafcategory and a randomuuid4release version per call. It is a starting point, not a sufficient seed.
Requirements and constraints
-
Commands. Add
./dev app-up,./dev app-down(keeps volumes) and./dev app-reset(removes only this stack's named volumes; refuses without an explicit--yes). Addmake up/make downhost wrappers in the existingdev-*style. Keep the rootless preflight (check-docker.sh),cap_drop: [ALL]andno-new-privilegeson every service. Bind every host port to127.0.0.1. Keep the existing./dev upworkspace,api-up,etl-*,publication-*and mock-only frontend flows unchanged. -
Isolation from development and test databases. The app stack uses its own Compose project name (or equivalent distinct names) and its own named volumes for the database and the promoted-archive store. The integration and publication suites run
DROP SCHEMA … CASCADEagainstpostgres/postgres-target, so they must never be able to reach the app database. The stack must be startable while the./dev upworkspace is running. Choose and document non-conflicting default host ports, or fail fast with a clear message. The workspace already publishesFRONTEND_PORT(5173), andapi-upuses 8000 and 9099. -
Startup ordering. Use healthchecks and one-shot tasks: postgres healthy → migrations as
lca_migrator→ idempotent seed → API ready (/api/v1/ready) → frontend. The auth emulator gets a healthcheck, and the demo account is created after it is healthy. The API must never run migrations on startup. Do not start Airflow in this stack. -
Synthetic seed. Commit a synthetic BAFU-shaped release under a runtime path outside
tests/. Make it deterministic, with a fixed release version and nouuid4per start. Load it through B4promoteand thenpublish/activateaslca_import/lca_publisher, with all B4 gates. A dedicated loader is acceptable only if it calls the same publication functions and constraints. Do not insert directly into the release, revision or publication tables, and do not bypass immutability or role limits. Preferably commit a pre-built ready artifact, with a documented regeneration command from committed synthetic sources, so that startup does not need Spark. The archivefile://URI must live on the stack's persisted volume. -
Seed variety. The published revision contains at least:
- 20 published processes;
- 2 top-level categories, with at least one
category_pathof depth ≥ 3; - ≥ 2 distinct reference units and ≥ 2 distinct reference amounts;
- one flow row that is positive in one process, negative in another, exactly
0in another and absent in another; - at least one valid score and one
N/A(missing) score, for the default indicator IPCC 2021 GWP 100; - at least one high-precision decimal amount (≥ 30 significant digits or an exponent ≤ -30).
No licensed or provider data.
-
Idempotence. The seed is idempotent on restart. Use fixed operation UUIDs, so that B4
reused: trueapplies. If the release is already published at the seed revision, it is a no-op. It never creates a second revision and never changes the publication pointer silently. Any unexpected state, such as a different active revision, fails loudly and does not republish. -
Demo account. Seed one verified email/password demo account in the Auth Emulator on every start, for project
demo-lca. Document its credentials as local-only. They must not appear in any production configuration, and the API's existing production refusal of emulator settings stays in force. -
API configuration. The API runs as
lca_apiwithLCA_ENVIRONMENT=local, explicit emulator verification and an explicitLCA_CORS_ORIGINSlist containing only the local frontend origin. -
Frontend container. Add a frontend container: a pinned image,
npm cifrom the committed lockfile, and the Vite dev server or a static build. It must be reachable at the documented localhost URL. In L1 it runs with explicitVITE_SERVICE_MODE=mock, shows the existing "Local demo mode" banner and does not yet show seeded data. L2 [Task] L2 — Connect the frontend to the real API and Auth Emulator #97 switches the stack to the real adapter. Do not changeapps/frontend/src. -
Opt-in BAFU path. Document how to import the private BAFU inputs with the existing B3 commands into a separate import database and then
lca-import promote/publishinto this stack's database, with the same publish semantics. Name the target JSON shape, environment variables and network/overlay used. This is documentation only; executing it is L3 verification. -
Documentation. Update the README quick start,
docs/engineering/development-environment.mdand the roadmap L1 status.
Acceptance criteria
- AC1: From a clean clone with rootless Docker, and with no
.env, private files or prior volumes,./dev app-upalone brings every long-running service to healthy and every one-shot task to exit code 0. The documented frontend, API/api/v1/healthand/api/v1/readyURLs respond from the host loopback. - AC2: A committed, container-run smoke check runs against the live stack. Its exact command is documented, and it prints no token values. With an emulator ID token for the demo user,
GET /api/v1/releasesreturns the seeded published release and active revision. With no token the request returns 401AUTH_REQUIRED. For an unverified emulator user it returns 403EMAIL_NOT_VERIFIED. A preflight from a non-allowlisted origin gets no CORS allow header. - AC3:
./dev app-downfollowed by./dev app-uppreserves the database and archive: the same release and revision IDs, one revision, the same pointer and no new publication operation. The demo login still works../dev app-resetwithout--yesrefuses and leaves the volumes../dev app-reset --yesfollowed by./dev app-uprecreates a clean seeded state. - AC4: The seed goes through B4 promotion and publication (evidence: one
promoteand onepublishrow inpublication_operation, recording the restricted session roles). Targeted automated tests prove:- (a) seed idempotence, including a rerun against an already-seeded database;
- (b) the variety minimums above, asserted from the published data;
- (c) exact decimal-string round-trip of seeded flow amounts and scores, including the high-precision value, through the API cell endpoints;
- (d) present zero vs absent vs
N/Astay distinct in API responses.
- AC5: With the workspace up,
make backend-test-integration(and./dev publication-run make backend-test-publicationif run) leaves the app stack's release and revision IDs unchanged../dev app-upsucceeds while./dev upis running. - AC6: No new secrets are committed beyond clearly labelled local-only credentials. The API image still excludes pyspark and airflow. Rendered Compose config and
docker portshow only127.0.0.1host bindings, and Postgres has no host port. All services keepcap_drop: [ALL]andno-new-privileges. - AC7: The README documents app-up/down/reset, demo login credentials (marked local-only), ports and URLs, the L1 mock-frontend limitation, troubleshooting (port conflicts, rebuilds, reset) and the opt-in BAFU path.
development-environment.mdand the roadmap are updated.
Out of scope and follow-ups
- The real frontend adapter, Firebase SDK and generated DTOs are L2 ([Task] L2 — Connect the frontend to the real API and Auth Emulator #97).
- The differences toggles, executing the opt-in BAFU import and final local acceptance are L3 ([Task] L3 — Differences toggles on the real API and local MVP acceptance #30).
- Real-stack Playwright smoke in CI arrives with L2/L3 per ADR 0006 item 7.
- Cloud deployment, Terraform and full-corpus validation are post-MVP (roadmap PM1/PM2).
Verification plan
On the Docker host (lifecycle only): ./dev config, ./dev app-up, ./dev app-down, ./dev app-up, ./dev app-reset, then ./dev app-reset --yes, then ./dev app-up. Also run ./dev up alongside to check AC5.
Inside ./dev shell: make backend-format-check backend-lint backend-typecheck backend-test-unit backend-test-integration backend-openapi-check, plus the new targeted seed tests and the AC2 smoke check, which runs in a container and not with host tooling. If ETL or publication code changes, also run ./dev publication-run make backend-test-publication.
Record exact commands, exit codes, rendered port bindings and IDs before and after restart. Never record token values. The applicable hosted CI (Backend, ETL and Frontend workflows) must pass. QA re-runs AC1–AC3 and AC5 from a clean clone at the delivered SHA, using a distinct project name and ports.
Dependencies and readiness
Satisfied:
- ADR 0006 is accepted. Its acceptance is recorded through the maintainer's merges of PR docs: local-only MVP scope (proposed ADR 0006) and L1–L3 plan #98 (
cf7f1d5) and PR docs: record ADR 0006 acceptance (L0 follow-up) #99 (401dc06) on 2026-11-16, and [Task] L0 — Record the local-only MVP scope (ADR 0006) #95 is closed. - B1–B4 are merged on
main.
L1 has no other blocking dependency. L2 #97 depends on this issue. PM grooming: see the issue comment.
Activity
DavidVFitzGerald commentedon Nov 16, 2026
PM: READY
Lifecycle: groomed/ready. Next role is Software Engineer (one issue and one PR under the ADR 0006 exception).
Phase: Local MVP (ADR 0006), milestone L1.
Dependency status (satisfied):
cf7f1d5and PR docs: record ADR 0006 acceptance (L0 follow-up) #99 at401dc06on 2026-11-16, and [Task] L0 — Record the local-only MVP scope (ADR 0006) #95 is closed.main.Spec references: §0.3 item 1, §3.1 "Single-command application run", §5.8, §7.1/§7.4, §8 (local MVP note, items 1–3/5/10), §9.2 (fixture rules and per-PR tier), §12 L1 and the definition of done.
Checks against the repository at
401dc06./devhas noapp-*commands andMakefilehas noup/down. Hostmakeexists, but the documented primary command stays./dev app-up.compose.yamlis projectlca-diff-dev.postgres(volumepostgres-data) has no host port.apiandauthhave no healthchecks. The workspace publishes127.0.0.1:${FRONTEND_PORT:-5173}, andapi-upuses 8000 and 9099. These collide with an app frontend on 5173 unless the app stack uses separate ports.apps/api/tests/conftest.py,packages/python/lca_shared/tests/test_schema.pyanddata_pipeline/tests/test_publication.pyrunDROP SCHEMA … CASCADEonpostgres/postgres-target. An app stack that shares that project or volume would be wiped by the issue's own verification commands. I added an isolation requirement and AC5 for this.lca_apirole, has an explicitLCA_CORS_ORIGINS(wildcard refused), validates the emulator host anddemo-project, provides/api/v1/healthand/api/v1/ready, and its CMD does not migrate. The lean image asserts that pyspark and airflow are absent.promotereads only a ready B3 artifact plus aTargetJSON with an absolutefile://archive. It andpublishare idempotent with the same operation UUID (reused: true). The archive must therefore persist with the database. I added this to the requirements, and to AC3 and the reset behaviour.lca-etldepends on airflow 3.4.0 and pyspark 4.3.0. Any seed that useslca-importruns from the ETL image, never the API image.data_pipeline/tests/fixtures.pyis a test-only generator. It has 7 processes (1 multi-output excluded), one category path and a random release version per call. It cannot meet the variety minimums or determinism as it stands, so a committed runtime seed source is required.VITE_SERVICE_MODE=mock, and there is no frontend Dockerfile. L1 therefore ships a mock-mode frontend container. The real adapter is L2. This is consistent with ADR 0006 item 6. §3.1's "real-adapter mode" is reached at the end of L2, not L1.Changes made to the issue body
./dev up;tests/that goes through B4promoteandpublish, preferably as a pre-built artifact so startup needs no Spark;LCA_ENVIRONMENT=localandLCA_CORS_ORIGINS;apps/frontend/srcchanges;.envor private files, and one-shot tasks must exit 0.AUTH_REQUIRED, 403EMAIL_NOT_VERIFIED) and a CORS negative check.publication_operationcounts, andapp-resetrefusing without--yes.N/Adistinctness../dev shelltargets (addingbackend-format-checkandbackend-openapi-check), the conditional publication suite and QA rerunning from a clean clone with distinct project and ports.Scope is unchanged relative to ADR 0006 and the specification. No new product decisions were introduced.
Decisions recorded and left to engineering (no ADR needed)
run-localonce on the first start is acceptable if it is documented and idempotent.Open points flagged for the maintainer (not blocking)
./dev app-upbuilds the ETL image (Airflow + PySpark) for the seed task, which makes the first start slow. Later starts are a no-op seed.DavidVFitzGerald commentedon Nov 16, 2026
Coordinator: state → implementing. Software Engineer assigned on branch
feat/l1-local-stack(isolated worktree, base401dc06). One issue and one PR for L1, per ADR 0006. QA will follow at the delivered SHA.DavidVFitzGerald commentedon Nov 16, 2026
Engineering: READY FOR QA
Lifecycle: implementing → QA. Next role: QA Engineer, at the delivered SHA.
feat/l1-local-stack59dce85(59dce85docs,6a8737astack,76f5277seed; base401dc06)Refs #96, no closing keyword)59dce85: all pass: backend-quality, api-quality, etl-quality (which now runsmake backend-test-seed: 6 passed) and Frontend quality.Summary
compose.app.yaml. It runs under its own project,${LCA_APP_PROJECT:-lca-diff-app}, which is always passed as--project-nameand never comes fromCOMPOSE_PROJECT_NAME. It has its own volumes,app-dbandapp-archive. Its database service isdb.Services and startup order.
dbbecomes healthy.migrateruns aslca_migrator.seedruns: B4promoteandpublishwith fixed operation UUIDs.authbecomes healthy and one-shotauth-seedcreates the verified demo account.apistarts aslca_api(local, emulator, CORS limited to the local origin) and waits for/api/v1/ready.frontendstarts: an explicitVITE_SERVICE_MODE=mockbuild served byvite preview.Airflow and Spark are not started.
Commands.
./dev app-up|app-down|app-reset [--yes]|app-status|app-logs|app-smoke|app-import, andmake up/make down../dev configalso validates the app file.Ports. Defaults are 127.0.0.1:5180 (frontend), 8010 (API) and 9110 (auth).
app-upfails fast on a port that is already in use.Seed (
data_pipeline/seed/). Invented sources, plus a pre-built ready B3 artifact produced by the Spark pipeline. The loader islca_etl/seed.py. A fixed releasesynthetic-local-2026.1gives deterministic IDs: releasee0639837-ac2a-56e4-9746-967bc5ad433f, revisiondc63c04e-8927-5825-8544-ffbfe2de8e8e.Tools image (
ops/local/tools.Dockerfile). The ETL runtime for the stack: thelca-etlpackage from the frozen lock, without the JVM. The API image is unchanged.Smoke and demo account.
ops/local/local_stack.pyprovidesdemo-userandsmoke, standard library only, and prints no tokens.Docs. README,
development-environment.md(app-stack section and L1 record), roadmap and.env.example.Acceptance criteria
git cloneof the branch at59dce85, with no.env, noprivate/and no volumes, under projectlca-diff-l1-cleanwith ports 5241/8241/9241../dev app-upexited 0.db,auth,apiandfrontendwere healthy;migrate,seedandauth-seedshowed Exited (0). From the host,curlon 127.0.0.1 got frontend 200,/api/v1/health200 and/api/v1/ready200. The same held in the worktree run (first build 2m26s)../dev app-smokeruns in the tools container on the stack network and passed 8/8: health and ready 200; no token gives 401AUTH_REQUIRED; the demo emulator token returns the seeded release and active revision; the exact1.234567890123456789012345678901234comes back through flow cells; an unverified user gets 403EMAIL_NOT_VERIFIED; a preflight fromhttp://untrusted.example.invalidgets noaccess-control-allow-origin; the local origin is allowed. No token values are printed.app-downandapp-up: the same release, revision and pointeractivated_at; one revision; the same 2 operations; 55 archive files with the same digest. The seed reportedpromote_reused/publish_reusedtrue, and the demo login worked again (smoke passed).app-resetalone exited 1 and kept both volumes.app-reset --yesremoved only<project>_app-dband<project>_app-archive, and the nextapp-upreseeded cleanly with the same IDs.publication_operationhas two rows:promotewithlca_import/lca_importandpublishwithlca_publisher/lca_publisher.make backend-test-seed(6 tests) covers these points:reusedtrue; an injected foreign revision raisesSEED_UNEXPECTED_REVISIONwithout a new operation. There is also a unit test of the state guard.missingandunresolved_basisscores.1.2345E-33, the score12.3456789012345678901234567890123and thee-40score.0(flow and score), an absentpresent:false, amount:null, and N/A scores withamount:nullstay distinct.lca-diff-l1-apprunning, the workspacelca-diff-l1ranmake backend-test-integration(5 passed),backend-test-api(4),backend-test-auth(1),./dev publication-run make backend-test-publication(3) andbackend-test-seed(6). The app state dump was identical before and after../dev app-upexited 0 while both thelca-diff-l1andlca-diff-devworkspaces were running..envfiles and noapps/frontend/srcoruv.lockchanges. The API image has nopyspark,airfloworlca_etl(build assertion plus a runtimefind_speccheck) and runs as user65532:65532. In the rendered config every service hascap_drop [ALL]andno-new-privileges:true. Port bindings are only127.0.0.1:docker portshowsapi8000→127.0.0.1:8240,auth9099→127.0.0.1:9240 andfrontend4173→127.0.0.1:5240;dbhas none.LCA_TARGET_*variables,./dev app-importon the stack network with the archive volume and a read-only/private).development-environment.mdand the roadmap are updated.Exact commands (host lifecycle; tooling only in containers)
The container commands set
UV_PROJECT_ENVIRONMENT=/var/tmp/lca-venv, because the worktree is on a size-limited tmpfs. Locked packages are the same. The non-interactivedocker compose exec -T workspacewas used in place of the interactive./dev shell.Blockers
None.
Limitations and follow-ups
./devrequires a rootless daemon, and GitHub runners are rootful. Per ADR 0006 item 7 it remains a local check until L2/L3 adds a CI smoke../dev app-import) but not executed. Running it is L3 [Task] L3 — Differences toggles on the real API and local MVP acceptance #30.lca-diff-l1,lca-diff-l1-app,lca-diff-l1-clean), their volumes, images and the clone. Other projects' containers were untouched.For QA
Re-run AC1–AC3 and AC5 from a clean clone at
59dce85. Use a distinctLCA_APP_PROJECTand ports, for exampleLCA_APP_PROJECT=lca-diff-l1-qa LCA_APP_FRONTEND_PORT=5250 LCA_APP_API_PORT=8250 LCA_APP_AUTH_PORT=9250, and a distinctCOMPOSE_PROJECT_NAME/ports for the workspace. The ETL overlay needs an existingLCA_PRIVATE_INPUT_DIR; an empty directory works.DavidVFitzGerald commentedon Nov 16, 2026
Coordinator: state → QA. Independent QA assigned at the delivered SHA
59dce8503885817849ac3de8da2b9372236a1fc1(PR #100). Hosted CI is 4/4 passing at that SHA.DavidVFitzGerald commentedon Nov 16, 2026
QA: PASS
Reviewed SHA:
59dce8503885817849ac3de8da2b9372236a1fc1(PR #100).Environment:
/var/tmp, with no.env, noprivate/and no volumes.lca-diff-l1-qa(ports 5250/8250/9250) and workspacelca-diff-l1-qaws(ports 5251/8251/9251).Criteria:
./dev app-upexits 0. db, auth, api and frontend are healthy. The migrate, seed and auth-seed one-shots exit 0. Frontend, health and ready all return 200 on loopback../dev app-smokepassed 8/8, twice.AUTH_REQUIREDwithout a token or with a garbage token. 200 with the seeded release and revision for the demo token. 403EMAIL_NOT_VERIFIEDfor an unverified user.http://127.0.0.1:5250is allowed.app-resetandapp-reset --noexit 1 and keep the volumes.app-reset --yesremoves only the app volumes. The nextapp-upreseeds with the same IDs and an identical archive digest.make downandmake upboth exit 0.promotebylca_importandpublishbylca_publisher.backend-test-seed: 6 passed.app-upexits 1 withSEED_UNEXPECTED_REVISION. The api and frontend are not started, and the state is unchanged.uv lock --check, format-check, lint, typecheck (46 files), unit (15), integration (5), API (4), auth (1) and OpenAPI check.db. The app uses a separate network and volumes, and everyDROP SCHEMAguard allowlist excludesdb.no-new-privileges. Host bindings are 127.0.0.1 only, anddbhas no host port.apps/changes and nouv.lockchange.app-*commands.Diff review:
./devare validated and quoted, with no injection path.Hosted CI: 4/4 passing at the SHA.
Non-blocking notes (follow-up candidates):
uv sync --frozen --all-packagesfirst, and this is undocumented. OverridingUV_PROJECT_ENVIRONMENTbreaks the Spark tests, becausePYSPARK_PYTHONis pinned../devshould refuse anLCA_APP_PROJECTequal to the workspaceCOMPOSE_PROJECT_NAME. Otherwise--remove-orphanscould remove the workspace containers. Data would stay safe.development-environment.mdomits thelocalhost/127.0.0.1allowance.127.0.0.1:<port>, solocalhost:<port>will fail once L2 makes real calls../dev app-importfails closed ifprivate/is missing; the README could state that it must exist.LCA_APP_*_PORTblocks every./devcommand, and the port range is unchecked.--no-cacherebuild.QA authored no changes and cleaned up all
lca-diff-l1-qa*resources. The evidence logs are in/var/tmp/l1qa-*.Coordinator handoff
feat/l1-local-stack@59dce85, PR L1: single-command local stack with seeded synthetic release (Refs #96) #100. It is ready for review: independent QA PASS and hosted CI 4/4. No merge has been performed.feat: deterministic synthetic local seed and idempotent B4 loader (Refs
feat: single-command local app stack with demo account and smoke chec…
docs: local app stack quick start, opt-in BAFU path and L1 status (Refs
DavidVFitzGerald commentedon Nov 16, 2026
Closed by the coordinator. L1 was delivered through PR #100, which the maintainer merged at
41c6b14on 2026-11-16. It passed independent QA (PASS at59dce85) with hosted CI 4/4 green. QA's non-blocking notes 2, 4 and 5 (project-name collision guard, the localhost CORS origin, and the missing-private/doc) are being handed to L2 #97 grooming. Notes 1, 3 and 6 are tooling follow-ups.