-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(webapp,run-engine,run-store,redis): wire the execution-snapshot store behind an off-by-default dial #4783
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
base: main
Are you sure you want to change the base?
Changes from all commits
b50613f
db8390c
e8ac9b3
95dd2a6
6cb49c8
fbe91ac
ac7b37b
f73d806
910039b
8119466
aee3f07
ea0e17b
1d4eb7b
94b9c68
f01d299
4f7162c
b02b426
7bba6a8
a553562
0f6c6d1
e03a185
e9ce909
57018fc
cff7fb9
bde40b3
c4469f7
b964f86
a229d99
ba91f75
aa71fd7
2ffd275
0f79a27
bbcd8c7
06b825e
253466c
9129315
b9c79ca
29bbeec
3d5c9a7
d4bf1a4
bea262f
6447afb
f901708
f7292ac
243d175
2267b18
07c3398
1bba0a0
511b5fe
6e976d0
6cc24de
ea6de93
dd927b3
3624cd3
7885f4e
3277ac3
ab27e4e
835c88a
f944a54
ba146e1
22c5a87
663b344
e7d040a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,14 @@ export const FEATURE_FLAG = { | |
| // System-wide kill switch for additional (scoped) environment API-key lookup. | ||
| // Defaults off; enable during rollout once the new lookup path is trusted. | ||
| additionalApiKeyLookupEnabled: "additionalApiKeyLookupEnabled", | ||
| // The execution-snapshot store rollout dial. A flag rather than an environment variable because | ||
| // a sustained append failure burns a task attempt per transition, so dial-down is a correctness | ||
| // control and cannot wait for a deploy. | ||
| snapshotStoreMode: "snapshotStoreMode", | ||
| // Per-org override, read from the org blob only. Deliberately narrower than the global key: | ||
| // snapshot reads are global, so an org at a read position would read state its own writes never | ||
| // created. Stripped from org payloads by withoutOrgForbiddenSnapshotKeys. | ||
| snapshotStoreOrgMode: "snapshotStoreOrgMode", | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| } as const; | ||
|
|
||
| export const FeatureFlagCatalog = { | ||
|
|
@@ -153,6 +161,8 @@ export const FeatureFlagCatalog = { | |
| [FEATURE_FLAG.additionalApiKeysEnabled]: z.boolean(), | ||
| [FEATURE_FLAG.additionalApiKeyIssuanceEnabled]: z.boolean(), | ||
| [FEATURE_FLAG.additionalApiKeyLookupEnabled]: z.boolean(), | ||
| [FEATURE_FLAG.snapshotStoreMode]: z.enum(["off", "dual-write", "redis-read", "redis-only"]), | ||
| [FEATURE_FLAG.snapshotStoreOrgMode]: z.enum(["off", "dual-write"]), | ||
| }; | ||
|
|
||
| export type FeatureFlagKey = keyof typeof FeatureFlagCatalog; | ||
|
|
@@ -188,8 +198,20 @@ export const ORG_LOCKED_FLAGS: FeatureFlagKey[] = [ | |
| FEATURE_FLAG.runOpsMintShardSetPrev, | ||
| FEATURE_FLAG.runOpsMintShardSetFlippedAt, | ||
| FEATURE_FLAG.runOpsMintShardOverride, | ||
| // The dial is deployment-wide; only snapshotStoreOrgMode is per-org. | ||
| FEATURE_FLAG.snapshotStoreMode, | ||
|
Comment on lines
+201
to
+202
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Org-only snapshot dial appears editable on the global flags page
Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback. |
||
| ]; | ||
|
|
||
| /** | ||
| * Drops keys an organisation must never supply. ORG_LOCKED_FLAGS is a UI predicate and no save path | ||
| * consults it, so the line is held here — the same way the mint grace stamps are stripped. | ||
| */ | ||
| export function withoutOrgForbiddenSnapshotKeys<T extends Record<string, unknown>>(values: T): T { | ||
| if (!(FEATURE_FLAG.snapshotStoreMode in values)) return values; | ||
| const { [FEATURE_FLAG.snapshotStoreMode]: _dropped, ...rest } = values; | ||
| return rest as T; | ||
| } | ||
|
|
||
| /** | ||
| * Flag groups where the operator sets a `primary` and the server computes the rest. The topology | ||
| * lives here, not in the server module, because the admin page needs it too: unsetting a primary | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import type { SnapshotRepairEnqueuer } from "@internal/run-store"; | ||
|
|
||
| export type SweepPassOutcome = { | ||
| outcome: "completed" | "partial" | "skipped_locked" | "failed" | "unbound" | "aborted"; | ||
| counts?: Record<string, number | boolean>; | ||
| }; | ||
|
|
||
| export type SweepRunner = (opts: { | ||
| deadline: number; | ||
| signal: AbortSignal; | ||
| }) => Promise<SweepPassOutcome>; | ||
|
|
||
| /** Late-bound so the run store never has to import the engine. A third module wires both at boot. */ | ||
| let repairEnqueuer: SnapshotRepairEnqueuer | undefined; | ||
| let sweepRunner: SweepRunner | undefined; | ||
|
|
||
| export function setSnapshotRepairEnqueuer(fn: SnapshotRepairEnqueuer): void { | ||
| repairEnqueuer = fn; | ||
| } | ||
|
|
||
| export function getSnapshotRepairEnqueuer(): SnapshotRepairEnqueuer | undefined { | ||
| return repairEnqueuer; | ||
| } | ||
|
|
||
| export function setSnapshotSweepRunner(fn: SweepRunner): void { | ||
| sweepRunner = fn; | ||
| } | ||
|
|
||
| export function getSnapshotSweepRunner(): SweepRunner | undefined { | ||
| return sweepRunner; | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.