Monorepo for Tangled tangled.org

AppView does not ingest pull status records #517

Closed onev.cat
Closed opened by onev.cat

Summary #

AppView currently does not subscribe to or ingest sh.tangled.repo.pull.status records. This leaves protocol-level pull request state records invisible to the web UI and can make AppView show stale state.

Reproduction / evidence #

For onev.cat/tang PR #2:

  • Pull record: at://did:plc:kl2ejrmz5zmxnno3ll4luz76/sh.tangled.repo.pull/3mkuuamwfj322
  • Status record on the author's PDS: at://did:plc:kl2ejrmz5zmxnno3ll4luz76/sh.tangled.repo.pull.status/3mkuuaumwkn2j
  • Status value: sh.tangled.repo.pull.status.merged
  • AppView page still renders the PR as open: https://tangled.org/onev.cat/tang/pulls/2/round/0

The same issue affects clients that write pull status records through ATProto: the record exists on the PDS and can be discovered by protocol-aware clients, but AppView does not reflect it.

Likely cause #

In appview/state/state.go, the Jetstream subscription list includes sh.tangled.repo.pull but not sh.tangled.repo.pull.status.

In appview/ingester.go, the commit dispatch handles tangled.RepoPullNSID, issues, comments, labels, etc., but has no tangled.RepoPullStatusNSID case.

The web UI close/reopen/merge paths appear to update the AppView database directly via db.ClosePulls, db.ReopenPulls, and db.MergePulls, which means AppView DB state and ATProto status records can diverge.

Expected behavior #

AppView should ingest sh.tangled.repo.pull.status records and update the corresponding pull state (open, closed, merged) in its indexed database, or otherwise define a single canonical source of truth for PR state.

Related context: #462 and #356.

Additional confirmation: this appears to have the same root cause as #462.

A wrongly-created issue in onev.cat/tang was closed via an ATProto sh.tangled.repo.issue.state record:

at://did:plc:kl2ejrmz5zmxnno3ll4luz76/sh.tangled.repo.issue.state/3mkuyvf7vk62p
issue: at://did:plc:kl2ejrmz5zmxnno3ll4luz76/sh.tangled.repo.issue/3mkuyolowjs2j
state: sh.tangled.repo.issue.state.closed

Protocol/PDS-aware clients show that issue as closed, but AppView still renders it as open. So both issue state and pull status records seem to be affected by the same missing AppView subscription/ingestion path for sh.tangled.repo.* state records.

#282 is also relevant background: it frames the broader repo-record atprotation problem as keeping knot state, AppView state, and PDS state consistent. This issue looks like the narrower issue/pull-state version of that same consistency gap.

Additional finding from a live tang E2E run: the same ingestion gap also affects sh.tangled.repo.pull.comment.

On a temporary repo/PR, tang pr comment successfully wrote a pull comment record to the author's PDS, and Constellation discovers it as a backlink to the pull:

  • Pull: at://did:plc:kl2ejrmz5zmxnno3ll4luz76/sh.tangled.repo.pull/3mm2gfugldv22
  • CLI-created pull comment: at://did:plc:kl2ejrmz5zmxnno3ll4luz76/sh.tangled.repo.pull.comment/3mm2ghzldwp2b

Then a comment created manually through AppView on the same PR produced the same collection and shape:

  • AppView-created pull comment: at://did:plc:kl2ejrmz5zmxnno3ll4luz76/sh.tangled.repo.pull.comment/3mm2gmwsqyy22

Both records have pull pointing at the same pull record, and both appear in Constellation backlinks. However, the AppView PR page renders only the AppView-created comment.

This matches the current code path: appview/pulls/comment.go writes the PDS record and then directly inserts into AppView's pull_comments table, while the Jetstream subscription list includes RepoPullNSID but not RepoPullCommentNSID. So external ATProto clients can create valid pull comment records, but AppView does not project them into its DB.

For contrast, RepoIssueCommentNSID is subscribed and has an ingester path, so this looks specific to pull comments/status records rather than comments in general.

should be better in the new architecture!

Sign up or Sign in to add to the discussion.