Repository navigation
test(migrate): a covered bundle grant takes its repository at the claim and binds its site - #454
Merged
Merged
Conversation
…im and binds its site A covered bundle grant (the account's own plan covers the order) is redeemed at provision time, before delivery, with no repository. This proves it still reaches the site binding. The post-delivery claim hands the redeemed row back and gives it the delivered repository. connect-project then lets it through and binds the site. - unit: the real provisionMigrateBundle (covered) → claim.post → connect-project.post over one stateful grant store. - contract: the same sequence on postgres. The candidate row passes migrate_grants_trial_shape (Migrate always signs trial_days) before the order conflict. Pairs with migrate#758.
Member
Author
|
ork2 review @c1f86c58: OK (test-only, paired with migrate#758). It proves ORK's MUST: a covered grant, redeemed before delivery, still gets its repo from the post-delivery claim and passes connect-project → site binding. Unit chain (real provisionMigrateBundle covered → claim.post → connect-project.post) + contract on postgres:16 (24/24). The trial_days / trial_shape fragility is now pinned by the contract test. Gate (t7): test:ci unit 2247 / integration 515 / nuxt 350, typecheck 0. |
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.
What
Test only. It proves that a covered "Migrate with Studio" grant still reaches the site binding. Covered means the account's own running plan covers the order. Such a grant is redeemed at provision time, before delivery, and has no repository yet.
Paired with Contentrain/migrate#758, which records the covered Studio line on the Migrate order so its forms wait for this bind (run 3 R3-1/R3-2/R3-3).
The chain (
origin/main66360b0)server/utils/migrate-provision.ts:97-120provisionCovered:claimMigrateGrantwithkind: 'bundle'and no repository, binds the workspace,markMigrateGrantRedeemed(id, null).server/api/migrate/claim.post.ts:49(after delivery, same order):postgres-db/migrate-grants.ts:92-135doesinsert … onConflict(order_id).doNothing, then returns the existing row. There is no state filter, so the redeemed grant comes back.claim.post.ts:62: the same user.claim.post.ts:69-70: a bundle grant with no repository →setMigrateGrantRepo(:266-281, written only while the repository is null).connect-project.post.ts:41: bundle +redeemed_at+ workspace + owner + name all hold → project + site binding (feat(migrate): bind a bundle's delivered site to its project (studio.json) #452), retried by the sweep (feat(migrate): retry a bundle site's binding and raise the alarm when it stays unbound #453).Result: no Studio change needed. One thing the contract run showed: Postgres checks
migrate_grants_trial_shapeon the candidate row before the order conflict, so step 2 works because Migrate always signstrial_days(migrate apps/web/server/api/orders/[orderId]/studio-claim.post.ts:91: the bundle's days, default 60). A claim withouttrial_dayswould fail there for every bundle grant, paid or covered. The contract test pins this.Tests
tests/unit/migrate-covered-grant-chain.test.ts(2), run against one stateful grant store with the provider's semantics:provisionMigrateBundle(covered) →POST /api/migrate/claim→POST …/connect-project, ending with the project created, the site binding asked for the delivered repository through the workspace's installation, andsiteBinding: written;tests/contract/migrate-grants.contract.test.ts(+1, postgres:16): the same sequence on the real SQL (covered claim → bind → redeem → delivery claim → existing row → repository set). The stored row passes connect-project's gate.Gate
pnpm test:ciunitpnpm test:ciintegrationpnpm test:cinuxtpnpm typecheckcontentrain-query generate, as CI does)pnpm lint