Skip to content

[Task] F3: manage individual selection order and a virtualized selected-process list #18

Closed

Description

@DavidVFitzGerald

Delivery phase

Phase 1 - frontend with mock services

Goal

Maintain one coherent ordered process selection independently of current search visibility.

Context and authority

Milestone F3; read AGENTS.md, docs/team/product-manager.md, docs/product/LCA_diff_PRD.md, docs/engineering/roadmap.md, and docs/engineering/LCA_diff_Implementation_Specification.md §§6.2–6.3, 6.8. Current planning baseline is on docs/agent-workflow, pending review/merge into main; proposed ADRs are not accepted authority. Add app-level ordered selection state/controller and selector checkboxes/selected list, exposed for later Flows/Scores consumers. These application paths are planned until created. Exclude all archive/reference folders.

Requirements and constraints

Individual checkboxes append newly selected IDs in user order with no duplicates or product cap. A collapsible Selected processes (N) list supports removal and clear all. Virtualize long lists. Expose shared state so grid/header removal and both tabs later use the same order. No durable workspace persistence in this slice.

One session-sized task/PR including verification and handoff. Run all development, installation and checks in containers; install nothing on the host. No real backend, Firebase project, cloud credentials or proprietary inputs. If the current PRD/spec must change, prepare an ADR and updates to both current documents in the same PR.

Acceptance criteria

  • AC1 - Individual selects append in selection order; repeated selection is idempotent, removal deselects everywhere, and reselect appends at the end.
  • AC2 - Selection survives collapsed nodes, paging and filtering; items outside current results remain visible/removable in the selected list.
  • AC3 - Selected count, checkbox state and list update coherently; clear all removes every selected ID and leaves search unchanged.
  • AC4 - The selected list uses bounded rendering for hundreds of IDs with accessible item labels/removal controls and predictable keyboard focus.
  • AC5 - Component/controller tests cover hidden-by-filter items, rapid toggles, duplicate display names, clear and no-process empty state; the state API supports future column reorder/removal without copying selection.

Out of scope and follow-ups

Alphabetically ordered filter-scoped bulk additions are #19; grid drag/header removal is F4; UID-scoped browser persistence is F5. No arbitrary selection limit or confirmation merely for large comparisons.

Verification plan

Inside ./dev shell, run format:check/lint/typecheck/test:unit/build and npm --prefix apps/frontend run test:e2e. Exercise hundreds of synthetic selected IDs, measure bounded mounted list items and check shared selection order after filter/remove/reselect operations.

Engineer records branch/SHA and exact results, leaves issue open, and hands off to QA. QA verifies every criterion at that SHA and reports PASS/FAIL/BLOCKED; mock evidence is not proof of real security/integration.

Dependencies and readiness

Blocked by #16. No implementation until dependencies and the M1 environment runtime gate are satisfied. This body is groomed planning material, not PM READY while blockers remain. Coordinator/PM rechecks merged dependencies and session-sized scope before starting.

Current readiness — supersedes historical planning baseline/blockers above

Rechecked 2026-11-14 on main at 4e8126e. #16 is merged (PR #50) and closed; the M1/M2 bootstrap gates were already satisfied for F2/#16. #17 now depends on this issue; it runs next, at the maintainer's request.

