Skip to content

The Review queue counts pending proposals and stays listed for admins - #1717

Merged
zlareb1 merged 17 commits into
ClickHouse:mainfrom
VanshajPoonia:issues/1141-review-queue-count
Nov 30, 2026
Merged

zlareb1 merged 17 commits into
ClickHouse:mainfrom
VanshajPoonia:issues/1141-review-queue-count

Conversation

@VanshajPoonia

@VanshajPoonia VanshajPoonia commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Closes: #1141

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in a release)

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

The dashboard's Review queue is always listed for a namespace admin, and its count now includes pending proposals. conflicts.list with count_only also answers proposals, and memory.proposals takes count_only for an exact count of the proposals waiting.

Why

Pending proposals had no effect on the Review queue entry. A namespace with only proposals waiting showed no entry at all, and the badge counted only conflicts. The listing's total stops at memory_proposals_scan_cap, so a correct count needs its own bounded read rather than a page of rows.

Scope and risk

  • Server: the conflicts.list count now reads both numbers in one statement. It is one countIf pass over the namespace's conflicted and proposed rows under FINAL, in the caller's read scope, with no value column. It answers total as before and adds proposals. The cached pair is dropped by a resolve as before, and now also by a proposal decision. memory.proposals gets count_only for headless clients: one count with prefix, tags and scope applied, and no rows or graded counts. It answers the namespace's own policy from policy_for's minute cache, so an auto-policy namespace is not reported as manual. No stored data changes.
  • Dashboard: the Review queue entry is listed for every admin of a memory namespace, also with nothing pending or after a failed count. Its badge is open conflicts plus pending proposals, from the conflicts.list read the sidebar already makes, so no route reads more than before. A failed read hides the badge, as the other badges do. The closed Admin button says how many wait ("2 to review").
  • A decision in the Proposals tab makes the sidebar read its counts again for the namespace it shows now. That read replaces any read still in flight from before the decision, so a decision never changes another namespace's count, and an accept that waits in Conflicts stays counted. It asks for a fresh count, because a decision drops only the cache of the replica that took it. The fresh count reads with sequential consistency, so a replica that has yet to apply the decision cannot answer it. A count that started before a decision, or that a newer count finished ahead of, still answers its caller but does not write its number back into the cache. The minute's polls still read the cache.
  • The Review queue page moves to Proposals once, when its own fresh count finds proposals waiting and no open conflict, unless a tab was picked first. Later counts leave the tab alone, and a count that a resolve overtook keeps Conflicts.
  • Cost: the badge read is the same one statement per minute per open admin tab, two countIf instead of one count(). No new request. The startup chunk is 122,873 bytes against the 122,880 budget, on this branch and on its merge with current main. To fit the fresh flag, the Review queue entry is built inline in adminItems, and its badge is 0 rather than unset when nothing waits (every renderer already hides 0).
  • Left for a follow-up: moving Review out of the admin drawer into the main memory nav.

Compatibility, rollout and rollback

  • Wire: conflicts.list gains the output field proposals (int or null, set with count_only). memory.proposals gains count_only (bool, default false). count_only with only="ready" is refused with a 422 (VALIDATION_FAILED) by the handler, after the namespace grant check, since ready needs each row's verdict. A replica still on the previous build answers count_only without proposals, and the dashboard counts the conflicts alone until it is upgraded.
  • Operator steps: none.
  • Rollback: reverting leaves nothing behind. The generated SDK files and the operation reference revert with it.

