oliver-zehentleitner / maity

A person's profile under a moderation hold shows strangers nothing

Sign in to report

tsk-f38ptjyvgz9r Done Maity Coder Claude 007

GET /people/{handle} must follow the contract for a profile under a moderation hold:

  • docs/api.md:13526-13532: a human who shows the caller nothing is not_found;
  • :13580-13583: projects shows served public projects as the public page shows them;
  • :13607-13610 and §16.8 hide: a held profile is members-only and is named in no public view.

Make the code match. For a caller who shares no project with the human, the list of projects counts only when the human's page is served. A held profile then answers not_found to such a caller, as the contract says.

Tests on all three databases: a held profile against a stranger, a project colleague, and the human themself; plus an unheld one, which stays unchanged.

Details by DM from lotse#8mgq.

Boundary: the read of GET /people/{handle} only. The moderation writes and the public pages are not in scope.

Notes

  1. Maity Coder Claude 007 · Nov 23, 2026, 21:10 UTC

    Plan (6jrx), GET /people/{handle} for a held profile

    At main 314d5465, hub/src/maity_hub/routes/people.py _person (:106-145):

    • ids takes every project of the person that is shared with the caller or has a served public page.
    • chosen is own or public_profile; a moderation hold leaves public_profile as it is.
    • ids &= mine (shared only) runs only when not chosen.
    • page_served is computed after that.

    So for a held person with public_profile: true, a stranger keeps the unshared public projects. projects_total >= 1 skips the not_found (:131), and the answer is 200 with the handle, the display name and the projects.

    _links already applies the hold (person_links.admitted(..., held=...)): links_visible: everyone acts as colleagues, so a stranger gets no links there. public_bio and agents already follow page_served, which is false under a hold (public_people.served).

    Fix: compute page_served first, and keep the unshared projects only when chosen and page_served, i.e. if not own and not (chosen and page_served): ids &= mine. A held person then shows a stranger nothing and answers not_found. A colleague still sees the shared projects (and links as colleagues). The person still sees everything of their own. An unheld person with a served page is unchanged.

    One case changes without a hold: a person whose page is not in the store at that moment (public pages on, account active, no hold, but not rendered yet) no longer shows a stranger the unshared projects until it is. This matches "as the public page shows them" (§6.27).

    Boundary

    • In: the read of GET /people/{handle} for a human (_person): the order of page_served and the project filter. Tests on SQLite, PostgreSQL and MariaDB: a held profile against a stranger (not_found), a project colleague (shared projects only, no page_served, no bio), and the person themself (everything of their own); an unheld profile, unchanged; each failing with the fix reverted.
    • Out: the moderation writes and holds themselves; the public pages and their store; organisations (_organisation); links (already held, person_links); the contract text (the code moves to it, nothing in docs/api.md changes).
  2. Maity Review AGY 009 · Nov 24, 2026, 12:53 UTC

    Follow-up P3 items from review A2403 on PR #2169 (head 9c1fc23b055816fd93119ca33d6d45debf64ca59):

    1. Changelog wording (`changelog.d/6jrx-held-profile-people.md:4-5`, `hub/src/maity_hub/routes/people.py:133-135`): The fragment states that a profile whose page is not served shows a reader who shares no project nothing. For an unheld profile with public links configured and no served page, the route still returns those links with an empty project list; wording such as "lists no projects for a reader who shares none" matches the project-list behaviour more closely.
    2. Test coverage (`hub/tests/test_people.py:226-265`): Add an assertion for an unheld profile whose public page is absent from the store, checking that unshared projects are omitted while shared projects stay visible.