fabro/lib/crates
Bryan Helmkamp 30fcee98c2
refactor(events): type stage/parallel ids with newtypes
Promote RunEvent.stage_id / parallel_group_id / parallel_branch_id
and the internal Event enum's matching fields from stringly-typed
Option<String> to Option<StageId> / Option<ParallelBranchId>. The
wire contract is now self-enforcing: malformed strings are rejected
at the serde seam, not quietly round-tripped, and the three
StageId::new(...).to_string() calls in stored_event_fields() just
drop the .to_string() since the newtypes flow straight through.

- fabro-types/src/stage_id.rs: new ParallelBranchId { group: StageId,
  index: u32 } mirroring StageId's Display / FromStr / serde string
  form. "{group}:{index}" (e.g. "fanout@2:0"). Tests for round-trip
  and parse rejections.
- fabro-types/src/lib.rs: re-export ParallelBranchId.
- fabro-types/src/run_event/mod.rs: RunEvent, RunEventRaw, and
  RunEventParts take Option<StageId> / Option<ParallelBranchId>.
  from_ref gains a small generic opt_field<T: Deserialize> helper
  that also replaces the bespoke actor null-handling branch. to_value
  uses serde_json::to_value(value) for the three typed fields.
- fabro-workflow/src/event.rs: Event::Stage{Started,Completed,
  Failed,Retrying} and Event::Agent take Option<StageId> /
  Option<ParallelBranchId>. Event::ParallelBranch{Started,Completed}
  take the required (non-Option) typed forms. StoredEventFields
  and stored_event_fields() plumb the newtypes end-to-end.
- fabro-workflow/src/context.rs: WorkflowContext::parallel_group_id()
  returns Option<StageId>, parallel_branch_id() returns
  Option<ParallelBranchId>. Read via serde_json::from_value which
  validates the shape on the way out.
- fabro-workflow/src/handler/parallel.rs: builds typed values
  directly, stores in context via serde_json::to_value (still
  produces a JSON string through the custom Serialize). BranchSetup
  holds a ParallelBranchId.
- fabro-workflow/src/handler/llm/api.rs: StageEventScope holds
  typed ids.
- fabro-workflow/src/lifecycle/event.rs: stage_parallel_ids returns
  typed tuple.

Wire JSON is byte-identical before and after (StageId serializes as
"{node_id}@{visit}", ParallelBranchId as "{node_id}@{visit}:{index}",
matching the existing spec). Progenitor-generated types and OpenAPI
schema untouched. Existing None-only fixtures in runtime_store,
git, pipeline, error, run_state, rewind, pr_view, and store/dump
didn't need any edit because None fits any Option<T>.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 12:39:40 -04:00
..
fabro-agent feat: embed fabro spa and align interruption semantics 2026-04-08 14:43:44 -04:00
fabro-api fix(api): resolve build spec path at runtime 2026-04-07 23:05:07 -04:00
fabro-checkpoint test(checkpoint): restore RunRecord helper fields 2026-04-07 23:24:36 -04:00
fabro-cli refactor(events): type stage/parallel ids with newtypes 2026-04-09 12:39:40 -04:00
fabro-config feat(artifacts): remove scratch artifact cache staging 2026-04-08 17:42:55 -04:00
fabro-core feat: embed fabro spa and align interruption semantics 2026-04-08 14:43:44 -04:00
fabro-devcontainer refactor(workspace): satisfy clippy all-targets warnings 2026-04-05 14:37:32 -04:00
fabro-github refactor(cli): make run-adjacent commands server-only 2026-04-06 06:12:16 -04:00
fabro-graphviz Clean up workspace clippy warnings 2026-03-30 11:27:25 -04:00
fabro-hooks refactor(workspace): satisfy clippy all-targets warnings 2026-04-05 14:37:32 -04:00
fabro-interview feat: embed fabro spa and align interruption semantics 2026-04-08 14:43:44 -04:00
fabro-llm feat: embed fabro spa and align interruption semantics 2026-04-08 14:43:44 -04:00
fabro-macros Add twin test mode for OpenAI E2E tests 2026-03-31 20:36:48 -04:00
fabro-mcp Rename fabro-api-types to fabro-api with progenitor client generation 2026-04-03 11:17:27 -07:00
fabro-model fix(clippy): restore workspace lint cleanups after main merge 2026-04-07 18:01:53 -04:00
fabro-oauth refactor(workspace): satisfy clippy all-targets warnings 2026-04-05 14:37:32 -04:00
fabro-proc feat(run): harden server-supervised worker lifecycle 2026-04-07 07:59:35 -04:00
fabro-retro Merge remote-tracking branch 'origin/main' 2026-04-07 15:24:07 -04:00
fabro-sandbox refactor(storage): unify scratch paths and key schema 2026-04-06 10:13:37 -04:00
fabro-server refactor(store): flatten EventEnvelope wire shape via serde 2026-04-09 12:09:00 -04:00
fabro-slack fix(clippy): restore workspace lint cleanups 2026-04-07 20:40:02 -04:00
fabro-spa feat: embed fabro spa and align interruption semantics 2026-04-08 14:43:44 -04:00
fabro-store refactor(events): type stage/parallel ids with newtypes 2026-04-09 12:39:40 -04:00
fabro-telemetry fix(home): migrate all runtime consumers to use Home 2026-04-06 13:36:43 -04:00
fabro-test fix: resolve clippy warnings across workspace 2026-04-08 15:56:51 -04:00
fabro-tracker fix(test): remove hidden HTTP client startup overhead 2026-04-04 21:25:51 -04:00
fabro-types refactor(events): type stage/parallel ids with newtypes 2026-04-09 12:39:40 -04:00
fabro-util refactor(home): move Home to fabro-util so all crates can share it 2026-04-06 13:08:35 -04:00
fabro-validate Add publish = false to all crates to prevent accidental crates.io publish 2026-03-29 13:47:09 -04:00
fabro-workflow refactor(events): type stage/parallel ids with newtypes 2026-04-09 12:39:40 -04:00