-
Notifications
You must be signed in to change notification settings - Fork 15
feat: 010 scalability improvements #301
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
zeljkoX
wants to merge
12
commits into
main
Choose a base branch
from
010-scalability-improvements
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.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
26d66d1
feat: Scalability improvements
zeljkoX 67ae96e
chore: Partial
zeljkoX 2bbd261
feat: Scalability implementation
zeljkoX 7e4de78
chore: Normalize spec files
zeljkoX 926e7db
chore: add example
zeljkoX 825af2c
Merge branch 'main' into 010-scalability-improvements
zeljkoX a3fccc5
chore: PR suggestions
zeljkoX 46eb550
chore: Improvements
zeljkoX f0dc738
chore: Improvements
zeljkoX b495534
chore: PR suggestions
zeljkoX 5737abf
chore: Formatting
zeljkoX 025f07f
Merge branch 'main' into 010-scalability-improvements
zeljkoX 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
3 changes: 3 additions & 0 deletions
3
crates/server/migrations/2026-06-23-000001_auth_sessions/down.sql
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,3 @@ | ||
| DROP INDEX IF EXISTS auth_sessions_realm_expires_idx; | ||
| DROP INDEX IF EXISTS auth_sessions_expires_idx; | ||
| DROP TABLE IF EXISTS auth_sessions; |
21 changes: 21 additions & 0 deletions
21
crates/server/migrations/2026-06-23-000001_auth_sessions/up.sql
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,21 @@ | ||
| -- Shared operator/EVM session store for horizontal scaling (issue #242). | ||
| -- Sessions move out of per-process memory so a session issued on one replica | ||
| -- is honored on every replica. Keyed by the SHA-256 digest of the session | ||
| -- token (the plaintext token is never stored). The primary key is composite on | ||
| -- (realm, token_digest) so operator and EVM sessions share one table with the | ||
| -- realm boundary enforced by the database, not merely by token randomness. | ||
|
|
||
| CREATE TABLE auth_sessions ( | ||
| realm TEXT NOT NULL, | ||
| token_digest BYTEA NOT NULL, | ||
| subject JSONB NOT NULL, | ||
| issued_at TIMESTAMPTZ NOT NULL, | ||
| expires_at TIMESTAMPTZ NOT NULL, | ||
| -- Set on logout; the row is kept until natural expiry so the revocation | ||
| -- is honored fleet-wide for as long as the token would have been valid. | ||
| revoked_at TIMESTAMPTZ NULL, | ||
| PRIMARY KEY (realm, token_digest) | ||
| ); | ||
|
|
||
| CREATE INDEX auth_sessions_expires_idx ON auth_sessions (expires_at); | ||
| CREATE INDEX auth_sessions_realm_expires_idx ON auth_sessions (realm, expires_at); | ||
3 changes: 3 additions & 0 deletions
3
crates/server/migrations/2026-06-23-000002_auth_challenges/down.sql
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,3 @@ | ||
| DROP INDEX IF EXISTS auth_challenges_expires_idx; | ||
| DROP INDEX IF EXISTS auth_challenges_realm_principal_idx; | ||
| DROP TABLE IF EXISTS auth_challenges; |
21 changes: 21 additions & 0 deletions
21
crates/server/migrations/2026-06-23-000002_auth_challenges/up.sql
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,21 @@ | ||
| -- Shared operator/EVM login-challenge store for horizontal scaling (issue #242). | ||
| -- A challenge issued on one replica must be verifiable on another. Realm-aware | ||
| -- so the two verification models coexist: `challenge_key` is the operator | ||
| -- signing-digest hex or the EVM nonce, and `payload` carries the realm-specific | ||
| -- fields needed to match/recover at verify time. Matching runs in Rust (Falcon | ||
| -- verify / ECDSA recover); the store provides the candidates and the single-use | ||
| -- claim. | ||
|
|
||
| CREATE TABLE auth_challenges ( | ||
| realm TEXT NOT NULL, | ||
| challenge_key TEXT NOT NULL, | ||
| principal TEXT NOT NULL, | ||
| payload JSONB NOT NULL, | ||
| issued_at TIMESTAMPTZ NOT NULL, | ||
| expires_at TIMESTAMPTZ NOT NULL, | ||
| consumed_at TIMESTAMPTZ NULL, | ||
| PRIMARY KEY (realm, challenge_key) | ||
| ); | ||
|
|
||
| CREATE INDEX auth_challenges_realm_principal_idx ON auth_challenges (realm, principal); | ||
| CREATE INDEX auth_challenges_expires_idx ON auth_challenges (expires_at); |
1 change: 1 addition & 0 deletions
1
crates/server/migrations/2026-06-24-000001_worker_leases/down.sql
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 @@ | ||
| DROP TABLE IF EXISTS worker_leases; |
14 changes: 14 additions & 0 deletions
14
crates/server/migrations/2026-06-24-000001_worker_leases/up.sql
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,14 @@ | ||
| -- Single-owner coordination for background workers under horizontal scaling | ||
| -- (issue #242, subsumes #190). At most one replica holds a named lease at a | ||
| -- time; the holder renews on a heartbeat and a stale lease can be reclaimed by | ||
| -- another replica once it expires. `fence_token` increments only on a change of | ||
| -- holder (steal), so a superseded holder can be detected at its write boundary. | ||
|
|
||
| CREATE TABLE worker_leases ( | ||
| lease_name TEXT PRIMARY KEY, | ||
| holder_id TEXT NOT NULL, | ||
| acquired_at TIMESTAMPTZ NOT NULL, | ||
| renewed_at TIMESTAMPTZ NOT NULL, | ||
| expires_at TIMESTAMPTZ NOT NULL, | ||
| fence_token BIGINT NOT NULL DEFAULT 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
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.