Skip to content

fix: reject stale plans before preview and apply - #265

Merged
lloydrichards merged 5 commits into
codex/upgrade-vfs-oxcfrom
refactor/plan-apply-contract
Sep 27, 2026
Merged

lloydrichards merged 5 commits into
codex/upgrade-vfs-oxcfrom
refactor/plan-apply-contract

Conversation

@lloydrichards

@lloydrichards lloydrichards commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Goals/Scope

Ensure that Apply uses the repository state represented by Plan. Review the baseline checks before composition and each write, including the preview path.

Description

Plan records the canonical repository root and fingerprints of inspected text files. Preview and Apply now return StalePlanFailure when those paths change. File preview seeds an isolated memory filesystem and uses the same guarded Apply path. Tests cover drift, root changes, partial writes, and host file preservation.


@vercel

vercel Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
stack-effect-docs Ready Ready Preview Sep 27, 2026 10:11am UTC

@changeset-bot

changeset-bot Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7d85ff9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
stack-effect Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@lloydrichards

Copy link
Copy Markdown
Owner Author

@pullfrog please review

@lloydrichards
lloydrichards force-pushed the refactor/plan-apply-contract branch from 2f0cae3 to 1016e5c Compare September 27, 2026 09:50

@pullfrog pullfrog Bot 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.

Caution

File preview now rejects valid greenfield Plans and BOM-prefixed text files as stale. These false positives block --dry-run --show-files and valid incremental file previews.

Reviewed changes across the Plan baseline contract, repository capture and freshness checks, guarded Apply, virtual file preview, CLI serialization, integration tests, and supporting documentation:

  • Repository authority: Plans now carry canonical roots and path fingerprints, with typed stale errors for drift.
  • Execution and preview: Apply validates state before composition and each write; file preview seeds a private filesystem and reruns guarded Apply.
  • Coverage and documentation: Added drift, partial-write, and host-preservation tests and recorded the contract in OKF.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏

Comment thread packages/scaffold/src/service/apply/ApplyPreviewService.ts
Comment thread packages/scaffold/src/service/apply/ApplyPreviewService.ts Outdated
@lloydrichards
lloydrichards force-pushed the refactor/plan-apply-contract branch from 39c1e61 to 7d85ff9 Compare September 27, 2026 10:08
@lloydrichards

Copy link
Copy Markdown
Owner Author

@pullfrog please review the latest head, including the greenfield and BOM preview fixes.

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes since the prior Pullfrog review, including the greenfield and BOM preview fixes and their VFS compatibility update:

  • Preserved preview bytes: Seeded fingerprinted files with raw bytes so BOM-prefixed files remain valid.
  • Restored greenfield previews: Adapted the missing-root baseline to the initialized virtual root and checked host state before and after seeding.
  • Verified coverage: Added regressions for both cases; bun run test --filter=@repo/scaffold and bun run type-check pass.

Pullfrog  | View workflow run | Using GPT Sol | 𝕏

@lloydrichards
lloydrichards merged commit 4fb6c21 into main Sep 27, 2026
13 checks passed
@lloydrichards
lloydrichards deleted the refactor/plan-apply-contract branch September 27, 2026 10:19

This branch was successfully deployed

1 active deployment
Preview — 7d85ff9b Deployed Sep 27, 2026 by vercel[bot]
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.

Ensure Apply executes the repository state represented by Plan

1 participant