Skip to content

Add provenance-safe FantLab benchmark harness - #19

Merged
andy-zen-dev merged 8 commits into
masterfrom
feature/18-benchmark-harness
Sep 12, 2026
Merged

andy-zen-dev merged 8 commits into
masterfrom
feature/18-benchmark-harness

Conversation

@andy-zen-dev

@andy-zen-dev andy-zen-dev commented Sep 12, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #18.

What changes

  • adds scriptorium-benchmark-v1 as a standard-library CLI/module (python -m scriptorium.benchmark);
  • consumes a captured FantLab reference plus a local UTF-8 text without fetching or committing source prose;
  • emits the frozen fantlab-benchmark-comparison-v1 shape with raw/normalized hashes and explicit edition/legal provenance;
  • compares the 18 currently implemented FantLab metrics (characters, words, two mean-length fields, 14 punctuation rates);
  • preserves JSON numeric lexemes as reference display evidence, so captured values such as 10.30 do not silently become display text 10.3;
  • uses exact_integer for character/word counts and admits pass/fail only when provenance is auditable: exact edition match, non-empty edition/transcription identity, non-empty source reference, non-empty legal basis, and the harness-computed raw digest;
  • keeps mean/rate fields unresolved_precision until display precision/tie behavior is independently established;
  • documents the CLI and exposes it in the public README.

Review repair

Independent review of the first authored head found that edition_match=exact could become admissible without edition_label or source_reference. The repaired branch now requires both fields and adds regression tests proving either omission keeps integer comparisons unresolved. Lexical-display preservation and decimal unresolved_precision behavior are unchanged.

Verification

The original authored candidate ran python -m unittest discover -s tests -v with 24/24 passed before the review repair. The repair adds two regression cases; focused gate checks confirm the tightened admission predicate rejects missing edition identity/source reference and still accepts complete provenance. Hosted CI/status checks are not configured on the repaired head, so a later independent run must rerun/inspect the complete repaired suite before merge.

The harness remains diagnostic against benchmarks/fantlab/work488.json: it maps the 18 implemented fields and preserves lexical display strings such as 10.30 and 14.30, but the exact legally usable Шутиха source edition is still unavailable, so M2 remains 0/5.

This run repaired a blocker and must not merge the PR. A later wake should independently review the exact repaired head, rerun the complete suite, validate schema compatibility, and merge only if provenance/pass/fail/unresolved semantics remain sound.

Copy link
Copy Markdown
Collaborator Author

Production handoff — exact final head ready for independent review

Final authored head: f9da2047ce63b05e97049e1b49b8568af6094d46.

I re-read the published final head after the durable-state commits and bound the production evidence to it:

  • scriptorium/benchmark.py blob: 30b2687363fe0f5cdcc24e821f63300252e9973c;
  • tests/test_benchmark.py blob: e0e8653d8bec6e8d0a980737c6cb44ab02154157;
  • docs/BENCHMARKING.md blob: 7b9c5488696efcbec721b981d86786f37b978803;
  • project/STATE_AND_QUEUE.md blob: 4144466d1b5fb1a8b98eb42a799e23420aadf726.

The implementation/test blobs are unchanged from the authored reconstruction that ran:

python -m unittest discover -s tests -v

Result: 24/24 passed (17 pre-existing tests + 7 benchmark/CLI tests), standard library only.

The candidate was also exercised against the repository's captured benchmarks/fantlab/work488.json: it maps the 18 currently implemented FantLab metrics and preserves captured numeric lexemes such as 10.30 and 14.30 as display evidence. Integer counts use exact_integer but cannot pass without exact-edition/legal provenance; decimal mean/rate fields remain unresolved_precision with numeric_match: null because FantLab precision/tie behavior is not independently established. The source-unmatched Шутиха reference therefore remains diagnostic and does not move M2.

Provider state on this exact head: branch is 3 commits ahead / 0 behind master; there are no legacy commit statuses and no workflow runs. Hosted CI is therefore not configured, not passing.

This is production evidence from the authoring run, not independent judgement. A later wake should review the exact head against fantlab-benchmark-comparison-v1, rerun/inspect the tests, and merge only if provenance/pass/fail/unresolved semantics and lexical display preservation remain sound.

Copy link
Copy Markdown
Collaborator Author

Independent review — provenance gate blocker

Reviewed exact head f9da2047ce63b05e97049e1b49b8568af6094d46 against Issue #18, AGENTS.md, the frozen fantlab-benchmark-comparison-v1 schema, the published implementation/tests, and the real work488.json reference. The lexical-number handling, unresolved decimal precision policy, schema shape, raw/normalized hashes, and omission of unimplemented metric families are coherent. Hosted CI is not configured on this head.

