Repository navigation
chore: hold the console's page to the strict effect lint - #180
Merged
ChristopherPHolder merged 2 commits intoNov 22, 2026
Merged
Conversation
I put apps/console/src and libs/design-system under the same strict Effect rules as the bot and the Worker, and fixed what they found: Effect's Array, String and Record helpers instead of the native methods, Schema.Finite instead of Schema.Number, Effect instead of async functions in the fakes and specs, make() for the sign-in failures, deterministic service keys and the Option succeed helpers. The specs sit next to the code, so the override that lets tests provide layers inline now covers *.spec.ts too. resources.ts keeps looking up globalThis.fetch on every request so Sentry's wrapped fetch traces the API calls; global-fetch is off for that one file.
5 tasks done
ChristopherPHolder
marked this pull request as ready for review
November 22, 2026 14:33
…udget (#179) * ci: open the console's built page in chromium and hold it to a size budget Whether the built page starts in a real browser, and how big it gets, were only ever checked by hand. A smoke task now builds the Console and opens the page in Playwright's Chromium with the API answered by hand: it has to start, be styled, move between tabs with the arrow keys and throw nothing, and its scripts have to stay under 260 kB gzipped. CI installs Chromium and runs it after the builds. * chore: lint the console's page with foldkit's own rules (#181) * chore: lint the console's page with foldkit's own rules @foldkit/oxlint-plugin's recommended rules now run on the Console's page and the design system. They found the root copying a child's Model out of Recorder.signedIn, Recorder.failedSignIn, Stats.open and Consent.open, and the consent panel doing the same with ErasureAdmin.open, which would silently drop any Commands those return. Each now goes through Update.foldChild with the child's Step as its input. The recorder's draft is updated with modifyFields instead of spreads. * refactor: build the design system on foldkit's ui components (#185) * refactor: build the design system on foldkit's ui components The design system's interactive helpers now sit on @foldkit/ui, Foldkit's headless components, so the ARIA attributes, keyboard handling and focus management come from Foldkit and the markup and CSS stay ours. The tabs are its Tabs Submodel, wired into the page and the stats with a Model field, a Got message and Update.foldChild, which replaces the roving focus I had hand-rolled for the arrow, Home and End keys. The button, the text fields, the select, a new checkbox and a new disclosure use its stateless view helpers. The page now builds its controls from the package and stays off its pb- classes: the action item's checkbox and owner select, the refusal reason, the clickable recording row, the empty-list lines, and "Add a title and agenda", which becomes a disclosure drawn with the same marker as before. The generic utilities (stack-2, align-start, label, muted and the confirm box) move into the design system's CSS. The record button and the recording-duration formatters move into the page, which is the only thing that uses them. libs/design-system/README.md describes the package, its CSS files and every helper. * feat: render the console's first screen into its page at build time (#183) * feat: render the console's first screen into its page at build time The page used to arrive as an empty <div id="root"> and stay blank until 254 kB of script loaded inside Discord's frame. The build now renders init and view with Foldkit's server renderer and puts the result into dist/client/index.html, and the page hydrates that markup instead of drawing it again. Only the starting screen is rendered: who's asking is only known after the Discord SDK signs them in, in the browser. scripts/render-shell.ts builds src/entry.server.ts for Node after vp build and injects the render. The Foldkit plugin compiles one build id, the commit in CI, into both, so hydration refuses a page from another build. vp dev keeps starting the page fresh. * test: give the console's whole-program test time to sign in on a slow runner vi.waitFor gives up after one second by default. On GitHub's runners, signing in and the first status poll took a little longer, so the test failed while the page was fine. It now waits up to five seconds. * feat: serve the console's page alone against a fake office, with foldkit devtools (#184) * feat: serve the console's page alone against a fake office, with foldkit devtools pnpm --filter console dev:fake runs the page without the Worker, a database or Discord. A fake Worker built from the API contract and a fake Discord answer in the browser, and ?scenario= picks an idle, recording, paused, away or admin office. Starting, pausing and stopping a recording work. The fake Worker that the tests already used now lives in src/app/dev, so the tests and the dev mode share it, and none of it reaches the production bundle. The page also carries Foldkit's DevTools in development, with the Message schema so they can dispatch, and .mcp.json hands coding agents the same view through Foldkit's DevTools MCP server. * chore: upgrade effect to 4.1.5 (#186) * chore: upgrade effect to 4.1.5 effect and every @effect package move from 4.1.0 to 4.1.5, the latest release, inside Foldkit's ~4.1.0 range. @effect/tsgo moves from 0.63.0 to 0.67.7, the newest release that can patch the oxlint 1.89 that Vite+ 1.4 ships; 0.68 and later need oxlint 1.91 or newer, which comes with Vite+ 1.7. * fix: tell people the truth when a consent action fails, and keep the privacy tab's state (#187) * fix: tell people the truth when a consent action fails, and keep the privacy tab's state - A withdrawal the Worker refused said the bot would still withdraw it later, though nothing was stored. It now says nothing changed. When a withdrawal, deletion request, cancellation or admin decision gets no answer at all, the page says it can't tell whether it went through and shows where things stand, instead of claiming nothing changed. - Opening the Privacy tab again no longer resets it, so an action that's still running keeps its busy state and an admin keeps what they typed. - A refusal reason starts blank for each request and after Back, so it never carries over to someone else, and it survives a send that failed. - A late answer to an earlier stats request no longer replaces fresher numbers with an error. - When signing in through Discord fails, every tab says why instead of waiting forever. - Every tab points at a panel that's in the page; the tabs helper hides the ones not selected. - The action-item checkbox is a native checkbox labelled by the item's visible text, so screen readers read it once and clicking the text ticks it. * refactor: simplify the console's page and tidy the design system (#189) * refactor: give the design system one way to call each helper, typed tabs and no dead CSS - Tabs.create(tabs) builds a set of tabs once, so the Selected value comes back as one of their ids, and the view takes its slot from the tabs' Model. - Helpers that only wrap content (card, description, descriptionItem) take their children; noticeRegion takes an Option of a notice; badge, stat and heading take a config like the rest. - NoticeContent is a Schema, so the page can keep a notice in its Model without its own copy. - Person and avatar both use avatarUrl and isSpeaking. statusHeading always takes a description and a subheading that may be null. - card has one size, so CardSize and the md max-width rule are gone. - confirmBox renders the confirmation box the page used to build from the confirm classes, and blockButton gets its own pb-block-button base style. - The index stops exporting barShare, heatOf, initials, liveDot and the config types nobody imports. - CSS: the unused text styles, the dead .pb-btn:disabled rule and the comments are gone; the focus shadows are built from the focus colours; the global resets live in base.css, and sr-only and text-tabular in utilities.css. - New tests: tabs in the pills style, selectField's onChange, a disabled button with no click handler, and confirmBox as a group and as a form. * refactor: simplify the console's page without changing what it shows - Child steps fold with Update.foldChildStep, and History's edit Submodels with Update.foldChildAt. - Sign-in lives in one place: the recorder reads it as a view input, and its polling starts only once signed in, like History's. - The three edit Submodels keep one save state (Idle, Saving or Answered with a notice) instead of isSaving and notice. - The recorder and History share one request counter for ignoring stale answers. History keeps it on its Model and ignores every earlier request when a recording opens. Its list fetch, which only ever has one request in flight, just tracks whether one is. - History keeps its list and the open recording as AsyncData, so each view shows its own failure. - The recorder's settle composes its steps with Update.combine. - The answer polling repeats with Effect.repeat. - The page uses the design system's NoticeContent, noticeRegion with an Option, confirmBox and typed tabs, so viewOf and rangeOf are gone. - ErasureAdmin.open did what refresh does from Idle, so the privacy tab always refreshes. - Dead code: the FakeDiscord type, and exports used only in their own file. - The fake office builds its recordings from the History test fixtures. * perf: load sentry only when the console has somewhere to report (#188) @sentry/browser was about 52 kB of the page's 258 kB of gzipped script, downloaded by everyone even when the Worker has no Sentry configured. It's now a dynamic import: the page loads it once /api/telemetry names a DSN, or when there's a crash or a failed request to report. The page starts with 207 kB of script. The smoke test now budgets the scripts the page loads at start, at 220 kB, and checks that no other script loads when there's no Sentry. * fix: make the bot more reliable around restarts, reconnects and the database (#190) * fix: join the office when someone already in at startup agrees later The bot only moved on Opened and Emptied. Someone who was in the office when the bot started, and agreed to be recorded afterwards, filled it without an Opened, so the bot stayed out for the whole occupancy: no soundboard sounds or emoji were recorded and a recording carried over from before the restart was ended. Whether the bot should be in now follows who's admitted to the office, not the announcements. * fix: replace an office voice connection that drops after it was ready A voice WebSocket that closes with anything but 4014 takes the connection from Ready straight back to Signalling, without passing through Disconnected. The connection only watched for Disconnected or Destroyed after Ready, so a reconnect that never finished left the bot on a dead connection for good, and a recording started on it heard nothing. It now waits for any move away from Ready and gives every reconnect the same 20 seconds a first join gets. * fix: don't let a deletion be cancelled or refused once it's running The erasure reads the request once, then spends minutes taking the person's name out of Slack and deleting their audio before it deletes the rows. A cancel from the Console or a refusal from an admin in that window still succeeded, so the person was told it was cancelled, or the admin that it was refused, and the data was erased anyway. A request starts running when it's due, so cancelling, refusing and deleting now only apply before then. Agreeing to be recorded again still cancels it at any point, as the bot checks that again just before deleting. * fix: record an automatic recording stop the database missed When the office emptied or a recording hit its time limit, the bot stopped capturing first and then wrote the stop. If that write failed, nothing tried again: the bot had already let go of the recording, so it stayed running in the database, was never posted, and every later start ran into it. The stop is now kept until it's written, and each tick writes it before handling any request. * fix: pick up a recording from before a restart when the database is late On startup the bot checks for a recording that was running before it restarted, and either carries on with it or ends it. That check ran once, on the first presence, and gave up if the database didn't answer in time, which it's allowed not to while it starts. The recording then stayed running in the database with nobody capturing it, and every later start ran into it. Each tick now runs the check until it succeeds, before handling any request. * fix: keep what someone was saying when the voice connection fails mid-recording Capture flushed each speaker's unfinished clip when a recording stopped, but not when the voice connection failed: the stream was failed straight away and the receive streams destroyed without ending, so up to five minutes of the clip in progress was never saved. The unfinished clips are now handed on before the failure. * test: fail when pollUntil gives up instead of carrying on pollUntil stopped after its bound and returned whatever it last saw, so a test waiting for something that never happened carried on as if it had, and only failed if a later assertion happened to check the same thing. It now fails with what it last saw. * fix: answer Slack messages that Slack sends again after a reconnect Socket Mode dropped every event Slack delivered a second time, to avoid answering the same message twice. Slack only sends an event again when it didn't get the ack, so a mention sent while the bot was restarting for a deploy, or that reached a connection as it closed, was never answered, and a button press in an admin's DM was lost the same way. It now remembers the last thousand event IDs and drops only an event it already has. * refactor: build the three database-backed request stores with one helper The recording requests, recording edits and consent requests layers were the same five lines apart from the service they built. * refactor: drop folder exports nothing outside the folder imports The office, announcing, consent and erasure interfaces re-exported names only their own modules and tests use; tests import those from the modules directly. * refactor: find whose names to erase with the same queries the admins are shown The bot kept its own copies of the queries that find a person's names and Slack IDs, and of the shortest name worth matching, while the inventory the admins review used the library's. They matched, but nothing kept them matching. The bot now uses the library's. * fix: give up on a consent write that hangs, and try it again The voice activity writer treats a query that takes longer than 10 seconds as an outage and retries it, but the consent book waited on its reads and writes forever. A write hanging on a half-dead connection held up every consent event after it, and stopped the bot from shutting down cleanly. Both now share the same time limit. * fix: report a clip the database couldn't record A clip whose row couldn't be written was dropped with only an error in the journal, so nobody heard that part of a recording was missing, or that its audio was left in the bucket with no row pointing at it. It's now reported like the recorder's other store failures. It isn't retried, since a write that timed out may still have gone in.
ChristopherPHolder
added a commit
that referenced
this pull request
Nov 22, 2026
* refactor: call the worker through its typed HttpApi client The page described each endpoint a second time: a path, a schema run through Schema.toEncoded and a status code to tell errors apart. It now calls the Worker through HttpApiClient, built from the contract in office-domain, and gets decoded values and typed errors back. The bearer session is the SignedIn client middleware; the gateway retries and their Sentry reports are a client transform, as before, and an attempt that hangs for 15 seconds now counts as unanswered. Failures still name the endpoint and status when the contract doesn't declare them, and read as what the Worker meant when it does. Opening a recording gets its own number, so a late answer to an earlier look at the same recording no longer replaces the fresh one. The tests run against a fake Worker built from the same contract, and the whole-program test speeds up the polling for the bot's answer instead of waiting on real seconds. * chore: hold the console's page to the strict effect lint (#180) * chore: hold the console's page to the strict effect lint I put apps/console/src and libs/design-system under the same strict Effect rules as the bot and the Worker, and fixed what they found: Effect's Array, String and Record helpers instead of the native methods, Schema.Finite instead of Schema.Number, Effect instead of async functions in the fakes and specs, make() for the sign-in failures, deterministic service keys and the Option succeed helpers. The specs sit next to the code, so the override that lets tests provide layers inline now covers *.spec.ts too. resources.ts keeps looking up globalThis.fetch on every request so Sentry's wrapped fetch traces the API calls; global-fetch is off for that one file. * ci: open the console's built page in chromium and hold it to a size budget (#179) * ci: open the console's built page in chromium and hold it to a size budget Whether the built page starts in a real browser, and how big it gets, were only ever checked by hand. A smoke task now builds the Console and opens the page in Playwright's Chromium with the API answered by hand: it has to start, be styled, move between tabs with the arrow keys and throw nothing, and its scripts have to stay under 260 kB gzipped. CI installs Chromium and runs it after the builds. * chore: lint the console's page with foldkit's own rules (#181) * chore: lint the console's page with foldkit's own rules @foldkit/oxlint-plugin's recommended rules now run on the Console's page and the design system. They found the root copying a child's Model out of Recorder.signedIn, Recorder.failedSignIn, Stats.open and Consent.open, and the consent panel doing the same with ErasureAdmin.open, which would silently drop any Commands those return. Each now goes through Update.foldChild with the child's Step as its input. The recorder's draft is updated with modifyFields instead of spreads. * refactor: build the design system on foldkit's ui components (#185) * refactor: build the design system on foldkit's ui components The design system's interactive helpers now sit on @foldkit/ui, Foldkit's headless components, so the ARIA attributes, keyboard handling and focus management come from Foldkit and the markup and CSS stay ours. The tabs are its Tabs Submodel, wired into the page and the stats with a Model field, a Got message and Update.foldChild, which replaces the roving focus I had hand-rolled for the arrow, Home and End keys. The button, the text fields, the select, a new checkbox and a new disclosure use its stateless view helpers. The page now builds its controls from the package and stays off its pb- classes: the action item's checkbox and owner select, the refusal reason, the clickable recording row, the empty-list lines, and "Add a title and agenda", which becomes a disclosure drawn with the same marker as before. The generic utilities (stack-2, align-start, label, muted and the confirm box) move into the design system's CSS. The record button and the recording-duration formatters move into the page, which is the only thing that uses them. libs/design-system/README.md describes the package, its CSS files and every helper. * feat: render the console's first screen into its page at build time (#183) * feat: render the console's first screen into its page at build time The page used to arrive as an empty <div id="root"> and stay blank until 254 kB of script loaded inside Discord's frame. The build now renders init and view with Foldkit's server renderer and puts the result into dist/client/index.html, and the page hydrates that markup instead of drawing it again. Only the starting screen is rendered: who's asking is only known after the Discord SDK signs them in, in the browser. scripts/render-shell.ts builds src/entry.server.ts for Node after vp build and injects the render. The Foldkit plugin compiles one build id, the commit in CI, into both, so hydration refuses a page from another build. vp dev keeps starting the page fresh. * test: give the console's whole-program test time to sign in on a slow runner vi.waitFor gives up after one second by default. On GitHub's runners, signing in and the first status poll took a little longer, so the test failed while the page was fine. It now waits up to five seconds. * feat: serve the console's page alone against a fake office, with foldkit devtools (#184) * feat: serve the console's page alone against a fake office, with foldkit devtools pnpm --filter console dev:fake runs the page without the Worker, a database or Discord. A fake Worker built from the API contract and a fake Discord answer in the browser, and ?scenario= picks an idle, recording, paused, away or admin office. Starting, pausing and stopping a recording work. The fake Worker that the tests already used now lives in src/app/dev, so the tests and the dev mode share it, and none of it reaches the production bundle. The page also carries Foldkit's DevTools in development, with the Message schema so they can dispatch, and .mcp.json hands coding agents the same view through Foldkit's DevTools MCP server. * chore: upgrade effect to 4.1.5 (#186) * chore: upgrade effect to 4.1.5 effect and every @effect package move from 4.1.0 to 4.1.5, the latest release, inside Foldkit's ~4.1.0 range. @effect/tsgo moves from 0.63.0 to 0.67.7, the newest release that can patch the oxlint 1.89 that Vite+ 1.4 ships; 0.68 and later need oxlint 1.91 or newer, which comes with Vite+ 1.7. * fix: tell people the truth when a consent action fails, and keep the privacy tab's state (#187) * fix: tell people the truth when a consent action fails, and keep the privacy tab's state - A withdrawal the Worker refused said the bot would still withdraw it later, though nothing was stored. It now says nothing changed. When a withdrawal, deletion request, cancellation or admin decision gets no answer at all, the page says it can't tell whether it went through and shows where things stand, instead of claiming nothing changed. - Opening the Privacy tab again no longer resets it, so an action that's still running keeps its busy state and an admin keeps what they typed. - A refusal reason starts blank for each request and after Back, so it never carries over to someone else, and it survives a send that failed. - A late answer to an earlier stats request no longer replaces fresher numbers with an error. - When signing in through Discord fails, every tab says why instead of waiting forever. - Every tab points at a panel that's in the page; the tabs helper hides the ones not selected. - The action-item checkbox is a native checkbox labelled by the item's visible text, so screen readers read it once and clicking the text ticks it. * refactor: simplify the console's page and tidy the design system (#189) * refactor: give the design system one way to call each helper, typed tabs and no dead CSS - Tabs.create(tabs) builds a set of tabs once, so the Selected value comes back as one of their ids, and the view takes its slot from the tabs' Model. - Helpers that only wrap content (card, description, descriptionItem) take their children; noticeRegion takes an Option of a notice; badge, stat and heading take a config like the rest. - NoticeContent is a Schema, so the page can keep a notice in its Model without its own copy. - Person and avatar both use avatarUrl and isSpeaking. statusHeading always takes a description and a subheading that may be null. - card has one size, so CardSize and the md max-width rule are gone. - confirmBox renders the confirmation box the page used to build from the confirm classes, and blockButton gets its own pb-block-button base style. - The index stops exporting barShare, heatOf, initials, liveDot and the config types nobody imports. - CSS: the unused text styles, the dead .pb-btn:disabled rule and the comments are gone; the focus shadows are built from the focus colours; the global resets live in base.css, and sr-only and text-tabular in utilities.css. - New tests: tabs in the pills style, selectField's onChange, a disabled button with no click handler, and confirmBox as a group and as a form. * refactor: simplify the console's page without changing what it shows - Child steps fold with Update.foldChildStep, and History's edit Submodels with Update.foldChildAt. - Sign-in lives in one place: the recorder reads it as a view input, and its polling starts only once signed in, like History's. - The three edit Submodels keep one save state (Idle, Saving or Answered with a notice) instead of isSaving and notice. - The recorder and History share one request counter for ignoring stale answers. History keeps it on its Model and ignores every earlier request when a recording opens. Its list fetch, which only ever has one request in flight, just tracks whether one is. - History keeps its list and the open recording as AsyncData, so each view shows its own failure. - The recorder's settle composes its steps with Update.combine. - The answer polling repeats with Effect.repeat. - The page uses the design system's NoticeContent, noticeRegion with an Option, confirmBox and typed tabs, so viewOf and rangeOf are gone. - ErasureAdmin.open did what refresh does from Idle, so the privacy tab always refreshes. - Dead code: the FakeDiscord type, and exports used only in their own file. - The fake office builds its recordings from the History test fixtures. * perf: load sentry only when the console has somewhere to report (#188) @sentry/browser was about 52 kB of the page's 258 kB of gzipped script, downloaded by everyone even when the Worker has no Sentry configured. It's now a dynamic import: the page loads it once /api/telemetry names a DSN, or when there's a crash or a failed request to report. The page starts with 207 kB of script. The smoke test now budgets the scripts the page loads at start, at 220 kB, and checks that no other script loads when there's no Sentry. * fix: make the bot more reliable around restarts, reconnects and the database (#190) * fix: join the office when someone already in at startup agrees later The bot only moved on Opened and Emptied. Someone who was in the office when the bot started, and agreed to be recorded afterwards, filled it without an Opened, so the bot stayed out for the whole occupancy: no soundboard sounds or emoji were recorded and a recording carried over from before the restart was ended. Whether the bot should be in now follows who's admitted to the office, not the announcements. * fix: replace an office voice connection that drops after it was ready A voice WebSocket that closes with anything but 4014 takes the connection from Ready straight back to Signalling, without passing through Disconnected. The connection only watched for Disconnected or Destroyed after Ready, so a reconnect that never finished left the bot on a dead connection for good, and a recording started on it heard nothing. It now waits for any move away from Ready and gives every reconnect the same 20 seconds a first join gets. * fix: don't let a deletion be cancelled or refused once it's running The erasure reads the request once, then spends minutes taking the person's name out of Slack and deleting their audio before it deletes the rows. A cancel from the Console or a refusal from an admin in that window still succeeded, so the person was told it was cancelled, or the admin that it was refused, and the data was erased anyway. A request starts running when it's due, so cancelling, refusing and deleting now only apply before then. Agreeing to be recorded again still cancels it at any point, as the bot checks that again just before deleting. * fix: record an automatic recording stop the database missed When the office emptied or a recording hit its time limit, the bot stopped capturing first and then wrote the stop. If that write failed, nothing tried again: the bot had already let go of the recording, so it stayed running in the database, was never posted, and every later start ran into it. The stop is now kept until it's written, and each tick writes it before handling any request. * fix: pick up a recording from before a restart when the database is late On startup the bot checks for a recording that was running before it restarted, and either carries on with it or ends it. That check ran once, on the first presence, and gave up if the database didn't answer in time, which it's allowed not to while it starts. The recording then stayed running in the database with nobody capturing it, and every later start ran into it. Each tick now runs the check until it succeeds, before handling any request. * fix: keep what someone was saying when the voice connection fails mid-recording Capture flushed each speaker's unfinished clip when a recording stopped, but not when the voice connection failed: the stream was failed straight away and the receive streams destroyed without ending, so up to five minutes of the clip in progress was never saved. The unfinished clips are now handed on before the failure. * test: fail when pollUntil gives up instead of carrying on pollUntil stopped after its bound and returned whatever it last saw, so a test waiting for something that never happened carried on as if it had, and only failed if a later assertion happened to check the same thing. It now fails with what it last saw. * fix: answer Slack messages that Slack sends again after a reconnect Socket Mode dropped every event Slack delivered a second time, to avoid answering the same message twice. Slack only sends an event again when it didn't get the ack, so a mention sent while the bot was restarting for a deploy, or that reached a connection as it closed, was never answered, and a button press in an admin's DM was lost the same way. It now remembers the last thousand event IDs and drops only an event it already has. * refactor: build the three database-backed request stores with one helper The recording requests, recording edits and consent requests layers were the same five lines apart from the service they built. * refactor: drop folder exports nothing outside the folder imports The office, announcing, consent and erasure interfaces re-exported names only their own modules and tests use; tests import those from the modules directly. * refactor: find whose names to erase with the same queries the admins are shown The bot kept its own copies of the queries that find a person's names and Slack IDs, and of the shortest name worth matching, while the inventory the admins review used the library's. They matched, but nothing kept them matching. The bot now uses the library's. * fix: give up on a consent write that hangs, and try it again The voice activity writer treats a query that takes longer than 10 seconds as an outage and retries it, but the consent book waited on its reads and writes forever. A write hanging on a half-dead connection held up every consent event after it, and stopped the bot from shutting down cleanly. Both now share the same time limit. * fix: report a clip the database couldn't record A clip whose row couldn't be written was dropped with only an error in the journal, so nobody heard that part of a recording was missing, or that its audio was left in the bucket with no row pointing at it. It's now reported like the recorder's other store failures. It isn't retried, since a write that timed out may still have gone in.
ChristopherPHolder
added a commit
that referenced
this pull request
Nov 22, 2026
* refactor: share the office's types from an office-domain library The schemas, the Console's HttpApi contract and the shared constants move out of recording-requests and activity-sign-in into libs/office-domain, which holds no SQL and no Node code. Lint keeps it that way and stops it importing the libraries that depend on it. recording-requests keeps the SQL, the migrations and the handlers; activity-sign-in keeps the OAuth exchange and the sessions. The page used to pull the stats reader's SQL into its bundle through the contract; it doesn't any more, and the bundle is 16 kB smaller. The telemetry settings the page reads at start-up are now an endpoint in the contract too, served by a handler, and the Worker's own route is only the Sentry tunnel. * chore: describe what recording-requests and activity-sign-in hold now * refactor: call the worker through its typed HttpApi client (#178) * refactor: call the worker through its typed HttpApi client The page described each endpoint a second time: a path, a schema run through Schema.toEncoded and a status code to tell errors apart. It now calls the Worker through HttpApiClient, built from the contract in office-domain, and gets decoded values and typed errors back. The bearer session is the SignedIn client middleware; the gateway retries and their Sentry reports are a client transform, as before, and an attempt that hangs for 15 seconds now counts as unanswered. Failures still name the endpoint and status when the contract doesn't declare them, and read as what the Worker meant when it does. Opening a recording gets its own number, so a late answer to an earlier look at the same recording no longer replaces the fresh one. The tests run against a fake Worker built from the same contract, and the whole-program test speeds up the polling for the bot's answer instead of waiting on real seconds. * chore: hold the console's page to the strict effect lint (#180) * chore: hold the console's page to the strict effect lint I put apps/console/src and libs/design-system under the same strict Effect rules as the bot and the Worker, and fixed what they found: Effect's Array, String and Record helpers instead of the native methods, Schema.Finite instead of Schema.Number, Effect instead of async functions in the fakes and specs, make() for the sign-in failures, deterministic service keys and the Option succeed helpers. The specs sit next to the code, so the override that lets tests provide layers inline now covers *.spec.ts too. resources.ts keeps looking up globalThis.fetch on every request so Sentry's wrapped fetch traces the API calls; global-fetch is off for that one file. * ci: open the console's built page in chromium and hold it to a size budget (#179) * ci: open the console's built page in chromium and hold it to a size budget Whether the built page starts in a real browser, and how big it gets, were only ever checked by hand. A smoke task now builds the Console and opens the page in Playwright's Chromium with the API answered by hand: it has to start, be styled, move between tabs with the arrow keys and throw nothing, and its scripts have to stay under 260 kB gzipped. CI installs Chromium and runs it after the builds. * chore: lint the console's page with foldkit's own rules (#181) * chore: lint the console's page with foldkit's own rules @foldkit/oxlint-plugin's recommended rules now run on the Console's page and the design system. They found the root copying a child's Model out of Recorder.signedIn, Recorder.failedSignIn, Stats.open and Consent.open, and the consent panel doing the same with ErasureAdmin.open, which would silently drop any Commands those return. Each now goes through Update.foldChild with the child's Step as its input. The recorder's draft is updated with modifyFields instead of spreads. * refactor: build the design system on foldkit's ui components (#185) * refactor: build the design system on foldkit's ui components The design system's interactive helpers now sit on @foldkit/ui, Foldkit's headless components, so the ARIA attributes, keyboard handling and focus management come from Foldkit and the markup and CSS stay ours. The tabs are its Tabs Submodel, wired into the page and the stats with a Model field, a Got message and Update.foldChild, which replaces the roving focus I had hand-rolled for the arrow, Home and End keys. The button, the text fields, the select, a new checkbox and a new disclosure use its stateless view helpers. The page now builds its controls from the package and stays off its pb- classes: the action item's checkbox and owner select, the refusal reason, the clickable recording row, the empty-list lines, and "Add a title and agenda", which becomes a disclosure drawn with the same marker as before. The generic utilities (stack-2, align-start, label, muted and the confirm box) move into the design system's CSS. The record button and the recording-duration formatters move into the page, which is the only thing that uses them. libs/design-system/README.md describes the package, its CSS files and every helper. * feat: render the console's first screen into its page at build time (#183) * feat: render the console's first screen into its page at build time The page used to arrive as an empty <div id="root"> and stay blank until 254 kB of script loaded inside Discord's frame. The build now renders init and view with Foldkit's server renderer and puts the result into dist/client/index.html, and the page hydrates that markup instead of drawing it again. Only the starting screen is rendered: who's asking is only known after the Discord SDK signs them in, in the browser. scripts/render-shell.ts builds src/entry.server.ts for Node after vp build and injects the render. The Foldkit plugin compiles one build id, the commit in CI, into both, so hydration refuses a page from another build. vp dev keeps starting the page fresh. * test: give the console's whole-program test time to sign in on a slow runner vi.waitFor gives up after one second by default. On GitHub's runners, signing in and the first status poll took a little longer, so the test failed while the page was fine. It now waits up to five seconds. * feat: serve the console's page alone against a fake office, with foldkit devtools (#184) * feat: serve the console's page alone against a fake office, with foldkit devtools pnpm --filter console dev:fake runs the page without the Worker, a database or Discord. A fake Worker built from the API contract and a fake Discord answer in the browser, and ?scenario= picks an idle, recording, paused, away or admin office. Starting, pausing and stopping a recording work. The fake Worker that the tests already used now lives in src/app/dev, so the tests and the dev mode share it, and none of it reaches the production bundle. The page also carries Foldkit's DevTools in development, with the Message schema so they can dispatch, and .mcp.json hands coding agents the same view through Foldkit's DevTools MCP server. * chore: upgrade effect to 4.1.5 (#186) * chore: upgrade effect to 4.1.5 effect and every @effect package move from 4.1.0 to 4.1.5, the latest release, inside Foldkit's ~4.1.0 range. @effect/tsgo moves from 0.63.0 to 0.67.7, the newest release that can patch the oxlint 1.89 that Vite+ 1.4 ships; 0.68 and later need oxlint 1.91 or newer, which comes with Vite+ 1.7. * fix: tell people the truth when a consent action fails, and keep the privacy tab's state (#187) * fix: tell people the truth when a consent action fails, and keep the privacy tab's state - A withdrawal the Worker refused said the bot would still withdraw it later, though nothing was stored. It now says nothing changed. When a withdrawal, deletion request, cancellation or admin decision gets no answer at all, the page says it can't tell whether it went through and shows where things stand, instead of claiming nothing changed. - Opening the Privacy tab again no longer resets it, so an action that's still running keeps its busy state and an admin keeps what they typed. - A refusal reason starts blank for each request and after Back, so it never carries over to someone else, and it survives a send that failed. - A late answer to an earlier stats request no longer replaces fresher numbers with an error. - When signing in through Discord fails, every tab says why instead of waiting forever. - Every tab points at a panel that's in the page; the tabs helper hides the ones not selected. - The action-item checkbox is a native checkbox labelled by the item's visible text, so screen readers read it once and clicking the text ticks it. * refactor: simplify the console's page and tidy the design system (#189) * refactor: give the design system one way to call each helper, typed tabs and no dead CSS - Tabs.create(tabs) builds a set of tabs once, so the Selected value comes back as one of their ids, and the view takes its slot from the tabs' Model. - Helpers that only wrap content (card, description, descriptionItem) take their children; noticeRegion takes an Option of a notice; badge, stat and heading take a config like the rest. - NoticeContent is a Schema, so the page can keep a notice in its Model without its own copy. - Person and avatar both use avatarUrl and isSpeaking. statusHeading always takes a description and a subheading that may be null. - card has one size, so CardSize and the md max-width rule are gone. - confirmBox renders the confirmation box the page used to build from the confirm classes, and blockButton gets its own pb-block-button base style. - The index stops exporting barShare, heatOf, initials, liveDot and the config types nobody imports. - CSS: the unused text styles, the dead .pb-btn:disabled rule and the comments are gone; the focus shadows are built from the focus colours; the global resets live in base.css, and sr-only and text-tabular in utilities.css. - New tests: tabs in the pills style, selectField's onChange, a disabled button with no click handler, and confirmBox as a group and as a form. * refactor: simplify the console's page without changing what it shows - Child steps fold with Update.foldChildStep, and History's edit Submodels with Update.foldChildAt. - Sign-in lives in one place: the recorder reads it as a view input, and its polling starts only once signed in, like History's. - The three edit Submodels keep one save state (Idle, Saving or Answered with a notice) instead of isSaving and notice. - The recorder and History share one request counter for ignoring stale answers. History keeps it on its Model and ignores every earlier request when a recording opens. Its list fetch, which only ever has one request in flight, just tracks whether one is. - History keeps its list and the open recording as AsyncData, so each view shows its own failure. - The recorder's settle composes its steps with Update.combine. - The answer polling repeats with Effect.repeat. - The page uses the design system's NoticeContent, noticeRegion with an Option, confirmBox and typed tabs, so viewOf and rangeOf are gone. - ErasureAdmin.open did what refresh does from Idle, so the privacy tab always refreshes. - Dead code: the FakeDiscord type, and exports used only in their own file. - The fake office builds its recordings from the History test fixtures. * perf: load sentry only when the console has somewhere to report (#188) @sentry/browser was about 52 kB of the page's 258 kB of gzipped script, downloaded by everyone even when the Worker has no Sentry configured. It's now a dynamic import: the page loads it once /api/telemetry names a DSN, or when there's a crash or a failed request to report. The page starts with 207 kB of script. The smoke test now budgets the scripts the page loads at start, at 220 kB, and checks that no other script loads when there's no Sentry. * fix: make the bot more reliable around restarts, reconnects and the database (#190) * fix: join the office when someone already in at startup agrees later The bot only moved on Opened and Emptied. Someone who was in the office when the bot started, and agreed to be recorded afterwards, filled it without an Opened, so the bot stayed out for the whole occupancy: no soundboard sounds or emoji were recorded and a recording carried over from before the restart was ended. Whether the bot should be in now follows who's admitted to the office, not the announcements. * fix: replace an office voice connection that drops after it was ready A voice WebSocket that closes with anything but 4014 takes the connection from Ready straight back to Signalling, without passing through Disconnected. The connection only watched for Disconnected or Destroyed after Ready, so a reconnect that never finished left the bot on a dead connection for good, and a recording started on it heard nothing. It now waits for any move away from Ready and gives every reconnect the same 20 seconds a first join gets. * fix: don't let a deletion be cancelled or refused once it's running The erasure reads the request once, then spends minutes taking the person's name out of Slack and deleting their audio before it deletes the rows. A cancel from the Console or a refusal from an admin in that window still succeeded, so the person was told it was cancelled, or the admin that it was refused, and the data was erased anyway. A request starts running when it's due, so cancelling, refusing and deleting now only apply before then. Agreeing to be recorded again still cancels it at any point, as the bot checks that again just before deleting. * fix: record an automatic recording stop the database missed When the office emptied or a recording hit its time limit, the bot stopped capturing first and then wrote the stop. If that write failed, nothing tried again: the bot had already let go of the recording, so it stayed running in the database, was never posted, and every later start ran into it. The stop is now kept until it's written, and each tick writes it before handling any request. * fix: pick up a recording from before a restart when the database is late On startup the bot checks for a recording that was running before it restarted, and either carries on with it or ends it. That check ran once, on the first presence, and gave up if the database didn't answer in time, which it's allowed not to while it starts. The recording then stayed running in the database with nobody capturing it, and every later start ran into it. Each tick now runs the check until it succeeds, before handling any request. * fix: keep what someone was saying when the voice connection fails mid-recording Capture flushed each speaker's unfinished clip when a recording stopped, but not when the voice connection failed: the stream was failed straight away and the receive streams destroyed without ending, so up to five minutes of the clip in progress was never saved. The unfinished clips are now handed on before the failure. * test: fail when pollUntil gives up instead of carrying on pollUntil stopped after its bound and returned whatever it last saw, so a test waiting for something that never happened carried on as if it had, and only failed if a later assertion happened to check the same thing. It now fails with what it last saw. * fix: answer Slack messages that Slack sends again after a reconnect Socket Mode dropped every event Slack delivered a second time, to avoid answering the same message twice. Slack only sends an event again when it didn't get the ack, so a mention sent while the bot was restarting for a deploy, or that reached a connection as it closed, was never answered, and a button press in an admin's DM was lost the same way. It now remembers the last thousand event IDs and drops only an event it already has. * refactor: build the three database-backed request stores with one helper The recording requests, recording edits and consent requests layers were the same five lines apart from the service they built. * refactor: drop folder exports nothing outside the folder imports The office, announcing, consent and erasure interfaces re-exported names only their own modules and tests use; tests import those from the modules directly. * refactor: find whose names to erase with the same queries the admins are shown The bot kept its own copies of the queries that find a person's names and Slack IDs, and of the shortest name worth matching, while the inventory the admins review used the library's. They matched, but nothing kept them matching. The bot now uses the library's. * fix: give up on a consent write that hangs, and try it again The voice activity writer treats a query that takes longer than 10 seconds as an outage and retries it, but the consent book waited on its reads and writes forever. A write hanging on a half-dead connection held up every consent event after it, and stopped the bot from shutting down cleanly. Both now share the same time limit. * fix: report a clip the database couldn't record A clip whose row couldn't be written was dropped with only an error in the journal, so nobody heard that part of a recording was missing, or that its audio was left in the bucket with no row pointing at it. It's now reported like the recorder's other store failures. It isn't retried, since a write that timed out may still have gone in.
ChristopherPHolder
added a commit
that referenced
this pull request
Nov 22, 2026
* chore: point coding agents at foldkit's source and skills The Console's page moved to Foldkit, and the Angular skills went with it, so agents had nothing to read for the framework. pnpm foldkit:vendor now fetches the Foldkit repository at the installed release into repos/foldkit, which git, lint, format and typecheck ignore. CLAUDE.md sends agents there before they write Foldkit code, and the project enables Foldkit's foldkit-skills plugin. effect is now a root dev dependency too, so node_modules/effect/AGENTS.md, which CLAUDE.md already told agents to read, exists at the root. * refactor: share the office's types from an office-domain library (#177) * refactor: share the office's types from an office-domain library The schemas, the Console's HttpApi contract and the shared constants move out of recording-requests and activity-sign-in into libs/office-domain, which holds no SQL and no Node code. Lint keeps it that way and stops it importing the libraries that depend on it. recording-requests keeps the SQL, the migrations and the handlers; activity-sign-in keeps the OAuth exchange and the sessions. The page used to pull the stats reader's SQL into its bundle through the contract; it doesn't any more, and the bundle is 16 kB smaller. The telemetry settings the page reads at start-up are now an endpoint in the contract too, served by a handler, and the Worker's own route is only the Sentry tunnel. * chore: describe what recording-requests and activity-sign-in hold now * refactor: call the worker through its typed HttpApi client (#178) * refactor: call the worker through its typed HttpApi client The page described each endpoint a second time: a path, a schema run through Schema.toEncoded and a status code to tell errors apart. It now calls the Worker through HttpApiClient, built from the contract in office-domain, and gets decoded values and typed errors back. The bearer session is the SignedIn client middleware; the gateway retries and their Sentry reports are a client transform, as before, and an attempt that hangs for 15 seconds now counts as unanswered. Failures still name the endpoint and status when the contract doesn't declare them, and read as what the Worker meant when it does. Opening a recording gets its own number, so a late answer to an earlier look at the same recording no longer replaces the fresh one. The tests run against a fake Worker built from the same contract, and the whole-program test speeds up the polling for the bot's answer instead of waiting on real seconds. * chore: hold the console's page to the strict effect lint (#180) * chore: hold the console's page to the strict effect lint I put apps/console/src and libs/design-system under the same strict Effect rules as the bot and the Worker, and fixed what they found: Effect's Array, String and Record helpers instead of the native methods, Schema.Finite instead of Schema.Number, Effect instead of async functions in the fakes and specs, make() for the sign-in failures, deterministic service keys and the Option succeed helpers. The specs sit next to the code, so the override that lets tests provide layers inline now covers *.spec.ts too. resources.ts keeps looking up globalThis.fetch on every request so Sentry's wrapped fetch traces the API calls; global-fetch is off for that one file. * ci: open the console's built page in chromium and hold it to a size budget (#179) * ci: open the console's built page in chromium and hold it to a size budget Whether the built page starts in a real browser, and how big it gets, were only ever checked by hand. A smoke task now builds the Console and opens the page in Playwright's Chromium with the API answered by hand: it has to start, be styled, move between tabs with the arrow keys and throw nothing, and its scripts have to stay under 260 kB gzipped. CI installs Chromium and runs it after the builds. * chore: lint the console's page with foldkit's own rules (#181) * chore: lint the console's page with foldkit's own rules @foldkit/oxlint-plugin's recommended rules now run on the Console's page and the design system. They found the root copying a child's Model out of Recorder.signedIn, Recorder.failedSignIn, Stats.open and Consent.open, and the consent panel doing the same with ErasureAdmin.open, which would silently drop any Commands those return. Each now goes through Update.foldChild with the child's Step as its input. The recorder's draft is updated with modifyFields instead of spreads. * refactor: build the design system on foldkit's ui components (#185) * refactor: build the design system on foldkit's ui components The design system's interactive helpers now sit on @foldkit/ui, Foldkit's headless components, so the ARIA attributes, keyboard handling and focus management come from Foldkit and the markup and CSS stay ours. The tabs are its Tabs Submodel, wired into the page and the stats with a Model field, a Got message and Update.foldChild, which replaces the roving focus I had hand-rolled for the arrow, Home and End keys. The button, the text fields, the select, a new checkbox and a new disclosure use its stateless view helpers. The page now builds its controls from the package and stays off its pb- classes: the action item's checkbox and owner select, the refusal reason, the clickable recording row, the empty-list lines, and "Add a title and agenda", which becomes a disclosure drawn with the same marker as before. The generic utilities (stack-2, align-start, label, muted and the confirm box) move into the design system's CSS. The record button and the recording-duration formatters move into the page, which is the only thing that uses them. libs/design-system/README.md describes the package, its CSS files and every helper. * feat: render the console's first screen into its page at build time (#183) * feat: render the console's first screen into its page at build time The page used to arrive as an empty <div id="root"> and stay blank until 254 kB of script loaded inside Discord's frame. The build now renders init and view with Foldkit's server renderer and puts the result into dist/client/index.html, and the page hydrates that markup instead of drawing it again. Only the starting screen is rendered: who's asking is only known after the Discord SDK signs them in, in the browser. scripts/render-shell.ts builds src/entry.server.ts for Node after vp build and injects the render. The Foldkit plugin compiles one build id, the commit in CI, into both, so hydration refuses a page from another build. vp dev keeps starting the page fresh. * test: give the console's whole-program test time to sign in on a slow runner vi.waitFor gives up after one second by default. On GitHub's runners, signing in and the first status poll took a little longer, so the test failed while the page was fine. It now waits up to five seconds. * feat: serve the console's page alone against a fake office, with foldkit devtools (#184) * feat: serve the console's page alone against a fake office, with foldkit devtools pnpm --filter console dev:fake runs the page without the Worker, a database or Discord. A fake Worker built from the API contract and a fake Discord answer in the browser, and ?scenario= picks an idle, recording, paused, away or admin office. Starting, pausing and stopping a recording work. The fake Worker that the tests already used now lives in src/app/dev, so the tests and the dev mode share it, and none of it reaches the production bundle. The page also carries Foldkit's DevTools in development, with the Message schema so they can dispatch, and .mcp.json hands coding agents the same view through Foldkit's DevTools MCP server. * chore: upgrade effect to 4.1.5 (#186) * chore: upgrade effect to 4.1.5 effect and every @effect package move from 4.1.0 to 4.1.5, the latest release, inside Foldkit's ~4.1.0 range. @effect/tsgo moves from 0.63.0 to 0.67.7, the newest release that can patch the oxlint 1.89 that Vite+ 1.4 ships; 0.68 and later need oxlint 1.91 or newer, which comes with Vite+ 1.7. * fix: tell people the truth when a consent action fails, and keep the privacy tab's state (#187) * fix: tell people the truth when a consent action fails, and keep the privacy tab's state - A withdrawal the Worker refused said the bot would still withdraw it later, though nothing was stored. It now says nothing changed. When a withdrawal, deletion request, cancellation or admin decision gets no answer at all, the page says it can't tell whether it went through and shows where things stand, instead of claiming nothing changed. - Opening the Privacy tab again no longer resets it, so an action that's still running keeps its busy state and an admin keeps what they typed. - A refusal reason starts blank for each request and after Back, so it never carries over to someone else, and it survives a send that failed. - A late answer to an earlier stats request no longer replaces fresher numbers with an error. - When signing in through Discord fails, every tab says why instead of waiting forever. - Every tab points at a panel that's in the page; the tabs helper hides the ones not selected. - The action-item checkbox is a native checkbox labelled by the item's visible text, so screen readers read it once and clicking the text ticks it. * refactor: simplify the console's page and tidy the design system (#189) * refactor: give the design system one way to call each helper, typed tabs and no dead CSS - Tabs.create(tabs) builds a set of tabs once, so the Selected value comes back as one of their ids, and the view takes its slot from the tabs' Model. - Helpers that only wrap content (card, description, descriptionItem) take their children; noticeRegion takes an Option of a notice; badge, stat and heading take a config like the rest. - NoticeContent is a Schema, so the page can keep a notice in its Model without its own copy. - Person and avatar both use avatarUrl and isSpeaking. statusHeading always takes a description and a subheading that may be null. - card has one size, so CardSize and the md max-width rule are gone. - confirmBox renders the confirmation box the page used to build from the confirm classes, and blockButton gets its own pb-block-button base style. - The index stops exporting barShare, heatOf, initials, liveDot and the config types nobody imports. - CSS: the unused text styles, the dead .pb-btn:disabled rule and the comments are gone; the focus shadows are built from the focus colours; the global resets live in base.css, and sr-only and text-tabular in utilities.css. - New tests: tabs in the pills style, selectField's onChange, a disabled button with no click handler, and confirmBox as a group and as a form. * refactor: simplify the console's page without changing what it shows - Child steps fold with Update.foldChildStep, and History's edit Submodels with Update.foldChildAt. - Sign-in lives in one place: the recorder reads it as a view input, and its polling starts only once signed in, like History's. - The three edit Submodels keep one save state (Idle, Saving or Answered with a notice) instead of isSaving and notice. - The recorder and History share one request counter for ignoring stale answers. History keeps it on its Model and ignores every earlier request when a recording opens. Its list fetch, which only ever has one request in flight, just tracks whether one is. - History keeps its list and the open recording as AsyncData, so each view shows its own failure. - The recorder's settle composes its steps with Update.combine. - The answer polling repeats with Effect.repeat. - The page uses the design system's NoticeContent, noticeRegion with an Option, confirmBox and typed tabs, so viewOf and rangeOf are gone. - ErasureAdmin.open did what refresh does from Idle, so the privacy tab always refreshes. - Dead code: the FakeDiscord type, and exports used only in their own file. - The fake office builds its recordings from the History test fixtures. * perf: load sentry only when the console has somewhere to report (#188) @sentry/browser was about 52 kB of the page's 258 kB of gzipped script, downloaded by everyone even when the Worker has no Sentry configured. It's now a dynamic import: the page loads it once /api/telemetry names a DSN, or when there's a crash or a failed request to report. The page starts with 207 kB of script. The smoke test now budgets the scripts the page loads at start, at 220 kB, and checks that no other script loads when there's no Sentry. * fix: make the bot more reliable around restarts, reconnects and the database (#190) * fix: join the office when someone already in at startup agrees later The bot only moved on Opened and Emptied. Someone who was in the office when the bot started, and agreed to be recorded afterwards, filled it without an Opened, so the bot stayed out for the whole occupancy: no soundboard sounds or emoji were recorded and a recording carried over from before the restart was ended. Whether the bot should be in now follows who's admitted to the office, not the announcements. * fix: replace an office voice connection that drops after it was ready A voice WebSocket that closes with anything but 4014 takes the connection from Ready straight back to Signalling, without passing through Disconnected. The connection only watched for Disconnected or Destroyed after Ready, so a reconnect that never finished left the bot on a dead connection for good, and a recording started on it heard nothing. It now waits for any move away from Ready and gives every reconnect the same 20 seconds a first join gets. * fix: don't let a deletion be cancelled or refused once it's running The erasure reads the request once, then spends minutes taking the person's name out of Slack and deleting their audio before it deletes the rows. A cancel from the Console or a refusal from an admin in that window still succeeded, so the person was told it was cancelled, or the admin that it was refused, and the data was erased anyway. A request starts running when it's due, so cancelling, refusing and deleting now only apply before then. Agreeing to be recorded again still cancels it at any point, as the bot checks that again just before deleting. * fix: record an automatic recording stop the database missed When the office emptied or a recording hit its time limit, the bot stopped capturing first and then wrote the stop. If that write failed, nothing tried again: the bot had already let go of the recording, so it stayed running in the database, was never posted, and every later start ran into it. The stop is now kept until it's written, and each tick writes it before handling any request. * fix: pick up a recording from before a restart when the database is late On startup the bot checks for a recording that was running before it restarted, and either carries on with it or ends it. That check ran once, on the first presence, and gave up if the database didn't answer in time, which it's allowed not to while it starts. The recording then stayed running in the database with nobody capturing it, and every later start ran into it. Each tick now runs the check until it succeeds, before handling any request. * fix: keep what someone was saying when the voice connection fails mid-recording Capture flushed each speaker's unfinished clip when a recording stopped, but not when the voice connection failed: the stream was failed straight away and the receive streams destroyed without ending, so up to five minutes of the clip in progress was never saved. The unfinished clips are now handed on before the failure. * test: fail when pollUntil gives up instead of carrying on pollUntil stopped after its bound and returned whatever it last saw, so a test waiting for something that never happened carried on as if it had, and only failed if a later assertion happened to check the same thing. It now fails with what it last saw. * fix: answer Slack messages that Slack sends again after a reconnect Socket Mode dropped every event Slack delivered a second time, to avoid answering the same message twice. Slack only sends an event again when it didn't get the ack, so a mention sent while the bot was restarting for a deploy, or that reached a connection as it closed, was never answered, and a button press in an admin's DM was lost the same way. It now remembers the last thousand event IDs and drops only an event it already has. * refactor: build the three database-backed request stores with one helper The recording requests, recording edits and consent requests layers were the same five lines apart from the service they built. * refactor: drop folder exports nothing outside the folder imports The office, announcing, consent and erasure interfaces re-exported names only their own modules and tests use; tests import those from the modules directly. * refactor: find whose names to erase with the same queries the admins are shown The bot kept its own copies of the queries that find a person's names and Slack IDs, and of the shortest name worth matching, while the inventory the admins review used the library's. They matched, but nothing kept them matching. The bot now uses the library's. * fix: give up on a consent write that hangs, and try it again The voice activity writer treats a query that takes longer than 10 seconds as an outage and retries it, but the consent book waited on its reads and writes forever. A write hanging on a half-dead connection held up every consent event after it, and stopped the bot from shutting down cleanly. Both now share the same time limit. * fix: report a clip the database couldn't record A clip whose row couldn't be written was dropped with only an error in the journal, so nobody heard that part of a recording was missing, or that its audio was left in the bucket with no row pointing at it. It's now reported like the recorder's other store failures. It isn't retried, since a write that timed out may still have gone in.
ChristopherPHolder
added a commit
that referenced
this pull request
Nov 22, 2026
… types and bot fixes (#175) The Console's page and design system move from Angular to Foldkit, and the stack of follow-ups that grew on top of it lands with it: - The page is a Foldkit program; the design system is built on @foldkit/ui (#175, #185). - libs/office-domain holds the schemas, the Console's HttpApi contract and the shared constants, with no SQL or Node code (#177). - The page calls the Worker through the typed HttpApiClient: decoded values, typed errors, gateway retries and a per-attempt timeout (#178). - Strict Effect lint and Foldkit's own lint rules cover the page and the design system (#180, #181). - CI opens the built page in Chromium and holds its start-up scripts to a gzipped budget (#179); Sentry loads only when it's configured, so the page starts with 207 kB of script instead of 258 kB (#188). - The build renders the first screen into index.html and the page hydrates it (#183); `pnpm --filter console dev:fake` serves the page against a fake office, with Foldkit DevTools and their MCP server (#184); agents get Foldkit's source and skills (#176). - Effect is upgraded to 4.1.5 (#186). - Review fixes: failed consent actions say what really happened, the Privacy tab keeps its state, refusal drafts don't carry over, stale stats answers are dropped, a failed sign-in shows on every tab, tabs point at real panels, and the action-item checkbox is labelled once (#187); the page is simplified without changing what it shows (#189). - The bot joins when someone already in agrees later, replaces a voice connection that drops, keeps speech when the connection fails mid-recording, writes a missed recording stop, answers Slack messages redelivered after a reconnect, refuses to cancel a deletion that's already running, and times out hung consent writes (#190).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The first lint override in
vite.config.tsnow coversapps/console/src/**andlibs/design-system/**, so the Console's page and the design system get the same strict Effect rules as the bot, the Worker and the libraries. The page's specs sit next to the code as*.spec.ts, so I added**/*.spec.tsto the override that turns offstrict-effect-providefor tests.Turning it on found 140 problems. I fixed 139 of them in the code:
prefer-effect-array: Effect'sArray.map,join,findFirstand the rest instead of the native methodsschema-number:Schema.Finiteinstead ofSchema.Numberprefer-effect-string:String.trim,padStart,slice,splitand similarasync-function: the fake Worker's fetch and the async specs now run as Effectsnew-schema-class:SignInFailure.makeandLinkFailure.makedeterministic-keyson theSessionToken,ConsoleApiandSessionservice keysprefer-succeed-some-or-none, 2schema-sync, 1prefer-schema-over-json, 1prefer-effect-recordand 1catch-to-or-else-succeedNothing a person sees has changed.
There's one exception.
resources.tshandsFetchHttpClienta function that looks upglobalThis.fetchon every request. Sentry wrapsfetchonce it starts, and holding on to the firstfetchwould leave the API calls out of its traces. Soglobal-fetchis off for that one file, andCONTRIBUTING.mdsays why.How I tested it
vp run cipasses: typecheck, check, every package's tests and the builds. No tests were removed or loosened. The Console specs that looked requests up withfind(...)?.fieldnow assert on anOption, so they also fail if the request was never sent.Checklist
vp run cipasses