Skip to content
This repository was archived by the owner on Jul 7, 2026. It is now read-only.

Allow checkpoint-only version artifact directories#198

Closed
anth-volk wants to merge 1 commit into
mainfrom
codex/fix-179-artifact-checkpoint-collision
Closed

Allow checkpoint-only version artifact directories#198
anth-volk wants to merge 1 commit into
mainfrom
codex/fix-179-artifact-checkpoint-collision

Conversation

@anth-volk

Copy link
Copy Markdown
Contributor

Summary

Fixes #179.

  • Allow an explicit version artifact directory to be reused when its existing contents are limited to the configured PE-US rebuild checkpoint trees for the same run.
  • Preserve the existing collision behavior for unrelated contents, unconfigured checkpoint contents, missing checkpoint configuration, and non-directory version paths.
  • Forward stage_runtime_writer through save_versioned_us_microplex_artifacts() to match the existing _finalize_versioned_build_artifacts() call path.

Notes on Scope

The checkpoint-only directory allowance is the direct #179 fix. While validating the full versioned-artifacts test file, current main also exposed an adjacent finalization mismatch: _finalize_versioned_build_artifacts() already passed stage_runtime_writer, but save_versioned_us_microplex_artifacts() did not accept or forward it. This PR includes that small pass-through so the live stage-runtime path remains consistent.

Tests

  • ruff check src/microplex_us/pipelines/versioned_artifacts.py tests/pipelines/test_versioned_artifacts.py
  • git diff --check
  • PYTHONPATH=/Users/administrator/Documents/PolicyEngine/microplex-us/src PYTHONDONTWRITEBYTECODE=1 /Users/administrator/Documents/PolicyEngine/worktrees/microplex-us/fix-pe-rebuild-smoke-issues/.venv/bin/python -m pytest -q -p no:cacheprovider tests/pipelines/test_versioned_artifacts.py -k 'configured_checkpoint or unrelated_existing or unconfigured_checkpoint or existing_version_file'
  • PYTHONPATH=/Users/administrator/Documents/PolicyEngine/microplex-us/src PYTHONDONTWRITEBYTECODE=1 /Users/administrator/Documents/PolicyEngine/worktrees/microplex-us/fix-pe-rebuild-smoke-issues/.venv/bin/python -m pytest -q -p no:cacheprovider tests/pipelines/test_artifacts.py::test_source_provider_versioned_build_initializes_live_stage_writer

A full tests/pipelines/test_versioned_artifacts.py run passed before the final non-directory guard was added; after the guard, the focused allocator tests above cover the changed behavior.

@anth-volk
anth-volk requested a review from MaxGhenis June 3, 2026 17:28
@MaxGhenis

Copy link
Copy Markdown
Contributor

Closing rather than merging — same situation as #155. microplex-us went spec-only in #261 and is archived; pipelines/versioned_artifacts.py was deleted in that conversion, which is why this is CONFLICTING, and the passing CI is stale. The build/checkpoint logic moved to populace's us_fiscal_refresh builder, which is a different checkpoint model, so this allocation relaxation doesn't carry over — #179 needs re-triage there if it still happens.

On the change itself: the logic was careful and the safety property holds. Reuse only triggers when every entry under the version dir resolves inside a configured checkpoint tree, so a stray real artifact still raises FileExistsError, and it fails closed when checkpoints aren't configured. The stage_runtime_writer pass-through was a correct consistency fix. One coupling worth knowing if it's ever ported: the checkpoint-root helper hardcodes the two checkpoint config keys, so a third checkpoint stage would fail allocation until added — safe, but worth a comment in any successor.

@MaxGhenis MaxGhenis closed this Jul 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PE-US rebuild final artifact allocation fails when checkpoint paths are inside version directory

2 participants