Preserve unrelated fields when writing the .neon context file - #433
Open
philip wants to merge 1 commit into
Open
Preserve unrelated fields when writing the .neon context file#433philip wants to merge 1 commit into
philip wants to merge 1 commit into
Conversation
`updateContextFile` overwrote `.neon` wholesale, so a single `neon link` would wipe the ephemeral `_init` state `neon init` stashes there (and any field a user had added). Merge instead: the managed keys (orgId, projectId, branch, branchId) are still fully governed by the write, but foreign keys are read back and carried forward. `neon link --clear` gets a dedicated `clearContextFile` that still resets the file wholesale. Co-authored-by: Isaac
Collaborator
|
Why would someone write their own content to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
updateContextFilewrote.neonwholesale, replacing the entire file on every write. That means a singleneon link(orcheckout, orset-context) would clobber the ephemeral_initstateneon initstashes in the same file, along with anything a user had added by hand. This is the blocker that stopsneon initfrom delegating toneon linkfor project setup.Fix it by merging instead of overwriting:
orgId,projectId,branch,branchId) are still fully governed by the write, so re-linking without a branch still clears a stale one.neon link --cleargets a dedicatedclearContextFilethat still resets the file wholesale, since "forget this directory" should drop everything.neon project createalready callsupdateContextFileand now benefits from the same preservation without changes; its managed-key behavior is unchanged.Split out of #431 so it can be reviewed on its own.
This pull request and its description were written by Isaac.