Repository navigation
Description
Delivery phase
Phase 1 - frontend with mock services. Milestone F4; task key F4-03.
Goal
Render scientific cell values with the prescribed signed geometry while preserving their canonical precision and missingness.
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, 9.2 behavior 15. Planned files: apps/frontend/src/components/comparison/ chart/value components and decimal-display helpers/tests (planned).
Requirements and constraints
Consume whole-selection row summaries from #20. Use floats only to derive chart pixels; decimal display/equality must not lose canonical digits. One reusable component serves Flows and Scores. Keep no substantive bar for zero/absence/N/A; preserve raw decimal text for the full-precision tooltip.
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 — For M>0, positive/negative bars extend up/down from data y=0 with height H×abs(value)/M; a mixed row has chartable height H×(P+N)/M and axis H×P/M below top.
- AC2 — Golden row
-80,+20has height 1.25H and above/below components 0.25H/H; equal ± extrema reach 2H; positive-only and negative-only rows retain H. - AC3 — All-zero/absent/N/A rows retain standard height and a thin near-top baseline; present zero shows
0, absence is blank, N/A showsN/A, none has a substantive bar. - AC4 — Positive bars are green, negative red, magnitude intensity is monotonic; sign/value labels communicate meaning without relying on color.
- AC5 — Labels contain value only, use adaptive decimal/scientific notation and sit above zero except non-positive-only rows below; padding/text strips avoid overlap without altering geometry.
- AC6 — Hover/focus reveals full stored precision for tiny/large decimals;
-0and0display consistently and pixel calculations do not overflow into invalid geometry.
Out of scope and follow-ups
Virtualizer measurement is #23, flow cell warning wiring is #24, Scores mounting is #28, differences are #29/#30. No source conversions.
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.
Unit geometry and precision fixtures cover positive-only, negative-only, asymmetric mixed, zero, absence/N/A, 1e-300/1e300 and long exact decimals; component/browser checks validate labels, axis and focusable tooltips.
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: #20. 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.
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: #20. 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 (recheck)
The blocking predecessor #20 is closed and merged in PR #63, and M1 and the bootstrap configuration are merged. The interfaces were checked against the current
mainatf138482:FlowRowSummary, with exactmax_positive/max_negative_magnitudelexemes and counts.FlowValueandScoreValuestates.services/decimal.ts, which the UI may import since [Task] F4 — Build shared process headers and comparability warnings #21.Removing
blocked.docs: format the #22 signed-bar notes (Refs #22)
DavidVFitzGerald commentedon Nov 14, 2026
Engineering: READY FOR QA
Branch
feat/f4-signed-bars, delivered SHAea88551, PR #67, basemainatf138482.Criteria
rowGeometryderives the row from P and N.barGeometrydraws each bar from data y = 0 with height H × |value| / M. For mixed rows the chart height is H × (P + N) / M and the axis sits H × P / M below the top.geometry.test.ts:0.N/A.-0and0display identically. Pixel ratios use exact per-operand exponents, and clamping keeps geometry finite and inside the chart.Commands
All run in the workspace container.
format:checklinttypecheckbuildtest:unit(twice)test:e2e -- --project=chromiumNew tests:
services/decimal-display.test.tscomponents/comparison/geometry.test.tscomponents/comparison/SignedValueCell.test.tsxLimitations
Next: independent QA at
ea88551.DavidVFitzGerald commentedon Nov 14, 2026
QA: FAIL
Reviewed:
feat/f4-signed-barsatea88551(PR #67; basemainatf138482, reviewed withgit diff f138482..ea88551).Mode: Phase 1, mock/component only. Cells are not mounted in the app yet (#23/#24/#28), so nothing here validates a real backend or security.
Environment: existing rootless workspace container
lca-diff-dev-workspace-1, at/workspaces/lca-diff. Nothing was installed on the host.Authority: spec §§6.4–6.7 and §9.2 behaviour 15, the PRD, and
services/README.md(#20 and #22 sections). The archive and reference folders were not used.Verdict per criterion
0and-0show0. An absent cell has no children, no text and no tab stop. N/A showsN/Awith its reason in the description, and no bar, also in a scaled row.#1f7a4aand negative#b3261e. Opacity is 0.35 + 0.65×|v|/M, which is monotonic; a mutation to a constant opacity fails a test. Sign is also in the label text (-0.5) and the accessible name (-0.5, negative).9.9995→10,999999→1e6,999949→999900,0.00099995→0.001,0.00099994→9.999e-4,-9.9995→-10,+12.345→12.35,1.0E+3→1000,-1.0e-3→-0.001,999.95→1000,99999.5→100000,9.9995e-5000→1e-4999,-0.0E+0/+0/0e-9999→0,.5→0.5,00012.300→12.3, 1 followed by 400 zeros →1e400, and 5000 nines →1e5000. Rounding is half away from zero, using the exact digits.-1.2345678901234567890123e-300intact. It hides on Tab away, and hovering N/A showsN/A: unresolved basis.displayDecimalkeeps every stored digit and unsigns zeros only (-0→0,-0.0e7→0.0e7). Geometry stays finite and inside the chart for 1e±300, 1e±5000, 1.1e308/1, 5e-324 and inconsistent summaries.decimalRatioreturns 0 or +Infinity at exponent gaps beyond ±400, and every caller clamps the result.Other checks:
SignedValueCelltakes a tab-neutralCellState(present/absent/unavailable).RowScaleInput, which matchesFlowRowSummary.max_positive/max_negative_magnitude, never from mounted cells.services/decimalandcontractsare imported.Commands (in container, at
ea88551)All run as
docker compose --project-directory . -f compose.yaml exec -T workspace bash -lc 'cd /workspaces/lca-diff && npm --prefix apps/frontend run <script>':format:checklinttypecheckbuildtest:unit(run 3 times)test:e2e -- --project=chromiumQA probes were all temporary, and the working tree stayed clean (
git status --shortis empty):src/zz-qa-22.test.ts): run and then deleted.apps/frontendunder/tmp, with a replacedmain.tsxrendering six rows of cells and a private Playwright config. It measured bounding boxes, focus, Tab and hover. Removed afterwards.>5rounding-0kept in the tooltipDefects
D1 — Medium (blocking AC1): minority-side hairline bars are drawn on the wrong side of the zero axis.
Location:
apps/frontend/src/components/comparison/geometry.ts:105-107. TheMIN_BARfloor of 1 px is followed by clamping into[0, chartHeight - height]. In a mixed row where the smaller extreme is below M/40, the space on the minority side of the axis is under 1 px, so the clamp moves the bar across the axis.Repro (unit):
rowGeometry({max_positive:"1000", max_negative_magnitude:"0.5"})giveschartHeight40.02 andaxis40. ThenbarGeometry("-0.5", row)returns{sign:-1, top:39.02, height:1}, so the negative bar spans 39.02–40.02, about 0.98 px above data y = 0. Mirror case:rowGeometry({max_positive:"0.5", max_negative_magnitude:"1000"})has its axis at 0.02, andbarGeometry("0.5")returnstop: 0, so the positive bar spans 0–1 and extends below zero.Repro (Chromium, same rows):
-0.5and-1.2345678901234567890123e-300bars occupy 45.02–46.02 px. They sit on the positive side, and the label chip also hides them.0.5bar at 6–7 px.Expected vs actual: spec §6.6 says "a negative draws downward … Always place the bar baseline at data y=0". Actually, red hairlines are drawn upward from the axis.
Why it matters: mixed rows such as (+1000, −0.5) are common in LCA data.
Why tests missed it: the existing "extreme and inconsistent" test (row
1e999/1e-999, value-1e-999) asserts only the bounds, not the direction.Possible fixes:
chartHeightMIN_BARon each populated sideAdd a direction assertion either way: positives satisfy
top + height == axis, negativestop == axis.D2 — Low (non-blocking; fix with D1): M is chosen with a float comparison, so the "exact"
RowGeometry.Mcan name the wrong extreme.geometry.ts:69,decimalRatio(P, N) >= 1.rowGeometry({max_positive:"1", max_negative_magnitude:"1.00000000000000000001"}).Mis"1", althoughcompareDecimalMagnitudereturns −1 (N is larger).compareDecimalMagnitude(P, N) >= 0.Observations (non-blocking)
-1.235e-300, was 68.7 px.text-overflow: ellipsiscould cut an exponent in narrower columns (-1.235e-30…), so [Task] F4 — Virtualize comparison rows and columns with sticky alignment #23 should guarantee a minimum column width or use another fit strategy.-1in a (2, 0) row gives a red bar above the axis. Such input should not occur under [Task] F4 — Add snapshot-consistent flow windows and whole-row chart summaries #20 contracts, but returningnullor a clamp on the correct side would fail safer.decimal.ts:79says+Infinityoccurs "only when b is zero", but1e5000 / 1also returns+Infinity, as the test itself asserts.aria-label="No flow"on a role-lessdiv. ARIA does not support naming generic elements, so assistive technology may ignore it. Revisit this when [Task] F4 — Virtualize comparison rows and columns with sticky alignment #23 adds grid cell roles.Next action
Engineering fixes D1 (and D2) with regression tests on
feat/f4-signed-bars, then returns the issue to QA. The recheck covers geometry tests, the Chromium harness rows (1000, −0.5) and (0.5, −1000), and the standard gates.fix: keep signed bars anchored on their own side of zero (Refs #22)
DavidVFitzGerald commentedon Nov 14, 2026
Engineering: READY FOR QA (round 2)
Branch
feat/f4-signed-bars, delivered SHA15ba70d, PR #67. This round responds to the QA FAIL atea88551.Fixes
geometry.tsbarGeometry: a bar is now always anchored at data y = 0, so positive bars end at the axis and negative bars start there.max(MIN_BAR, min(room on its own side, H × |v| / M)).compareDecimalMagnitude(P, N) >= 0instead of a float ratio.decimalRatiodoc comment, which now also notes the function must not be used for ordering.aria-label. They remain visually blank, with no chart, axis, bar or label, and are not focusable.Regression tests
New in
geometry.test.ts:Against the old
geometry.tsfromea88551, run in a temporary container copy, these three tests fail. They pass on the fix.Commands
All run in the workspace container.
format:checklinttypecheckbuildtest:unit(twice)test:e2e -- --project=chromiumNext: independent QA recheck at
15ba70d.DavidVFitzGerald commentedon Nov 14, 2026
QA: PASS
Independent recheck of F4-03 (#22, PR #67) after the round-1 FAIL at
ea88551.15ba70donfeat/f4-signed-bars. Shared checkout;git rev-parse --short HEAD=15ba70d, tree clean before and after.lca-diff-devworkspace container (rootless Docker). Nothing was installed on the host.git diff ea88551..15ba70d(round-2 fix) andgit diff f138482..15ba70d(whole change). Authority: spec §6.6 (with §§6.4–6.5, §9.2 behaviour 15), PRD, and the services README section "Signed bars and value labels ([Task] F4 — Implement exact signed-bar geometry and full-precision value tooltips #22)". Historical folders were not used.Round-1 defects
geometry.ts:111-113now takesroomon the bar's own side, setsheight = max(MIN_BAR, min(room, H×|v|/M)), and anchorstopat the axis (positive:axis − height; negative:axis). Exact repros:(1000, 0.5)/-0.5givestop 40, height 1(axis 40);(0.5, 1000)/0.5givestop −0.98, height 1, so it ends at axis 0.02. QA sweep: 27 P × 27 N × 27 magnitudes × both signs = 39,366 combinations (0,-0,0.000e5, 5e-324, 1e±300, 1e±5000, 1.1e308, 30-digit integers, values near M/40, values beyond M, values on a side the row lacks). Every geometry value is finite. Every nonzero bar is anchored at zero (positivetop + height == axis, negativetop == axis, within 1e-9) and stays within[−CHART_PADDING, chartHeight + CHART_PADDING]. Height is ≥ MIN_BAR and ≤ H, and stays within its own-side room whenever room ≥ 1 px. Hairline overflow is at most 1 px, so it fits inside the 6 px padding.ea88551'sgeometry.tsswapped into a container-only copy, these fail: "extreme and inconsistent…", "keeps sub-pixel bars on their own side… (QA D1)" and "chooses M from exact magnitudes (QA D2)", plus 3 of my 4 probes. They pass with the15ba70dfile.geometry.ts:73usescompareDecimalMagnitude(P, N) >= 0, a BigInt-exponent and digit-string comparison. Probes:1vs1.00000000000000000001picks the latter in both orders;0.99999999999999999999vs1picks1;2e-400/1e-400and1e5000/9e4999are correct in both orders; 202-digit lexemes differing in the last digit are correct in both orders. A tie (1.0/1,10e-1/1) keeps P's lexeme;1.0/1e0gives chartHeight 2H with the axis at H.(2, 0)/-1gives a red hairline below the axis (top 40).(0, 2)/1gives one above it (top −1). A value beyond M is capped by its side's room:(2, 1)/-5has height 20.decimalRatiocomment now names both +Infinity cases and forbids its use for ordering.Acceptance criteria
-80gives top 10, height 40;20gives top 0, height 10. Equal extrema(7, 7)give 80 = 2H with the axis at 40. Positive-only: H with the axis at H and labels above. Negative-only: H with the axis at 0 and labels below. M = 0 isemptywith no bars, and-0draws no bar. D1 sweep as above.RowScaleInput.labelTopstays within the padded cell for every row in the sweep. In Chromium,(1e300, 1e-300)/-0shows the label0with no bar..signed-chart,.signed-bar,.zero-axisor.signed-label. The cell has notabindexand noaria-label. The.signed-sr-onlyspan computes toposition:absolute; clip-path:inset(50%); overflow:hidden; white-space:nowrap, with a 1×1 px box. Screenshots of absent cells 0-3 and 4-3 (96×53 px) contain one colour only,255,255,255,255, so the "No flow" text is not visible.ariaSnapshotof the absent cell is- text: No flow, andgetByText("No flow")finds 6. Tab order covers the 14 non-absent cells and then the next control, skipping all 6 absent cells. N/A hover showsN/A: unresolved basis; a zero shows0with no bar.-1.2345678901234567890123e-300shows the tooltip at opacity 1 with the full lexeme. Unitdecimal-displaytests pass unchanged.Chromium bar measurements (px from the cell top, 6 px padding):
10006–46;-0.546–47;-1.23e-30046–47-10006.016–46.016;0.55.031–6.031-8016–56;206–16-1e-30046–47-146–47No bar crosses the axis. The 0.015 px offset in row (0.5, 1000) comes from Chromium rounding layout to 1/64 px (LayoutUnit), not from the geometry. The unrounded geometry is exact.
Documentation
PASS. README §"Signed bars and value labels (#22)" correctly describes the never-cross-zero rule, exact M selection, the 1 px hairline extending into the padding, and the absent cell's visually-hidden text. The doc comments on
barGeometry,MIN_BARanddecimalRatiomatch the behaviour. No PRD or spec deviation, so no ADR is needed.Commands (workspace container, at
15ba70d)Form:
docker compose --project-directory . -f compose.yaml exec -T workspace bash -lc 'cd /workspaces/lca-diff && npm --prefix apps/frontend run <script>'format:checklinttypecheckbuildtest:unit(run 1)test:unit(run 2)test:e2e -- --project=chromiumQA probes. All ran in a container-only copy,
/tmp/qa22b-feinsidelca-diff-dev-workspace-1, which has since been deleted. The shared checkout was not modified, andgit status --shortis empty.npx vitest run src/zz-qa-22b.test.ts: 4/4 passed (the sweep, named lopsided/inconsistent cases, D2 ties and long lexemes, AC regression).ea88551'sgeometry.ts: 6 failed and 30 passed, as expected. The current file was then restored.npx playwright test -c qa.config.ts: a Chromium harness with a replacedmain.tsxrendering 5 rows × 4 cells, served by Vite on port 4199. 1/1 passed.New defects
None.
Observations (non-blocking)
border-topdrawn fromaxisdownward, so negative bars (and their 1 px hairlines) start under the axis line, while positive bars end at its top edge. For a negative hairline, the visible red sits mostly behind the 1 px grey axis and the label chip. It is still present and correctly signed, and the label and accessible name carry the sign. Consider centring the axis line or drawing the bar above it in the [Task] F4 — Virtualize comparison rows and columns with sticky alignment #23 visual tuning.MIN_BARcomment "(never above CHART_PADDING)" is terse. It means the 1 px minimum must stay ≤ the padding so overflow stays inside the cell. A short rewording would help, but no change is required.Next action
Ready for maintainer review of PR #67 (coordinator). QA does not close or merge.
feat: add exact signed-bar geometry and full-precision value cells (R…
docs: format the #22 signed-bar notes (Refs #22)
fix: keep signed bars anchored on their own side of zero (Refs #22)
DavidVFitzGerald commentedon Nov 15, 2026
Coordinator: QA PASS at 15ba70d, required checks passed, maintainer merged PR #67 (84643b2). Closing.
🤖 Generated with Claude Code