Skip to content

Add typed accuracy, UnitsDB roundtrip and explicit power kind generations - #5

Merged
suleman-uzair merged 5 commits into
unitsml:mainfrom
suleman-uzair:f40/typed-accuracy-unitsdb-roundtrip-power-kind
Nov 19, 2026
Merged

suleman-uzair merged 5 commits into
unitsml:mainfrom
suleman-uzair:f40/typed-accuracy-unitsdb-roundtrip-power-kind

Conversation

@suleman-uzair

Copy link
Copy Markdown
Member

This PR adds three new F40 feature generations beside the existing ones. Every earlier corpus file is unchanged, and the only edit to an existing file is a README addition.

Changes

  • corpora/features/ruby-typed-quantity-accuracy/v1: 36 rows. Each plurimath.evaluate.quantity/1 request keeps the class of its binding values (decimal, rational, binary64). Expected results come from Formula#evaluate_quantity at plurimath-ruby 0a1df68 with unitsml-ruby de4f5b9.
  • corpora/features/unitsdb-schema-roundtrip/v1: 1812 rows. These are the UnitsDB from_yaml(...).to_yaml roundtrips for the database, its collections and each record, run with the unitsdb-ruby spec matcher. There are two profiles: the unitsdb 2.2.15 data and UnitsDB b0b4315. Every check passes.
  • corpora/features/ruby-explicit-kind-power/v1: 22 rows. They record what the existing explicit quantity-kind API does with kV*A at unitsml-ruby 2ec9583. Implicit typing of kV*A is not covered.
  • Each generation has its own stdlib check script under scripts/. validate.yml now runs all three, and ci_tamper_selftest.py proves that each one fails when its corpus is tampered with.

Every producer ran twice in separate processes, and the two outputs are byte-equal.

Test plan

  • On Linux, all eight check scripts pass, check_append_only.py passes against main with 19 files added and none rewritten, and the tamper self-test catches a tampered corpus for all eight validators.

Add corpora/features/ruby-typed-quantity-accuracy/v1 with 29 rows whose
plurimath.evaluate.quantity/1 requests keep the class of each binding
value: {"decimal": s} for BigDecimal, {"rational": [n, d]} for Rational
and {"binary64": hex} for Float, while integers and String controls stay
plain Strings. Expected results come from Formula#evaluate_quantity with
the same typed values at plurimath-ruby 0a1df68 and unitsml-ruby de4f5b9.

The rows cover the six ruby-feature-additions/v1 accuracy rows (same ids
and results), five String-exact controls, three unused-binding controls,
nine decimal precision controls and six Float rounding rows. Each row also
records the Ruby request entry point's answer for the same request. Two
producer runs are byte-equal; a stdlib check script verifies seals, ids
and vectors.json. Earlier files are unchanged apart from a README addition.
Append seven rows to corpora/features/ruby-typed-quantity-accuracy/v1 so
it covers every Ruby source probe behind the typed binding support: an
unused decimal or Float binding beside a single-variable formula, the
zero precision of BigDecimal 0.0, a result that re-enters the accuracy
combination (0.01 m * 100.0 s gives limited_1), a decimal sum across a
unit conversion, and two Float neighbours including the binary64
product 0.1 * 0.2.

The producer ran again at plurimath-ruby 0a1df68 and unitsml-ruby
de4f5b9 in two processes with byte-equal output. The first 29 rows are
byte-identical; index.json seals, counts, ids and findings are updated.
Add corpora/features/unitsdb-schema-roundtrip/v1, the schema/provenance
part of F02.roundtrips (WORK-PACKAGES.md:44). The producer loads UnitsDB
with the unitsdb gem 2.2.15 under unitsml-ruby 2ec9583 and writes it back
with to_yaml through Database.from_db, each collection class and each
entity class, the calls the unitsdb-ruby specs make. Each result is
compared with canon be_yaml_equivalent_to, with a class-exact structural
diff, per field, and against the collection schema on input and output.

Two profiles: the gem's bundled data and UnitsDB b0b4315 (tree c57eb0a).
Each has 1 database row, 7 collection rows and 897 record rows; all pass.
Each profile ran twice in separate processes and the payloads are
byte-equal. scripts/unitsdb_schema_roundtrip.py checks seals, byte
equality, vectors.json, the frozen id digest and the per-row outcomes.
Earlier generations are unchanged apart from a README addition.
Add corpora/features/ruby-explicit-kind-power/v1 with 22 rows that record
what the explicit quantity-kind API of unitsml-ruby 2ec9583 does with the
unit kV*A. The rows cover construction with a caller-declared kind
(NISTq187 apparent power or NISTq20 power), convert_to("kW"), addition,
subtraction and equality of the two kinds with controls, and the untyped
kV * A product with its primary_kind.

Each row has one expected result per UnitsDB profile: the unitsdb gem
2.2.15 data and the merged UnitsDB #143 commit b0b4315. Each snapshot is
loaded read-only with Database.from_db. Both profiles give the same
results. Each profile ran twice in separate processes with byte-equal
output, and a stdlib check script verifies seals, ids and vectors.json.

The rows pin current API behaviour only; implicit typing of kV*A is not
covered. Earlier files are unchanged apart from a README addition.
@suleman-uzair
suleman-uzair marked this pull request as ready for review November 13, 2026 09:36
@suleman-uzair

Copy link
Copy Markdown
Member Author

@ronaldtse, this is ready from our side and CI is green. It adds three F40 generations: typed quantity accuracy (36 rows), UnitsDB schema roundtrip (1812 rows, run on both the 2.2.15 data and the data merged in unitsml/unitsdb#143) and explicit power kinds (22 rows). All are additive, and CI now runs their validators. Could you please review and merge it if it looks good?

@suleman-uzair
suleman-uzair merged commit 9db4764 into unitsml:main Nov 19, 2026
1 check passed
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