electric-sql / electric-sql/electric-circuits
Engine restart silently freezes extended-API shapes (clients tail dead streams)
- Dominant language
- Rust
- Stars
- 30
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
Found during the production-readiness investigation.
**Symptom / failure scenario:** all shape state is in-memory (`apps/engine/src/engine.rs:47-61`); nothing re-registers shapes at boot. After an engine restart the `shape/` streams still exist on the DS server, but no tailer maintains them — an extended-API client long-polling its feed keeps getting valid responses (historical data, then silence) while Postgres keeps changing. **The shape is silently stale forever**; no error is surfaced to the client, no detection exists server-side.
`/v1/shape` clients at least get a `409 must-refetch` (`apps/engine/src/electric.rs:661-664`); extended-API clients get nothing.
**Fix direction:** short-term, make staleness detectable (e.g. engine epoch/generation stamped on streams or a control message on shutdown/boot so clients can detect an unmaintained feed). Real fix: persist the shape catalog and resume maintenance at boot (recovery epic).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Contributor guide
Research direction
Start with the in-memory shape state in apps/engine/src/engine.rs:47-61 and compare the /v1/shape handling at apps/engine/src/electric.rs:661-664 with extended-API stream maintenance across restart. Trace boot and shutdown behavior first. Done means an extended-API client can detect an unmaintained stream, or shape state is persisted and maintenance resumes after boot, as selected by the recovery plan.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, rust
- Domain
- api, backend, databases
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100