Repository navigation
Description
Delivery phase
Phase 1 - frontend with mock services. Milestone F4; task key F4-01.
Goal
Give the grid bounded row/cell reads and whole-selection chart extrema without fetching the entire matrix.
Context and authority
Read AGENTS.md, docs/product/LCA_diff_PRD.md, docs/engineering/LCA_diff_Implementation_Specification.md, docs/engineering/roadmap.md, and docs/team/product-manager.md. Do not read archive/reference folders. Current governance/spec documents are prepared on branch docs/agent-workflow; acceptance/merge authority follows docs/adr/README.md, not proposed ADR status. Any contract deviation needs an ADR and both current document updates in the same PR.
Specification §§6.4, 6.6, 7.1–7.3, 9.1. Planned files: apps/frontend/src/services/ provisional comparison DTOs, mock adapter, comparison query hooks, and service tests (planned).
Requirements and constraints
Extend the provisional services contract and mock adapter together; document this frontend-only read-summary extension for later OpenAPI reconciliation. This issue does not mandate or implement a production endpoint/DTO change; any later material API change follows the ADR/spec workflow. Return canonical decimal-string P/N (or equivalent extrema) and sign/zero summary per row for all selected processes, independent of the visible column window. This is read-only chart metadata, not ETL aggregation or difference filtering. Use revision snapshots, stable row keys and cursors, modest overscan, AbortSignal, and structured errors.
All work runs in containers with synthetic mock data and no API/Firebase/cloud dependency. Keep HTTP/auth/fixtures behind typed services and mock adapters; components consume contracts rather than fixtures. Follow Software Engineer and QA role handoffs, commit focused increments referencing this issue, and leave it open for QA/review.
Acceptance criteria
- AC1 — A selected-process union returns only represented
(flow_id, flow_type)rows with deterministic §6.4 ordering and stable next cursors. - AC2 — Row/cell responses and summary metadata refer to the same immutable revision snapshot; stale/mismatched requests fail explicitly rather than mix revisions.
- AC3 — A row whose largest magnitude is offscreen has identical P/N, chart height and scale for every visible window; metadata is requested per row window rather than all cells.
- AC4 — Present zero and absent cells remain distinct; cell warnings remain process-specific; no differences computation runs in ordinary row-summary requests.
- AC5 — Aborted/obsolete requests cannot overwrite newer query results, and transport batching never imposes a selection-count cap.
Out of scope and follow-ups
Chart rendering is #22; window mounting is #23; final Flows composition is #24. No backend endpoints, normalization or ingestion.
Verification plan
Run on the Docker host: ./dev shell, then inside /workspaces/lca-diff: npm --prefix apps/frontend run format:check, npm --prefix apps/frontend run lint, npm --prefix apps/frontend run typecheck, npm --prefix apps/frontend run test:unit, and npm --prefix apps/frontend run build. These scripts are established by F1, not claimed available today. Browser scenarios use npm --prefix apps/frontend run test:e2e -- --project=chromium (F1 establishes the pinned Playwright tool/browser setup). No host package installs.
Add service/query tests with more selected processes than one column window, offscreen ± extrema, present-zero/absence, multiple pages, aborts and publication changes. Assert bounded requested IDs, exact decimal strings, snapshots and request counts.
Record exact commands/results and delivered SHA in the engineering handoff. QA independently checks every criterion at that SHA and reports PASS/FAIL/BLOCKED; unavailable required checks are not passing.
Dependencies and readiness
Blocking predecessors: #19. Also requires verified M1 container runtime and merged bootstrap/M2 configuration; later milestones are planned, not implementation-ready while predecessors remain open. PM must recheck dependencies and actual interfaces before marking READY.
Current readiness — supersedes historical planning baseline/blockers above
Rechecked 2026-11-14 on main at d3fddb1. #19 (PR #62) is merged and closed, so F3 is complete; the M1/M2 gates were satisfied earlier.
Merged interfaces this issue builds on (#8, #9)
flowRows: cursor-paged, deterministic §6.4 order, union of represented flows,comparison_tokenbound to the canonical process set, the tab and the snapshot.flowCells: windowed. Processes and rows are each at most 100 per request and their product at most 1000. It rejects stale or mismatched snapshots withSTALE_SNAPSHOT.- Query options for both.
- AC1/AC2 behaviour already exists at the service level. This issue adds the missing whole-selection chart summary, the query/batching layer and the evidence.
Decisions
- D1 Provisional contract extension (frontend-only, no ADR).
- New method
DataService.flowSummaries(FlowSummariesRequest). The request is{revision_snapshot, comparison_token, process_ids, row_keys}, whereprocess_idsis the complete selection (unbounded) androw_keysis one row window (at most 100). - The response is
CellsResponse-like:{summaries, revision_snapshot, comparison_token, request_id}. - Each
FlowRowSummaryholds:row_key;max_positive(P), the exact decimal lexeme of the largest positive present amount, or"0";max_negative_magnitude(N), the exact lexeme of the most negative present amount without its sign, or"0";positive_count,negative_count,zero_countandabsent_countover all selected processes.
- The request sends the full process set as well as the token, so a real backend can stay stateless (spec §7.3: correctness must not depend on a cached token).
- It is documented in
services/README.mdas a provisional read-summary extension that I1 must reconcile with OpenAPI. There is no production endpoint or spec change in this issue.
- New method
- D2 Exact decimals.
- New pure
services/decimal.ts:compareDecimal,decimalSignanddecimalMagnitude. Exact comparison of lexemes, including exponents and signed zero (-0is zero). No floats. - On ties the first process in canonical ID order wins, so the output is deterministic.
- New pure
- D3 Mock.
- The mock validates that the token exists, that the snapshot is identical to the token's (
STALE_SNAPSHOTotherwise), thatprocess_idsequals the token's process set exactly, and that every row key belongs to the token's rows. - Rows are bounded by
window_limit. - It computes extrema over every selected process. There are no difference predicates.
- The mock validates that the token exists, that the snapshot is identical to the token's (
- D4 Query layer (
src/app/queries.ts).flowRowPages(input): infinite cursor query.flowSummaries(input).flowCellWindow(...): splits any visible row × column window into transport batches within the window and cell limits, merges them in request order, and aborts every batch together.- A pure
cellBatcheshelper is unit-tested. - All keys include the token and snapshot, so obsolete or aborted results cannot overwrite newer keys.
- D5 Scope. No UI in this issue: chart geometry is [Task] F4 — Implement exact signed-bar geometry and full-precision value tooltips #22, virtualization [Task] F4 — Virtualize comparison rows and columns with sticky alignment #23, composition [Task] F4 — Assemble the Flows comparison with exact missingness and cell warnings #24. Scores summaries follow in F5.
Objective verification
- Unit:
decimal.test.ts(ordering across exponents, signs, zeros and long lexemes) andcellBatches. - Mock service (
mock/comparison.test.ts):- Summaries over 250 selected processes, more than two column windows, with the extreme value outside any first window.
- P/N identical across every cell-window choice, with exact lexemes.
- Present zero distinct from absent, and warnings only on the affected cell.
- Stale, evicted or mismatched token, snapshot or process set fails explicitly.
- Row-window bound.
- No difference work.
- Query (
src/services/mock/comparison-queries.test.tsxorsrc/app/queriestest):- Infinite row pages follow cursors with stable keys.
- The cell window issues bounded batches (asserting requested IDs and counts) for 250 processes.
- Abort cancels every batch.
- An obsolete slow response for an old token never replaces the newer result.
- An old snapshot keeps being served after a new revision is selected.
- Container commands: format:check, lint, typecheck, test:unit, build, and e2e
@smokeplus the full suite for regression. There is no new browser journey: the grid UI is [Task] F4 — Virtualize comparison rows and columns with sticky alignment #23/[Task] F4 — Assemble the Flows comparison with exact missingness and cell warnings #24.
Activity
DavidVFitzGerald commentedon Nov 13, 2026
PM: BLOCKED
Groomed using docs/team/product-manager.md for F4, Phase 1 — frontend with mock services. Documentation review: PASS for scope, required sections, specification coverage and acyclic dependency links; this is not application QA or implementation readiness.
Blocking predecessor issues: #19. The M1 runtime gate (#2) and merged bootstrap/M2 configuration (#3) also remain required. PM must recheck merged dependencies and current interfaces before changing this to READY.
Engineer implements one issue, commits regularly and hands the delivered SHA plus exact container checks to independent QA; do not close before QA, review and approved merge. No backend/Firebase/cloud credentials or host installations are required for Phase 1.
DavidVFitzGerald commentedon Nov 14, 2026
PM: READY
Phase 1 (frontend with mock services), milestone F4, F4-01. Dependency #19 is merged, so F3 is complete. Spec: §§6.4, 6.6, 7.1–7.3, 9.1.
Decisions D1–D5 are in the issue body's Current readiness section:
flowSummariesread-summary method that takes the complete process set plus the token, documented for I1 OpenAPI reconciliation, with no production or spec change;No ADR is needed: the issue explicitly scopes this as a provisional frontend-only extension and makes no material production API change. Next: Software Engineer.
DavidVFitzGerald commentedon Nov 14, 2026
Engineering: READY FOR QA
PR #63, branch
feat/f4-flow-windows, delivered SHAe19235a(based on maind3fddb1).Container
lca-diff-f4-flowsresults:@smoke: 12 passedAC evidence:
comparison-queries.test.ts(cursor pages, §6.4 group order, stable replay) plus the existingcomparison.test.tsunion tests.flow-summaries.test.ts(stale, unknown, evicted, revision-bound and mismatched inputs; the old revision keeps serving its own values) plus the window rejecting a mixed-revision batch.-0and absent stay distinct; warnings stay on the affected cell; no difference work.Hosted full CI: https://github.com/DavidVFitzGerald/LCA-diff/actions/runs/43629402876. Next: independent QA.
DavidVFitzGerald commentedon Nov 14, 2026
QA: FAIL
Reviewed: PR #63, branch
feat/f4-flow-windows, SHAe19235a25a770ca37814ab59a2c57f48420e5fbf, in a detached worktree. Phase 1, mock mode only. Nothing here validates a real backend, real auth or data security.Environment: rootless Docker Compose project
lca-diff-qa20withFRONTEND_PORT=5195. No host runtimes were used.The verdict is FAIL because of one medium defect in the AC2 revision-consistency guard. Every gate passes, and AC1, AC3, AC4 and AC5 pass.
Commands and results
COMPOSE_PROJECT_NAME=lca-diff-qa20 FRONTEND_PORT=5195 ./dev up && … ./dev checkdocker compose -p lca-diff-qa20 exec -T workspace bash -lc 'cd apps/frontend && npm ci --no-audit --no-fund && npm run format:check && npm run lint && npm run typecheck && npm run test:unit && npm run build && npm run test:e2e -- --grep @smoke && npm run test:e2e'npm ciformat:checklint(--max-warnings 0)typechecktest:unitbuild@smokenpx vitest run src/services/mock/qa20-probe.test.tsgh pr checks 63qualitypass (run 43629405178, heade19235a)gh run list --branch feat/f4-flow-windowspull_requestrun 43629405178 and theworkflow_dispatchFrontend run 43629402876, both ate19235aPer-AC findings
flowRowPagesfollowsnext_cursorand returns no duplicate rows.comparison-queries.test.ts).total_countmatched the full selection.STALE_SNAPSHOT. It rejects a subset, a duplicate-padded subset, a token for a different selection, a scores token and foreign rows asINVALID_FILTER. It rejects revision-bound IDs used under another snapshot asUNKNOWN_PROCESS. A malformed or empty snapshot isINVALID_FILTER. An older revision still serves its own values. All of this was reproduced by the probe and the existing tests.FlowSummariesRequesthas no column-window parameter. P and N for 250 processes, with the extremes at indices 180 and 220, are identical across three column windows and in reversed order.REQUEST_WINDOW_TOO_LARGE. Duplicate keys are deduplicated first, and an empty window returns[].0,-0,0.000,0e5and+0each count as zero and stay distinct from absence."0",zero_count= 12."0"; with only positive values, N ="0". Counts are correct when absences are mixed in.-8e1against-80.00returns the first ID's lexeme.warningsfield. No difference predicate runs.AbortError.flowCells. Input is captured, so mutating the caller's input after building the options changes nothing.cellBatchesstays within both the row-and-process limit and the cell limit for awkward shapes: 1×5000, 101×1, 7×333, 999×3, 50×50 with 7 cells, and 3×3 with 2/1. It covers every pair exactly once and does not cap the selection.Decimal probe (D2): PASS
1e3=1000,0.0001e4=1,00.0001e+0004=+1,+.5=5e-1,-0e-99999=0e99999, and a 30-digit integer equals itse29form.1e399<1e400-1e400<-1e399-1e-400<0<1e-4000.09<0.11<1.00000000000000000000000000000019.99999999999999999999e5<1e6TypeError; see Defect 2.Contract, ADR and boundaries
flowSummariesis a provisional, frontend-only DTO that the issue and D1 scope explicitly. It adds no production endpoint and changes no spec or PRD meaning.services/README.mddocuments it and says I1 must reconcile it through the ADR/spec workflow. Adopting a real endpoint in B2 or I1 will need a spec update, plus an ADR if it deviates from §7.1.src/services/mock/appear only inapp/composition.ts, the boundary test and the existingcontracts.test.ts.flowSummaries,flowCellWindoworflowCells, or usesfetch.flowSummariesis in the auth-guarded operation list.Defects
flowCellWindowdoes not check batch snapshots against the requested snapshot.src/app/queries.ts(flowCellWindow) compares each batch's token with the request's. It compares each snapshot only with the previous batch's snapshot, never withdto.revision_snapshot.flowCellsso that it returnsrevision_snapshot: [{…, revision_id: "other"}]. Then callclient.fetchQuery(queries.flowCellWindow({revision_snapshot: snapshot, …})).STALE_SNAPSHOT. The docstring says "Every batch must answer with the request's token and snapshot, so revisions are never mixed", and the README says a batch answering with a different snapshot "fails the window".other, and the result is cached under the requested snapshot's key (probe output:ok:other).flowSummariesquery also never validates the response's token or snapshot.dto.revision_snapshotanddto.comparison_token. Add a single-batch regression test.decimalStringaccepts1e99999999999999999999, butdecimal.tsthrowsTypeErrorbecause the exponent is not a safe integer. If the mock summary meets such a value, the promise rejects with a rawTypeErrorinstead of a structuredServiceError. Real data is unlikely to hit this. Either document the limit or map it to a structured error.flowSummarieswith OpenAPI appears only inservices/README.md, not on the roadmap's I1/B2 rows or an issue. The coordinator should record it where I1 work will pick it up.Info: when one batch returns a structured error, the window does not abort its sibling batches; they run to completion. This is acceptable.
Next action
Engineering fixes Defect 1 and adds a regression test, then hands back a new SHA. QA will then recheck AC2 and the affected query tests. Defects 2 and 3 can be handled in the same PR or as follow-ups, at the coordinator's discretion.
fix: validate every comparison response against the requested snapsho…
DavidVFitzGerald commentedon Nov 14, 2026
Engineering: READY FOR QA (re-verify)
Delivered SHA
2382aa4on PR #63.QA findings addressed:
flowCellWindownow checks every batch, including a lone one, against the requested token and the release-ordered requested snapshot.flowSummariesandflowRowPagesresponses are checked the same way. A mismatch fails asSTALE_SNAPSHOTand is never cached under the request key.queries.ts.decimal.tsuses BigInt exponents, so1e99999999999999999999and similar values compare exactly. Test added.flowSummariesOpenAPI reconciliation duty: B2 provides an equivalent stateless endpoint, or the spec/ADR workflow replaces it.Container results:
@smoke: 12 passedHosted full CI: https://github.com/DavidVFitzGerald/LCA-diff/actions/runs/43630184577
DavidVFitzGerald commentedon Nov 14, 2026
QA: PASS
Reviewed: PR #63, branch
feat/f4-flow-windows, SHA2382aa49988665d474adfd49d2e83c8dad1a3fed, in a detached worktree. Phase 1, mock mode only. Nothing here validates a real backend, real auth or data security.Environment: rootless Docker Compose project
lca-diff-qa20bwithFRONTEND_PORT=5195. No host runtimes were used.D1, D2 and D3 are fixed, every gate passes and AC1–AC5 hold. One new low, non-blocking observation is listed below (O1).
Commands and results
COMPOSE_PROJECT_NAME=lca-diff-qa20b FRONTEND_PORT=5195 ./dev up && … ./dev checkdocker compose -p lca-diff-qa20b exec -T workspace bash -lc 'cd apps/frontend && npm ci --no-audit --no-fund && npm run format:check && npm run lint && npm run typecheck && npm run test:unit && npm run build && npm run test:e2e -- --grep @smoke && npm run test:e2e'npm ciformat:check,lint,typecheck,buildtest:unit@smokenpx vitest run src/services/mock/qa20-probe.test.tsgh pr checks 63qualitypass (run 43630189057,pull_request, head2382aa4)gh run view 43630184577workflow_dispatchFrontend run: success at2382aa4Earlier findings
queries.tshas a newmismatch()that compares each response's snapshot with the requested snapshot after sorting both by release, and compares tokens whenever the request sent one.flowCellWindowbatch, including a lone batch, and toflowSummariesand to everyflowRowPagespage.other) now giveserr:STALE_SNAPSHOT, where it previously gaveok:other.getQueryDatafor the request key staysundefined, so nothing is cached.[C, A, B]:[A,B,C],[B,C,A],[C,A,B]and copied objects are all accepted. This held for a multi-batch window (30×50), a lone batch, summaries and row pages.STALE_SNAPSHOT.1e99999999999999999999>1; it is also >1e99999999999999999998;-1e…99<-1e…98;1e-…99>0;10e…98=1e…99;0e…99=-0.1e99999999999999999999now returnsok, with P equal to that lexeme.flowSummarieswith OpenAPI: B2 provides an equivalent stateless endpoint, or the spec/ADR workflow replaces it. The README matches.Per-AC status
0,-0,0.000,0e5,+0) stays distinct from absence. Counts and ties are correct. Summaries carry no warnings, and no difference predicate runs.cellBatchesstays within limits for awkward shapes and has no selection cap.Docs and contract
New observation (non-blocking)
flowRowPagesquery are not checked against each other's token.ComparisonRowsRequestcarries no token, so every page passes as long as its snapshot matches.t1and page 2 witht2, both under the requested snapshot. The query succeeds and caches pages with tokens["t1","t2"].flowCellWindowstill keeps the unusedsnapshot ?? dto.revision_snapshotpath. The result reports the response's snapshot (release-sorted), which is equivalent. PlainflowCellsand the score queries do not runmismatch, but they are outside [Task] F4 — Add snapshot-consistent flow windows and whole-row chart summaries #20's scope.Next action
Ready for maintainer review and merge (coordinator). O1 is optional hardening for I1.
DavidVFitzGerald commentedon Nov 14, 2026
Coordinator: ready for review
PR #63 head:
2382aa4.2382aa4([Task] F4 — Add snapshot-consistent flow windows and whole-row chart summaries #20 (comment)). The earlier FAIL ate19235ais fixed (D1–D3).qualitypassed (run 43630189057), and the full frontend run 43630184577 succeeded at2382aa4.The issue stays open until the maintainer merges.
feat: add whole-selection flow row summaries and batched cell windows…
docs: document the provisional flow summary extension and F3 completi…
fix: validate every comparison response against the requested snapsho…
DavidVFitzGerald commentedon Nov 14, 2026
Closed after independent QA PASS (at
2382aa4), passing hosted CI and the maintainer's merge of PR #63 (16e9802). Follow-up O1 is tracked in #64.