Changes to Engage

Changelog

Read recent changes to Engage, from new features to fixes and improvements. The source repository holds the full development history.

17 November 2026

1 commit
  1. Fixdiscussion
    Bound comment vote retries by time, not attempt count (#123) (#134)

    * fix(discussion): bound comment vote retries by time with backoff (#123) The comment vote compare-and-swap gave up after 12 fixed attempts with a 2-8 ms jitter. On a cold replica set the first write can take hundreds of milliseconds, so 25 concurrent voters exhausted the attempts and valid votes failed with 'Comment votes changed at the same time. Try again.' Retry on a five-second time budget instead, with exponential backoff and jitter (4 ms doubling to a 250 ms cap). Legitimate contention converges even when writes are slow; a genuinely stuck writer still fails in bounded time. Exactly-once is unchanged. The write is still one version-filtered compare-and-swap of the whole vote state, so a lost race writes nothing and retries against the committed state. Voter arrays, switching between upvotes and downvotes, and the persisted shape are untouched. Expiry now logs comment_vote_retry_budget_exhausted with the comment ID, attempt count and budget only - never member IDs or vote choices - before throwing. Tests add a deterministic cold-write case (40 ms per comment write) that fails under the old attempt count and passes now, plus a stuck-writer case proving the budget is bounded and the warning is emitted without identities. * chore(changelog): record bounded comment vote retries (#123) Regenerates the public snapshot so the fix commit appears on /changelog/. The 80-commit window still drops the oldest entries, which is the pre-existing truncation tracked in #96. * fix(discussion): make the comment vote retry budget configurable (#123) The 5 s retry budget was a fixed constant. Under full-suite load the injected 40 ms cold-write test needed longer than 5 s to converge and failed, even though votes were not actually lost. Read the budget from ENGAGE_COMMENT_VOTE_RETRY_BUDGET_MS at call time. Unset, empty or invalid values use the 5000 ms default; values are clamped to 250-60000 ms so a bad setting cannot remove the bound. The expiry warning records the effective budget. The stress test now runs with a 15000 ms budget, proving convergence under injected slow writes on a loaded machine while production keeps the 5 s default. The stuck-writer test uses the 250 ms floor so it stays fast, and asserts the default, fallback and clamp rules. Exactly-once is unchanged: the write is still one version-filtered compare-and-swap of the whole vote state, and no persisted shape or privacy boundary changed. * chore(changelog): record the configurable comment vote retry budget (#123) Regenerates the public snapshot so the stabilisation commit appears on /changelog/. * refactor(discussion): inject the comment vote retry budget instead of an environment variable (#123) Configuration belongs in the administration panel; environment variables are reserved for secrets, bootstrap and deployment topology. Remove ENGAGE_COMMENT_VOTE_RETRY_BUDGET_MS from the vote path. The production budget stays a fixed 5000 ms module constant. Tests pass an explicit optional fifth argument to voteOnComment, an injection point that is validated and clamped to 250-60000 ms; production callers omit it. The expiry warning still records the effective budget. The concurrency tests pass 15000 ms so a loaded runner cannot turn a machine stall into a false failure, and the stuck-writer test passes 1 ms (clamped to the 250 ms floor) so it stays fast. Exactly-once assertions, the persisted shape and the privacy boundary are unchanged. Docs remove the environment-override wording. * chore(changelog): record the injected comment vote retry budget (#123) Regenerates the public snapshot so the refactor appears on /changelog/. * chore(changelog): record bounded comment vote retries after merging main

    b0e0c81 ↗

16 November 2026

2 commits
  1. Fixballots
    Remove the tally projection watermark and make rebuilds compare-and-set only (#124)

    * fix(ballots): make the tally projection rebuild compare-and-set only The merged projection skipped increments whose vote timestamp was at or below an appliedThrough watermark that a rebuild believed it had counted. Under concurrency that watermark was wrong: a vote could be visible to the increment but not the recount, so the increment was skipped and the row under-counted. The full suite failed on main with 7 votes in the row against 8 votes. Remove appliedThrough and its timestamp guard entirely. Increments always apply: each is one atomic upsert of the choice, total and an internal monotonic version. Nothing is skipped. The rebuild is now absolute and compare-and-set only. It reads the row version (0 when the row is missing), recounts every bound vote, and writes absolute counts only if the version is unchanged, advancing it by one. A mismatch recounts and retries, bounded. A concurrent increment either lands before the recount (the absolute write is correct) or after the compare-and-set (it adds on top). The 500 ms deadline still writes nothing, leaving the row for the repair CLI. Revision moves remain transactional deltas and certification still never reads the projection. Tests: 20 rounds that deterministically interleave an increment between the rebuild's recount and its compare-and-set (and after it), asserting exact equality with the authoritative bound tally every round; an increment after an absolute rebuild is applied; the concurrent first-vote, change and revision-move cases remain. The projection test file raises its write deadline under load because a timed-out write is allowed to be abandoned; the timeout case still asserts that nothing is written. Refs #52 * docs(status): record the compare-and-set-only projection rebuild Removes the appliedThrough watermark description and records the merged under-count it caused. Documents the current contract: unconditional atomic increments, transactional revision moves, and an absolute recount that writes only when the row version is unchanged, retries when it moved, and writes nothing at its deadline. Records the 20-round interleaved race test, the 12-test projection suite run ten times, both 713-test full-suite runs, the residual delayed-increment window, and the configurable test deadline. Refs #52 * chore(changelog): record the compare-and-set-only 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 * chore(changelog): record the projection race fix after merging main

    8693fbb ↗
  2. Fixmember,admin
    Keep unread updates and label votes correctly (#108, #56) (#109)

    * fix(member): keep unread updates until the member dismisses them My Engage advanced engage_member_last_seen on every page load, so navigating away and back hid updates the member never opened. Reading the page now only resolves the window; the cursor advances only through POST /api/member/updates/dismiss. Adds a 'Mark updates as seen' action to the catch-up digest, a matching status message, a seven-day window for members who have never dismissed updates, and a pure helper so the window, list and counts share one rule. Refs #108 * fix(admin): classify votes as votes in the participation feed The panel built vote activities with kind 'vote' but only handled 'votes', so every vote rendered as a proposal submission with the wrong filter and count. Encrypted ballot records carry no member identity, which made the mismatch affect all recent votes. Votes, contributions and proposals now share one classifier and one seven-day window. Vote rows use the recorded timestamp and the existing canViewIdentifiableBallots gate; encrypted records render as 'A member' and choices, reasons, tallies and envelopes are never read. Replayed records collapse by ballot and voter, while separate ballots and voters remain separate rows. The summary strip and tabs are derived from the same rows, and the previously truncated feed now shows the whole window. Refs #56 * chore(changelog): regenerate snapshot for member updates and participation fixes * chore(changelog): record the member and participation fixes

    29c794d ↗

15 November 2026

2 commits
  1. Fixpolicies
    Resolve a branch's public slug for registry addresses (#93)

    Production's Victorian branch predates the standard identifiers and has a UUID, so a policy address derived from the branch ID would be unusable and the import could not target the existing branch without creating a duplicate. - branch records may carry an explicit public slug (vic, nat); - the registry resolves /policies/<slug>/ and import targets by that slug; - ratification writes the branch slug onto new policy records; - the standard branch migration backfills a missing slug without renaming, re-parenting or un-recognising an existing branch; - the import CLI accepts either the branch ID or its public slug.

    20dfa90 ↗
  2. Fixballots
    Make the ballot_results index migration preflighted and recoverable (#55) (#83)

    * feat(ballots): make the ballot_results index migration explicit and recoverable Startup no longer creates or drops the ballot_results indexes as a silent side effect. A legacy collection is reported and left untouched; a fresh one still receives the indexes; an already-migrated one is a no-op. `npm run ballots:results-index` adds preflight, dry-run, apply, verify and recovery commands. Apply backs up the index definitions and documents before change, proves the unique partial ballotId index before dropping the legacy unique proposalId index, verifies the final state, and records the actor and backup in data_migrations. Failures are recorded and re-raised instead of being swallowed. Duplicate results are reported for human reconciliation; nothing deletes or rewrites ballot results to make an index fit. Tests: eight replica-set cases cover a fresh install, legacy startup, duplicate blockers, dry run, full apply, partial apply, re-run, loud failure and recovery reporting. The Sprint 1 integrity test now asserts the explicit contract rather than the old startup upgrade. Also records PR #51 as merged to main and the resolved migration risk (#55). Closes #55 * chore(changelog): record the ballot-results index migration * docs(security): record Turnstile as merged to main

    15f7ac5 ↗

13 November 2026

5 commits
  1. Fixballots
    Show single relative ballot deadline in viewer's local timezone (#47)
    db6d4b8 ↗
  2. Fixballots
    Look up encrypted votes by blind index in member queues and activity (#45)
    14ae304 ↗
  3. Fixbranding
    Remove internal Horizon label from public and verification emails (#24)

    * fix(branding): remove internal Horizon label from public and verification emails * chore(changelog): update changelog snapshot

    787160a ↗
  4. Fixbranches
    Reuse existing identities and accept national concerns
    2a7452a ↗
  5. Fixsense-box
    Accept local concerns before branch setup
    7efcbbb ↗

9 November 2026

2 commits
  1. Fixvoting
    Refresh proposal hero after saving a vote
    7560540 ↗
  2. Fixengagement
    Repair proxy test sends and clarify admin delivery reporting

    Use JSON and the configured public origin to prevent the reverse proxy from rejecting admin test email before provider submission. Separate explicit provider rejection from uncertain sends, expose safe self-only receipts, and keep test bounces isolated from member preferences. Replace raw engagement reporting with responsive cards, period controls, a read-only audience preview and expandable diagnostics. Historical ballot opportunity coverage remains explicitly unavailable. Validation: 144 tests passed, 15 optional tests skipped; Astro check and build passed; mocked-provider HTTP and DOM interaction checks passed. Browser screenshots and authenticated production delivery remain blocked and are documented.

    34166c8 ↗