The bug #
pr list showed merged and closed pull requests as Open, and pr close
looked like it did nothing. The records were fine all along: every merge and
close wrote its sh.tangled.repo.pull.status record — check the author's PDS:
pipobscure.com carries 15 of them, including merged for pull requests the
list still shows as Open. A close written by the pull's own author works
end-to-end (that pull leaves the list); the difference is who wrote the
status record.
Root cause #
pr list takes its state (and its server-side status filter) from the
indexer, and the indexer only counts status records the pull's author
wrote. The rule the appview itself applies — author, owner, collaborators —
is what pr view and every state-changing command already compute locally via
currentState(), which is why pr view said Merged while pr list said Open
for the same pull request.
The fix #
pr list now fetches without the status filter, computes every state itself
(currentState, maintainer rule included), and selects locally:
--state merged/--state closedfind the pull requests that are merged or closed, even when a maintainer did it.--state openstops listing merged and closed pull requests as open.- JSON output carries the computed state.
- To keep
--limithonest after local filtering, a state-filtered list fetches a wider net (4× the limit, capped at 200) before selecting.
selectState is a pure helper with unit tests; pooled runs the per-item
state lookups 8 at a time so the listing does not turn into a serial crawl.
Bonus: run list on a repo without CI runs #
sh.tangled.ci.queryPipelines answers pipelines: null (not an empty list)
when there is nothing to report — tangled run list crashed reading
.length of it (seen on a repo with no CI at all). overall() would have
crashed the same way on null workflows. Both guarded.
Upstream note #
The indexer (bobbin / api.tangled.org) should apply the same maintainer rule
the appview does when it computes a pull's state for listPulls — happy to
draft that patch for tangled.org/core if wanted.