Skip to content

refactor: codify formatter API contracts - #18

Merged
qartik merged 5 commits into
mainfrom
codex-qir-maintainability
Sep 24, 2026
Merged

qartik merged 5 commits into
mainfrom
codex-qir-maintainability

Conversation

@qartik

@qartik qartik commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Stacked on #17; this PR should merge after it. Because #17's rust branch is
in a fork, the base is an upstream mirror of its current head. After #17
merges, retarget this PR to main and remove codex-pr17-rust-base.

Summary

  • generate _native.pyi from the PyO3 declarations during development and CI
  • fail CI when the committed generated stub is stale, and package it in release wheels
  • preserve the legacy val_fns class attribute through introspectable PyO3 declarations
  • document the supported Rust surface and enforce public-item documentation
  • codify the QIR i64 boundary for Python inputs, including malformed out-of-range values
  • make the Python compatibility suite an explicit permanent release gate
  • verify Cargo.toml and pyproject.toml versions stay aligned

Validation

  • CI=true uv run src/scripts/ci_checks.sh
  • cargo test --no-default-features
  • generated the stub on Linux with Maturin 1.15
  • built a stripped wheel and verified that it contains the checked generated stub

PyO3 still labels binary introspection experimental. Maturin also removes the
introspection section when stripping Linux binaries, so CI generates and checks
the stub before release builds; release wheels remain stripped and package that
checked stub.

The larger streaming-output and formatter-architecture changes remain separate follow-ups.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-23T16:33:13.085231Z dc27c62 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@qartik
qartik requested a review from qfreewilll September 23, 2026 17:47

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this file is now auto-generated.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The CI stale-stub check does not detect when the generated stub is absent from the committed tree.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Codifies Python/Rust formatter contracts, generated bindings, release packaging, and compatibility requirements.

Changes:

  • Generates and validates PyO3 stubs.
  • Documents Rust APIs and enforces version alignment.
  • Tests Python compatibility and signed 64-bit boundaries.
File Description
.github/​workflows/​release.yml Builds stripped release wheels.
Cargo.toml Enables PyO3 introspection.
README.md Documents contracts and stub generation.
pyproject.toml Adds Maturin tooling configuration.
src/​labeled_formatter.rs Documents the public Rust API.
src/​lib.rs Documents exports and checks versions.
src/​python.rs Exposes introspectable binding metadata.
src/​qir_formatter/​_native.pyi Updates the generated native stub.
src/​scripts/​ci_checks.sh Generates and validates the stub.
tests/​README.md Defines compatibility-suite expectations.
tests/​test_public_api.py Tests the legacy validator registry.
tests/​test_qir_formatter.py Tests signed 64-bit boundaries.
uv.lock Locks the Maturin dependency.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/scripts/ci_checks.sh Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The API, generation, packaging, and boundary changes are consistent and adequately validated.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@qartik
qartik changed the base branch from codex-pr17-rust-base to main September 24, 2026 12:54
@qartik
qartik force-pushed the codex-qir-maintainability branch from 4f7afd1 to 9fb31b4 Compare September 24, 2026 12:57
@qartik
qartik merged commit 4e24ee7 into main Sep 24, 2026
2 checks passed
@qartik
qartik deleted the codex-qir-maintainability branch September 24, 2026 13:01
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.

3 participants