Skip to content

Implement provenance-safe FantLab benchmark CLI harness #18

Closed

Description

@andy-zen-dev

Unit

SCRIP-REPRO-002

Why

SCRIP-METRIC-001 is merged, so M1 now has executable deterministic metrics but still lacks the field-by-field benchmark runner required by the milestone gate. The repository already freezes fantlab-benchmark-comparison-v1 and fantlab-2022-v1; this unit must execute those contracts without weakening their provenance, display-precision, or parity rules.

Scope

  • Add a standard-library benchmark module and CLI (python -m scriptorium.benchmark).
  • Read an existing FantLab reference JSON plus a local UTF-8 source text; never fetch or embed book text.
  • Compute raw/source and normalized SHA-256, run the merged deterministic metric profile, and emit fantlab-benchmark-comparison-v1.
  • Compare only currently implemented FantLab metrics present in the reference: characters, words, mean word/sentence length, and the 14 punctuation fields.
  • Preserve the exact numeric lexeme from the reference JSON as expected.display_text so values such as 10.30 are not silently rewritten as 10.3.
  • Use exact_integer for integer count fields.
  • Keep decimal fields unresolved_precision while independent display_places evidence is absent; visual numeric resemblance must not become a pass.
  • Enforce the existing parity gate: no pass unless edition match is exact, legal basis is recorded, and an immutable raw digest exists.
  • Report expected/actual/raw delta/result/reason per canonical metric ID plus source/analyzer provenance.
  • Add standard-library tests for exact-match, mismatch, provenance-gated unresolved results, unresolved decimal precision, preserved display lexemes, and CLI JSON output.
  • Document the CLI and update durable state/changelog. Leave the resulting PR for a later independent review.

Non-goals

  • No source acquisition or scraping.
  • No attempt to locate the missing Шутиха source edition in this unit.
  • No dialogue, vocabulary, morphology, POS, or page-estimate implementation.
  • No invented display precision or FantLab tie-breaking rule.
  • No promotion from inferred to reproduced.

Acceptance criteria

  • A local text + FantLab reference produces a deterministic comparison artifact keyed by canonical FantLab metric IDs.
  • The artifact preserves raw and normalized hashes and explicit source-edition/legal metadata.
  • Exact integer equality can only pass with admissible provenance; otherwise it is unresolved.
  • Integer disagreement with admissible provenance fails.
  • Decimal fields with unknown precision remain unresolved_precision / unresolved with numeric_match: null even when values look equal.
  • Reference numeric lexical display text is preserved where the reference JSON records it.
  • Existing tests plus new benchmark/CLI tests pass with python -m unittest discover -s tests -v and no new runtime dependency.
  • Durable state ends in REVIEW with the exact PR/head identified for independent judgement.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions