Threads port: a thread's resolver is told by its account, never by resolvedBy's type (#331, part 1; P-53)

Merged
DO
24d ago
+1097-49

Part of #331. Its part 2 is #338, blocked by #196 PR 2b-2.

A review thread's resolver is now told by its account, never by resolvedBy's type. Record 0067 holds the ruling. It extends 0005 and edits neither 0005 nor 0061.

What changes

  • The resolver (adapters/threads.py, adapters/timeline.py).
    • GraphQL types resolvedBy as a User whoever resolved the thread, an App included (P-49), and no timeline item names a resolution (P-53).
    • The resolver's account id is first matched to the thread's comment author, whose type GraphQL gives. Failing that, it is matched to the repo's permission read of its login, which answers the account's id and type (P-53), held to the id.
    • When neither answers, or a read fails, the resolver is unread and the Kernel defers on that thread. It is never taken for a User.
    • Another App (a Bot that is not the thread's Lens) leaves a Lens's thread open under gate.closed.
    • Cost: one permission read per login per pass, shared with the read of a person's write access.
  • Reconciliation (adapters/seen.py, controller/reconcile.py). A thread's resolver is told by its account id among the Factory's identities. A Role's resolution is matched to its resolve_thread Effect. Before this, an App's resolution was attributed to no identity, so an unrecorded one went unseen.
  • Trial P-53 (trials/P-53.json, with a section 6 row). It ran read-only, by the Maintainer's gh login, on the canary's pull request 55, the one P-49 used, and passed.
    • The REST issue timeline and GraphQL timelineItems name no thread's resolution.
    • Nothing links a reply to its deleted first comment.
    • The repo's permission read answers the App's bot as id 344141469, a Bot, and the Maintainer as a User.
    • Nothing was written, no token was minted, and nothing was made, so there was nothing to undo. /users reads were taken, then dropped from the fixture: the trials check keeps a canary fixture under the org's repos.

Not here

  • A deleted first comment (part 2, #338). GitHub keeps no link from the reply, so the check must come from the Lens's own applied/1, which nothing reads per pull request until the collector does. test_a_thread_a_trial_recorded_is_read_as_the_port_reads_it stays @pending for it. 0005's row names that test as not held yet, and the context check requires a not-held row to name a pending test.
  • A follow-up worth filing. _can_write never holds the cached permission answer's user.id to the actor's id. This was already true before this PR (from the Claude review).

Gates

  • The Claude review with a security pass approved. It found no way to make a Lens's open thread read as closed.
  • Argon and Muse each raised a blocker, the same stale mutant. Muse also raised a major: reconciliation read a resolver as a User. Both are fixed in bb51de0, and Argon re-read the fix round.
  • Mutants. All 69 mutants of threads.py and timeline.py, plus the new seen.py and reconcile.py ones, apply once, parse and are killed.

Verify

make verify passes on a fresh export. The record is 0067: this pull request goes ahead of #340, which takes 0068.

šŸ¤– Generated with Claude Code