Repository navigation
Description
Delivery phase
Workflow / roadmap / environment bootstrap. This is container-tooling and developer-documentation hardening of the existing workspace and ./dev wrapper. It changes no application behavior.
Goal
A fresh clone can run the documented workspace backend targets without hidden steps. The ETL Spark tests honor an overridden virtual-environment location. The test-guard documentation matches the code. A bad LCA_APP_*_PORT value produces a clear, range-checked error that affects only the app-* commands.
Source: non-blocking L1 QA notes 1, 3 and 6 on #96 (QA PASS at 59dce85, merged in PR #100 at 41c6b14).
Context and authority
Read AGENTS.md (containers and required technology), docs/adr/0003-rootless-development-workspace.md, docs/engineering/development-environment.md, README.md ("Open the development workspace" and "Run the local application"), specification §3.1 and §3.3 (frozen uv workspace, documented container commands). Do not read the archive or reference folders.
Repository facts at 41c6b14:
- Fresh-clone sync.
./dev updoes not run.devcontainer/check-env.sh, which is the Dev ContainerspostCreateCommandand runsuv sync --frozenwithout--all-packages. So a fresh./dev shellhas no synced workspace environment. Themake backend-*targets inMakefilerunuv run --frozen ...and needuv sync --frozen --all-packagesfirst. CI does this explicitly (.github/workflows/backend.yml), but the developer docs do not. - Spark interpreter pin.
data_pipeline/DockerfilesetsPYSPARK_PYTHON=/workspaces/lca-diff/.venv/bin/python. IfUV_PROJECT_ENVIRONMENTis overridden in the ETL container (for example/var/tmp/lca-venv, which L1 used on a tmpfs worktree), Spark workers use a missing or different interpreter, and the Spark tests fail. - Test-guard wording.
development-environment.md("Isolation", local application stack section) says the destructive suites refuse any host other thanpostgres/postgres-target. In factapps/api/tests/conftest.pyandpackages/python/lca_shared/tests/test_schema.pyalso acceptlocalhostand127.0.0.1.data_pipeline/tests/test_publication.py(postgres/postgres-target) andtest_seed.py(postgres-targetonly) are stricter. - Port validation.
devlines 25–28 validateLCA_APP_FRONTEND_PORT,LCA_APP_API_PORTandLCA_APP_AUTH_PORTat top level for every command, using a digits-only regex with no range check. So an invalid value blocks unrelated commands such as./dev shelland./dev up, while0or70000pass validation.
Requirements and constraints
- Fresh-clone sync (fact 1). Make the required step explicit and reliable. Either document
uv sync --frozen --all-packagesas the first step in the workspace section of the README anddevelopment-environment.md, or have the container-side entry point perform it (for example amake backend-synctarget, or thebackend-*targets syncing with--all-packages). Keep frozen installs and the singleuv.lock. Do not change the lock. - Spark interpreter (fact 2). Spark workers must use the interpreter of the active uv environment, so that overriding
UV_PROJECT_ENVIRONMENTkeepsmake backend-test-etlandmake backend-test-seedworking. One option is to derivePYSPARK_PYTHONfrom the active environment (for examplesys.executablein the Spark session or test setup) rather than the image's fixed path. Another is to document and enforce that both variables are overridden together. Keep the default image behavior unchanged. - Guard wording (fact 3). Correct the documentation to state each suite's actual host allowlist. Changing the guards themselves is out of scope unless a guard is found to be unsafe; if so, report it and do not widen it.
- Port validation (fact 4). Validate the
LCA_APP_*_PORTvalues only forapp-*commands (andmake up/make down), and accept only integers 1–65535. Produce one clear error that names the variable. Non-app commands must be unaffected by an invalid app port. - Host changes are limited to the
devwrapper and documentation. All tooling runs in containers. Install nothing on the host. Preserve the rootless preflight. - Coordination. L2 [Task] L2 — Connect the frontend to the real API and Auth Emulator #97 also edits
dev(anLCA_APP_PROJECTcollision guard) and the README. Implement this issue after [Task] L2 — Connect the frontend to the real API and Auth Emulator #97 merges, or rebase onto it. Do not reimplement [Task] L2 — Connect the frontend to the real API and Auth Emulator #97's guard.
Acceptance criteria
- AC1. From a fresh clone (no
.venv, no.env), following only the documented steps,./dev up,./dev shell, thenmake backend-format-check backend-lint backend-typecheck backend-test-unitall exit 0. The exact commands and results are recorded. - AC2. In the ETL container with
UV_PROJECT_ENVIRONMENT=/var/tmp/lca-venv(after a frozen--all-packagessync into it),./dev etl-run make backend-test-etl(or the documented equivalent) and./dev publication-run make backend-test-seedpass. With the default environment they still pass. - AC3.
development-environment.mdstates the actual host allowlist of each guarded suite (API/schema:postgres,localhost,127.0.0.1; publication:postgres,postgres-target; seed:postgres-target). This matches the code at the delivered SHA. - AC4.
LCA_APP_API_PORT=abc ./dev shellandLCA_APP_API_PORT=70000 ./dev upare not blocked by the app port (each behaves as without the variable).LCA_APP_API_PORT=abc ./dev app-up,LCA_APP_API_PORT=0 ./dev app-upandLCA_APP_API_PORT=65536 ./dev app-statusexit nonzero before any container starts, with a message naming the variable. A validLCA_APP_API_PORT=8011 ./dev app-upstill works. - AC5. No change to
uv.lock, the application code or the API/ETL runtime images beyond what fact 2 requires. Hosted CI stays green.
Out of scope and follow-ups
- The L2 items from the same QA report (app project-name collision guard, localhost CORS origin,
private/requirement forapp-import) belong to [Task] L2 — Connect the frontend to the real API and Auth Emulator #97. - QA note 7 (committed synthetic seed reports titled "Private import report") is not part of this issue.
- No new CI jobs are added.
Verification plan
On the host: git clone into a scratch directory, and use a distinct COMPOSE_PROJECT_NAME and ports. Run ./dev up, ./dev shell, and the AC4 ./dev invocations, recording the exit codes.
Inside containers:
- the backend
maketargets in AC1; ./dev etl-run/./dev publication-runwith and withoutUV_PROJECT_ENVIRONMENTfor AC2 (the ETL overlay needs an existingLCA_PRIVATE_INPUT_DIR; an empty directory works).
AC3 is verified by inspection against the guard code. No new commands are required unless the engineer adds a sync target; if one is added, document its exact invocation.
Dependencies and readiness
- None blocking. L1 [Task] L1 — Single-command local stack with a seeded synthetic release #96 is merged.
- It does not block L2 [Task] L2 — Connect the frontend to the real API and Auth Emulator #97 or L3 [Task] L3 — Differences toggles on the real API and local MVP acceptance #30.
- Schedule it after [Task] L2 — Connect the frontend to the real API and Auth Emulator #97 merges (or rebase onto it) because both touch
devand the README. - No product, scientific or ADR decisions are needed.
Activity
DavidVFitzGerald commentedon Nov 16, 2026
PM: READY
Issue #101 is ready against merged
origin/mainatcd6d8a6557b65d40a5d3d12b5278f0eec9aefee0(L2 PR #105). The maintainer explicitly requested this tooling follow-up after L2 on 2026-11-16. Existing acceptance criteria and scope remain unchanged.Phase and dependencies: workspace/container tooling hardening. L1 #96 is merged, and the scheduling dependency on L2 #97 is satisfied by PR #105. One issue and one PR; no product/scientific decision or ADR is needed. Specification §§3.1/3.3, ADR 0003, and the current root instructions govern rootless execution, frozen installs and the single lock.
Scope confirmed against current code:
uv sync --frozen --all-packagesstep before the existing backend targets; do not changeuv.lock.UV_PROJECT_ENVIRONMENT=/var/tmp/lca-venv.postgres,localhost,127.0.0.1; publicationpostgres,postgres-target; seedpostgres-target. The guards also require databaselca. Do not widen guards.LCA_APP_*_PORTsettings toapp-*commands, accept integers 1–65535, and name the failing variable before any Compose call. Preserve L2's project-collision guard and rootless preflight.Engineering and QA plan: start an isolated worktree/branch from merged main, with distinct workspace/app project names and ports. Use an existing empty private-input directory for the ETL mount. From a fresh clone with no
.envor.venv, follow only the documented workspace steps and run AC1's four backend checks. Run actual ETL and seed suites both with the default environment and with/var/tmp/lca-venv, frozen-synced inside their containers. Verify port negatives and non-app invocations, a live valid-port app start, unchanged guards/lock, and existing hosted checks at the delivered SHA. Record exact commands, outcomes and unavailable evidence; QA independently verifies the delivered commit.Implementation pitfalls: avoid integer overflow or shell octal interpretation for long/leading-zero port inputs; keep all port validation out of non-app commands; pass the override into the container process rather than assuming a host environment variable crosses Compose
exec; keep disposable test databases isolated from the app stack.Next: Software Engineer implements #101, then independent QA. No source or criteria changes were made during this PM assessment.
DavidVFitzGerald commentedon Nov 16, 2026
Coordinator: IMPLEMENTING after PM READY. Branch fix/101-workspace-tooling in isolated worktree .task-worktrees/tooling-101, based on merged main cd6d8a6 (PR #105). Rootless preflight/toolchain checks pass. Scope is the four documented tooling defects; verification includes fresh-clone backend checks, real ETL/seed suites with default and overridden environments, and app-only port validation. Independent QA will review the delivered commit. #97 is closed after its authorized merge.
DavidVFitzGerald commentedon Nov 16, 2026
Engineering: READY FOR QA
Branch
fix/101-workspace-tooling; candidatee1077a418a4294ac6a32cb28439f93395ec1c46a; draft PR #106: #106.All five criteria are implemented and local engineering checks pass. Hosted Backend/Frontend/ETL workflows are queued/running at this SHA; they are not yet claimed green. Independent QA remains required.
.envor.venv. Documented./dev up→ interactive./dev shell→uv sync --frozen --all-packages→make backend-format-check backend-lint backend-typecheck backend-test-unitall exited 0: 15 unit tests, MyPy 47 source files. The final regression source also passes those four checks in the implementation container..venvandUV_PROJECT_ENVIRONMENT=/var/tmp/lca-venv: 1 real Spark/PostgreSQL ETL test + 6 seed tests each. The golden test retains a nonexistent inherited worker path. Real workers reported their active interpreter in both environments; running the pre-fix extraction source failed with the same inherited stale path.postgres,localhost,127.0.0.1), publication (postgres,postgres-target) and seed (postgres-target) allowlists, all requiring databaselca.abcshell and70000workspace startup exit 0;abc/0app-up and65536app-status exit 2 with variable/range, without changing app container IDs. A dedicated app on API port 8011 starts and passesapp-smoke. Workspaceconfigand explicit appapp-configremain daemon-free. Literal-only dotenv ports are documented; expressions require an explicit process environment value.Reproduction and exact commands:
docs/engineering/tooling-101-verification.md. No ADR deviation. Historical folders excluded; no host dependencies installed or licensed inputs used.Isolation: implementation worktree
/home/david/projects/LCA-diff/.task-worktrees/tooling-101, workspace/publication projectlca-diff-101-engport 5271; fresh clone.../tooling-101-fresh, projectlca-diff-101-freshport 5273. The own applca-diff-101-eng-app(5272/8011/9272) was stopped via guardedapp-down, retaining volumes and freeing API 8011 for independent QA. Existing L2 app and main workspace were left untouched. Logs: host/tmp/lca-101-*, plus fresh-clone container/tmp/lca-101-fresh-backend.log.Next: independent QA at the candidate SHA, hosted checks, then maintainer review. Issue remains open; no merge performed.
DavidVFitzGerald commentedon Nov 16, 2026
QA: PASS
Reviewed commit:
e1077a418a4294ac6a32cb28439f93395ec1c46a, branchfix/101-workspace-tooling, PR #106, based on merged L2 atcd6d8a6.Independent clean clone:
/home/david/projects/LCA-diff/.task-worktrees/qa-tooling-101-e1077a4. Before setup it had neither.envnor.venv. QA changed no source, tests or criteria; the checkout remains clean. All tools, installs and tests ran in rootless containers, with namespace user0:0, all capabilities dropped and no-new-privileges. Docker 29.9.3 reports rootless; Python 3.14.2/uv 0.9.30 and the committed frozen lock were used../dev config,./dev up, actual interactive./dev shell, thenuv sync --frozen --all-packagesand all four requested backend targets. Every command exited 0. Formatter: 62 files already formatted; lint passes; MyPy: no issues in 47 source files; unit suite: 15 passed, 18 deselected. No database/private input was started or supplied for these checks.postgres/postgres-target. Default: 1 ETL test passed (18.47 s), 6 seed tests passed (11.50 s). Frozen-synced/var/tmp/lca-venv: 1 ETL test passed (18.78 s), 6 seed tests passed (11.36 s). The override was passed inside the container, and its driver reports/var/tmp/lca-venv/bin/python3. The retained golden test deliberately sets an inherited nonexistent worker path, so actual Spark workers exercise the fix. Reviewed the sole Spark builder: it setsPYSPARK_PYTHON=sys.executablebefore session creation.postgres,localhost,127.0.0.1; publication allowspostgres,postgres-target; seed allows onlypostgres-target. All require databaselca. Guard implementations are unchanged; no allowlist was widened.LCA_APP_API_PORT=abc ./dev shellopens/exits 0;LCA_APP_API_PORT=70000 ./dev upexits 0. Required app negatives (abc/0withapp-up,65536withapp-status) exit 2, naming the variable and range; no QA app containers existed before/after them. A separate actualapp-upwith API 8011 succeeds and its real auth/precision/CORS smoke passes 9/9. Expanded container regression matrix passes for all three ports/every app command, range endpoints, empty/oversized values, leading zeros, quoted/commented dotenv values (including no-space quoted comments), invalid dotenv settings, environment precedence and existing L2 collision cases.configwith invalid app port andapp-configwith valid ports both exit 0 against a nonexistent Docker socket, proving the documented daemon-free split.uv.lock, API code, runtime Dockerfiles, Compose files and workflow files are byte-unchanged fromcd6d8a6; no new CI job was added. Changes are limited to the wrapper, Spark interpreter fix/regression, existing guard regression script and current documentation. No product/scientific/API semantics changed and no ADR is required.uv lock --checkpasses; all five hosted jobs pass at the reviewed SHA, and PR #106 reportsCLEAN.Exact setup/check commands:
The documented empty
private/empty-inputdirectory was then created inside the workspace container. ETL/publication checks used a separate Compose project:Live app verification used
LCA_APP_PROJECT=lca-diff-101-qa-app, frontend 5280, API 8011 and auth 9280, with./dev app-upthen./dev app-smoke. Daemon-free probes setDOCKER_HOST=unix:///tmp/lca-101-qa-no-daemon.sock. All destructive database tests were restricted to the QA publication project's disposable databases. No application reset or named-volume deletion was performed; the primary workspace and existing L2 application were untouched.Independent logs:
/tmp/lca-101-qa-fresh-backend.log,/tmp/lca-101-qa-guards.log,/tmp/lca-101-qa-default-etl-seed.log,/tmp/lca-101-qa-override-etl-seed.log,/tmp/lca-101-qa-app-up.logand/tmp/lca-101-qa-app-smoke.log. The fresh-backend log is also retained inside its workspace container.Hosted evidence: Backend/API, ETL, Frontend/real-stack.
No blocking defects or missing required evidence remain. Next owner: coordinator/maintainer for PR #106 review and explicit merge. QA leaves the issue open and does not merge or close it.
DavidVFitzGerald commentedon Nov 16, 2026
Coordinator: READY FOR REVIEW
Issue #97 is closed following the maintainer's merge of PR #105 at
cd6d8a6. Task #101 is implemented in PR #106 onfix/101-workspace-tooling, candidatee1077a418a4294ac6a32cb28439f93395ec1c46a, based on that merged main.Independent QA PASS verifies AC1–AC5. A clean disk-backed clone with no
.envor.venvfollows the documented interactive workspace/frozen all-packages setup and passes all four backend targets (15 unit tests; MyPy 47 sources). The actual Spark/PostgreSQL ETL test and all six seed tests pass in both default and/var/tmp/lca-venvenvironments. The retained Spark regression starts with a nonexistent inherited worker path. Guard/port regressions, live invalid/non-app commands, daemon-free configuration and the isolated API-8011 app startup/smoke pass. All five hosted jobs pass at the delivered SHA.The change documents frozen setup and exact test guard allowlists, selects the active worker interpreter, and validates app ports only for
app-*.configis workspace-only;app-configexplicitly validates the app. Literal dotenv port values retain environment precedence; interpolation requires an explicit evaluated process-environment value as documented. The dependency lock, API, runtime image recipes, Compose definitions, existing test guards and workflow definitions are unchanged; no new CI jobs or ADR.Exact commands and engineering evidence:
docs/engineering/tooling-101-verification.md. Independent QA evidence is recorded on this issue. The implementation worktree is clean at.task-worktrees/tooling-101; no host installs, private-data imports, volume resets, merge or issue closure were performed for #101.Next action: maintainer review/merge of PR #106; leave #101 open until approved merge. L3 #30 remains the next required local-MVP milestone, and #103 remains a separate optional hardening follow-up.
fix: harden frozen workspace setup and app port guards (Refs #101)
test: retain active Spark worker and port configuration regressions (…
DavidVFitzGerald commentedon Nov 16, 2026
Coordinator: closing after the maintainer merged PR #106 at baff738. Independent QA PASS: #101 (comment) . All five delivered-head CI jobs passed. Per the maintainer instruction, no L3 work is started.