Skip to content

fix(push,pull): never take over same-named org resources without --adopt - #104

Merged
dhruva-vapi merged 3 commits into
mainfrom
devin/1795220315-no-name-takeover
Nov 21, 2026
Merged

dhruva-vapi merged 3 commits into
mainfrom
devin/1795220315-no-name-takeover

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

GitOps no longer takes over an existing org resource just because its name matches a local file. A name match is reported, and taking over the resource needs an explicit --adopt.

  • State provenance: ResourceState gains an optional origin: "pushed" | "pulled" | "adopted". A POST records pushed, pull records pulled, and --adopt records adopted. Legacy { uuid } entries stay linked and are not rewritten. asResourceState, upsertState and the hash-store migration preserve origin.
  • No automatic rename: src/recanonicalize.ts is deleted. A pulled foo-<uuid8> key is no longer collapsed to foo before a push, and pull no longer links an untracked remote resource to a local file by name slug (findExistingResourceId is removed). A local foo stays unlinked, and the new-file check now names the same-named org resource and points to --adopt foo.
  • Dependency auto-apply: findExistingResourceByName only reuses state entries with origin pushed or adopted. A match only against a pulled entry, a legacy entry or the live dashboard list now causes a POST of a new resource and a warning (type, name, UUID, --adopt hint).
  • --adopt <id>[=<uuid>] (repeatable; push and apply): links a local file with no state entry to its single same-named candidate from state and the dashboard, or to the UUID you give. It errors on a missing file, an already-linked file, zero candidates, or ambiguous candidates. The adopted UUID is PATCHed as normal and other state aliases for it are removed.
  • Dry run ends with a Name collisions section listing every planned POST that matches an existing resource. It does GET-only inventory and prints none when nothing matches. Behavior change: apply --dry-run now skips the pull so local files and state are untouched, which means it previews current local state.
  • Leftover alias file: when --adopt foo removes an alias such as foo-<uuid8>, its local file is deleted automatically if it has no edits since the last sync, and its hash baseline is dropped too. If the file has edits, a terminal run asks first. A non-TTY run stops before any write. A dry run only reports what it would do.
  • Stop report: the new-file check, adopt errors and alias-file problems are collected before any write and printed as one plain-language report. It never says "orphan". Each file gets the fix and the exact command, and the report ends with one combined command when every suggestion is unambiguous. The run exits once with code 1. --json prints the same report once to stdout as [{file, resourceType, problem, fix, command}] for CI. The engine never passes --adopt or --allow-new-files by itself.

Docs: AGENTS.md (safety table, new-file check), README, commands/how-it-works/workflows guides, learnings, improvements.md.

Tests: npm run build, npm test (595 pass), and Biome pass. New unit and local-HTTP integration tests cover provenance, pull without name linking, POST vs reuse, adoption, apply passthrough, and dry-run with no writes. No live org was touched.

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

Copy link
Copy Markdown
Contributor Author

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 Author

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 Author

Devin Review

🟢 Devin Review found nothing to fix · View findings

dhruva-vapi and others added 2 commits November 21, 2026 00:59
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@dhruva-vapi
dhruva-vapi merged commit fb6798e into main Nov 21, 2026
5 checks passed
dhruva-vapi added a commit to VapiAI/docs that referenced this pull request Nov 24, 2026
## Description

Documents the `--adopt` flag shipped in [VapiAI/gitops#104](VapiAI/gitops#104).

- `fern/config-as-code.mdx`: new "Adopt an existing resource" section covering when to adopt (dashboard-created resources, renamed or moved files), `--adopt <resourceId>[=<uuid>]` on `push`/`apply`, the resource ID format, matching without a UUID, `--dry-run` previews, and `--dry-run --json` output for automation.
- Checked against `src/adopt.ts`, `src/link-preflight.ts` and `src/push.ts` on gitops `main`.
- Left out on purpose: the PR's validation and safety tightening, plus gitops#106 (`metadata.gitops.folderPath`). Nothing in the dashboard reads that field yet.

## Testing Steps

- [x] `npx --yes fern-api check`: 0 errors
- [ ] Check the Config as code page in the preview deployment

<!-- devin-bot-banner-begin -->
---

<p><picture><source srcset="https://app.devin.ai/api/presigned_proxy?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjpudWxsLCJidWNrZXRfbmFtZSI6ImRldmluYXR0YWNobWVudHMiLCJidWNrZXRfa2V5IjoiYXR0YWNobWVudHNfcHJpdmF0ZS9vcmdfeDgzMHFFaUNHMTlpNzZGNi9mOTVmNTA1Zi03MDE3LTRiYzUtODAxYS03ZDA2MTkzNjFlY2UiLCJpYXQiOjE3OTUyODE4MjksIm9yZ19pZCI6Im9yZ194ODMwcUVpQ0cxOWk3NkY2IiwiZmlsZW5hbWUiOiJib3QtYmFubmVyLnBuZyJ9.wfL-6vFLPjAVQvAhBIae5CKWZspG72VC9eYWRR3GPm0"><img height="63" alt="" align="left"></picture><strong><a href="https://app.devin.ai/bots/f980eb0dc44a4e4cb8725e2d8d721fb6">Technical Writer</a> opened this PR for Dhruva</strong><br>
Implemented in session <a href="https://app.devin.ai/sessions/832ca0b861b94888888d8f774684e565">Update docs for recent product changes</a><br>
<a href="https://app.devin.ai/review/VapiAI/docs/pull/1451">Review&nbsp;with&nbsp;Devin</a> · <a href="https://app.devin.ai/desktop/session/832ca0b861b94888888d8f774684e565?variant=devin">Open&nbsp;in&nbsp;Devin&nbsp;Desktop</a></p>
<br clear="left">
<!-- devin-bot-banner-end -->
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