Inspiration
Distribution restoration is taught through static diagrams, yet the risky part is the order of operations. A single premature close can energize a faulted cable, backfeed a section or overload a source. Restoration Lab turns that reasoning into a short interactive drill for junior distribution engineers.
What it does
The trainee operates four switches on a synthetic one-line feeder after a cable fault interrupts 700 customers and a community hospital. Before the network changes, a deterministic safety gate evaluates the proposed state.
An unsafe Source A close is rejected and the exact fault path flashes red. After both isolators are opened, the trainee can restore West campus from Source A and pick up Riverside plus the hospital from Backup Source B. The timeline records every accepted and blocked action with a plain-English reason.
How we built it
The browser app uses React, TypeScript and Vite. A small graph engine builds adjacency from the closed switches, traces reachability from both sources and checks four rules:
- no source may reach the faulted cable;
- two sources may not feed the same section;
- restored demand must stay within the drill's source limits;
- the hospital must be energized in the completed state.
Vitest covers the graph rules. Playwright checks the blocked action, the safe four-step restoration and the guided demo. Remotion assembles the 84-second narrated walkthrough from the real browser recording.
How we used the Devpost Learn Skill Pack and Codex
We used the required challengepost/learn-ai-basics skill pack from the start. The flipped-interaction flow produced a learner profile, scope, PRD, technical spec and ordered build checklist before implementation. Codex then built one verified slice at a time, ran the unit and browser tests, created the app map, recorded the working demo and kept the planning documents beside the code for inspection.
Challenges
The hardest part was keeping a rejected action completely separate from the trusted state. We used a two-phase pattern: current state -> proposed state -> deterministic checks -> accept or reject. A blocked move never mutates the current switch map.
Accomplishments
- The app explains why a move is unsafe instead of returning a black-box answer.
- The guided demo ends with all 700 customers and the hospital restored while the fault remains dead.
- Six unit tests, three browser tests and a production build pass.
- The repository contains the approved planning trail, code tour, captions and Remotion source.
What we learned
Small, inspectable rules make AI-assisted development easier to test. Planning first also stopped the project from growing into a full power-flow simulator. The proof stays focused on one decision: should this proposed switch action be allowed before it changes the network?
What's next
Add more feeder scenarios, a scenario authoring format and instructor scoring. The safety engine will remain deterministic and the product will stay a training model, not an operational switching tool.
Built With
- codex
- devpost-learn-skill-pack
- playwright
- react
- remotion
- typescript
- vite
- vitest