Skip to content

fix(push): validate the whole plan before the first write - #101

Closed
dhruva-vapi wants to merge 2 commits into
mainfrom
devin/1795218722-push-preflight
Closed

dhruva-vapi wants to merge 2 commits into
mainfrom
devin/1795218722-push-preflight

Conversation

@dhruva-vapi

@dhruva-vapi dhruva-vapi commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Push wasn't atomic: during the NHS test push (#99/#100 on #94), a 400 on resource 2 of 6 left the org half-applied. Validator errors only warned unless --strict, so a payload the validators already knew was bad still went out after earlier POSTs.

Push now runs a preflight on the write plan before any remote mutation (orphan deletes included):

plan = selected resources + local deps push would auto-apply (computePushPlan, no API calls)
blocking = error findings on plan resources
         + unresolved-credential findings on plan resources
         + (--strict) error findings anywhere
if blocking: print them, "Nothing was written to the remote API.", exit 1
  • Errors in files outside the plan still only warn, so a scoped push isn't blocked by an unrelated bad file. --strict keeps its old meaning (block on any error).
  • --dry-run runs the same gate, so a dry run predicts the real run.
  • Nothing before the gate writes to the API (bootstrap/state checks are reads only).
  • What this doesn't cover: a 400 the offline validators can't predict can still leave partial writes. Each new rejection case needs its own validator (like feat(validate): catch undefined squad variables and Liquid transfer numbers #99's transfer-number-liquid, which this gate now makes blocking).

Tests: tests/push-preflight.test.ts, using a local HTTP stub. It covers a full push with a later invalid resource (exit 1, zero POST/PATCH/DELETE), a scoped push with an unrelated invalid file (proceeds), dry-run, unresolved credentials, --strict, and an auto-applied dependency with an error. npm run build is clean, npm test gives 591 pass / 0 fail, and biome is clean.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access that start with 'Devin'.

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Devin Review

🟢 Devin Review found nothing to fix · View findings

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

Replaced by #107 (same branch, opened as the Devin bot so it can be approved).

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.

1 participant