feat(scarab): ledger-daemon PR-1 scaffold (Khepri-3 watchdog)#105
Draft
gHashTag wants to merge 1 commit into
Draft
feat(scarab): ledger-daemon PR-1 scaffold (Khepri-3 watchdog)#105gHashTag wants to merge 1 commit into
gHashTag wants to merge 1 commit into
Conversation
🪲 First building block of the Scarabaeus Engine (#101) — a single-replica Railway service that ticks every 30 s and corrects course from above. ## What's in this scaffold (PR-1) - Workspace member: `bin/ledger-daemon` with Cargo.toml + README.md. - main.rs: tokio runtime, neon connect, tick loop with MissedTickBehavior::Skip, graceful Ctrl-C, four-job dispatch with no-fatal error collection. - config.rs: env parsing (NEON_DATABASE_URL with TRIOS_NEON_DSN/DATABASE_URL fallback chain matching trios-trainer-igla::neon_writer), tick_secs, worker_dead_after_secs, leak_bpb_threshold, telegram, destructive_ok. - audit.rs: R7 triplet emit helper writing to gardener_runs (action, lane, seed, before_bpb, after_bpb, decision JSONB). - jobs.rs: four jobs as DRY-RUN scaffolds. Each runs the full SELECT and emits an audit row with `decision.dry_run=true` so we can verify decision quality from gardener_runs before wiring mutations. ## Four jobs | Job | Trigger | Dry-run audit action | Mutation (PR-N) | |---|---|---|---| | 1 | workers.last_heartbeat > N s | `resurrect_candidate` | PR-2 Railway API redeploy | | 2 | queue_depth (pending+ready) | `autoscale_compute` | PR-3 service replicas patch | | 3 | done rows with bpb < threshold | `leak_flag` (writes last_error) | already live | | 4 | running rows older than N h | `zap_stuck` (Khepri-2 requeue) | already live | Jobs 3 and 4 are NOT dry-run — they write last_error and requeue respectively. Jobs 1 and 2 are dry-run-only until PR-2 / PR-3. ## Verified locally ``` $ cargo build -p ledger-daemon # clean $ cargo test -p ledger-daemon # 0 passed (no unit tests yet, PR-2 adds) $ cargo fmt -p ledger-daemon # clean ``` ## Refs - parent: trios-railway#101 🪲 Scarabaeus Engine umbrella - depends-on: trios-railway#102 (Khepri-0 contract test) - depends-on: trios-railway#103 (Khepri-1 LISTEN/NOTIFY) - depends-on: trios-railway#104 (Khepri-2 retry/DLQ) Anchor: phi^2 + phi^-2 = 3 — TRINITY — NEVER STOP.
gHashTag
pushed a commit
that referenced
this pull request
May 20, 2026
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.
🪲 First building block of the Scarabaeus Engine (trios-railway#101).
This is PR-1 of 5 for Khepri-3. Scaffolds the crate with the tick loop, config, R7 audit emitter, and four DRY-RUN job stubs. Mutations land in PR-2..PR-5 (one per job).
Four jobs
workers.last_heartbeat > N sresurrect_candidateautoscale_computebpb < thresholdleak_flag(writes last_error)zap_stuck(Khepri-2 requeue)Jobs 3 and 4 are not dry-run — they write
last_errorand requeue respectively.Verified locally
Refs
Anchor:
phi^2 + phi^-2 = 3. NEVER STOP.