Skip to content

HBAI adapter: read office:value — full precision, display text as a consistency guard - #73

Merged
MaxGhenis merged 1 commit into
mainfrom
hbai-precision
Aug 20, 2026
Merged

HBAI adapter: read office:value — full precision, display text as a consistency guard#73
MaxGhenis merged 1 commit into
mainfrom
hbai-precision

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

The #44 follow-up from the #48 gate (sol round 1, finding 9b): the adapter
parsed the displayed text — DWP renders rates to whole percentage points and
counts to 0.1 million — while the workbook stores the unrounded value in each
cell's office:value attribute (75.875 behind "75.9"; the 16% headline is
0.15911572...).

Cells are now Cell(str) objects carrying the stored value; parse_value prefers
it (with percentage-typed fraction alignment) and requires the display text to
be its rounded rendering — a mispaired text/attribute aborts the run. The 13
inline headline checks become rounds-to assertions and all pass; the
completeness gates are untouched.

Artifacts regenerated: hbai-poverty.json (13,056 rows, same shape, unrounded
values) + the DB re-ingested (accounting and anchors identical; zero of 6,528
rate claims still sit at exact 2dp — previously all did). Per sol's ruling on
#48: claim ids are value-independent, no HBAI comparisons exist yet, so this
lands cleanly before any are run.

Dual gate: fable review done; sol pass next.

🤖 Generated with Claude Code

The #44 follow-up sol flagged on the #48 gate: the adapter kept the
DISPLAYED text (rates rounded to whole percents, counts to 0.1M) while
the workbook stores the unrounded value in the ODS office:value
attribute — e.g. 75.875 behind a displayed "75.9", 0.15911572...
behind the published 16% headline.

Mechanism: cells become Cell(str) — string identity keeps every label,
regex, and repetition read untouched — carrying (office:value,
value-type) when numeric. parse_value prefers the stored value
(percentage-typed cells align fraction -> display scale so the one
kind conversion applies to both types) and REQUIRES the display text
to be its rounded rendering at the text's own precision: a mispaired
cell aborts the run, never emits. The adapter's 13 headline checks
become rounds-to assertions (the publication's figures are the rounded
renderings); all pass, structural completeness gates unchanged.

Regenerated: data/externals/hbai-poverty.json (13,056 rows, identical
shape, values unrounded) and the DB re-ingested (same accounting
15,851/1,073/1,829; anchors identical; zero of 6,528 rate claims still
sit at exact 2dp — previously all did). annotations.json
rounding-precision note updated: the DISPLAY is rounded, these values
are not.

Tests: 7 added to tests/test_hbai_adapter.py alongside the original
completeness suite (mechanism, percentage alignment, the
rounded-rendering guard both ways, text-only fallback, emitted-file
precision with a regression-proof threshold, and the vendored 75.875
cell). Suite: 243.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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