DSPyOpen PR

Cleaning up deployment snapshots

Remove superseded prerelease documentation when its exact stable release is published, without disturbing other versions or retry safety.

Versioned documentation snapshots were append-only. A beta such as 3.4.0b1 could stay deployed and visible after stable 3.4.0 was published.

This contribution proposes cleaning up only the alpha, beta, and release-candidate snapshots for that exact stable release. The difficult part is preserving publication guarantees while removing stale routes and inventory entries.

DSPy illustration of superseded documentation snapshots being cleaned up
DSPy · contribution overview

Match the exact release, not a broad prefix

Publishing 3.4.0 can remove 3.4.0a1, 3.4.0b12, and 3.4.0rc2. It must preserve other patch or minor releases, unrelated prereleases, and stable snapshots.

Before stable publication3.4.0a1 superseded3.4.0b12 superseded3.4.0rc2 superseded3.4.1b1 preserve
Publish 3.4.03.4.0 stable3.4 → 3.4.0 alias3.4.1b1 unchanged
Illustrative inventory: only prereleases for the exact stable version are pruned.
Exact prerelease matching · Python
prerelease = re.compile(re.escape(identifier) + r"(?:a|b|rc)[0-9]+")
superseded = [
    str(entry.version)
    for entry in versions
    if prerelease.fullmatch(str(entry.version))
]

Escaping the stable identifier and using fullmatch keeps the candidate set tied to one release. Multi-digit prerelease suffixes are included without broad directory or minor-line deletion.

One deployment update, not a partial state

Mike’s ordinary deploy and delete commands each create a commit. Running them separately would expose an intermediate state where the stable release is published but cleanup has not completed.

The proposed publisher uses Mike’s Git primitives to put stable publication, alias updates, inventory changes, and prerelease removal into one Git commit. Missing or malformed inventory fails before cleanup; prereleases with unexpected alias ownership are not silently removed.

Stable content remains immutable. An identical existing stable snapshot can clean up retained prereleases without rewriting its content. Different content is rejected. Once publication and cleanup have succeeded, an identical retry is a no-op.

Regression coverage for publication guarantees

Tests exercise real Mike publication in temporary Git repositories. They check exact alpha/beta/RC removal, unrelated-version preservation, one-commit publication, immutable stable content, forward-only aliases, and retry behaviour.

An injected inventory-write failure verifies that the combined update leaves the deployment branch unchanged and allows a later successful retry.

Reported local validationResult
Relevant versioned-documentation tests24 passed
Ruff lint and formattingPassed
Applicable pre-commit hooksPassed
git diff --checkPassed

Implementation available for review

PR #10563 contains the publisher change, documentation, and regression tests. It remains open. The implementation preserves the existing publication model while adding exact cleanup; it does not claim that deployment changes have already shipped upstream.

View implementation & discussion ↗
PR status checked .
Mahaboob AshrafSoftware & AI Engineer · Hyderabad, India

Frequently asked questions

Which snapshots does a stable publication remove?

Only alpha, beta, and release-candidate versions belonging to that exact stable release, such as 3.4.0a1, 3.4.0b12, and 3.4.0rc2 when publishing 3.4.0.

What happens if publication is repeated?

After successful publication and cleanup, an identical retry is a no-op. An identical already-published stable snapshot can also clean up stale prereleases without rewriting its content.

Can cleanup overwrite a stable snapshot or move its alias backward?

No. Different content for an existing stable snapshot is rejected, and the forward-only minor-alias behaviour is preserved. The regression suite covers both guarantees.

LET’S CONNECT

LET’S TALK ABOUTWHAT’S NEXT.

I’m open to contracts, internships, and remote engineering roles.

STRAIGHT TO MY INBOX