Tests

  • tests/unit/test_badge_reads.py: count_only answers both counts from one cached read, a proposal decision drops only its namespace's cached counts, and the count statement reads no value column. A held count that returns after a decision or after a newer count does not refill the cache, and only a fresh count reads with sequential consistency. Both cases fail on the previous head. test_read_scope_admission.py and test_conflicts_resolve_scope.py follow the new count (one cache entry per read scope, the resolve's fresh total).
  • tests/unit/test_proposals.py: the count is exact past the scan cap and reads no value or LIMIT, it uses the listing's WHERE and params, and it serializes an auto-policy namespace's own policy. only="ready" with count_only is refused by the handler before any read. A transport test sends that pair over HTTP and MCP: a caller outside the namespace gets AUTH_INSUFFICIENT on both and an admitted caller gets VALIDATION_FAILED. Against the previous model validator the outside caller got VALIDATION_FAILED.
  • Analyzer: a memory_proposals case drives the count and the listing, each with and without prefix and tags, and the conflicts ledger case drives the new count. shapes.txt gains three shapes and keeps 72a96f3573e5. The corpus still differs on 59f565e11882 (memory_for_file), which fails the same way on main at 2bf02e8.
  • The 136 unit files that touch conflicts, proposals, MCP, the SDKs, the reach census or the badge reads: 2,606 tests pass. Three cannot pass on this Mac: two need the code extra (numpy, tree_sitter), and the CodeQL archive test builds its paths under the macOS temp folder. None of them touches this diff.
  • make lint steps: ruff, the function-length gate, the secrets check and every codegen --check pass. The mypy gate here reports only the missing numpy and tree_sitter imports (the code extra is not installed on this machine).
  • Frontend: tsc is clean, Biome lint is clean, and the full vitest run passes (319 files, 3,753 tests, LANG=en_US.UTF-8). Sidebar.test.tsx checks the call order: the first poll cached, the read after a decision fresh, the next poll cached. npm run build and npm run budget pass. Playwright route-budget.spec.ts (every route at 13 reads or fewer) and navigation.spec.ts pass (26 tests).
  • Biome format fails only on docs/pages/adoption.astro, as on main (The format, unit and statement-shape regression checks pass #1706). The unit failures on the last CI run are main's too (Coverage reads report when they reach a bound #1722, The adoption snapshot test keeps fixture rows within retention #1740), and the statement corpus still differs on 59f565e11882 (memory_for_file) as on main.
  • Not run here: the integration suite (no local ClickHouse). CI runs it.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code wrote the diff and ran the checks listed under Tests.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Local format, lint, type checks and focused tests pass. The full make test-unit and applicable integration results are reported by CI; a full local run is not required before pushing.
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/reference/ tables (python scripts/codegen/docs_reference.py), the reach manifest, schemas/schema.sql (make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.
  • I signed the Contributor License Agreement (CLA) if CLA assistant requested a signature.

Note

Medium Risk
Touches conflict/proposal counting, replica cache invalidation, and admin badge UX; wire/API changes are additive but mixed-version replicas omit proposals until upgraded.

Overview
The Review queue badge and admin nav now treat open conflicts plus pending proposals as one count, from a single conflicts.list call with count_only (new proposals field). Namespace admins always see Review queue in the admin drawer for memory namespaces—even when empty—instead of hiding it unless conflicts or recent auto-resolutions existed.

On the server, conflict badge reads use count_review (one FINAL pass with countIf for conflicted and proposed rows). memory.proposals accepts count_only for an exact pending count past the list scan cap. Cached counts are dropped after a resolve or a proposal decision; fresh reads use sequential consistency and ticket logic so stale in-flight counts do not repopulate the cache.

The dashboard replaces countConflicts with countReview, stores proposals on AdminBadges, and bumps reviewDecisions when a proposal is accepted/rejected so the sidebar refetches counts with fresh: true. The Review queue page can open on the Proposals tab once when only proposals are waiting. SDKs and operation docs are updated for the new wire fields.

Reviewed by Cursor Bugbot for commit 40c5689. Bugbot is set up for automated code reviews on this repo. Configure here.

A badge needs the number, not the rows. count_only answers total from one count() over the pending proposals the caller may read, with prefix and tags applied, past the listing's scan cap and with no value, graded count or policy read. It refuses only=ready, which needs each row's verdict. The generated SDKs, the MCP description and the operation reference carry the field.

Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
The entry is listed for every admin of a memory namespace, so an empty queue or a failed count still leaves it reachable. Its count is the review items waiting, open conflicts plus pending proposals from memory.proposals count_only, and its accessible name gives each kind or says which one could not be counted. The phone's More sheet and the closed Admin button read the same entry.

Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
With proposals pending and no open conflict, the queue starts on its Proposals tab, and a tab the person picks stays until the namespace changes. A decision lowers the sidebar's proposal count at once instead of at its next read. The dashboard guide describes the entry and its count.

Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
@vercel

vercel Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Nov 30, 2026 3:28am UTC
loom-telemetry Ready Ready Preview Nov 30, 2026 3:28am UTC

Request Review

@zlareb1 zlareb1 self-assigned this Nov 28, 2026

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread frontend/src/views/admin/Proposals.tsx Resolved

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A proposal decision can change the Review queue count for a different namespace.

Comment thread frontend/src/views/admin/Proposals.tsx Resolved
Comment thread frontend/src/layout/Sidebar.tsx Resolved

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The format job fails on the same adoption page assignment as clean main. The pinned formatter passes with the tracked repair. PR format job · Main format job · Repair #1706

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The rename report integration test fails at the same assertion on this head and on clean main. The tagged fixture describes a naming claim, so the planner returns about_naming. The same test passes with the fixture repair. PR job · Main job · Repair #1719

Comment thread server/memory/app/proposals_ops.py Resolved
…queue-count

Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
…d listing apart

Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
…m the same read

Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
… again after a decision

Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The decision callback no longer adjusts another namespace’s badge directly. The refreshed code still has a cached-count race, and the new count-only path needs to preserve authorization order and report the correct response fields.

Comment thread frontend/src/layout/Sidebar.tsx Resolved
Comment thread server/memory/api/models_proposals.py Resolved
Comment thread server/memory/app/proposals_ops.py Resolved

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ClickHouse expires the adoption directory test’s fixed snapshot rows before the view reads them. Clean main reproduces the failure. The test passes with UTC-relative fixture dates. Failed unit job · Repair #1740

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The unit gate reports the same duplicate coverage row limit on this head's CI merge tree and on clean main. The coverage repair keeps the store's bounds and removes the duplicate limit. The gate passes with the separate docstring repair applied locally. Failed unit job · Coverage repair #1722

…ce grant check

Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
…e polls read the cache

Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
@VanshajPoonia

Copy link
Copy Markdown
Contributor Author

Thank you for tracing the unit failures to #1722 and #1740. Both fail the same way on main, so this branch leaves them to those PRs.

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The authorization and policy fixes are present on this head. The Review queue can still show a rejected proposal after a decision.

Comment thread server/memory/app/conflicts_ops.py Resolved
Comment thread server/memory/app/conflicts_ops.py Resolved
Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
… Review queue cache

Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread server/memory/app/conflicts_ops.py Resolved

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A fresh count now reads with sequential consistency and an older count cannot overwrite a newer count in the same namespace. The cross-namespace invalidation finding remains on this head. I traced the completion order through the cache: a fresh read for B can return zero, leave B's cached one in place after a decision in A, and let the next poll show one again. Scope invalidation to the affected namespace and test this interleaving.

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The sender census reports the same stale plugin client fingerprints on this CI merge and on clean main. The test passes locally with both fingerprint repairs. PR job · Main job · Plugin repair #1773 · SDK repair #1706

The extraction classification test also fails on main because changed_files has no content classification. PR job · Repair #1747

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

GitHub reports a merge conflict with main in sdk/rust/src/wire_models.rs. Please resolve it and regenerate the Rust wire models so CI can validate the merge.

Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
zlareb1
zlareb1 previously approved these changes Nov 29, 2026

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A decision now invalidates only its own namespace’s cached counts. The regression verifies that a fresh count in another namespace replaces its stale value. All 630 focused tests pass.

GitHub reports conflicts in sdk/rust/src/wire_models.rs and tests/analyzer/cases/planes.py. Please resolve both and regenerate the Rust wire models so CI can validate the merge.

…queue-count

Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>

# Conflicts:
#	sdk/rust/src/wire_models.rs
#	tests/analyzer/cases/planes.py
@VanshajPoonia

Copy link
Copy Markdown
Contributor Author

Thank you for the approval. I merged main in d358af1. In planes.py both sides added a line after list_conflicted, so the case now drives the review count and main's derived_sources read. shapes.txt is what --write gives, and the Rust wire models are regenerated. All generator checks are current and 641 focused tests pass.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit d358af1. Configure here.

Comment thread frontend/src/layout/Sidebar.tsx Resolved
Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The sidebar count race blocks approval on this head. I traced a same-namespace refresh of whoami while the post-decision count is in flight. Cleanup discards the fresh result, but the replacement request sees the decision as already counted and can cache an older replica’s answer. Keep the refresh pending until its fresh result is applied, and cover the interrupted request in the sidebar test.

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The interrupted-read regression passes. A failed fresh read can still consume the decision and let a cached count bring back the rejected proposal badge.

Comment thread frontend/src/layout/Sidebar.tsx Resolved

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The conflict resolver's attestation test fails at the same superseder assertion on this CI merge and on clean main with ClickHouse 26.11.5.8. Repair #1781 keeps the timestamp assertion at equal standing and tests the lower-standing refusal separately. The integration shard passes on the repair. PR job · Main job · Repair · Passing shard

Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A refused count leaves the decision pending until a fresh count is shown. The regression verifies that the retry requests a fresh count and that the following poll uses the cache. All 130 focused Sidebar, Review queue, and Proposals tests pass.

@zlareb1
zlareb1 merged commit 4d5ea04 into ClickHouse:main Nov 30, 2026
78 of 84 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pending proposals do not surface the Review queue or its sidebar count

2 participants