Merged interfaces this issue consumes

  • src/components/process-tree/ ([Task] F3: render the paginated release and nested process tree #16): the ARIA tree with roving tabindex, lazy branch pages, TreeProcess nodes carrying release_id, id, label and geography, and virtualized rows (@tanstack/react-virtual 3.14.24, fixed 32 px rows).
  • Workspace in src/App.tsx is keyed by verified UID and unmounts on signout, lock or account change.

Decisions

  • D1 Identity. A selection entry is {release_id, revision_id, id, name, geography}, keyed by (release_id, id). revision_id is the release's current revision when the entry is selected. Name and geography are captured from the tree node as in-memory display data, so entries outside the loaded or visible tree still render. F5 restore will fill them via headers. No request is issued by selecting.

  • D2 Controller. src/app/selection.tsx adds a SelectionProvider inside Workspace and a useSelection() hook backed by an external store (useSyncExternalStore) with immutable ordered snapshots. API:

    • entries (ordered);
    • isSelected(key), select(entry) (idempotent append), deselect(key), toggle(entry) and clear();
    • move(key, toIndex) for F4 reorder.

    Later Flows/Scores/grid consumers read the same store. Nothing is copied.

  • D3 Tree checkboxes.

    • Process treeitems expose aria-checked (true/false) and a visual, aria-hidden checkbox.
    • Space, Enter or a click on a process row toggles it.
    • Branch rows stay without aria-checked and Space stays unbound on them; branch tri-state and bulk actions belong to [Task] F3: implement filter-scoped bulk selection and tri-state parent checkboxes #19.
    • The process accessible name is unchanged ("name — geography"); the checked state is conveyed by aria-checked.
  • D4 Selected list.

    • Placement: below the tree in the process sidebar.
    • Header: a disclosure button "Selected processes (N)" with aria-expanded, expanded by default.
    • Clear all: a "Clear all" button, disabled when the list is empty. There is no confirmation (spec §6.2 permits that and §6.8 forbids confirmations just for size). A polite live region announces "Cleared N selected processes."
    • List: role="list" labelled "Selected processes", virtualized with fixed rows, each item a listitem with aria-posinset and aria-setsize. Each item shows its 1-based position, "name — geography", and the release display name and version as secondary text.
    • Remove buttons are named "Remove name — geography from selection". To keep duplicate labels distinct, the name gains the release name and version, plus "(item k)" if the label is still duplicated.
  • D5 Keyboard and focus in the list.

    • The list has one tab stop (roving tabindex on the remove buttons). ArrowUp/Down, Home and End move focus; Enter or Space removes.
    • After a removal, focus moves to the next item, or to the previous item when the last was removed. When the list becomes empty, focus goes to the empty-state text's container (a focusable status with tabindex=-1).
    • After Clear all, focus stays on the disabled-state container; focus is never lost to body.
  • D6 Empty state. "No processes selected. Use the checkboxes in the process tree to add processes." The comparison pane's empty state is unchanged; F4 replaces it.

  • D7 No persistence. Selection is in memory only. It is discarded when Workspace unmounts (signout, lock, account change) and is never written to storage. UID-scoped persistence is F5.

  • D8 Filtering. Search does not exist until [Task] F3: add reactive AND-tokenized process search with cancellation #17. In this slice, AC2's "filtering" is proven by independence from tree visibility:

    • selected entries remain listed, removable and checked after a collapse, after paging and when their branch was never re-expanded;
    • deselecting from the list unchecks the tree row when it is next shown.

    The search-filter journey is carried to [Task] F3: add reactive AND-tokenized process search with cancellation #17 (its AC3/AC4).

Scope

Change src/app/selection.tsx (new), src/components/process-tree/ProcessTree.tsx, a new src/components/selected-processes/ component and CSS, src/App.tsx, tests and e2e/selection.spec.ts, plus the roadmap F3 row. There is no service, contract or composition change.

Objective verification

  • Controller unit tests:
    • append order, idempotent select, deselect then reselect appends at the end;
    • rapid toggles; clear; move;
    • duplicate display names with distinct keys;
    • snapshots are immutable, and the snapshot identity changes only on change.
  • Component tests:
    • tree aria-checked and Space/Enter/click toggling;
    • the list's order, count and checkbox state stay coherent;
    • removal from the list unchecks the tree row;
    • collapse/paging retention, and an entry whose branch is collapsed stays removable;
    • Clear all;
    • 500 selected entries keep mounted list items bounded (at most viewport plus overscan plus the active row);
    • keyboard roving and focus after removal and clear; the empty state;
    • signout clears the list, and re-login is empty with no storage writes.
  • Browser (e2e/selection.spec.ts, Chromium and Firefox, composed mock):
    • select Gamma, then Alpha, then Beta by keyboard and click; the list order and count are 3;
    • remove Alpha from the list and the tree row is unchecked; reselect Alpha and it appends at the end;
    • Clear all;
    • signout, then re-login, gives an empty list;
    • no requests or console errors.

Verification (container only)

COMPOSE_PROJECT_NAME=lca-diff-f3-selection FRONTEND_PORT=5188 ./dev up && ./dev check
docker compose -p lca-diff-f3-selection 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'

Mock evidence does not prove real persistence, authorization or performance.

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 F3, 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: #16. 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. removed
    blocked
    on Nov 14, 2026
  4. DavidVFitzGerald commented on Nov 14, 2026

    @DavidVFitzGerald
    OwnerAuthor

    PM: READY

    Phase 1 (frontend with mock services), milestone F3. Dependency #16 is merged (PR #50, 4e8126e) and closed; the M1/M2 gates were satisfied previously. Spec: §§6.2, 6.3 (selection order and shared removal), 6.8. Decisions D1–D8 are in the issue body's Current readiness section: entry identity and in-memory display data; the useSelection external-store controller with move for F4; tree aria-checked with Space/Enter/click on process rows only (branch bulk actions in #19); a virtualized selected list with roving remove buttons and defined focus; no confirmation; no persistence (F5); the filter journey carried to #17. #17 is re-sequenced after this issue at the maintainer's request. No ADR is needed; there is no PRD or spec deviation. Next: Software Engineer.

  5. DavidVFitzGerald commented on Nov 14, 2026

    @DavidVFitzGerald
    OwnerAuthor

    Engineering: READY FOR QA

  6. DavidVFitzGerald commented on Nov 14, 2026

    @DavidVFitzGerald
    OwnerAuthor

    QA: FAIL at b61dbe5

    Independent QA of #18 (F3 ordered selection and virtualized selected list) at delivered SHA b61dbe508d7ea91ccd505d66bee9119c63c0dd7a (branch feat/f3-selection, PR #53). Phase 1, mock mode only. This does not prove real persistence, authorization or performance. Hosted CI is left to the coordinator.

    Environment

    • Isolated detached worktree /tmp/lca-diff-qa18 at b61dbe5.
    • Rootless Compose project lca-diff-qa18, FRONTEND_PORT=5189.
    • Nothing installed on the host.

    Commands and results

    Command (inside docker compose -p lca-diff-qa18 exec -T workspace, cd apps/frontend) Result
    COMPOSE_PROJECT_NAME=lca-diff-qa18 FRONTEND_PORT=5189 ./dev up && ./dev check PASS (8 preflight scenarios, rootless, frozen lock)
    npm ci --no-audit --no-fund PASS, 232 packages
    git diff main b61dbe5 -- apps/frontend/package.json apps/frontend/package-lock.json package.json uv.lock empty: no dependency or lockfile changes
    npm run format:check / lint / typecheck PASS / PASS (0 warnings) / PASS
    npm run test:unit ×4 PASS 200/200 in 13 files on all 4 runs; no flakiness seen
    npm run build PASS
    npm run test:e2e -- --grep @smoke PASS, 10
    npm run test:e2e PASS, 30 (Chromium and Firefox)
    Temporary adversarial Playwright spec (QA-only, untracked, deleted afterwards), Chromium and Firefox Found F-1 below; other probes as expected

    Findings

    F-1 (Medium, blocking: D5 and AC4) — Clear all while the section is collapsed loses focus to body.

    • File: apps/frontend/src/components/selected-processes/SelectedProcesses.tsx:123-126 with :90 and :171.
    • Cause: clearAll() sets focusEmpty, and the effect then calls emptyRef.current?.focus(). When the disclosure is collapsed, the empty-state <p> is inside <div id="selected-body" hidden>, so it cannot take focus. The Clear all button has just become disabled, so focus falls to body.
    • Reproduction (composed mock, both browsers):
      1. Sign in as [email protected].
      2. Expand to road › operations/infrastructure and select Alpha and Beta.
      3. Click "Selected processes (2)" to collapse the section (aria-expanded=false).
      4. Focus "Clear all" and press Enter.
    • Expected (D5): "After Clear all, focus stays on the disabled-state container; focus is never lost to body."
    • Actual: document.activeElement is BODY in both Chromium and Firefox. The next Tab lands on the "Flows" tab, so the keyboard position in the sidebar is lost.
    • With the section expanded, Clear all correctly focuses the empty-state text.
    • Suggested direction (engineering's choice): when the section is collapsed, focus a visible fallback such as the disclosure button. Add a component or e2e regression test.

    Per-criterion verdicts

    • AC1 — PASS.
      • store.select appends only when the key is absent (selection.ts), and the key is (release_id, id).
      • deselect is global through the shared store, so the tree reads aria-checked from the same snapshot.
      • Reselecting appends at the end: unit, component and browser (Gamma, Alpha, Beta, then remove Alpha, reselect, Alpha is 3rd).
      • Re-verified in the browser: 7 rapid Space presses give a coherent count and state.
    • AC2 — PASS (with D8 scoping).
    • AC3 — PASS.
    • AC4 — FAIL (F-1). What passes:
      • Bounded rendering: 300 entries mount at most viewport/36 + 2×6 + 1 rows (+1 for the active row while scrolled).
      • One roving tab stop. ArrowUp/Down/Home/End work, and Enter (and Space, which QA checked in the browser) removes.
      • Focus moves to the next item, or to the previous one after the last is removed.
      • Focus goes to the empty state when the list empties, by keyboard or mouse in both browsers.
      • Remove buttons are labelled; the active row is kept mounted.
      • The "never lost to body" guarantee fails on the collapsed path.
    • AC5 — PASS.
      • Controller tests: order, idempotence, rapid toggles, the same ID in two releases, immutable snapshots that change identity only on change, move clamping, clear, no cap (5,000).
      • Component tests: hidden-row removal, duplicate names, clear, empty state, signout/account change.
      • move(key, toIndex) reorders the shared store in place, so F4 can reorder and remove without copying the selection.

    D1–D8

    • D1 — PASS. The entry is {release_id, revision_id, id, name, geography}. revision_id comes from the release, and no request is made on select.
    • D2 — PASS, with a cosmetic deviation.
      • Delivered as src/app/selection.ts rather than .tsx, using createElement.
      • It is a useSyncExternalStore external store with frozen snapshots.
      • useSelection() returns {entries, store} rather than spreading the methods. This is functionally equivalent.
    • D3 — PASS.
      • Process rows have aria-checked and an aria-hidden visual box; branches have no aria-checked.
      • Space on a branch remains unbound (re-checked in the browser and by the [Task] F3: render the paginated release and nested process tree #16 test at process-tree.test.tsx:130).
      • Space, Enter and click toggle without moving focus, and accessible names are unchanged.
    • D4 — PASS.
      • The disclosure has aria-expanded and is expanded by default.
      • Clear all is disabled when empty, with no confirmation.
      • The list is a role=list with listitem rows carrying posinset/setsize, the position, "name — geography" and the release as secondary text.
      • Duplicate labels get the release, then "(item k)".
      • Minor: the live text has no trailing period.
    • D5 — FAIL (F-1). Everything else in D5 is verified.
    • D6 — PASS. The empty-state text matches, and the comparison pane is unchanged.
    • D7 — PASS.
      • The provider sits inside Workspace key={auth.user.uid} (App.tsx:198-199).
      • The selection code has no storage access.
      • Component and e2e tests assert no storage keys change, and signout or account change gives an empty list.
    • D8 — PASS as scoped.

    Boundary and other checks

    • No mock imports or HTTP in components. SelectedProcesses/ProcessTree use only useServiceQueries and app/selection. The grep hits are fetchNextPage/refetch from TanStack Query.
    • test-harness.ts is test-only under services/mock. The [Task] F3: render the paginated release and nested process tree #16 coverage is intact: process-tree.test.tsx still has 15 it cases (15 on main), with the same assertions, now using geometry.tree.
    • e2e/f2-gate.spec.ts: the update is correct. Focus passes through "Selected processes (0)", the disabled Clear all is skipped, and the heading match is exact.
    • Historical folders were not used.

    Non-blocking follow-ups

    1. The objective verification specified 500 selected entries for the bounded-render test; it uses 300. That still meets AC4's "hundreds"; consider 500 for parity.
    2. removeNames/releaseName recompute for every entry on every render: O(N·releases). This is fine at MVP scale; consider memoizing for very large selections.
    3. Add a trailing period to the "Cleared N selected processes" announcement to match D4 text (cosmetic).

    Next action

    FAIL returns to the Software Engineer to fix F-1 with a regression test. Then QA rechecks the new SHA: the unit, e2e selection/f2-gate and full gates.

  7. DavidVFitzGerald commented on Nov 14, 2026

    @DavidVFitzGerald
    OwnerAuthor

    Engineering: QA F-1 fixed — READY FOR QA re-check at 71630cd (PR #53).

    • Clear all with the section collapsed now focuses the "Selected processes (0)" toggle instead of body. With the section expanded, focus still goes to the empty-state text.
    • Regression test: selection.test.tsx › keeps focus on the section toggle when Clear all runs with the list collapsed. It fails without the fix and passes with it.
    • The "Cleared N selected processes." announcement now has D4's trailing period.
    • Container: format, lint, typecheck and build PASS; test:unit 201/201 (3 consecutive runs); full e2e 30/30.
  8. DavidVFitzGerald commented on Nov 14, 2026

    @DavidVFitzGerald
    OwnerAuthor

    QA: PASS at 71630cd

    QA re-check of #18 after fixing F-1. Delivered SHA: 71630cda5a57a8701751760eaf08e99156ecdbad (feat/f3-selection, PR #53).

    • Mode: Phase 1, mock mode only. This does not prove real persistence, authorization or performance.
    • Hosted CI: left to the coordinator.

    Environment

    • Fresh detached worktree /tmp/lca-diff-qa18 at 71630cd.
    • Rootless Compose project lca-diff-qa18 with FRONTEND_PORT=5189.
    • Nothing was installed on the host.

    Change reviewed (b61dbe5..71630cd)

    SelectedProcesses.tsx:

    • After Clear all, focus goes to the empty-state text when the section is expanded, or to the "Selected processes" toggle when it is collapsed.
    • open was added to the effect deps.
    • The announcement now ends with a period.

    selection.test.tsx:

    • New regression test for a collapsed-section Clear all.
    • The existing test was updated for the new announcement text.

    The verification doc was also updated. There are no other source changes, and no dependency or lockfile changes against main.

    Commands and results

    Inside docker compose -p lca-diff-qa18 exec -T workspace, in apps/frontend:

    Command Result
    COMPOSE_PROJECT_NAME=lca-diff-qa18 FRONTEND_PORT=5189 ./dev up && ./dev check PASS
    npm ci --no-audit --no-fund PASS, 232 packages
    npm run format:check, lint, typecheck PASS
    npm run test:unit ×3 PASS, 201/201 in 13 files on every run; no flakiness
    npm run build PASS
    npm run test:e2e -- --grep @smoke PASS, 10
    npm run test:e2e PASS, 30 (Chromium and Firefox)
    Temporary QA-only Playwright spec (untracked, deleted afterwards), Chromium and Firefox PASS, 4

    F-1 re-check

    The QA spec ran in both browsers and gave identical results.

    Collapsed section — fixed:

    • Keyboard: collapse the section, focus Clear all and press Enter. Focus lands on BUTTON "Selected processes (0)", not body.
    • Expand afterwards: focus stays on the toggle, with no focus stealing. The next Tab goes to "Flows", because the empty text is tabindex=-1 and Clear all is disabled. This matches the f2-gate order.
    • Mouse: clicking Clear all with the section collapsed also focuses the toggle.

    Expanded section — unchanged:

    • Clear all: focus goes to the empty-state text, and the live region reads "Cleared 2 selected processes."
    • Single removal:
      • Removing a middle item focuses the next item (Beta).
      • Removing the last item focuses the previous item (Gamma).
      • Removing the only item focuses the empty-state text.
    • No console or page errors.

    Per-criterion verdicts

    • AC1, AC2 (D8 scoping), AC3, AC5 — PASS, unchanged from the b61dbe5 review. Only the focus target and the announcement text changed.
    • AC4 — PASS: F-1 is resolved, and bounded rendering, roving focus and removal focus still hold.
    • D1–D8 — PASS. D5 now holds on the collapsed path too. The D4 announcement now has its trailing period.

    Findings

    None blocking. The remaining non-blocking follow-ups from the previous review still stand:

    • The bounded-render test uses 300 entries rather than the planned 500. That still meets AC4's "hundreds".
    • Memoize removeNames for very large selections.

    Next action

    PASS goes to the coordinator for hosted CI and maintainer review/merge. Do not close #18 before the merge is approved.

  9. DavidVFitzGerald commented on Nov 14, 2026

    @DavidVFitzGerald
    OwnerAuthor

    Coordinator: QA re-check PASS at 71630cd (issuecomment-6880208586), after the earlier FAIL at b61dbe5 was fixed. Hosted CI PASS at 71630cd: PR quality https://github.com/DavidVFitzGerald/LCA-diff/actions/runs/43612779671; full dispatch https://github.com/DavidVFitzGerald/LCA-diff/actions/runs/43612806838. State: ready for review; PR #53 awaits maintainer merge. Non-blocking notes: the bounded test uses 300 entries (meets "hundreds"); removal-name memoization is possible for very large selections. After merge, #17 is rechecked next.

  10. DavidVFitzGerald commented on Nov 14, 2026

    @DavidVFitzGerald
    OwnerAuthor

    Closed by coordinator: PR #53 merged by the maintainer after QA PASS (re-check at 71630cd) and hosted CI PASS.

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