Skip to content

F4: exact signed-bar geometry and full-precision value cells (#22) - #67

Merged
DavidVFitzGerald merged 3 commits into
mainfrom
feat/f4-signed-bars
Nov 15, 2026
Merged

DavidVFitzGerald merged 3 commits into
mainfrom
feat/f4-signed-bars

Conversation

@DavidVFitzGerald

Copy link
Copy Markdown
Owner

Refs #22 (F4-03). Phase 1, mock services only. No contract change, so no ADR.

Behavior

Row geometry (components/comparison/geometry.ts) is derived from the whole-selection extrema P and N.

  • Positive-only and negative-only rows are H tall, with the axis at the bottom or the top.
  • Mixed rows are H × (P + N) / M tall, with the axis H × P / M below the top.
  • The golden row -80, +20 is 1.25H tall: 0.25H above zero and H below. Equal ± extrema make 2H.
  • M = 0 rows keep the standard height and a thin baseline near the top.
  • Bars start at data y = 0 and are H × |v| / M tall. Nonzero values get at least 1 px.
  • Inconsistent inputs are clamped into the chart, so geometry is always finite and valid.

Precision. Floats are used only for pixels, through the exponent-aware decimalRatio, so 1e-300 and 1e999 stay valid.

  • Labels come from formatDecimal: the value only, in adaptive fixed or scientific notation, rounded from the exact digits.
  • Tooltips show the full stored lexeme via displayDecimal. -0 displays as 0.

SignedValueCell is the single component for both Flows and Scores. Each cell is one of three states:

  • present, including a zero shown as 0 with no bar
  • absent, rendered blank
  • unavailable, shown as N/A with its reason and no bar

Colour, sign and labels:

  • Positive bars are green and negative bars red. Intensity rises monotonically with magnitude.
  • The sign is also in the label and in the accessible name, so meaning does not depend on colour.
  • Labels sit above zero, or below it when every value in the row is non-positive. They use a translucent chip and never change the geometry.
  • Hover or focus shows the full-precision tooltip.

Checks (workspace container)

  • format:check, lint, typecheck and build pass.
  • Unit tests: 26 files, 331 tests pass, on two runs.
  • Chromium e2e: 19/19 pass.
  • A temporary visual harness (not committed) confirmed the geometry, labels and tooltip in Chromium.

Limitations

🤖 Generated with Claude Code

DavidVFitzGerald and others added 2 commits November 14, 2026 20:44
…efs #22)

Row geometry comes from whole-selection P/N extrema (spec §6.6):
positive-only and negative-only rows keep H, mixed rows grow to
H × (P + N) / M with the axis H × P / M below the top, and M = 0 rows
keep a thin near-top baseline. Floats are derived only for pixels via
an exponent-aware ratio. One SignedValueCell serves Flows and Scores
with adaptive value-only labels, full-lexeme hover/focus tooltips,
blank absence, N/A and no bar for zero.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
QA D1: in lopsided mixed rows with under 1 px on the smaller side, the
1 px minimum bar was clamped across the axis. Bars are now always
anchored at zero, capped by the room on their own side, with the
hairline extending into the cell padding instead. QA D2: M is chosen by
exact magnitude comparison rather than a float ratio. Also announce
absent cells via visually-hidden text and correct the decimalRatio doc.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@DavidVFitzGerald

Copy link
Copy Markdown
Owner Author

Ready for maintainer review

Not merged; waiting for the maintainer.

@DavidVFitzGerald
DavidVFitzGerald merged commit 84643b2 into main Nov 15, 2026
1 check passed
DavidVFitzGerald added a commit that referenced this pull request Nov 15, 2026
# Conflicts:
#	apps/frontend/src/components/comparison/SignedValueCell.tsx
#	apps/frontend/src/components/comparison/geometry.ts
#	apps/frontend/src/services/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant