Repository navigation
Description
Delivery phase
Phase 2 — backend and real integration (B1)
Goal
Deliver the complete Python domain/schema foundation in one issue and one PR, ready for B2 read services and B3 ingestion. Work may span sessions with internal checklists and incremental commits; do not split this milestone into extra implementation issues without maintainer instruction.
Context and authority
Maintainer instruction 2026-11-14; roadmap B1; PRD §§4–6; specification §§0.2, 3–4, 8–9.2 and 12; accepted ADRs 0001/0003 and ADR 0005 after approved merge (#55, PR #56). Read AGENTS.md, docs/team/software-engineer.md, current PRD/specification, docs/engineering/development-environment.md and applicable ADRs. Exclude all archive/reference folders. The proposed ADR alone does not make this issue ready.
Requirements and constraints
- Use an isolated backend worktree/branch and separate rootless Compose project, ports and volumes; preserve the other agent's frontend checkout, source, mocks and provisional contracts. Coordinate shared root config/locks/CI changes. Do not stop the frontend project's containers.
- All dependencies, resolution, generation and checks run in guarded containers. Use one committed uv.lock, a runnable shared member and separate documented API/ETL dependency selections; lean API installs exclude Airflow/PySpark. Introduce actual API/ETL members with meaningful implementations in B2/B3 rather than fabricating empty services to satisfy a check. Establish a mutually supported Python/toolchain version and honor Airflow constraints before locking. Current bootstrap Python 3.14 is not evidence of Airflow/PySpark compatibility. If a single resolver cannot satisfy the stack, document the conflict and follow the ADR process before splitting projects/locks.
- Exact numeric storage and deterministic keys must preserve scientific meaning. No arbitrary NUMERIC scale, float persistence, guessed identity, redundant process release FK, staging deduplication or cross-revision joins. No backend integration changes inside apps/frontend/.
Acceptance criteria
- AC1 — A runnable pinned shared uv member, frozen workspace sync and compatible Python/container toolchain exist. Lean API and ETL dependency selections and single-lock compatibility are documented and reproducibly verified; actual API/ETL members arrive with B2/B3 unless B1 has a meaningful implementation for them. Shared Pydantic v2/Settings boundaries, Loguru context and local-only dotenv with environment precedence are usable; tooling runs without host installation.
- AC2 — SQLAlchemy/Alembic implements specification §4.1 release/revision/publication/import/source/validation/resolution-rule tables; release version uniqueness, revision numbering and composite publication membership prevent mismatched release pointers. Published revision values are protected from mutation/deletion; old revisions remain available for rollback/snapshots.
- AC3 — All five stg_bafu_* contracts preserve raw values and source coordinates, duplicates and original cell types. Revision-safe source/parent FKs prevent cross-revision associations; staging allows malformed duplicate process numbers to be retained and reported.
- AC4 — Harmonized flow/process/process_flows/flow_provenance/impact_method/impact_indicator/lcia_score/process_warning relations, enums, integrity constraints and §4.5 indexes exist. Exactly scoped keys prevent duplicate measurements; valid/missing/unresolved scores and zero/absence remain distinct. Decimal serialization uses strings and rejects non-finite measurements.
- AC5 — UUIDv5 namespace/key encoding is stable and versioned, release-scoped across reimport revisions, includes type and relevant compartments/unit/meaning, excludes display name/sign, and prevents unsafe collisions. Shared exact decimal helpers avoid context rounding in sums/conversions/comparisons. Provenance is self-contained without mandatory local-only staging links.
- AC6 — A private disposable Postgres profile and documented container commands support clean migrations, targeted database checks and separate migration/import/read roles. API role cannot write or read private staging; no application superuser credential is used. Production topology is not provisioned.
- AC7 — Focused container-backed behavior checks prove clean-DB upgrade, critical unique/FK/revision/publication protections, immutable publication data, decimal precision/missingness, deterministic identity and config/log redaction. Applicable frozen-lock/Ruff/MyPy/pytest/migration CI is introduced with this component, using synthetic data only; existing frontend checks remain intact.
- AC8 — Roadmap and backend verification record document exact commands/results, provisional contract decisions, remaining B2/B3/B4 responsibilities and independent QA handoff at the delivered SHA. One PR references this issue; issue remains open pending checks, QA and approved merge.
Out of scope and follow-ups
B2 owns public endpoints/Firebase verification; B3 owns extraction/harmonization/reconciliation/reports; B4 owns artifact transfer and publish/rollback commands. I1 owns generated frontend types, real adapter and UI integration; R1/R2 own cloud provisioning/deployment, license approval and full-data release gates. Preserve DESIGN-NOW interfaces only; no post-MVP feature implementation. Those milestone issues, once published, must be cross-linked rather than creating extra B1 implementation issues.
Verification plan
Existing entry points: guarded ./dev and container Make targets. B1 must introduce backend-targeted commands (names below are planned, not current passing evidence) and document invocation under a distinct COMPOSE_PROJECT_NAME/FRONTEND_PORT. Inside the isolated workspace: uv lock --check, uv sync --frozen --all-packages for the implemented members under the selected compatible constraints, make backend-format-check, make backend-lint, make backend-typecheck, make backend-test-unit, and make backend-test-integration. The integration target starts/uses only disposable isolated Postgres, runs alembic upgrade head against an empty database and the focused constraint/immutability tests. Add reproducible dependency-resolution evidence proving the intended lean API selection omits ETL libraries and the intended ETL selection honors Airflow constraints; do not fabricate runtime packages for this check. Do not invent success or run nonexistent targets; implement/document these commands with the component. No coverage percentage target or redundant full suites. Frontend tests run as required by shared configuration changes, not as backend security evidence.
Dependencies and readiness
BLOCKED until ADR 0005 is approved and merged through #55 / PR #56 and verified M1/M2 configuration is available on the base branch. Confirm rootless tooling and compatible dependency resolution before application development. After those gates, B1 is independent of F3–F5 completion. B2/B3 consume B1; B4 consumes B3 and B2 visibility evidence. PM must record readiness; exact-SHA independent QA and maintainer review/merge remain required.
Published implementation graph: B1 #57 → B2 #58 / B3 #59 → B4 #60.
Activity
DavidVFitzGerald commentedon Nov 14, 2026
PM: READY — B1 / Phase 2
ADR 0005's approval-and-merge gate is satisfied: the maintainer explicitly authorized merge, and GitHub confirms PR #56 merged at
125b0909595a6db89b214ac3db59b0d108a44226on 2026-11-14. The remaining Proposed wording is historical branch wording, not evidence that the merged decision remains blocked. #55 is closed. M1/M2 foundation delivery is recorded in the merged roadmap; the coordinator reports the isolated planning workspace's guarded rootless container check passed with Python 3.14.2 and uv 0.9.30. I verified the issue scope, merged roadmap and PR merge state independently; the container observations are attributed coordinator evidence.Proceed with one B1 issue and one PR in an isolated backend worktree, preserving the active frontend checkout. Authority: specification §§3–4, 8–9.2 and 12; PRD §§4–6; ADRs 0001/0003 and merged 0005. B1's first engineering step must reproducibly resolve compatible pinned Python/API/ETL dependency selections under Airflow constraints before application development; bootstrap version availability is not proof of resolver compatibility. Keep one lock and introduce actual API/ETL members with B2/B3 unless B1 has meaningful implementations.
Acceptance criteria and container verification plan are complete in this issue. Introduce the listed backend targets with their components; they are planned commands, not already passing checks. Focus tests on domain precision/identity, migration/revision/publication constraints, private/read-only roles and config/log safety. Independent QA must verify the delivered SHA. No merge, deployment or production publication is authorized by this readiness record.
B2 #58 and B3 #59 remain blocked on B1 delivery and QA; B4 #60 waits on B3 and B2 visibility. I1 retains Phase 1, B2 and B4 gates.
DavidVFitzGerald commentedon Nov 14, 2026
Engineering: IN PROGRESS
B1 implementation is isolated on
feat/b1-domain-schemain/tmp/lca-diff-b1; no frontend files changed. Domain/schema/roles/migration and guarded backend profile are implemented. Focused container checks currently pass: 9 unit cases, 5 PostgreSQL integration scenarios, Ruff and strict MyPy (12 source files).The real uv resolver proves Python 3.14 compatibility for lean FastAPI/Firebase and combined API/Airflow/PySpark selections under official Airflow 3.4.0 constraints. Firebase Admin 7.8.0 conflicted with its Google dependency pin; verified 7.7.0 resolves. One workspace lock is retained. Checks include exact decimals, revision FKs, self-contained provenance, private read-only views, importer publication denial, immutable history/reparenting and publication/write lock contention.
Remaining: verification/runbook documentation and merged-ADR status reconciliation, CI run, final review and exact-SHA independent QA. No API endpoints, ETL import, production resources or publication are claimed.
fix: protect publication races and document backend foundation (Refs #57
DavidVFitzGerald commentedon Nov 14, 2026
Engineering: READY FOR QA
Issue #57; PR #61; branch
feat/b1-domain-schema; delivered SHA11596f0e2a33aa43cdb2c391be4de3fb51149a7e. Worktree/tmp/lca-diff-b1is clean. No frontend application files changed, no source archive extracted/imported and no production action performed.AC1–AC8: implemented with passing local evidence. Shared Pydantic/Settings/domain member, exact arithmetic/JSON strings, deterministic UUIDv5 keys, all specified staging/harmonized/release tables, composite revision/publication membership and self-contained provenance are delivered. Separate migration/import/publisher/API roles, private Postgres profile, safe
api.*views, immutable published metadata/measurements/rule history and targeted CI are included. ADR 0005 acceptance status records the verified PR #56 merge at125b090; PRD/spec/roadmap/roles agree. Full component/ownership details and commands are indocs/engineering/b1-verification.md.Exact observed container commands from the isolated checkout:
Results: frozen lock/sync PASS; Ruff format/lint PASS; strict MyPy PASS (12 source files); 9 unit cases PASS; 5 PostgreSQL integration scenarios PASS; clean upgrade and idempotent migration PASS; lean FastAPI/Firebase and combined Airflow/PySpark resolver selections PASS under checksummed official Airflow constraints. The last small guard edits were rechecked with Ruff/MyPy and the affected 5 integration scenarios. Default
uv sync --frozenfollowed by shared import also passed. Hostgit diff --checkand synchronized Task-form comparison passed. No host runtime/install used.Independent QA found and engineering fixed a release-metadata/publication race, draft-rule audit mutation and importer temporary-table shadowing. Regressions stay within the five integration scenarios. Every guard pins its trusted search path with
pg_templast; revision freeze locks revision/release/shared rule/flow metadata. Rule references are release scoped and immutable once used in published history. Root frozen sync retains the real shared package.Dependency evidence: Python 3.14.2/uv 0.9.30; Airflow 3.4.0 constraints SHA
0521ca33b8fcf92d9cd672d25ec85fdaf95a0021116b64d193079eb334143268. Firebase Admin 7.8.0 failed its Google-core constraint; 7.7.0 resolves with FastAPI 0.162.0, Uvicorn 0.54.0, Airflow 3.4.0 and PySpark 4.3.0. Exactly one workspace lock remains; no placeholder API/ETL member. B2/B3 introduce actual runtime members and runtime checks.Limitations/next actions: independent QA must reverify this delivered SHA and hosted checks must pass for it. B2 #58 owns verified Firebase/read endpoints/cursors/transport budgets; B3 #59 owns ingestion/reconciliation/all audits; B4 #60 owns complete readiness gates, authenticated artifacts/promotion/publication/rollback. API role reads only documented
api.*ever-published views, active release list uses publication pointer, and older published snapshots remain available. I1 owns generated TS contracts and real frontend integration. Java/Spark execution, real Firebase authorization, full-data licensing/validation and cloud deployment are not claimed by B1. Issue remains open; no merge authorization assumed.fix: allow publication locks without catalog write privileges (Refs #57)
DavidVFitzGerald commentedon Nov 14, 2026
Engineering: READY FOR QA — updated delivered SHA
The delivered SHA is now
d3a23893faea5668cdf35bc34a3750f55193dea0onfeat/b1-domain-schema, PR #61, superseding11596f0in the earlier handoff.Final self-review found that the publisher's shared-row freeze locks require UPDATE privileges even though publication must not grant catalog mutation rights. A narrowly granted SECURITY DEFINER helper now obtains only the trusted revision/release/rule/flow locks, with the pinned safe search path; role authorization remains in the invoker trigger. Only publisher/migrator can execute the helper. The actual
lca_publisherconnection now freezes successfully and is denied catalog UPDATE in the existing role scenario.Affected container checks passed:
make backend-format,make backend-lint,make backend-typecheck(12 source files),make backend-test-integration(5 scenarios). Other earlier exact commands/results and AC1–AC8 delivery remain unchanged. Documentation records the role boundary. Independent QA and hosted checks must use this SHA. No merge or production action performed.DavidVFitzGerald commentedon Nov 14, 2026
QA: PASS
Reviewed B1 SHA:
d3a23893faea5668cdf35bc34a3750f55193dea0, issue #57 / PR #61. Independent QA used detached worktree/tmp/lca-diff-b1-qa, rootless Compose projectlca-diff-b1-qa, frontend port 5190 and its own private PostgreSQL volume. This verifies shared domain/database foundation using synthetic data; no real Firebase/API, ETL import, frontend integration or production publication is claimed. QA authored no application/test changes.Criterion evidence
lca-sharedmember and one committed uv lock; frozen checks/install pass. Python 3.14.2 / uv 0.9.30 in the guarded container. Both lean API and combined API/Airflow/PySpark dependency probes resolve under official Airflow 3.4.0 Python 3.14 constraints, with lean selection excluding ETL libraries. Official downloaded constraint SHA independently matches the vendored0521ca33b8fcf92d9cd672d25ec85fdaf95a0021116b64d193079eb334143268. Settings precedence, production dotenv refusal and operational-log redaction pass. Root frozen sync retains the shared member.lca_publishersuccessfully freezes a revision containing flow/rule dependencies and inserts its publication pointer, while direct process/flow edits are denied. Its SECURITY DEFINER helper only locks rows, pins a trusted search path and grants EXECUTE to publisher, not API/import roles. API cannot read staging, assume migrator role or write public views even after disabling its client default read-only setting. Import cannot publish or bypass immutability using temporary relation names/caller search paths.docs/engineering/b1-verification.mdrecord implemented behavior, exact commands, limitations and B2 [Task] B2 — Read API and real authorization #58 / B3 [Task] B3 — BAFU ingestion and LCIA reconciliation #59 / B4 [Task] B4 — Promotion, atomic publication and rollback #60 / I1 responsibilities. Accepted ADR 0005 status is reconciled with recorded merge evidence. One B1 PR references [Task] B1 — Python domain, schema and release contracts #57; no issue closure or merge performed by QA.Commands and results
From the isolated QA worktree, with
COMPOSE_PROJECT_NAME=lca-diff-b1-qa FRONTEND_PORT=5190:All exit 0; frontend diff and tracked/untracked QA status are empty.
./dev checkindependently passed rootless UID/GID mapping, dropped capabilities/no-new-privileges and eight preflight scenarios. Final MyPy checked 12 source files; Ruff checked 16 formatted files. Additional stdin Python/SQL probes used only synthetic fixtures and separate actual-role connections: release/rule writer contention returns55P03; frozen metadata/rule or temp-shadow mutation returns23514; cross-release rule linkage returns23503; forbidden helper/role/base-table operations return42501; non-updatable API-view deletion is denied.Earlier code review found release metadata/publication races, mutable draft-rule evidence referenced by frozen history and an importer temporary-table shadow bypass. Engineering corrected them and added focused regression assertions within the existing scenarios. Publisher privilege correction was additionally verified with populated flow/rule dependencies rather than only the migrator connection.
Hosted final-head checks: backend-quality, frontend quality.
Unrun/out of scope: real auth/endpoints (B2), XML/workbook/Airflow/Spark execution and reports (B3), promotion/publication operations (B4), full real-integration browser journeys (I1) and release validation (R1/R2). Dependency resolution is not runtime ETL evidence. Next action: coordinator/maintainer review; continue dependent backend work under its existing issues, retaining explicit merge authorization requirements.
DavidVFitzGerald commentedon Nov 15, 2026
Coordinator: stack reconciled with current main
No maintainer action is required to unblock ongoing B3/B4 development. PRs remain unmerged.
Merged current
origin/maininto the isolated B1 branch and propagated B1 into B2 without rewriting history. Conflicts were limited to the roadmap; current frontend progress and delivered backend QA/CI status were retained.485c480f6944813d5e2ca880219b8aa95aa7a3ee; backend implementation unchanged from independently QA-passedd3a2389.c49aa58d905fef5767e552460673431da5c8a154; API/backend implementation unchanged from independently QA-passed44471c6.The API/shared/database/Python lock/scripts/backend workflow diff from the prior B2 delivery is empty. Whitespace/conflict checks passed. New hosted runs and independent reconciliation review are pending; prior exact-SHA evidence is retained rather than misattributed to the new commits. B3 will integrate the updated B2 branch before its single PR. The active frontend checkout and its uncommitted work were untouched.
DavidVFitzGerald commentedon Nov 15, 2026
QA: PASS
Updated exact-SHA review:
485c480f6944813d5e2ca880219b8aa95aa7a3eeon PR #61 after merging current main. This supersedes the previous delivered-SHA verdict without claiming a new implementation.B1 AC1–AC8 remain PASS. I independently compared the prior QA-passed
d3a23893faea5668cdf35bc34a3750f55193dea0against this head forapps/api,packages/python,db,pyproject.toml,uv.lock,scripts,.github/workflows/backend.yml,compose.yaml,dev,Makefileand.dockerignore: empty diff. The previously verified domain/schema, publication/rule/temporary-shadow protections, roles, locks and tooling are unchanged. The detailed original B1 QA evidence therefore carries forward.I inspected the combined roadmap merge diff and confirmed main's frontend status was retained, B1/B2 branch-only QA evidence is explicitly distinguished from merged completion, and I1 reconciliation remains recorded.
git diff 485c480^2 485c480 -- apps/frontend .github/workflows/frontend.ymlis empty: the merge preserves main's actual frontend tree/workflow. Applicable whitespace checks pass. No application edits, local test repetition, main merge or issue closure performed by QA.Fresh exact-head hosted checks pass and rerun the executable gates: backend-quality, frontend quality. The inherited local evidence remains 9 unit cases, 5 database scenarios, frozen/static/migration/compatibility checks and actual-role adversarial/concurrency probes; unchanged suites were not redundantly rerun locally for a roadmap/main merge.
Next action: coordinator/maintainer review at this exact SHA. PR remains unmerged; existing authorization and production-release gates remain in force.
DavidVFitzGerald commentedon Nov 15, 2026
Coordinator: merged delivery verified
PR #61 was merged by the maintainer into
mainatf790803cde32a13c8115abed0fb09f448a85ff9a. Its reviewed head485c480f6944813d5e2ca880219b8aa95aa7a3eehad independent QA PASS and passing hosted checks. This completes B1 #57; closure records observed delivery rather than the later feature-target merges.B2 #58 and B3 #59 remain open until recovery PR #82 delivers their reviewed code to
main. B4 #60 remains unimplemented.