Repository navigation
A rebuilt sandbox comes up with its shop, and keeps what was configured - #648
Merged
Merged
Conversation
Owner: "Live voice is switched off for this shop ... i didnt do. may be db reset?" and "open ai setting gone." He was right, and yesterday's keep did not save him. Today's reset fell through two holes at once. The box did not RESTORE its snapshot, it REBUILT from the seeder - and the seeder has never configured online ordering at all. So it came up with no store address: /online-ordering answers "none_configured" and every printed code points at nothing. Every rebuild has always done this; nobody noticed because the snapshot usually restores instead. The seeder now switches ordering on, at a FIXED address rather than a generated one, because an address that changes on every rebuild breaks every QR code and every link anybody has pasted - which is exactly what happened when it went ABC123, then FJ5AF, then ABC. And the keep saves the settings collections faithfully, but their rows are keyed by licence and branch id. A rebuild mints new ones, so the restored rows pointed at a branch that no longer existed and the shop read as though nothing had ever been configured: no key, no switches, no address. The keep worked for a restore and did nothing for a rebuild, which is the case that needed it. When the old branch is gone and there is exactly one shop now, the configuration and the settings rows are re-homed onto it. One shop is not a guess; several would be, and then it does nothing and says so rather than picking. An account row belongs to the licence rather than to a branch, so it takes the new licence and keeps its null branch.
Contributor
|
Merged to Try it at https://develop.posnic.io, or run it yourself: git fetch origin develop && git checkout develop
npm install && npm --prefix api install
npm run dev # then http://localhost:3000When you have tested it, say what you did and what happened, and set Reporting that something is broken is as useful as fixing it. It is |
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.
Owner: "Live voice is switched off for this shop ... i didnt do. may be db reset?" and "open ai setting gone."
He was right, and yesterday's keep did not save him. Today's reset fell through two holes at once.
One: the seeder never set up online ordering
The box did not restore its snapshot, it rebuilt from
seed.js— andseed.jshas never configured online ordering. Right now:No store address, so
/order/ABCis gone and every printed code points at nothing. Every rebuild has always done this; it went unnoticed because the nightly reset usually restores a snapshot where the address had been set by hand.The seeder now switches ordering on, at a fixed address (
SEED_STORE_ADDRESS, defaultABC) rather than a generated one. An address that changes on each rebuild breaks every QR code and every pasted link — which is what happened when it went ABC123, then FJ5AF, then ABC. It will not stamp over a shop that already has one.Two: the keep could not re-home what it saved
The keep dumps
branch_secretsandbranch_preferencesand puts them back, but their rows are keyed by licence and branch id. A rebuild mints new ones, so the restored rows pointed at a branch that no longer existed, and the shop read as though nothing had ever been configured. The keep worked for a restore and did nothing for a rebuild — the exact case it was added for.keep-branches.jsnow handles both. A restore lands the ordinary way. When the old branch is gone and there is exactly one shop now, the ordering configuration and the settings rows are re-homed onto it, so a key typed yesterday is still a key today. One shop is not a guess; several would be, and then it does nothing and says so. An account row belongs to the licence rather than a branch, so it takes the new licence and keeps its null branch.Tests
tests/sandbox-scripts-deployed.test.js(7 now): the seeder configures ordering at a fixed address and will not overwrite an existing one; the keep re-homes both collections, treats account rows correctly, refuses to guess when there is more than one shop, still handles the restore case, and cleans up its working copy.After this deploys
The next reset brings the shop back at
/order/ABCwith whatever is configured at that moment. This does not restore what today's rebuild already lost — the key and the switches will need entering once more, and then they stay.