Repository navigation
Conversation
… own the needs_input banner (INC-976)
|
Review of 5b26208 (Codex plus a manual check). CI is green. I confirmed each item below in the code. 1. 2. Two quick events can open two review splits. 3. The PR description is out of date. It still says "Nothing fires yet" and that runtime isn't exercised. The branch now has the event tap (29a05ed) and the notify/review/run actions (5b26208). The Testing section should cover those too. Also: |
What this does
First slice of event routes (INC-976):
programa.jsoncan now hold aroutesblock, and Programa reads it, checks it, and knows which events each route matches and when it should fire. Nothing fires yet. Hooking routes up to live agent events and running their actions (notify, run, review, send) comes in the next PRs.Summary
Start with
Sources/RouteGate.swift(the debounce/throttle logic), thenSources/ProgramaRoutes.swift(schema and validation). The rest is wiring.ProgramaRoutes.swift): each route hasname,on,when,debounceMs,throttleMs,key, and exactly one action. Routes decode one at a time, so a bad route becomes an issue and the other routes, commands and recipes still load. Durations take milliseconds or strings like"5m".RouteMatching.swift): MQTT-style topics with+and#.whenfollows pmndrs/pine's filter syntax, limited to equality,ne,in,existsandregex.RouteGate.swift): one tagged-union state per (route, key) with a pure reducer that takesnowas input. Debounce handles the last event of a burst, and throttle fires once and then drops matches for the window. The defaultkeyis{{topic}}, as in pine.ProgramaConfig.swift): routes load from the global~/.config/programa/programa.jsononly, and they are part of the reload change check.routes.listand the debug-onlydebug.routes.load. Both are stubs until the engine lands.commandsis now optional, so a file with only routes loads.testDecodeMissingCommandsKeyThrowsbecomestestDecodeMissingCommandsKeyYieldsNoCommandson purpose.Known follow-ups for the next slice:
configRevision, which also refreshes the command palette.whenfields are not rejected yet, so a typo silently stops a route from firing.Testing
./scripts/reload.sh --tag inc-976-event-routes: build succeeded.python3 scripts/check-structural-budgets.py: pass.scripts/check-v2-contract.sh: ok.ProgramaRouteDecodingTests,ProgramaRouteStoreLoadingTests,RouteMatchingTests,RouteGateTests) have not run yet. This PR's CI is their first compile against the real module. They include the "once per 5 minutes" throttle check: matches at 0, 60 and 299 seconds fire once, and a match at 300 seconds fires again.Demo Video
Review Trigger (Copy/Paste as PR comment)
Checklist
./scripts/reload.sh --tag <name>)