-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(webapp): per-org S2 basin migration #3516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ericallam
wants to merge
13
commits into
main
Choose a base branch
from
feature/tri-9073-stop-s2-chat-input-streams-from-being-deleted-while-sessions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+547
−58
Open
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
0f9d1de
feat(webapp,run-engine): per-org S2 basin migration
ericallam a1d4564
chore(webapp): server-changes file for per-org basin migration
ericallam 692a257
fix(webapp): address coderabbit review on per-org basin migration
ericallam d6d3586
refactor(webapp): drop plan vocabulary from streamBasinProvisioner
ericallam 054d1af
fix(webapp): address review on per-org basin migration
ericallam fc88017
refactor(webapp): per-org basins for paid orgs only
ericallam 97eb08e
fix(webapp): address review on per-org basin migration
ericallam 871b993
fix(webapp): early-return reconcile when per-org basins disabled
ericallam b065509
fix(webapp): row-optional session-channel routes default to org basin
ericallam f55746d
docs(webapp): clarify reconfigure admin route's default vs retention …
ericallam 684fc2e
chore(webapp): trim per-org-basin comments
ericallam 9cb611d
refactor(webapp): cloud-driven basin sync, drop reconcile worker
ericallam 4ce5998
fix(webapp): match writer basin in session-stream wait race-check
ericallam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| area: webapp | ||
| type: feature | ||
| --- | ||
|
|
||
| Per-org S2 stream basins with retention tied to the org's billing plan, gated by `REALTIME_STREAMS_PER_ORG_BASINS_ENABLED`. Stops basin retention from deleting streams out from under live chat sessions and unlocks per-org cost attribution. |
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
47 changes: 47 additions & 0 deletions
47
apps/webapp/app/routes/admin.api.v1.orgs.$organizationId.stream-basin.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import { ActionFunctionArgs, json } from "@remix-run/server-runtime"; | ||
| import { z } from "zod"; | ||
| import { requireAdminApiRequest } from "~/services/personalAccessToken.server"; | ||
| import { isValidDuration } from "~/services/realtime/duration.server"; | ||
| import { | ||
| deprovisionBasinForOrg, | ||
| ensureBasinForOrg, | ||
| } from "~/services/realtime/streamBasinProvisioner.server"; | ||
|
|
||
| const ParamsSchema = z.object({ organizationId: z.string() }); | ||
|
|
||
| const BodySchema = z.discriminatedUnion("action", [ | ||
| z.object({ | ||
| action: z.literal("ensure"), | ||
| retention: z | ||
| .string() | ||
| .refine(isValidDuration, "retention must be a duration like 7d, 30d, 365d, 1h, 1y"), | ||
| }), | ||
| z.object({ action: z.literal("deprovision") }), | ||
| ]); | ||
|
|
||
| export async function action({ request, params }: ActionFunctionArgs) { | ||
| await requireAdminApiRequest(request); | ||
|
|
||
| const { organizationId } = ParamsSchema.parse(params); | ||
|
|
||
| let parsed: z.infer<typeof BodySchema>; | ||
| try { | ||
| const text = await request.text(); | ||
| const raw = text.length > 0 ? JSON.parse(text) : {}; | ||
| const result = BodySchema.safeParse(raw); | ||
| if (!result.success) { | ||
| return json({ ok: false, error: result.error.flatten() }, { status: 400 }); | ||
| } | ||
| parsed = result.data; | ||
| } catch { | ||
| return json({ ok: false, error: "Invalid JSON body" }, { status: 400 }); | ||
| } | ||
|
|
||
| if (parsed.action === "ensure") { | ||
| const result = await ensureBasinForOrg(organizationId, parsed.retention); | ||
| return json({ ok: true, ...result }); | ||
| } | ||
|
|
||
| const result = await deprovisionBasinForOrg(organizationId); | ||
| return json({ ok: true, ...result }); | ||
| } |
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.