Skip to content

[Task] L3 — Differences toggles on the real API and local MVP acceptance #30

Closed

Description

@DavidVFitzGerald

Re-scoped 2026-11-16 under ADR 0006 (#95). This issue was F5-04 (mock-only toggles). It now covers the MVP differences toggles against the real API plus local MVP acceptance, and it is the third and final local-MVP PR. The exhaustive mock predicate work stays in #29 (post-MVP). The former Phase 1 gate #34 is post-MVP.

Delivery phase

Local MVP (ADR 0006), milestone L3 — final implementation PR.

Goal

Each comparison tab has an independent "Show differences only" toggle backed by the API's exact differences_only reads. The local MVP is then accepted end to end from one command.

Context and authority

Read AGENTS.md, the PRD, the specification (§§6.7, 7.1–7.3, 9.2 behaviors 15–16, 9.3, 12 definition of done, as revised by ADR 0006), docs/adr/0006-local-only-mvp.md, docs/engineering/roadmap.md (L3), and the B2 differences_only implementation in apps/api/src/lca_api/queries.py. Do not read archive/reference folders.

Requirements and constraints

  • Toggles on Flows and Scores start off, stay independent across tab switches, and are disabled and reset to off with fewer than two processes. They are not persisted (browser workspace persistence is post-MVP, [Task] F5 — Persist the versioned account-scoped workspace #31).
  • Turning a toggle on requests only that tab's eligible rows via differences_only=true. Turning it off restores full rows without a difference query. Cache keys use the canonical (order-independent) process set, revision snapshot, indicators where relevant, tab and flag. Reordering alone reuses results.
  • Use exact semantics from the API. Absent ≠ present zero, -0 equals 0, N/A is never zero, and there is no float or tolerance comparison. Add a minimal exact-string mock implementation only so that deterministic unit tests and mock mode do not error. The full mock instrumentation stays in [Task] F5 — Implement exact on-demand difference queries in mock services #29.
  • Loading/error/cancellation keeps controls responsive and offers retry without applying a superseded snapshot's eligibility.
  • Local MVP acceptance: run the spec §9.3 UAT journeys (except browser restoration) on the L1/L2 stack. Extend the real-integration Playwright smoke with a differences step. Execute the documented opt-in BAFU path once using the representative private manifest (data_pipeline/examples/bafu-private-representative.json) and confirm the imported release is visible. Keep reports private and record only non-sensitive evidence. Record results in docs/engineering/local-mvp-verification.md.

Acceptance criteria

  • AC1 — Both toggles start off, are independent across tabs, and are disabled and reset with fewer than two processes.
  • AC2 — On sends only that tab's differences_only request; off restores full rows without one; unchanged inputs and reorders reuse cached results; membership, indicator or revision changes invalidate them.
  • AC3 — On seeded data, Flows hides only rows equal in every selected process, and absent vs present-zero counts as a difference. Scores hides equal valid values and uniformly N/A rows, and valid vs N/A counts as a difference.
  • AC4 — Error/cancel paths offer retry and never mix snapshots.
  • AC5 — From a clean clone, ./dev app-up alone yields a working app. A verified user can log in, search, bulk-select, compare Flows and Scores, toggle differences, reorder and remove columns. Data persists across ./dev app-down/app-up.
  • AC6 — The opt-in BAFU representative import is visible in the local app, or a concrete blocker is filed. Verification records list exact commands, results and remaining post-MVP gaps.

Out of scope and follow-ups

Workspace persistence #31, stale-ID reconciliation #32, async/accessibility audit #33, full mock acceptance #34 and exhaustive mock predicates #29 are post-MVP. Deployment and full-corpus validation are also post-MVP.

Verification plan

Inside ./dev shell: frontend format:check, lint, typecheck, test:unit, build. Real-integration Playwright smoke against ./dev app-up (Chromium; Firefox as practicable). Manual UAT checklist. Record exact commands/results and SHA. QA re-runs AC5 from a clean clone.

Dependencies and readiness

Blocking predecessor: L2 #97 (which requires L1 #96). ADR 0006 must be merged (#95).

Activity

  1. added
    task
    frontend
    blocked
    on Nov 13, 2026
  2. DavidVFitzGerald commented on Nov 13, 2026

    @DavidVFitzGerald
    OwnerAuthor

    PM: BLOCKED

    Groomed using docs/team/product-manager.md for F5, 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: #29. 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.

  3. changed the title [-][Task] F5 — Wire independent difference toggles and canonical query caching[/-] [+][Task] L3 — Differences toggles on the real API and local MVP acceptance[/+] on Nov 16, 2026
  4. DavidVFitzGerald commented on Nov 16, 2026

    @DavidVFitzGerald
    OwnerAuthor

    Re-scoped by the coordinator on 2026-11-16 per the maintainer's local-only MVP decision (ADR 0006, #95). Former F5-04 mock-only toggle scope is replaced by the L3 body: toggles against the real API's differences_only reads plus local MVP acceptance. The blocking predecessor changed from #29 (now post-MVP) to L2 #97. GitHub's edit history keeps the previous body.

  5. DavidVFitzGerald commented on Nov 16, 2026

    @DavidVFitzGerald
    OwnerAuthor

    PM: READY

    Rechecked on 2026-11-16 (coordinator acting under docs/team/product-manager.md). Dependencies are satisfied: L2 #97 closed via PR #105 (cd6d8a6), L1 #96 merged (PR #100), ADR 0006 accepted (PR #98). Scope, ACs and the container verification plan are unchanged. Branch: feat/l3-differences from main @ baff738.

    Grooming note for QA: the committed synthetic seed has no flow row with equal amounts across two processes, and its loader refuses to add or replace revisions (check_state). On seeded data, AC3's Flows half is therefore observable as "nothing equal, nothing hidden; absent vs present-zero kept". The hide case is evidenced by the B2 PostgreSQL API tests, the mock predicate tests and the opt-in representative BAFU import (AC6). Extending the seed would force ./dev app-reset --yes on existing volumes, so it is out of scope here.

  6. removed
    blocked
    on Nov 16, 2026
  7. DavidVFitzGerald commented on Nov 16, 2026

    @DavidVFitzGerald
    OwnerAuthor

    Engineering: READY FOR QA

    Branch feat/l3-differences @ f57d5e6dd33617ee371b54826e6f346626448cfe, PR #109. Evidence: docs/engineering/local-mvp-verification.md.

    AC Status
    AC1 Implemented. Vitest composed-App journey plus real-stack differences journey
    AC2 Implemented. One differences_only read per tab, cached off/on, reorder reuse, membership invalidation (Vitest + real)
    AC3 Implemented. Mock predicate tests. Real seed: absent vs zero kept, uniform missing GWP 100 hidden, N/A kept. The seed has no equal flow rows (see PM note)
    AC4 Implemented. Retry, cancel on off (abort asserted), no rows from a failed session
    AC5 Engineering: fresh isolated project, app-up/app-smoke 9/9/app-e2e 7/7 Chromium + Firefox, publication pointer byte-identical across down/up. QA to repeat from a clean clone
    AC6 Representative BAFU import ready, promoted, published and visible. Found and fixed #107 (Scores 422 with two releases). Follow-up #108

    Checks inside the workspace: format, lint, typecheck, contracts and build pass; Vitest 472/37; mock Playwright 72/72 at both the toggle and fix commits. The real suite needs a seed-only stack; it fails on environment assumptions after the opt-in import.

  8. DavidVFitzGerald commented on Nov 16, 2026

    @DavidVFitzGerald
    OwnerAuthor

    QA: PASS

    QA Engineer role (docs/team/qa-engineer.md), independent verification of L3 #30 and the bundled defect fix #107.

    • Reviewed SHA: f57d5e6dd33617ee371b54826e6f346626448cfe (feat/l3-differences, PR feat: L3 differences toggles and local MVP acceptance #109). The QA clone was not modified. A temporary revert of one file, used to confirm that the regression test fails, was restored afterwards (git status clean).
    • Mode: real (HTTP adapter + Firebase Auth Emulator + PostgreSQL) for the stack checks; mock for Vitest and the mock Playwright suite.
    • Environment: a fresh clean clone at /tmp/lca-l3-qa (private/ and data/ absent), rootless Docker via ./dev. These QA-only projects were created and touched nothing else: workspace lca-diff-l3-qa (FRONTEND_PORT 5291) and app stack lca-diff-l3-qa-app (ports 5270/8270/9270). AC6 was read-only against the existing lca-diff-l3-app (5280/8280/9280). On that stack only ./dev app-e2e node -e ... ran: no import, reset or down.

    Commands and results

    Command Result
    COMPOSE_PROJECT_NAME=lca-diff-l3-qa FRONTEND_PORT=5291 ./dev up && ./dev check PASS: rootless identity, restricted capabilities, toolchain, frozen lock, workspace writes
    docker compose -p lca-diff-l3-qa exec -T workspace bash -lc 'cd apps/frontend && npm ci && npm run format:check && npm run lint && npm run typecheck && npm run contracts:check && npm run build && npm run test:unit' All pass; Vitest 472 passed / 37 files
    ... npm run test:e2e (mock, Chromium + Firefox) 72/72 passed (4.2 min)
    LCA_APP_PROJECT=lca-diff-l3-qa-app LCA_APP_FRONTEND_PORT=5270 LCA_APP_API_PORT=8270 LCA_APP_AUTH_PORT=9270 ./dev app-up Healthy in ~33 s; one-shot migrate/seed/auth-seed exited
    ./dev app-smoke 9/9 ok, "smoke passed"
    ./dev app-e2e (Chromium) 7/7 passed, including both new L3 journeys
    ./dev app-e2e node_modules/.bin/playwright test --config playwright.real.config.ts --browser firefox 7/7 passed
    ./dev app-down → named volumes app-db/app-archive kept → ./dev app-up → psql ... "select * from release_publication" before vs after, compared with cmp Byte-identical publication pointer; ./dev app-smoke passed again
    gh pr checks 109 (head f57d5e6) quality, real-stack, api-quality, backend-quality, etl-quality: all pass

    Directed edge cases (QA stack, ./dev app-e2e node -e "<script>", Chromium)

    All of these were observed as expected:

    • With one process, both switches are disabled and off. Adding a second process enables them and leaves them off. While off, no differences_only row request is sent on either tab.
    • Flows on → Scores is still off. Each switch keeps its state across repeated tab switches.
    • Removing a column with the header × down to one process disables and unchecks both switches. Re-adding a process leaves both off and sends no difference request.
    • Responsiveness/cancel: the difference read was delayed by 4 s through route interception. During loading the switch stayed enabled, the grid was aria-busy, and tab switches still worked. Turning the switch off aborted the in-flight request (1 aborted), restored the identical full row count and sent no new flows row request.
    • Error: a forced 500 on the difference read showed a "could not be loaded" alert, one Retry button, no cells from the failed session, and the switch stayed enabled. Retry, once the fault was removed, loaded rows and cells.
    • Scores valid vs N/A (glued laminated = N/A, rooftop PV = valid): GWP 100 stays shown with the switch on (1 row; states unavailable, positive). The uniform-missing case is covered by the committed journey (0 rows plus an explicit "No differences" message).
    • Screenshots of the enabled, checked (Scores) and disabled switch: the label is bold and legible, the hint text is readable, and the disabled state is visibly greyed with the explanation "Select at least two processes to show differences."

    Per-criterion verdicts — #30

    • AC1 — PASS. Committed real journey plus the directed checks above (default off, independence, persistence across tabs, disable and reset below two processes, including removal via header ×). differences.ts resets during render, so no commit shows a stale on state.
    • AC2 — PASS. Observed requests show only that tab's differences_only: true read when on, and none when off. Toggling off and on reuses the cache with zero new row reads (committed test and QA). Keys use the sorted process set, snapshot, sorted indicators, tab and flag (useFlowGrid/useScoreGrid). Reorder and membership/indicator invalidation are covered by Vitest (flows-composition.test.tsx).
    • AC3 — PASS (with the PM-noted seed limitation). On seeded data, absent vs present-zero CO2 is kept, Flows hides nothing because the seed has no equal rows, uniform missing GWP 100 is hidden and valid vs N/A is kept. The Flows hide case is evidenced by the API PostgreSQL test (apps/api/tests/test_api.py, differences_only → total_count == 2) and the mock predicate tests (comparison.test.ts: -0 = 0, absent ≠ zero, N/A states). The mock predicate matches flow_base's HAVING (count < n OR min != max) and score_rows' status/value logic, with no floats or tolerance.
    • AC4 — PASS. Retry after a forced error, cancel-on-off abort, no failed-session rows, and the switch stays responsive (directed checks plus Vitest). Rows and cells stay bound to the session's comparison token and snapshot.
    • AC5 — PASS. Clean clone, ./dev app-up alone, then demo login, search, bulk select, Flows/Scores, toggles, reorder (keyboard) and header × removal, in both the real suites and the directed checks. Registration and verification of a new user are in the real suite. Data persisted across app-down/app-up (byte-identical publication pointer).
    • AC6 — PASS. On lca-diff-l3-app, read-only, only booleans recorded: 2 release roots are listed, including BAFU:2026 v1 2026 v1, next to the synthetic one. With its processes selected (≥2), Flows cells load without an alert. The switch is enabled and starts off. On sends a difference read; nothing was hidden for this selection, and no error occurred. Off restores the full row count without a new read. Scores shows GWP 100 as the first row with cells, without an error alert, both off and on. There were 0 comparison responses ≥400. Mixed releases (BAFU processes plus one synthetic): Scores requests both releases' GWP 100, shows 2 rows, and returns no alert and no 4xx. This is consistent with native, non-merged indicators (§6.5). local-mvp-verification.md lists commands, results and post-MVP gaps.

    #107 (Scores INVALID_FILTER with two releases)

    • AC1 — PASS. scopedIndicatorIds filters chosen indicators to the selected processes' releases (unknown IDs are kept for [Task] F5 — Reconcile restored IDs and publication changes atomically #32). On the two-release stack, 0 comparison 4xx and Scores loads.
    • AC2 — PASS. ScoresPanel shows "Select an indicator" with the "None of the chosen indicators belongs to the database version…" text when the scoped set is empty (App-level test in flows-composition.test.tsx).
    • AC3 — PASS. The component regression in scores-grid.test.tsx fails without the fix: QA reverted ScoresGrid.tsx to 064c518^, saw 1 failed / 3 passed, then restored it. The real two-release check passed (AC6 above).
    • Correctness vs spec: correct per §6.5 (native method/indicator keys; cross-release mapping post-MVP §10.3) and §7.3. The API rejects indicators outside the snapshot (score_rows: requested IDs ≠ snapshot indicators → 422), so scoping on the client is the right fix, with no contract change. [Task] Distinguish releases in the indicator tree when several releases are published #108 is an appropriate follow-up. The duplicate unlabeled method roots are a display/clarity issue under §6.2/§10.1, not a correctness defect, and should not block the MVP.

    Governance

    No PRD, specification or ADR changes. The toggles implement §6.7 as revised by ADR 0006 (in-memory, not persisted), so no ADR is needed. The roadmap and services README updates are consistent. The diff contains no references to the excluded historical folders, and QA did not use them.

    Unrun checks / notes

    • Real Playwright was not run against the BAFU-imported stack (engineering documents three environment-assumption failures there). The suite targets seed-only stacks, which QA ran.
    • The §9.3 "100+ processes" journey relies on mock e2e (the seed has fewer than 100 processes). Laptop benchmarks are post-MVP.
    • Manual UAT was done as directed automation, not by a human tester.

    Next action

    Maintainer review and merge decision on PR #109 (owner: maintainer). Coordinator closes #30 and #107 after merge. #108 is to be groomed afterwards.

  9. DavidVFitzGerald commented on Nov 16, 2026

    @DavidVFitzGerald
    OwnerAuthor

    Closed by the coordinator after QA PASS (see #30 QA verdict), passing hosted CI and the maintainer's merge of PR #109.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    frontendtask

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions