mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-02 02:13:49 +00:00
Step 4 of the legacy executor deletion, fourth commit: with no writer
and no reader left, the legacy event log goes.
- `fabro-types`: `run_event` (`EventBody`, `RunEvent` and every props
struct), `EventEnvelope` and the `RunEventDetail*` types are deleted.
What the projection and the API still use moves out of the event
vocabulary: `AgentEventProps`, `AgentSessionActivatedProps`,
`AgentToolsAvailableProps`, `StagePromptProps`, `SessionCapability`
and the coding event names to `agent_props`; `RunNoticeLevel` and
`RunNoticeCode` to `notice`; `InterviewOption` beside the question
types; `RunRunnableSource` beside the run status. `Checkpoint` is
what Fabro records for a Petri run: `timestamp`, `current_node`,
`git_commit_sha`; the conclusion's stage summaries derive from the
projection's stages instead of the checkpoint's node maps.
- `fabro-store`: the Slate bridge (`RunDatabase`, the Slate `Database`,
`keys`, `record`, `EventPayload`) and the reducer (`run_state`) are
deleted. `Database` is the blob table and the run summary store over
one pool; the blob store is SQLite only; the run summary store keeps
the `runs` row a projector writes and lists, and finds the pull
request creation candidates over `platform_records`; `build_summary`
and `projected_usage` live in `run_summary`. The SlateDB dependency
is gone. Test fixtures build the store from its two SQLite stores.
- `fabro-workflow`: the `event` module (the `Event` enum, its
conversion, sink, emitter, redaction, stored fields and names),
`runtime_store`, `StageScope` and the legacy seeding test helpers are
deleted; the tests that seeded legacy runs read platform records or
a projection instead.
- `fabro-sandbox` owns `GitRetryReason`.
- The server builds the store without an object store; the legacy
`POST /runs/{id}/events` tests go, an interrupt answers
`interrupt_unsupported` in the tests as it does in the handler, and
the tests that read a run back through the Slate handle read its
projection or its platform records. The projection folds a block
that lands while the run is paused as the pause's prior block, and a
pause or unpause clears the pending control it answers; a control
request's check-and-append holds a per-run lock so two concurrent
cancels record one request.
- The CLI's final output is the response of the last stage that
produced one; the workflow tests read completed nodes from the
succeeded stages.
- The spec's `RunCheckpoint` carries the three fields the type keeps.
Still failing until the next commits: the CLI tests that seed runs
through `POST /runs/{id}/events` or wait for legacy event names, and
the two Ask Fabro resume tests (the sandbox instance gap).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
75 lines
2.5 KiB
Rust
75 lines
2.5 KiB
Rust
use fabro_types::{BlobHash, IdpIdentityError};
|
|
|
|
pub type Result<T> = std::result::Result<T, Error>;
|
|
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum Error {
|
|
#[error("Object store error: {0}")]
|
|
ObjectStore(#[from] object_store::Error),
|
|
#[error("Serialization error: {0}")]
|
|
Serde(#[from] serde_json::Error),
|
|
#[error("SQLite error: {0}")]
|
|
Sqlite(#[from] sqlx::Error),
|
|
#[error("stored {record} has an invalid identity")]
|
|
InvalidStoredIdentity {
|
|
record: &'static str,
|
|
#[source]
|
|
source: IdpIdentityError,
|
|
},
|
|
#[error("stored {record} has an invalid {field} timestamp: {value}")]
|
|
InvalidStoredTimestamp {
|
|
record: &'static str,
|
|
field: &'static str,
|
|
value: i64,
|
|
},
|
|
#[error("stored blob {blob_hash} has bytes that conflict with its hash")]
|
|
BlobHashConflict { blob_hash: BlobHash },
|
|
#[error("stored blob data does not match requested hash {blob_hash}")]
|
|
BlobIntegrity { blob_hash: BlobHash },
|
|
#[error("I/O error: {0}")]
|
|
Io(#[from] std::io::Error),
|
|
#[error("Invalid event payload: {0}")]
|
|
InvalidEvent(String),
|
|
#[error("event rejected by run projection: {source}")]
|
|
EventRejected {
|
|
#[source]
|
|
source: Box<Self>,
|
|
},
|
|
#[error("Run not found: {0}")]
|
|
RunNotFound(String),
|
|
#[error("Run already exists: {0}")]
|
|
RunAlreadyExists(String),
|
|
#[error("Session not found: {0}")]
|
|
SessionNotFound(String),
|
|
#[error("Session already exists: {0}")]
|
|
SessionAlreadyExists(String),
|
|
#[error("run store is read-only")]
|
|
ReadOnly,
|
|
#[error("event sequence limit of {max_seq} reached")]
|
|
EventSequenceExhausted { max_seq: u32 },
|
|
#[error("invalid key segment: {segment:?}")]
|
|
InvalidKeySegment { segment: String },
|
|
#[error("failed to parse key: {0}")]
|
|
KeyParse(String),
|
|
#[error("stored run summary {run_id} has inconsistent field {field}")]
|
|
RunSummaryMismatch {
|
|
run_id: String,
|
|
field: &'static str,
|
|
},
|
|
#[error("run {run_id} head mismatch: expected {expected_last_seq}, stored {actual_last_seq:?}")]
|
|
RunHeadMismatch {
|
|
run_id: String,
|
|
expected_last_seq: u32,
|
|
actual_last_seq: Option<u32>,
|
|
},
|
|
#[error("stored run event {run_id} sequence {seq} has inconsistent field {field}")]
|
|
RunEventMismatch {
|
|
run_id: String,
|
|
seq: u32,
|
|
field: &'static str,
|
|
},
|
|
#[error(transparent)]
|
|
InvalidTransition(#[from] fabro_types::InvalidTransition),
|
|
#[error("{0}")]
|
|
Other(String),
|
|
}
|