Skip to content

fix: load spec YAML as JSON-compatible scalars and reject epoch release versions - #30

Merged
stefan-jansen merged 4 commits into
ml4t:mainfrom
quantum-like:review/fixes
Oct 16, 2026
Merged

stefan-jansen merged 4 commits into
ml4t:mainfrom
quantum-like:review/fixes

Conversation

@quantum-like

Copy link
Copy Markdown
Contributor

Owning issue

Closes #29

Outcome

2 correctness fixes, one commit each, each with a focused test:

  • read_spec_payload loaded YAML with PyYAML's YAML 1.1 rules: unquoted ISO dates became datetime objects (and fromisoformat raised TypeError), and unquoted yes/no/on/off became booleans, so an asset id NO did not stay text and created_by: no was saved as "False". Spec YAML now keeps JSON-compatible scalars: true, false, null and numbers stay typed; dates and the YAML 1.1 bool aliases stay strings. Test: tests/test_spec_io.py::test_read_spec_payload_keeps_json_compatible_yaml_scalars. (457b9fd)
  • Release preflight accepted a PEP 440 epoch such as 1!1.2.3 as a stable X.Y.Z version. Epochs are now rejected. Test: 1!1.2.3 added to tests/test_release_pipeline.py::test_release_preflight_rejects_nonstable_versions. (b127683)

Compatibility

  • No public compatibility impact
  • Compatibility impact is documented in the owning issue and migration guidance

Spec files that relied on unquoted dates or YAML 1.1 bool aliases now load them as strings (as JSON would).

Verification

  • Tests reproduce the prior failure or verify the requested behavior (each listed test fails on main and passes with its fix)
  • Ruff lint and format checks pass (ruff format --check is clean on the changed files and ruff check reports nothing new in them versus main, but I did not run the full pre-commit suite)
  • ty passes (not run on this branch)
  • Test suite passes: pytest: 382 passed before, 384 passed after; coverage stays at 100%.
  • Package build passes when applicable (not run)
  • Strict MkDocs build passes when documentation is affected (no documentation changes)
  • Ecosystem qualification passes (not run)

Documentation and release

No documentation changes. The behavior changes above may be worth a line in the next patch-release notes.

Amir

cursoragent and others added 4 commits October 7, 2026 07:34
PyYAML's YAML 1.1 loader turned unquoted ISO dates into datetime objects,
so fromisoformat crashed, and treated yes/no/on/off as booleans, so an
asset id such as NO or created_by no never reached validation as text.

Co-authored-by: quantum-like <quantum-like@users.noreply.github.com>
version_failure accepted PEP 440 epochs such as 1!1.2.3 even though a
stable release must be a normalized X.Y.Z or X.Y.Z.postN version.

Co-authored-by: quantum-like <quantum-like@users.noreply.github.com>

@stefan-jansen stefan-jansen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the YAML resolver isolation, public contract deserialization, and epoch rejection. Reproduced both added regressions against main 701bde6 in an isolated source tree: both failed for the reported defects; both pass with the correction. Full suite: 424 passed with 100% branch coverage on Python 3.12, 3.13, and 3.14. Ruff lint/format, ty, wheel/sdist build and twine checks passed. Latest head only adds landed contribution-policy documentation to satisfy strict branch freshness. Merge remains conditional on current-head hosted checks. AI assistance: Codex performed this source review and verification.

@stefan-jansen
stefan-jansen merged commit 4e96f30 into ml4t:main Oct 16, 2026
30 checks 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.

[Bug]: Spec YAML loads dates as datetime and yes/no as booleans; release preflight accepts epoch versions

3 participants