You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2b906d9
Browse filesBrowse the repository at this point in the historyBrowse files
fix(plugin-audit): a write stamps only the rows it wrote; the backfill stamps the backlog
The keeper's reconcile after a user's write corrected every reply of the
discussion to the root rule, so the first reply on a discussion with many
replies written before the column existed turned into one system update
(with its audit and activity rows) per old reply, inside the user's request.
It now corrects stamped roots and stamps only the rows the write wrote; the
backfill stamps the rest, and the threads read counts unstamped replies by
their chain until it has. Docs and the changeset say so, and no longer claim
that the next comment stamps a record's replies.
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufziM2GUsShZcjp6TiyD
Copy file name to clipboardExpand all lines: .changeset/39142-comment-thread-root.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,10 +8,10 @@ perf(plugin-audit): the comment threads read counts replies with one grouped rea
8
8
Clause-②: yes (widening)
9
9
Metadata-protocol: none
10
10
11
-
`sys_comment` gains `thread_root_id`, a read-only column the platform writes on each reply: the id of the top-level comment the reply's `parent_id` chain leads to within its record's discussion, or the reply's own id when it is in no thread; `null` on a top-level comment. A reply belongs to a thread up to 15 levels below its top-level comment, the rule a thread's participants are already kept by; a reply 16 or more levels deep belongs to none. The create stamps a reply from its parent, and the keeper that maintains `participants` brings every reply of a discussion to the rule in the same reconcile and the same system write (the comment's `updated_at` kept), so a re-point or a delete moves the roots under it. A client's value never lands: the create stamp replaces it, an ordinary update has it stripped and reported in `droppedFields`, and an update under `preserveAudit` has it dropped.
11
+
`sys_comment` gains `thread_root_id`, a read-only column the platform writes on each reply: the id of the top-level comment the reply's `parent_id` chain leads to within its record's discussion, or the reply's own id when it is in no thread; `null` on a top-level comment. A reply belongs to a thread up to 15 levels below its top-level comment, the rule a thread's participants are already kept by; a reply 16 or more levels deep belongs to none. The create stamps a reply from its parent, and the keeper that maintains `participants` corrects every stamped root of a discussion in the same reconcile and the same system write (the comment's `updated_at` kept), so a re-point or a delete moves the roots under it. After a write it stamps only the rows that write wrote, so a reply on a discussion full of older replies never turns into one system update (with its audit and activity rows) per older reply. A client's value never lands: the create stamp replaces it, an ordinary update has it stripped and reported in `droppedFields`, and an update under `preserveAudit` has it dropped.
12
12
13
-
The comment threads read (`POST /api/v1/comments/threads/query`) now takes each thread's reply count and latest distinct repliers from one grouped read of the page's replies by that column, and one read of each candidate replier's newest reply, as the caller. Before, it read every reply on the page's records and followed `parent_id` in the server. The answer's shape is unchanged. One count differs: a reply exactly 16 levels deep was counted before and is not now, matching the rule the participants list and the comment panel follow.
13
+
The comment threads read (`POST /api/v1/comments/threads/query`) now takes each thread's reply count and latest distinct repliers from one grouped read of the page's replies by that column, and one read of each candidate replier's newest reply, as the caller. Before, it read every reply on the page's records and followed `parent_id` in the server. The answer's shape is unchanged. Two latest repliers who replied in the same millisecond are ordered by id. The exported `CommentThreadsEngine` type now requires `aggregate`, and without one the read answers 503. One count differs: a reply exactly 16 levels deep was counted before and is not now, matching the rule the participants list and the comment panel follow.
14
14
15
15
The read's cursor now pages by the millisecond a thread was created in, then by id, compared at the millisecond on both sides. PostgreSQL stores microseconds while every read hands back milliseconds, so two threads a database default stamped microseconds apart could be skipped at a page edge. A page whose last millisecond may hold more threads ends with that millisecond read again by id, so the page and the cursor agree. A cursor issued before this release still reads.
16
16
17
-
**After upgrading, run the backfill.** Replies written before this release carry no root. The read still counts them, by following each one up its chain, so no count drops, but that read grows with the number of such replies. `os migrate comment-participants --apply` stamps them (dry run first, `os migrate comment-participants`; idempotent), and the next comment written on a record also stamps that record's replies.
17
+
**After upgrading, run the backfill.** Replies written before this release carry no root. The read still counts them, by following each one up its chain, so no count drops, but that read grows with the number of such replies. `os migrate comment-participants --apply` stamps them (dry run first, `os migrate comment-participants`; idempotent). Until it runs, they stay unstamped: a later reply or a re-point stamps only the rows it wrote, so that a user's request never pays for a discussion's backlog.
0 commit comments