Skip to content

feat(spec)!: a spec written back out puts its given block first - #818

Merged
FabianHofmann merged 9 commits into
mainfrom
feat/given-first
Oct 6, 2026
Merged

FabianHofmann merged 9 commits into
mainfrom
feat/given-first

Conversation

@FBumann

@FBumann FBumann commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Prompt: Canonical should probably also do it like this...? — Do it!

Follow-up: 818: fix

Note

The following content was generated by AI.

Breaking. to_yaml(), the canonical form, and the result of merge and override now write given: directly after description:. This matches the files in #813. A file with a given: block that canonical --check passed before fails until it is rewritten with --write.

Method, gate output, alternatives
  • src/mathspec/spec.py: the given field on Spec moves from after variables to after description. The section order of to_dict() follows the field order, so this one move changes every writer.
  • tests/test_canonical.py: SECTIONS pins the field order, and given now comes after description in it. Before the field moved, test_the_sections_come_in_one_order failed for the 27 example specs that have a given: block (27 failed, 27 passed). After the move, it passes.
  • docs/reference/language/file.md: the key table lists given first.
  • docs/reference/reading.md: "The sections come in one order" lists given after description. It did not list given before.
  • schema/mathspec.schema.json: regenerated with python -m tools.schema, and nothing changed. The gallery pages and the typesetter golden files also did not change.
  • Breaking. The title carries !: a file kept in canonical form is no longer canonical once it has a given: block.

Gates. Merged with origin/main at eefa8d2 (#837, after #810). pixi run lint: clean. pixi run ci: green, 54 documents compiled. Generated files regenerated.

Seen, not fixed. docs/reference/reading.md, "The sections come in one order", omits masks. It did before this PR.

Not done. The loader still accepts given: anywhere in a file. Only the output order changes.

Relation to #813. This PR is independent of #813. #813 reorders the files in docs/ and examples/; this PR reorders what the package writes. Both add a line at the same place in CHANGELOG.md; the second to merge keeps both lines. A trial merge of both on origin/main at eefa8d2 ran pixi run ci green: 2839 passed, 1 skipped.

🤖 Generated with Claude Code

https://claude.ai/code/session_019i7xNVeQzGJykmE9id6w51
https://claude.ai/code/session_01CsaSWMofYqJiKmnSiPycV9

`given:` now follows `description:` on `Spec`, so `to_yaml()`, the
canonical form and what `merge` and `override` return all write it
before `dimensions:`. The key table in the language reference lists it
first too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019i7xNVeQzGJykmE9id6w51
@FBumann
FBumann requested a review from brynpickering as a code owner October 1, 2026 13:25
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019i7xNVeQzGJykmE9id6w51
@read-the-docs-community

read-the-docs-community Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

@FBumann FBumann added the v0.3.0 label Oct 2, 2026
claude added 2 commits October 2, 2026 15:37
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011a8N2JQdmmd1WhVCKN1a2A
@FBumann FBumann changed the title feat(spec): a spec written back out puts its given block first feat(spec)!: a spec written back out puts its given block first Oct 2, 2026
claude added 3 commits October 6, 2026 10:22
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011a8N2JQdmmd1WhVCKN1a2A
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011a8N2JQdmmd1WhVCKN1a2A
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011a8N2JQdmmd1WhVCKN1a2A
@FBumann

FBumann commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

@FabianHofmann This is up to discussion.

@FBumann

FBumann commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

@FabianHofmann We need to check whether we want to rearrange other keys as well. Lets experiment individually with a stacked PR

@FabianHofmann
FabianHofmann merged commit 572be24 into main Oct 6, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants