Skip to content

feat(ci): continuous main alpha releases with reusable publishing - #533

Merged
VakninAriel merged 10 commits into
chunkhound:mainfrom
HananKavitzAmat:new_CI
Nov 17, 2026
Merged

VakninAriel merged 10 commits into
chunkhound:mainfrom
HananKavitzAmat:new_CI

Conversation

@HananKavitzAmat

Copy link
Copy Markdown
Collaborator

Summary

Implement continuous alpha releases to production PyPI after successful upstream main push builds.

  • CI allocates/reuses an annotated alpha tag for the tested SHA and directly calls a reusable release workflow using GITHUB_TOKEN; no GitHub App or TestPyPI.
  • Extract shared builds, validation, native-first publication, and alerts into release-packages.yml; stable/RC entry workflows become thin callers while preserving stable behavior.
  • Treat the requested tag as the version source of truth for both main and native builds, including multiple tags on one commit.
  • Assign next available alpha numbers in allocation order. Atomic release/identity tag pushes protect concurrent allocation and same-run reruns.
  • Preserve every main CI run; coordinate Pages deployment separately.
  • Alpha artifacts require the matching native version, including sdist rebuilds. Stable/RC dependency semantics remain unchanged.
  • Keep existing manual failed-job reruns and skip-existing; no automatic publication-retry or custom storage system.
  • Include the HTML design document and update release/setup documentation.

Validation

  • 69 focused tests passed, covering workflow contracts, concurrent allocation, reruns, packaging, artifact versions, and sdist roundtrips.
  • Smoke: 14 passed on the final run (uv run --no-sync pytest tests/test_smoke.py -v -n auto). Earlier runs showed intermittent 5-second CLI subprocess timeouts.
  • Actionlint passed on CI and all release workflows.
  • Focused Ruff, git diff --check, and uv lock --check passed.
  • Real stable/alpha sdist roundtrips checked by delegated implementation agents.
  • Independent review checked stable behavior, allocator concurrency, and publication gates; its OIDC documentation finding was corrected.

Full suite is NOT green

Ran uv run --no-sync pytest tests/ -v to completion (30m37s): 5663 passed, 11 failed, 72 errors, 104 skipped, 2 xfailed.

  • Two failures expected the previous workflow concurrency contract; updated those tests and reran the focused set successfully afterward.
  • 72 errors: site setup could not find Node package @resvg/resvg-js.
  • Other failures: five MCP startup timeouts, two QA search timing limits, one realtime deletion test, and one local Codex CLI authentication/token-refresh failure.
  • The full suite was not rerun after the two contract-test corrections. No claim that the remaining failures are proven pre-existing.

--no-sync preserves the locally built native extension as required by the development workflow.

Required deployment setup before merge/rollout

  • Configure PyPI Trusted Publishers for release-packages.yml (job_workflow_ref) with the correct project/environment combinations:
    • chunkhound: pypi, pypi-alpha
    • chunkhound-native: pypi-native, pypi-alpha-native
  • Create alpha environments without required reviewers; preserve existing stable approval controls.
  • Protect v* release tags and alpha-build/** identity tags against updates/deletion; permit Actions creation only in the required alpha namespaces without blanket stable-tag bypass.
  • Confirm the reviewed starting alpha base in .github/release-channel.toml (6.2.0).

The build-identity tags point to metadata blobs, not commits, and are tested not to affect Git version discovery. No release has been published during implementation.

@HananKavitzAmat

Copy link
Copy Markdown
Collaborator Author

Review: REQUEST CHANGES

Summary: The design is solid (atomic tag allocation, native-first publishing, artifact-level validation). A few operational points need a decision before merge.

Strengths

  • release-packages.yml removes about 450 lines of duplicated release jobs. release.yml and release-rc.yml become thin callers.
  • Publishing is safe by construction. The tag must resolve to the tested SHA, artifact versions are checked, and the sdist is rebuilt without CI flags.
  • The atomic push of the release tag and the run-identity tag prevents double allocation on reruns and concurrent runs.

Major

  • Alpha publish order is not guaranteed. ci.yml concurrency is now ci-${{ github.run_id }}, so two main pushes run in parallel. Alpha N+1 can reach PyPI before alpha N. If that is acceptable, please say so. Otherwise, put release-alpha in a shared non-cancelling concurrency group.
  • Every main merge now publishes to production PyPI with no human gate. Before merge, please confirm the Trusted Publisher entries, the alpha environments, tag protection, and the 6.2.0 base in release-channel.toml.

Minor

  • prepare-alpha is gated on 8 jobs, including site-build and site-build-validation. A docs-site failure therefore blocks a package alpha. If that is intended, please add a comment in ci.yml. A skipped alpha is also silent, so an optional alert would help.
  • create_next_alpha_tag.py runs several git cat-file calls per existing alpha tag (find_existing) and refetches all tags on every retry. This cost grows with the number of alphas. The retry loop has no backoff.
  • The Pages "still current main" check is racy, as the comment admits.
  • In pyproject.toml, the [tool.hatch.metadata.hooks.custom] table sits right before dependencies = [...]. That is easy to misread.
  • The branch history includes a changelog commit and merge commits that look unrelated to this change.
  • Several tests assert workflow YAML strings, for example "$current_sha" == "$TESTED_SHA". These are implementation-level. The allocation and artifact tests are good contract tests.

Reusability

  • The release-tag regex is duplicated in 5 places: release-packages.yml, release-rc.yml, validate_release_artifacts.py, the build-native-wheel action and create_next_alpha_tag.py. Consider centralizing it.
  • The inline Python in prepare and validate-tag could move to scripts/ so it can be tested.
  • validate_native_wheel_versions.py and validate_release_artifacts.py overlap.

Decision: REQUEST CHANGES. The two Major items above need a decision or setup confirmation before merge.

@HananKavitzAmat

Copy link
Copy Markdown
Collaborator Author

Update on the two Major items

  1. Alpha publish order: Accepted. Out-of-order publication is now documented in RELEASING.md (commit 89aed8d).
  2. No human gate on alpha publishing: This is the intended design, so I'm treating it as accepted rather than a blocker. Before merge, a maintainer with admin rights should confirm the setup listed in the PR body under "Required deployment setup":
    • PyPI Trusted Publishers
    • the alpha environments
    • tag protection
    • the 6.2.0 base version

@HananKavitzAmat HananKavitzAmat self-assigned this Nov 17, 2026

@VakninAriel VakninAriel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

PR #533 review

  • PR: #533
  • Title: feat(ci): continuous main alpha releases with reusable publishing
  • Reviewed: 2026-11-17
  • Base: 96a604c6be5cd0c12cf69997f2ceebeb23b6dda8
  • Head: 64517b3835b3472fc1a92e3985990e04b7deffc1
  • Recommendation: Request changes — one P2 correctness issue in the continuous-release guarantee.

Finding

[P2] Account for GitHub's workflow permission check when tagging older builds

Location: .github/workflows/ci.yml:340–348

prepare-alpha grants contents: write and uses checkout's default GITHUB_TOKEN to tag the exact tested github.sha. If another main push changes a workflow while this run is validating, creating a tag at the older tested SHA can be rejected by GitHub as creating/updating that workflow without workflows permission. This can happen even when the older commit remains an ancestor of main. The allocator treats this rejection as fatal (scripts/create_next_alpha_tag.py:145–167), so release-alpha is skipped despite successful validation. That breaks the stated guarantee that every successfully validated main push can independently release, including older runs that finish later.

The tagging design needs an authorization path that supports this case while retaining the exact tested SHA, or the release guarantee must explicitly be narrowed. workflows: write is not an available GITHUB_TOKEN workflow permission; adding actions: write does not solve this restriction. Ordinary tag-creation ruleset allowances do not grant the missing workflow permission. Introducing another credential would also need to preserve the intended event-trigger behavior and tag protections.

Evidence: The failure is observable in this external Actions run, attempt 1. The run tested 7be59c2; main advanced to 8f39bb4 while the run was active, changing .github/workflows/test.yml. The publishing checkout retained the old run SHA. Its token permissions show Contents: write, followed by:

! [remote rejected] v0.1.0 -> v0.1.0
(refusing to allow a GitHub App to create or update workflow
`.github/workflows/test.yml` without `workflows` permission)

Retrieve the evidence with:

gh run view 42348175974 --repo base-rs/base-web-media-type --attempt 1 --log

This is an externally observed platform constraint, not a reproduction against ChunkHound's production repository. It is conditional, not a claim that all older commits fail: an identical workflow at the same path on another branch can permit the operation. Existing tags or administrative intervention can also allow recovery. The unattended first-allocation path remains vulnerable.

Strengths

  • Shared release implementation preserves native-first publication and separates alpha approval environments from stable/RC environments.
  • Explicit requested-tag versioning avoids ambiguity when several tags point to one commit.
  • Atomic release/identity refs provide strong allocation and same-run rerun guarantees.
  • Alpha sdist configuration retains the native version pin through actual isolated source rebuilds.

No additional actionable defects were established in tag allocation, release parsing, packaging, or artifact validation. Independent reviewers examined workflow/platform contracts and allocator concurrency; a further adversarial review checked the retained permission finding.

@HananKavitzAmat

Copy link
Copy Markdown
Collaborator Author

Thanks for the thorough review. I'm declining the P2 finding.

The failure needs a narrow timing overlap: a run for an older commit has to finish after a newer push to main has changed a workflow file. It was only observed in an external repo, not here. When it does happen, the effect is limited. That one older alpha isn't published, and the newer push still releases normally. Fixing it would mean adding a new credential (PAT or GitHub App) with its own trigger and tag-protection questions. That is a lot of added complexity for a rare case that costs us very little.

I'll leave the design as is. If it shows up in practice, we can revisit it then.

@VakninAriel VakninAriel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Accepted

@VakninAriel
VakninAriel added this pull request to the merge queue Nov 17, 2026
Merged via the queue into chunkhound:main with commit b171ede Nov 17, 2026
27 checks passed
fstrasz added a commit to fstrasz/chunkhound that referenced this pull request Nov 17, 2026
Brings in chunkhound#526, chunkhound#502 and chunkhound#533. CHANGELOG.md conflicted only because this PR and chunkhound#526 each add a line at the top of [Unreleased] ### Fixed; both entries are kept, this PR's first. No other conflicts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

2 participants