Repository navigation
Labels
area:datadomain:serverDomain lane — seat card indexed by label:pm:seatpm:dispatchedDispatched to a dev agent by /pm-dispatchpriority:p2Medium: important, M3
Description
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzfHCzQWh6PeQnvToFz
立卡门类别:③ 专题子卡的后续(#39084 / PR #39135 的 L2 记录留下 N1、N2 两条 nit,座位修订 7347081374 裁定合并立一张卡)。Source: #39084
Part of #39077 · follow-up of #39084 (S3)
定级:area:data · Feature · priority:p2 (seat ruling 7347081374) · reach: a list whose page of threads has many replies; PostgreSQL rows whose created_at was written outside the driver
维护者速读
- 列表页评论栏的「按当前视图取评论串」读取(Comments: one read returns the threads on the records a list filter selects, as the caller #39084)算每条讨论的回复数和最近回复人时,会把这一页记录上的所有回复都读出来在程序里数。回复很多时读得多、慢。
- 另有一个边角:分页游标按毫秒比较创建时间,PostgreSQL 存的是微秒。平台自己写的时间都是毫秒,只有绕过驱动直接写库的行,才可能在翻页边界被漏掉一条。
- 本卡两件一起做:让回复数和最近回复人由数据库算出来,并让游标在微秒精度下也不漏不重。
Scope and acceptance
- Layer: server (plugin-audit, maybe platform-objects for a column) ·
area:data· Feature · size M · p2 - N1 — reply counts without the in-app walk. Today
readReplies(packages/plugins/plugin-audit/src/comment-threads-query.ts) reads every reply on the page's records, keyset-paged atREPLY_PAGE_SIZE= 1000, andthreadExtraswalksparent_idto each reply's thread root. The reason is thatsys_commentstores no thread root:thread_idis per record, and a reply at depth 2+ names only its parent. That is unbounded reads per page, against AGENTS.md Prime Directive 5 (SQL first).- Scope: give each reply a stored thread root, which the platform writes the way Comments: a thread stores who took part, so 'threads involving me' filters in one query #39081 writes
participants. Backfill it. Then count replies and pick the latest 3 distinct repliers with a grouped read by that root, as the caller. - Acceptance: one page costs a bounded number of statements whatever the reply count, and the answer is identical to today's for the same rows. A two-user test pins the reply count at depth 3, the latest-3-distinct order and an orphaned reply.
- Scope: give each reply a stored thread root, which the platform writes the way Comments: a thread stores who took part, so 'threads involving me' filters in one query #39081 writes
- N2 — keyset at microsecond precision. The cursor compares
created_atas the ISO texttoISOStringwrites (milliseconds), while PostgreSQLtimestamptzholds microseconds. Platform writes are stamped at milliseconds, so only a row written by the database default or outside the driver can sit between two cursor values and be skipped at a page edge.- Scope: either carry full precision in the cursor, or make the comparison truncate on both sides.
- Acceptance: a live-PG test with two threads 1 µs apart across a page boundary answers both, once each.
- Files it needs (read against the tree when building):
packages/plugins/plugin-audit/src/comment-threads-query.tsand its tests,comment-participants.ts(the keeper pattern),packages/platform-objects/**/sys-comment.object.ts,packages/qa/dogfood/test/comment-threads-query.dogfood.test.ts(PG cells needOS_TEST_POSTGRES_URL, not measured in CI). - Clause-②: no — the answer's shape is unchanged.
- Metadata-protocol: none
Dedupe: thread_root sys_comment, comment reply count thread root, keyset microsecond timestamptz (open issues) → only the epic #39077 and unrelated cards.
Metadata
Metadata
Assignees
Labels
area:datadomain:serverDomain lane — seat card indexed by label:pm:seatpm:dispatchedDispatched to a dev agent by /pm-dispatchpriority:p2Medium: important, M3
Activity
objectstack-fleet commentedon Dec 2, 2026
triage@os-warren · os-warren · session_01JQwxbZzZ2f5mzcvJbRrRNZ
First touch · 2026-12-02T14:06Z
定级:
area:data · Feature · p2 · 回复很多的列表页读得多且慢;绕过驱动写入的 PostgreSQL 行可能在翻页边界漏一条 · 读码(#39084 L2 的 N1、N2)domain:server、类型 Feature,进pm:queue(作者定级保留)。专题 专题:列表页右上角的评论入口——看当前视图里各条记录的评论串,可回复、可解决,不能写新评论 #39077 子卡;与在飞 PR feat(plugin-audit,spec,client): one read returns the comment threads on the records a list filter selects, as the caller #39135 同改comment-threads-query.ts,宜在其合并后开工。objectstack-fleet commentedon Dec 2, 2026
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhPdWmTd47Fi2bKYZS
Claim: card thread of seat repo:objectstack@os-support-ai, epic #39077 (list-page comments), follow-up of S3 (#39135)
Session:
session_01WGufzhPdWmTd47Fi2bKYZSThread session:
session_01WGufziM2GUsShZcjp6TiyDAccount:
os-support-aiBranch:
claude/project-thread-ovqx20Domain:
domain:serverSeat:
repo:objectstack@os-support-aiFile surface:
packages/plugins/plugin-audit/src/objects/sys-comment.object.ts,comment-participants.ts,comment-participants-backfill.ts,comment-threads-query.ts,index.ts, with their tests;packages/cli/src/commands/migrate/comment-participants.tsand its test;content/docs/deployment/cli.mdx,content/docs/api/data-api.mdx,content/docs/permissions/system-context.mdx(row 45a and the census);docs/audits/2026-08-tenant-audit-write-call-sites.counts/plugins/plugin-audit.md(regenerated only, never hand-edited);packages/qa/dogfood/test/comment-threads-query.dogfood.test.tsandcomment-thread-participants.dogfood.test.ts; a changeset. Stop on breach; explain in the report.Container & model:
M,mode:card-thread(built in the thread),model: TIER_DEFAULT,effort: high; contract-tier L2 at CONTRACT_REVIEW_TIER (served column); L1 by osa-L1-a.Clause-②: yes (widening): a new served, readonly, platform-written column
sys_comment.thread_root_idMetadata-protocol: none
Responsibility:
n/a — follow-up cardPremise: the threads read in #39135 counts replies and the newest repliers by reading every reply on the page. N1: a stored thread root, kept by the participants keeper in the same reconcile write and stamped from the parent at insert, lets the read count with one grouped aggregate run as the caller, plus one bounded read for the top-3 repliers (at most 5 statements per page). Backfill rides
os migrate comment-participants --apply. N2: the read door folds PG timestamps to milliseconds, so the cursor pages by (millisecond bucket, id), with one extra bounded read of the boundary bucket.Seat rulings on the two deviations in the proposal:
< 16hop rule of the participants and resolution keepers, so a reply at exactly depth 16 is not counted. Accepted for consistency, and stated in the PR and the docs.--apply" would be a visible regression. Replies without a stored root must still be counted, for example by keeping the bounded old walk for rows whose root is null, or by stamping roots lazily. Pin it with a test of a pre-backfill page. If no bounded fallback exists, stop and fork back to the seat.Serial constraints:
check-handover.mjs --inflightmeets cli:os migrate meta --from 18says addingviewAllFields: truekeeps a permission set's field reads, but a set with Modify All and its own row hiding a field still loses that field (read and edit) on 19 — the tool should name such entries #38924 (seat repo:objectstack@os-justin, claim 7346881638) only through its widecontent/docs/**. This card edits named rows in three doc pages; whichever lands second merges main. List page: a header comments icon opens a side column with the current view's threads #39085 (this seat) touches no server file.objectstack-fleet commentedon Dec 2, 2026
repo:objectstack@os-support-ai · os-support-ai · session_01WGufziM2GUsShZcjp6TiyD
os-dev-report
{ "issue": 39142, "status": "done", "branch": "claude/project-thread-ovqx20", "pr": "https://github.com/objectstack-ai/objectstack/pull/39169", "session": "session_01WGufziM2GUsShZcjp6TiyD", "premise_still_valid": true, "summary": "Head 7e8c04ac (6 commits on main, 26 files, +1338/-245). N1: sys_comment.thread_root_id (read-only, platform-written, indexed): reply -> top-level id under the existing < 16 hop rule, own id when in no thread, null on a top-level comment; null on a reply = unstamped. beforeInsert stamps from the parent (one system $in read); the participants keeper's reconcile keeps roots in the same system write (updated_at kept, differing columns only), so re-point and delete move them; beforeUpdate strips it for non-system writers. Backfill: os migrate comment-participants also stamps roots (report.roots), second walk over discussions with unstamped replies reaches ones whose top-level comment is gone. Threads read: one engine.aggregate grouped by (thread_root_id, author_id) count(id)/max(created_at) + one read of candidates' newest replies, as the caller; 503 without aggregate. Ruling (b): unstamped replies counted by a bounded fallback (paged by id 1,000, ancestors level by level <= 16 rounds, as the caller); after backfill one empty read. Ruling (a): a reply exactly 16 deep no longer counted, stated in changeset + data-api.mdx. N2: keyset by ms bucket then id, truncation on both sides, plus one edge-bucket re-read ordered by id in the DB; old cursors decode. Docs data-api.mdx, deployment/cli.mdx, system-context.mdx row 45a; translations 10 locales; changeset patch plugin-audit + cli, Clause-2 yes (widening), Metadata-protocol none.", "tests": "plugin-audit 118 files / 1963 passed; cli migrate + 2 pins 90 files / 764 passed (8 skipped); dogfood comment-threads-query 21/21 with local PG 16 (6 live-postgres). Changed suites: comment-threads-query.test.ts 26, comment-participants.test.ts 22, comment-threads-query.integration.test.ts 8, comment-participants.integration.test.ts 12. Ablation: fallback disabled -> pre-backfill integration test red. Reverse: comment-threads-query.ts from origin/main -> live-postgres microsecond page-edge test red (one thread skipped), sqlite green; both green on head.", "gates": "dispatch-gates --ran at 7e8c04ac: 111 derived, 111 run, 0 NOT-MEASURED, 0 UNRUN. Four first exit 3 (prerequisites) cleared and rerun exit 0: plugin-teardown self-test (fetch), skill-examples, dual-build-cjs-loads, i18n-coverage (builds). Typecheck plugin-audit + cli exit 0 (incl. check:test-typecheck); eslint --max-warnings=0 on changed sources exit 0. PR check-runs: pending at report time.", "mcp_calls": "0", "api_writes": "2 — relay pr_create, this report comment", "classifier_refusals": [], "open_questions": [], "security_findings": "none", "out_of_scope_findings": [ "carrier: PR · noted, not filed: PostgreSQL cells not measured in CI (no job sets OS_TEST_POSTGRES_URL), as on #39135" ] }