Skip to content

FRM-17: summarize timing and guard response completion - #38

Merged
xgame92 merged 2 commits into
mainfrom
fix/frm-17-completion-timing
Dec 3, 2026
Merged

xgame92 merged 2 commits into
mainfrom
fix/frm-17-completion-timing

Conversation

@xgame92

@xgame92 xgame92 commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

What and why

Persist the reached active-time total in the same batch that completes a response and deletes unreached answers. Completed responses have a timing summary immediately. Older rows with a null summary keep the bounded repair path.

Guard each completion write with the answer revision read before validation. If a save wins, recompute reach and required answers before retrying. Database triggers advance the revision on answer writes from both Worker versions during rollout. Position-only updates and duplicate saves keep the revision stable.

FRM-17

How it was tested

  • pnpm verify passed all 721 tests and the build on the final head. Hosted CI check passed.
  • All 96 focused tests and independent review passed on the final patch.
  • Removing the timing write or revision guards reproduced the corresponding regressions. Removing the triggers reproduced deletion of an answer reached by a previous-version Worker save.
  • Hosted pnpm test:e2e passed 174 Chromium tests with eight existing skips. CI run

Deploy notes

  • Apply D1 migrations 0015_answer_revision.sql and 0016_answer_revision_triggers.sql before the new Worker. The timing repair remains available for existing completed rows.
  • Draft Add isolated public Forms embeds #28 also uses migration number 0015. The branch that lands second must regenerate its migrations against the updated main.

Store the reached timing total in the completion batch and guard its pruning against a database-managed answer revision. Keep timing repair for older completions and retry when a concurrent save changes which questions the response reaches.
@xgame92

xgame92 commented Dec 3, 2026

Copy link
Copy Markdown
Member Author

recheck

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent exact-head review of ceb5dd47dd72d8d06a8ff486b1c0ea4c468379ac.

I find no blocking issue.

  • Migration order is additive and rollout-safe as written: 0015 only adds response.answer_revision with a default, then 0016 adds database triggers. A previous Worker can keep writing through the column addition, and once the triggers exist its answer inserts/updates advance the revision even though that Worker does not know the column. Position-only writes and already-applied marked saves do not write answer, so they do not advance the revision.
  • Completion uses the revision read before answer evaluation as a conditional guard in every completion statement. A concurrent save therefore invalidates deletion of unreached answers and the completion update together, and the bounded retry recomputes required/unreached answers from the newer rows instead of completing from stale state.
  • The reached active-time total is calculated in the same final completion statement after the conditional unreached-row deletes in the same batch, so the stored summary matches the answers that remain reached. Completed rows cannot receive further answer writes, which also makes the bounded null-summary repair stable.
  • The synthetic regression coverage is strong: it exercises a save winning just before completion, a branch opening with required and optional follow-ups, a previous-Worker write winning during rollout, persistent concurrent saves, save retry/position-only revision stability, withdrawal winning, duplicate completion, and median/backfill behavior.

I independently ran the focused suites at this tree: 56/56 passed. I also ran full pnpm verify: exit 0, including 517/517 web tests, 87/87 schema, 48/48 results and 58/58 tally-import tests plus the build. Hosted check, e2e, changes, cla and Devin Review are green at this head.

One coordination caveat, already in the PR body and not a defect of this diff: if draft #28 lands first with its own migration 0015, this branch must regenerate its migrations before landing. No merge, deployment or production action performed.

@xgame92
xgame92 marked this pull request as ready for review December 3, 2026 07:57
@xgame92
xgame92 merged commit e212af2 into main Dec 3, 2026
5 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant