Skip to content

Add a --json option to write structured results - #101

Merged
harryswift01 merged 6 commits into
96-feature-build-structured-resultsfrom
96-feature-write-structured-json-results-from-sist
Nov 16, 2026
Merged

harryswift01 merged 6 commits into
96-feature-build-structured-resultsfrom
96-feature-write-structured-json-results-from-sist

Conversation

@harryswift01

@harryswift01 harryswift01 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Summary

This PR adds a --json FILE option to sist that writes the result of a run as structured JSON, checked against the result schema. Closes #96. Refs #26, #27, #28.

Changes

  • Add --json FILE to sist. With --json alone only the JSON is written. With -o as well, the text output is also written from a second qsidd run without full precision, so it matches the existing output.
  • Run qsidd with -b -p -r -P for JSON, build the result with sist.results and check it with ResultValidator before writing.
  • Write a failed result, with an error, when a run fails: missing or unreadable input, missing IRF or qsidd, qsidd exiting with an error, a partition function that underflows, or a result that fails validation.
  • Record the command line in the result's provenance.
  • Build qsidd commands from the transitions registry instead of one block per algorithm.
  • Let SistRunner take the IR scorer, qsidd executor and result writer as arguments, with the existing behaviour as the default.
  • Streamline the tests: runner tests cover only the runner, and each algorithm has one regression test for the text output, which must match its 1.0.0 reference exactly, and one for the JSON result. test_cli.py and the separate JSON and parser-based regression tests are replaced.
  • Add unit tests for cli.py, python -m sist and the runner's real collaborators.

Testing

  • JSON results for all four algorithms match the 1.0.0 references to the 6 significant figures they print.
  • Text output is unchanged and still matches the references exactly.

Impact

  • Adds the --json option. Without it, behaviour and output are unchanged.
  • The silent value replacements inside qsidd ([Bug]: SIST silently replaces NaN values #26) are not changed here. The JSON output catches them: underflow becomes a failed result, and undefined values are written as null.
  • The open docs branches (22-docs-*) describe the old result layout and will be redone in the follow-up that regenerates the examples.
  • No new dependencies.

Checklist

  • Tests added or updated
  • Documentation updated
  • If dependencies in pyproject.toml changed, the lower bounds were reviewed deliberately

@harryswift01 harryswift01 self-assigned this Nov 11, 2026
@harryswift01
harryswift01 added this pull request to stack #99 November 11, 2026 15:35
@harryswift01 harryswift01 added the enhancement New feature or request label Nov 11, 2026
@harryswift01 harryswift01 linked an issue Nov 11, 2026 that may be closed by this pull request
4 tasks
@harryswift01
harryswift01 force-pushed the 96-feature-write-structured-json-results-from-sist branch 2 times, most recently from a73613b to e2cd21c Compare November 12, 2026 15:54
@harryswift01
harryswift01 requested a review from jimboid November 16, 2026 12:13
@harryswift01 harryswift01 changed the title Add a --json option to write structured results Add a --json option to write structured results Nov 16, 2026
@harryswift01
harryswift01 force-pushed the 96-feature-write-structured-json-results-from-sist branch from 496cc49 to baa5ccb Compare November 16, 2026 14:45

@jimboid jimboid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed this RR, happy for this to merge, its all very self explanatory.

@harryswift01
harryswift01 merged commit b87ea72 into main Nov 16, 2026
20 checks passed
@harryswift01
harryswift01 deleted the 96-feature-write-structured-json-results-from-sist branch November 16, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Write structured JSON results from sist

2 participants