Repository navigation
Live schema editing: MongoDB support, and a dialog that says what will happen - #24
Merged
Merged
Conversation
Live schema editing does not write a migration, and cannot: a migration is Atlas's format with an integrity file, minted by an external binary against a throwaway database, and a running server has neither. That much was already true and already reasoned about. What was missing is that it matters to somebody. `drizzle/schema.sql` is committed, and it is exactly what `rebase db generate` diffs against, so the migration is one command away — but nothing said so. A project that deploys by replaying migrations would have its database changed, its repository updated, and its *next environment* built without the change, having been told the change was applied. The plan and the result now carry `followUp`, and the panel shows it. Detected by the presence of `drizzle/migrations` holding at least one `.sql`; an unreadable directory counts as present, because staying quiet about a project that may replay migrations is the failure this exists to prevent. Silent when there is nothing to record — no DDL, or a project provisioned by boot-ensure, whose collections *are* the schema. Not answerable for a deployment committing to a remote repository, which is a built bundle: those are provisioned by boot-ensure rather than by replaying migrations, so the question does not arise. Co-Authored-By: Claude Opus 5 <[email protected]>
…y happen Two things, and the second follows from the first. **MongoDB was told it was unsupported.** `isSchemaEditingAdmin` is a structural check — a driver either offers `planSchemaChange` or it does not — and the Mongo driver did not, so a Mongo project fell back to the source-only editor, which is off in production. A schemaless database is the one place where changing a collection against a running backend cannot fail, and it was the one place it did not work. `planMongoSchemaChange` is short by the whole of its difficulty: there is no table to alter, so every change is applicable, nothing is refused, and there are no statements. What the changes still carry is what happens to the **data**, because that is where a reader imports the wrong intuition. Removing a property on Postgres is refused because it would drop a column; on MongoDB the field stays in every document that has it and the API stops serving it. Saying so is the difference between knowing the data is there and assuming it is gone. **So the dialog stopped assuming Postgres.** It described a database being altered even when nothing runs against one — true for MongoDB always, and for any change that only moves source. It now reads the plan instead of the engine: no statements means "Ready to commit" and a button that says "Commit". Deliberately narrow: "Commit" only when a plan is *going ahead* and has no statements. A refused plan also has none — because it will not run — and labelling that button "Commit" would name the change it is declining to make. Unknown reads as the fuller action, which is the safer way to be wrong. **And the destination is on screen before the button**, not in the receipt afterwards. A commit is landing somewhere, and which branch is the one fact nobody can recover from being wrong about. `owner/repo · branch` for a remote, and the checkout's name for a local one — the leading directories of an absolute path are the part nobody needs. The branch is read on `/status`, not on the plan: the plan is recomputed on every keystroke, and locally this is a git call. Verified in the browser: the dialog reads as intended, cancel still writes nothing, and the destination is legible. Co-Authored-By: Claude Opus 5 <[email protected]>
Planning could fail — a dropped connection, a backend restarting — and the only way forward was Cancel and start again: reopen the editor, re-enter the name, re-add the property, re-open the review. For a transient failure that teaches people to distrust the preview rather than the network. The plan request is now separable from starting a review, so it can be issued again against the same pending change. "Try again" appears only when planning actually failed. The review token moves with it, so a late answer to the *first* attempt cannot land in the dialog after the second has replaced it. Co-Authored-By: Claude Opus 5 <[email protected]>
I renamed the disclosure to "Statements that will run" when the dialog stopped assuming Postgres, and left the spec asserting "SQL that will run". My own rename, my own miss. Rather than swapping one literal for another, this asserts what the preview has to show whichever engine is behind it: the files it would commit and the message it would write. The statements disclosure is legitimately absent on a change that runs none — every MongoDB change, and any Postgres change that only moves source — so asserting it would have pinned the spec to one engine again. Co-Authored-By: Claude Opus 5 <[email protected]>
`Run E2E Test Suite` normally takes 4-5 minutes. On the last run it sat in that step for 41 minutes without failing, and would have kept sitting: no job in this workflow sets `timeout-minutes`, so GitHub's default of six hours applied. The run reported "pending" throughout, which is indistinguishable from slow. 30 and 40 minutes, against observed medians of 13 and 15 (slowest successful runs: 13.9 and 16.6). That is roughly 2x, so a genuinely slower run still passes and only a hang is caught — a ceiling tight enough to false-fail would be worse than none. publish.yml and publish-runtime-image.yml have the same gap. Left alone here because a release workflow's failure modes deserve their own look, not a number picked while landing a schema-editing branch. Co-Authored-By: Claude Opus 5 <[email protected]>
5 of 7 tasks
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.
Follow-up to #21 and #23, both merged.
MongoDB was told it was unsupported
isSchemaEditingAdminis a structural check — a driver either offersplanSchemaChangeor it does not. The Mongo driver did not, so a Mongo projectfell back to the source-only editor, which is off in production.
A schemaless database is the one place where changing a collection against a
running backend cannot fail, and it was the one place it did not work.
planMongoSchemaChangeis short by the whole of its difficulty: no table toalter, so every change is applicable, nothing is refused, no statements. What
the changes carry is what happens to the data — removing a property on
Postgres is refused because it would drop a column; on MongoDB the field stays
in every document and the API stops serving it. The change says so rather than
leaving a reader to import the relational answer.
So the dialog stopped assuming Postgres
It claimed a database was being altered even when nothing runs against one —
true for MongoDB always, and for any change that only moves source. It reads the
plan now: no statements means "Ready to commit" and a button that says "Commit".
Narrow on purpose. "Commit" only when a plan is going ahead and has no
statements; a refused plan also has none, because it will not run, and labelling
that button "Commit" would name the change it is declining to make.
The destination is on screen before the button
Not in the receipt afterwards. A commit is landing somewhere, and which branch
is the one fact nobody can recover from being wrong about.
owner/repo · branchfor a remote; the checkout's name for a local one.
Read on
/statusrather than on the plan — the plan is recomputed per keystrokeand this is a git call locally.
Verified
Driven in a browser: the dialog reads as intended, cancel writes nothing, the
destination is legible. 107 admin, 199 mongo, 2,833 server tests.