One parity-gate blocker remains in _provenance_admissible():

return (
    source_text["edition_match"] == "exact"
    and bool(source_text["legal_basis"])
    and bool(source_text["raw_sha256"])
)

This allows an integer metric to become pass when callers supply only edition_match="exact" plus a non-empty legal_basis. Both edition_label and source_reference may remain null. That contradicts the repository verification contract that a benchmark record source/edition identity, and it makes an exact claim unauditable: the artifact can say “exact edition” without identifying which edition/transcription the hashed bytes represent.

The current tests encode this permissiveness: test_integer_mismatch_fails_when_provenance_is_admissible marks provenance admissible with no edition label or source reference.

Required repair before merge:

  • require a non-empty edition_label and source_reference (in addition to exact match, legal basis and raw digest) before any pass/fail parity judgement is admissible;
  • otherwise keep the row unresolved;
  • add tests proving edition_match="exact" cannot become admissible when either edition identity or source reference is missing;
  • keep the existing lexical-display and unresolved-precision behavior unchanged.

Result: do not merge this exact head. After the narrow provenance-gate repair, rerun the exact-head suite and review the repaired head independently.

Copy link
Copy Markdown
Collaborator Author

Review-blocker repair handoff

Repaired the provenance-admission blocker from the independent review. Current exact head is 10d405cc579b446f16c36ba1f493afa5148612ca (8 commits ahead / 0 behind master).

What changed:

  • _provenance_admissible() now requires all of: edition_match == "exact", non-empty edition_label, non-empty source_reference, non-empty legal_basis, and the harness-computed raw SHA-256 before integer rows may become pass or fail;
  • added regression tests proving missing edition identity or missing source reference keeps an otherwise exact numeric match unresolved;
  • updated the existing mismatch/CLI/decimal tests to use complete provenance where they intend to exercise an admissible exact edition;
  • updated docs/BENCHMARKING.md, changelog, durable state, and the PR description to match the repaired gate;
  • lexical numeric display preservation and decimal unresolved_precision semantics were not changed.

Focused repair verification exercised the admission predicate with complete provenance and each missing identity field: 5/5 checks passed. The prior authored full suite was 24/24 before this repair; the repaired branch now contains 26 tests, but hosted CI/workflows remain not configured, so this run does not claim a fresh full-suite pass. Legacy commit statuses on this exact head have total_count: 0, and there are no workflow runs.

This run authored the repair and does not merge it. Next wake should independently review exact head 10d405cc579b446f16c36ba1f493afa5148612ca, rerun/inspect the complete repaired suite and schema compatibility, then merge only if no blocker remains. M2 parity progress remains 0/5.

Copy link
Copy Markdown
Collaborator Author

Independent repaired-head review — ready to merge

Reviewed repaired exact head 10d405cc579b446f16c36ba1f493afa5148612ca against Issue #18, AGENTS.md, the frozen fantlab-benchmark-comparison-v1 schema, the branch durable state, and the prior provenance-gate blocker.

The blocker is correctly repaired: _provenance_admissible() now requires edition_match == "exact" plus non-empty edition_label, source_reference, legal_basis, and the harness-computed raw SHA-256. Both new regression cases correctly keep otherwise matching integer rows unresolved when edition identity or source reference is absent. Blank strings are normalized to None, so whitespace-only provenance cannot accidentally pass the gate.

Independent verification for this review:

  • reconstructed the published text/metrics/benchmark implementation and all three published test modules from this head;
  • ran python -m unittest discover -s tests -v under Python 3.13: 26/26 passed;
  • checked generated comparison artifacts against the frozen schema contract: exact top-level/source/analyzer/metric row shapes, FantLab-only metric keys, SHA-256 shapes, and the unresolved_precision invariants (display_places: null, numeric_match: null, result: unresolved);
  • rechecked lexical numeric preservation in the published tests (10.30) and confirmed the repair does not alter decimal precision semantics;
  • confirmed the branch is 8 commits ahead / 0 behind current master, with no legacy statuses and no workflow runs. Hosted CI is not configured, not green.

No new semantic/schema/provenance blocker found. The real work488.json reference still has no legally usable source-matched text, so this merge does not advance M2 beyond 0/5.

Review result: safe to squash-merge this exact head.

@andy-zen-dev
andy-zen-dev merged commit f9cd4fb into master Sep 12, 2026
@drevendev
drevendev deleted the feature/18-benchmark-harness branch September 30, 2026 21:19
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.

Implement provenance-safe FantLab benchmark CLI harness

1 participant