Skip to main content

truereward-harwell

The recorded-state reader for truereward, over the Harwell engine.

It grades a change to a codebase that has no unit test suite. A case records what a job leaves behind when the code is right, and claims the parts of it the case is about: data sets, spool files and tables. Grading runs the same job against the changed codebase and reads those claims against the approved baseline.

  • A case is a starting state, a run and claims, and nothing unclaimed is compared. A case passes when every claim of it holds, fails when one does not, and is ungradable under a declared code when one could not be evaluated. A claim that names an observable and reads no field of it asserts that observable whole, byte for byte; an observable no claim names is not read at all, so a correct change is never failed on something nobody was asking about.
  • A case is data. A directory with case.json, a start/ snapshot and an expected/ snapshot, validated against the JSON Schema shipped in the package. Every field a case reads is resolved to bytes when the case is recorded, so grading never opens the candidate's source to decide what is compared.
  • grade_case(case, codebase) runs the case twice in a contained run, reads the claims over the first end state and the baseline, and answers with a truereward.CaseResult. The two runs are compared with each other, over the same claimed observables, under the author's own mask, which answers the determinism check.
  • record.record(...) records a case: refuse a case that names no claim, run the job twice, refuse a run that did not complete or that varied in something the case claims, keep what it left as the approved baseline, freeze every field map, and read every claim back over the baseline it just approved.
  • record_again(case, out_dir, where) and moved(old, new) are the reader's half of python -m truereward rerecord -p truereward_harwell CASES OUT --where CODEBASE: each case recorded again from its own declaration, frozen policy and all, on the engine installed now, and what moved read over the claimed observables only, each at its first differing record and byte with the old and new values there, beside every declaration field that moved.
  • selftest.run(...) asks whether a case set would catch a bug: the reference change must score 1.0, the unchanged codebase 0.0, and every seeded defect less than 1.0.

A task's test file:

from functools import partial
from pathlib import Path

import pytest
from truereward_harwell import cases, grade_case

CASES = Path(__file__).parent / "cases"


@pytest.mark.parametrize("case", cases(CASES), ids=lambda c: c.id)
def test_case(case, grade):
    grade(case, partial(grade_case, codebase="/grade"))

Run it with pytest -p truereward_harwell, which brings the truereward plugin with it.

Licensed under Apache-2.0.

Release files for truereward-harwell 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for truereward-harwell 0.3.3
File Size Uploaded
truereward_harwell-0.3.3.tar.gz 44.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for truereward-harwell 0.3.3
File Interpreter ABI Platform
truereward_harwell-0.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 94.8 kB

Release files / truereward_harwell-0.3.3.tar.gz

Download URL truereward_harwell-0.3.3.tar.gz
Size 44.5 kB
Tags Source
SHA-256 checksum
How to use checksums
56a6879db8bd88b557bf7103ebccf4825a5fac97be1cfae26a10215e567f24a7
BLAKE2b-256 checksum
How to use checksums
8c455629e571b15db9a312193eb53754dc9d99a1e28533bae4dc11dfeba539da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / truereward_harwell-0.3.3-py3-none-any.whl

Download URL truereward_harwell-0.3.3-py3-none-any.whl
Size 50.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1581424cd29dfc5cde4733cf290fcf430d1e00de626ae711d721e3fb0a842ced
BLAKE2b-256 checksum
How to use checksums
9d9e9a03b1940f1aea146fd254b45fa7f4345d6a8ecf69b3e6cd675e36016702
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.3.3 This release

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page