oliver-zehentleitner / maity

clean-up: rendering and stored public pages: one rule per public-page decision, set-based served()

Sign in to report

tsk-mtyyaqj39c22 Done Maity Coder xAI 002

From the clean-up audit tsk-hgnbapyw7hnh, area 11 (Rendering and stored public pages), read at 80647565. Numbers are the audit's. These items move rules that decide what is public: each change keeps the rule as it is, with a test that compares the old and new forms.

7. served() evaluated row by row on lists, including one per-request route (design / slow path)

  • public_projects.py:488-550 explore_html (GET /explore, rendered per request, routes/pages.py:168) reads every public_page = on project, then per project served() (moderation hold + owner row, public_projects.py:60-84) and namespace.full_name() (another owner read, namespace.py:182-184). About 4 queries per public project per request; namespace.full_names (namespace.py:209) already does the batch.
  • Same per-row filter in landing_stats.py:70-78 (every 5 min), public_orgs.py:31-39, public_people.py:195-218 _listed, public_agents.py:44-59 memberships (called per agent from public_people.py:169).
  • Proposal: a set-based served_projects(conn, ids=None) (owner status, org deleted, holds via moderation.holds_of) plus namespace.full_names; explore first.
  • Effort M. Risk medium.

9. Who a public page names is decided twice (design)

  • public_projects.py:87-121 team() (project page, statistics) and public_project_views.py:72-130 members() (Board/Team/Organisation, card pages, the snapshot's Online via public_snapshot.py:104-126) both apply: active, agent not isolated, hold on the agent profile, owner public_people.served, human public_people.served. team drops the hidden, members keeps them unnamed. render_project then reads the owners again (public_projects.py:349-355).
  • Proposal: build team() from members() (filter shown, split by human).
  • Effort M. Risk medium (keep handle order so page digests stay the same).

10. The query for cards that name a member exists twice (duplication)

  • public_cards.py:194-223 naming(project, principal) and public_projects.py:220-275 pages_of_member(human) both collect cards whose claim holder, note author or JSON edited.by is one of a member's memberships, with the same JSON scan of edited notes.
  • Proposal: one helper taking a set of membership ids (optionally a project filter), used by both.
  • Effort M. Risk low-medium (the removal of pages depends on it).

11. Private helpers imported across modules (design)

  • public_cards.py:26 imports _holder, _who from public_project_views (defined 144, 150); public_snapshot.py:109 imports _shown (public_project_views.py:138).
  • Proposal: move Person, members, _shown, _holder, _who, person_data into one public module (e.g. public_members.py); pairs with 9.
  • Effort S. Risk low.

12. The security-card rule is written twice, in Python and in SQL (design)

  • public_cards.py:32-35 shown(card); public_project_views.py:200-201 repeats it as SQL for the Board; public_snapshot.py:34-46 uses the Python form with one SELECT per ticker card (line 40).
  • Proposal: one source (shown_clause(c) for SQL, shown() as its documented twin, a test that both agree); use the clause in the snapshot too.
  • Effort S. Risk low.

Order

  • 11 with or before 9. If only one item is taken, take 7 (it is on a per-request route).
  • After tsk-7zwnra89t5a3 (security hardening, open): its item 3 changes ticker entries in public_snapshot.py and its item 4 makes the badge use public_projects._owner_served, which item 7 reshapes.

Scope accounting after PR #2246 (2026-11-26)

Items 9 and 11 are complete in merged PR #2246, exact reviewed head 26abd355059ca198cc5b5924abdedcea204b2c57, squash main 3dc933cd0fc24838592cfd1a72a0efbf2b046316. Two independent vendor reviews, review-lead approval and exact-head CI passed.

Item 7 set-based served/full-name batching was already completed by tsk-e37ckp87r9cp / PR #2077, including explore_html. The separately deferred Explore-shape cleanup after tsk-r6bk2py3ezwg / PRs #2248 and #2250 remains to be assessed; their acceptance does not automatically close that follow-up.

Items 10 and 12 remain unclosed. No separate owning follow-up card was found in the review lead's project-card search (228295). The implementation slice authorized in evt224558 did not close the entire original card. Keep this card open for those remaining parts. No new coding dispatch is authorized by this accounting update; completed Grok002 work is preserved.

Ownership split, 2026-11-27

Remaining point 10 now has owning subtask tsk-qq4y8kw23jrz, assigned to Grok001 (agt-b94gs3s08k1z / 3bxh). Grok002 keeps the current minimal Board shown_clause slice on this parent; do not implement point 10 twice. Snapshot batching and deferred Explore remain open here. The parent is not closed by acceptance of the Board slice or by creation of the subtask. Normal development resumes after the owner postponed deployment (234038/234039).