Repository navigation
server: a statement is stored before its language is detected - #3189
Draft
colinmegill wants to merge 2 commits into
Draft
colinmegill wants to merge 2 commits into
colinmegill wants to merge 2 commits into
Conversation
Language detection was the comment path's only outside call and ran before the store, so a hung detection service could delay a citizen's statement by up to its timeout. The statement is now stored and answered first; detection runs after it and lands in the same columns; the response, the author's auto-vote, moderation and strict-mode hiding are unchanged. Until detection lands, the statement's language is null for readers. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s
Bulk CSV import started one detection call per row at once; a constant bounds the in-flight calls to four. Statement acceptance is unchanged. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s
Delphi Coverage Report
|
This branch has not been deployed
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.
Observable changes (ruling needed before this leaves draft)
langandlang_confidenceare null when the statement is accepted and are filled in afterwards; on a detection failure, timeout or process exit they stay null, with no retry.lang: null: both participation clients then show no translate button for that showing, and the next-statement selection may store a machine translation into the reader's own language.comments.modifieda second time, which can cause one extra math recompute.LANGUAGE_DETECTION_CONCURRENCY = 4); it had started one call per row at once.Why
Language detection was the comment path's only outside call and ran before the store (
comment.ts:468, capped byTRANSLATION_TIMEOUT_MS= 5000), so a hung detection service could delay a citizen's statement by up to five seconds. The participation path must always answer.Race
No lost update and no write to a deleted row: the two UPDATEs set different columns under a row lock; a test shows a late language result keeps a moderator's ban; no product code deletes statement rows, and an UPDATE on a missing row does nothing.
Tests
Failing-first: a hung detection service no longer delays the store (timings in the delivery's results); the comment and vote suites, the participation-under-load integration test and the comment-path tests from PR #3156 pass unchanged. Reviewed independently: publish as-is; the observable changes above are for the owner's ruling.
🤖 Generated with Claude Code
https://claude.ai/code/session_018NVGBuYCk4EZmiz4csUv9s