Changelog
Read recent changes to Engage, from new features to fixes and improvements. The source repository holds the full development history.
17 November 2026
4 commits- Import domain modules directly and delete the barrel (#119) (#155)
* refactor(store): import domain modules directly and delete the barrel (#119) Migrate every page, component and test importer from the deprecated src/lib/store.ts barrel to the owning domain module, then remove the barrel. The architecture test now fails if the barrel returns, if any source file imports it, or if a production lib module imports a page/component directory. * docs(architecture): document domain modules after barrel removal (#119) * chore(changelog): refresh snapshot for barrel removal (#119)
017f71b↗ - Delete unclaimed read model and dead settings getters (#153)
Remove buildAuthorizedMatterBriefing, which had no production caller: reporting, PDF and decision-record reads go through decision-record.ts, and the module's only consumer was its own test. Remove six exported settings getters that no production module called; the *State functions and DEFAULT_* constants remain the interface. No route, page, permission, DTO or settings behaviour changes. Update the architecture overview and hardening notes so they stop describing the deleted module. Refs #152
6311c68↗ - Cut fresh database initialisation cost (#136) (#151)
* perf(db): cut fresh database initialisation cost (#136) A fresh test database spent ~1.25 s in `initializeDatabase`, called 18 times per suite (~22 s). Index creation dominated: 92 `createIndex` calls, each a journal commit on a newly created collection. - Group the index catalogue by collection and send one `createIndexes` command per collection (46 commands). Keys, names, uniqueness, partial filters, TTL and `expireAfterSeconds` are unchanged; a failed grouped command falls back to per-index creation so one legacy conflict cannot block the rest, as before. - Bulk-write the 78 baseline policies instead of one upsert per record. - Split startup into `ensureDatabaseIndexes` (new `src/lib/db-indexes.ts`) and `seedBaselineContent`. `initializeDatabase` still runs both, so production startup and `getDatabase` are unchanged. Mongo tests that seed their own content use the schema half; notification-outbox keeps the full path and asserts the seeded register and indexes. - The in-memory preview implements `createIndexes` and `bulkWrite`. Verified on the local replica set: index phase 1.44 s -> 0.76 s and total 1.27 s -> 0.95 s over six interleaved pairs (shared host, so absolute wall time varied). A fresh database has the same 47 collections and 139 indexes, and the same 78 proposals and revisions, before and after. Full suite (833 tests) passed twice; each run left only `admin`, `config`, `engage` and `local`. * chore(changelog): record database initialisation change (#136) * fix(settings): tie-break site settings events by insertion order * chore(changelog): record the site event ordering fix
ad8deae↗ - Split store.ts god module into domain modules (#115) (#120)
* refactor(store): split store.ts god module into domain modules (#115) * docs(architecture): add module-boundary rule and update store docs (#115) * test(store): enforce acyclic dependency graph across domain modules (#115)
831e950↗
16 November 2026
2 commits- Paginate the public list and add a display-only tally projection (#52) (#112)
* feat(ballots): project display-only tallies after a committed vote Public list pages (/ and /proposals/) tallied every vote and decrypted every encrypted ballot just to show a count. Add a display-only ballot_tallies row per (ballotId, revisionId), written best-effort after the vote transaction commits. The projection is never authoritative: recordFormalDecision keeps recomputing the outcome from the bound votes and does not read it. A failed or slow projection write is logged as an operational event and cannot fail, delay or alter the vote. Vote changes decrement the previous choice and increment the new one, a re-cast of the same choice is a no-op, and rows are revision-scoped. The row stores counts and a timestamp only: no member id, choice, reason or envelope. listProposals can now omit vote tallies so public reads never touch proposal_votes; the web pages overlay certified results and the projection in the next commit. Adds the unique compound index to initializeDatabase and a rebuild/repair path for the CLI. Refs #52 * perf(proposals): paginate the public list and stop scanning ballots /proposals/ loaded every proposal, applied search, stage, branch and sort in the page, and decrypted every vote for the row totals. It now reads a bounded display page of 25 rows from MongoDB with server-side pagination. - Page, total, page count and range are computed from the filtered set; invalid or out-of-range pages clamp; ties order deterministically by proposal id. - Links keep q, stage, branch, space, sort, focus and joined; changing a filter starts at page 1. Pagination uses the Button primitive with previous/next and a live range status. - Each page self-references its canonical address and emits rel=prev/rel=next. The repository has no noIndex convention for parameterised lists, so pages stay indexable with a self-canonical rather than inventing one. - Rows no longer read proposal_votes. A certified ballot shows the tally stored on ballot_results; otherwise a fresh ballot_tallies row is used; a missing or stale row shows "Voting open — tally updating" with a link to the matter. - / overlays the same projection on the register it already reads, so home no longer decrypts votes either. Matters without a trustworthy aggregate are left out of the highlights rather than showing a wrong percentage. Visibility is still decided by canViewProposal and re-checked after the coarse MongoDB pre-filter; eligibility, ballot binding and deadlines are untouched. Refs #52 * feat(scripts): rebuild the ballot tally projection from votes Add npm run ballots:tally-projection. It reports missing, mismatched and orphan projection rows against the votes they should represent, and with --apply rebuilds them. It never deletes, edits or rewrites a vote and never certifies a result. Dry run is the default; --verify exits non-zero when rows need repair; an explicit --database is required; production writes additionally require --allow-production and --confirm-production engage_production. Encrypted votes need the ballot keys and the tool refuses to write a partial tally without them. Refs #52 * fix(proposals): keep the active stage tab and certified tallies correct The parsed stage is now '' rather than 'all' for an unfiltered list, so the All tab has to compare against '' to stay marked current. A certified result is authoritative even when the matter no longer carries a ballotRevisionId (for example after a zero-vote unbind). Resolve certified results by every visible matter's ballot, not only those with a current binding, so the row shows the recorded tally instead of falling back to no tally. Refs #52 * docs(status): record public list pagination and the tally projection Adds the before/after harness snapshots for / and /proposals/ (before 57402f0, after 65ace21) and records what changed: 25-row server pagination with filter preservation and canonical/rel links, a display-only ballot_tallies projection, certified tallies from ballot_results, and a neutral tally-updating state for missing or stale rows. The profiler window records 3 -> 0 proposal_votes operations on /proposals/ and 6 -> 0 on /, with getMore batches falling from three to one on every measured public page. Reports the /proposals/ HTML increase honestly: it renders 25 rows instead of 15 at the specified page size, not extra markup per row. Updates I12 and S4, notes the detail page's remaining live tally and the deployment step to backfill the projection, and adds the new collection and CLI to the architecture docs. Refs #52 * fix(ballots): move a re-bound amendment tally to the right revision row An amendment ballot can be re-bound to a newer wording revision. A member who had already voted on the previous revision casts again on the new one, so the previous count belongs to the old row, not the new row. The projection now learns the revision the previous vote was bound to and recounts both rows from their votes instead of applying a delta to the wrong row. Main matter ballots cannot reach this path: castVote refuses a ballot whose existing votes are not all bound to its current revision. Adds a projection test for the move. Refs #52 * docs(status): correct the public-list suite count The final run includes the revision-move projection test: 655 tests, 0 fail. Refs #52 * chore(changelog): record public list pagination and the tally projection Regenerates the public snapshot from this branch's history. The generator's fixed 80-commit window drops the oldest entries, which is the pre-existing truncation tracked in #96, not a decision in this slice. Refs #52 * fix(ballots): make tally projection writes atomic under concurrency The projection's first-vote path read the votes and wrote absolute counts when no row existed. A concurrent increment could land between that read and write, or after it, double counting; the full suite exposed it as an extra abstain. The normal path is now one atomic upsert increment, so a first vote creates the row and counts it in a single operation. Two concurrent first votes can no longer each create a row or lose one. A write conflict from a transactional revision move retries inside the deadline. The only remaining recount is for an unreadable prior vote and the repair CLI. It is compare-and-set guarded on an internal version token and bounded by a watermark recorded in appliedThrough, so an increment for a vote the recount already included is skipped, and an increment that landed first forces a fresh recount. The deadline is enforced before each write (and with maxTimeMS on the recount), so a timed-out rebuild leaves the row for the repair CLI instead of writing a stale absolute count. A revision move is two transactional deltas on the old and new rows, not a recount. A row whose counts are negative or do not sum to its total is never displayed; it reads as tally pending until repaired. Tests: many concurrent first votes, concurrent vote changes and a concurrent revision move each equal the authoritative tally; ten rebuild-versus-increment races; a recorder that a timed-out rebuild writes nothing; and the public list treating an inconsistent row as pending. Refs #52 * docs(status): record the race-safe projection write strategy Replaces the read-then-write description with the atomic strategy: an upsert increment for normal votes, transactional deltas for a revision move, and a compare-and-set recount bounded by a watermark and deadline for the last-resort path. Records that an internally inconsistent row is displayed as pending, the residual out-of-order watermark caveat, the concurrency tests and both full suite results. Refs #52 * chore(changelog): record the race-safe tally projection writes Regenerates the public snapshot from this branch's history. The generator's fixed 80-commit window drops the oldest entries, which is the pre-existing truncation tracked in #96, not a decision in this slice. Refs #52 * chore(changelog): record public read models after merging main
b8320aa↗ - Replace the notification React island with a native disclosure (#52) (#111)
* perf(header): replace the notification React island with a native disclosure The signed-in header fetched unread notifications from a React island hydrated with client:idle, which shipped the React runtime (~330 KB) on every signed-in page for one small bell. The bell is now a native <details>/<summary> disclosure backed by a small vanilla module. It reads the same read-only inbox endpoint without caching, only after idle or first open, and renders the latest five notifications. Escape closes it and restores summary focus, outside clicks close it, and only one header panel stays open. Without JavaScript the summary's anchor still opens the notification centre. Marking notifications as read remains in the member notification centre. Refs #52 * fix(header): match the notification panel to the established header shadow * docs(perf): record the React-free header measurements and remaining #52 scope The audit now reports the signed-in header before/after harness snapshots, the pages that no longer ship React, the unchanged database command counts and the inline-script trade-off on anonymous pages. The tracker's I12 line records the header slice as done while leaving the tally read model and member-list pagination as the remaining #52 work. Refs #52 * chore(changelog): refresh the snapshot for the header performance work * fix(header): keep a retry from issuing duplicate inbox reads * chore(changelog): refresh the snapshot for the header retry guard * chore(changelog): record the header performance work after merging main
57402f0↗
15 November 2026
2 commits- Paginate the proposal register and stop reading ballots (#52) (#103)
* perf(admin): paginate the proposal register and stop reading ballots The proposals register loaded every proposal, including its rationale, and decrypted every vote for the rows in Decide so it could show live tallies. It sent ~1 MB of HTML and did per-vote work on a list read. The register now reads a bounded page of 25 rows from MongoDB, ordered by proposal id, with search, stage and branch filters applied server-side and the viewer's branch scope preserved. Page links keep the active filters; changing a filter starts at page 1; invalid or out-of-range pages clamp. Pagination uses the existing Button primitive with previous/next, the current page and a status region announcing the visible range. `listProposalRegister` projects the register fields only (no `details` or `detailHtml`) and never touches `proposal_votes`, so no ballot is decrypted on a list read. For a certified ballot it shows the tally, computed result and rule basis stored on `ballot_results` at certification. An open ballot shows "Open — view ballot" instead of live counts, and a closed but uncertified ballot links to the workspace to record the outcome. The detail workspace keeps the live bound tally and the result form unchanged; recording from the list would require decrypting every vote. Editing, revising and creating still resolve their full record, including rationale, from any page, with the same scope and lock checks. Measured with `npm run perf:render` (78 synthetic proposals, 1200 votes, 3 runs, administrator): HTML 938,422 B → 283,915 B (−69.7%); document DB commands 19 → 16; document DB time 28.7 ms → 16.0 ms; TTFB 103.1 ms → 57.6 ms. A MongoDB profiler window shows the register request reads proposals, comments, ballot_results, ballots, amendments and revisions, and no `proposal_votes`. Refs #52. * fix(admin): keep legacy register records keyed by policyId and status Legacy proposal documents store the identifier, stage and topic space under `policyId`, `status` and `category`. The register's narrow projection only asked for the current field names, so the shared normaliser would have seen an empty identifier and defaulted the stage to Deliberate. Project the alias fields too (still excluding rationale and ballot data), and match the stage filter against a stored `status` when a document has no `stage`. Adds a regression case for a legacy-shaped record: it keeps its identifier, its normalised stage, its space, and remains searchable by rationale without returning it. Refs #52. * docs(status): record register pagination and the tally-free list read Adds the before/after harness snapshots for `/admin/proposals/` (base `78c07c0`, after `c1f72c0`) and records what the register now reads and shows: one 25-row projected page, no `proposal_votes` access, certified tallies from `ballot_results`, and links instead of live counts for uncertified ballots. Records the trade-offs honestly: inline outcome recording moved to the workspace, "Open amendments" counts the whole register rather than the filtered subset, and search moved into MongoDB while still matching rationale. Updates I12/#52 without claiming the member-facing vote scans are done, and notes the small in-memory database fidelity improvements from this slice. * chore(changelog): refresh snapshot for register pagination Regenerates the public changelog from this branch's history: the register pagination, the legacy-record fix and the audit/status updates appear as the newest entries. Side effect of the generator's fixed 80-commit window: the oldest entries fall out of the snapshot. That truncation is the pre-existing generator defect tracked in #96, not a decision in this slice. * chore(changelog): record the register pagination after merging main * chore(changelog): record the register pagination after merging main * chore(changelog): record the register pagination after merging main * feat(admin): add on-demand inline outcome recording and address register review findings
86f9de6↗ - Typed ballot commands and central route policy (#53) (#94)
* refactor(governance): add typed ballot commands and central route policy Extract ballot.bind and ballot.record_result into typed commands that call the existing domain functions, and declare both routes in one policy table. Routes now validate input, run the command and map errors; no permission literals or role checks remain in the route files. No governance behaviour changes. * test(governance): prove ballot command and route policy equivalence Cover policy-table drift, the authorisation matrix for both commands, route authentication, bind idempotency and record_result preconditions against a real MongoDB replica set. Existing route suites continue to exercise the same behaviour. * docs(governance): document the command contract and mark #53 partial Describe the typed command contract, the central route policy table and the two-stage authorisation rule. Record that the ballot lifecycle is extracted while proposals, amendments and membership remain route-local. * chore(changelog): refresh the snapshot for the ballot command layer * fix(governance): preserve bind route error mapping and harden route drift guard Map domain errors per route so a BallotDomainError escaping bind still returns the generic 400, while result keeps its 409. Discover governed routes recursively across .ts, .js and .mjs with all handler export forms. Rename the route-level helper to authoriseGovernanceRouteRole and document the deliberate coarse-gate repeat. Correct the precondition wording: the delegated domain function enforces it. * test(governance): cover bind conflict status, route scope denial and recursive discovery Prove the bind route still returns 400 with one binding event for a conflicting ballot revision, prove an out-of-branch result request is denied with no write, and prove each declared audit event is written. Add temporary-directory fixtures for nested, index, JavaScript and re-exported routes, plus a malformed-body ordering check. * docs(governance): correct command preconditions and route policy scope Preconditions and effects are documentation enforced by the delegated domain function, not re-checked by the command layer. Describe the coarse role gate, its defensive repetition, per-route error mapping and recursive route discovery. * chore(changelog): refresh the snapshot after the PR review fixes * chore(changelog): record the command layer after merging main * chore(changelog): record the command layer after merging main * chore(changelog): record the command layer after merging main * chore(changelog): record the command layer after merging main * chore(changelog): record the command layer after merging main * chore(changelog): record the command layer after merging main * chore(changelog): record the command layer after merging main * fix(governance): inspect multi-binding route exports and clarify command preconditions
c94e3f9↗