fix(forge): poll gitea comments on instances that send an empty issue_url #1
Merged
vhaudiquet
merged 3 commits from 2026-11-17 21:59:44 +00:00
kosmos/rhema-claw:fix/gitea-comment-thread-number into main
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
504330b1b5 |
test(claw): the github mock answers since, as the forge does
android / debug (push) Successful in 2m24s
android / release (push) Successful in 3m5s
ci / checks (push) Successful in 1m6s
ci / test (push) Successful in 42s
ci / chart (push) Successful in 6s
ci / docker (push) Successful in 1m23s
ci / web (push) Successful in 14s
ci / publish-edge-images (deploy/docker/claw.Dockerfile, rhema-claw) (push) Successful in 1m28s
ci / publish-edge-images (deploy/docker/ui.Dockerfile, rhema-claw-ui) (push) Successful in 9s
ci / publish-edge-chart (push) Successful in 3s
android / debug (pull_request) Canceled after 0s
android / release (pull_request) Canceled after 0s
ci / checks (pull_request) Canceled after 0s
ci / test (pull_request) Canceled after 0s
ci / chart (pull_request) Canceled after 0s
ci / docker (pull_request) Canceled after 0s
ci / web (pull_request) Canceled after 0s
ci / publish-edge-images (deploy/docker/claw.Dockerfile, rhema-claw) (pull_request) Canceled after 0s
ci / publish-edge-images (deploy/docker/ui.Dockerfile, rhema-claw-ui) (pull_request) Canceled after 0s
ci / publish-edge-chart (pull_request) Canceled after 0s
The fresh-watch pass now seeds its cursor at *now*, and the issues feed is where GitHub applies `since` server-side. The mock always answered the whole history, so the seeding pass fed an issue the real forge would have filtered out and the new "a fresh watch seeds its cursor" assertion saw one event. The mock now returns the issue row only for the rewound cursor the test sets, and nothing for any other `since`. |
||
|
|
b6327a458f |
fix(claw): a repo watch resumes from its durable cursor, or starts now
android / release (pull_request) Skipped
android / debug (pull_request) Successful in 2m16s
ci / checks (pull_request) Successful in 1m0s
ci / test (pull_request) Failing after 36s
ci / chart (pull_request) Successful in 5s
ci / docker (pull_request) Successful in 1m23s
ci / web (pull_request) Successful in 14s
ci / publish-edge-images (deploy/docker/claw.Dockerfile, rhema-claw) (pull_request) Skipped
ci / publish-edge-images (deploy/docker/ui.Dockerfile, rhema-claw-ui) (pull_request) Skipped
ci / publish-edge-chart (pull_request) Skipped
The watcher kept one cursor per repo in a `Mutex<HashMap>`, so every daemon restart began with no cursor — and `Watcher::poll` reads "no cursor" as "feed everything the forge returns". A restart therefore replayed the repository's whole history: every old thread a dispatch, and every dispatch a comment posted on a thread nobody had just touched. The dispatcher's dedup lane does not save this: it dedups against the pending inbox, and a drained event re-ingests clean. The cursor is a row now (`watch_cursors`, beside `watch_health`, same scope/forge/subject key), written after every successful poll and read before every poll, so a restart resumes where the last pass stopped. A watch with no cursor yet — newly added, or added to a repository full of history — starts at *now* rather than at the beginning: a watch reports news, and history is not news. The seed is written before the poll, so a forge that is down cannot walk the start line forward on every pass and lose the news arriving in between. Removing a watch forgets its cursor too, so a re-add seeds afresh instead of resuming into a backlog. `Watcher::poll_since` is the seam the daemon needs to pass a cursor it keeps itself; `Watcher::poll` keeps its in-memory behaviour unchanged. `Timestamp::from_epoch_millis` spells an instant the way the forges spell theirs, which is what a seed is. Tests: the first pass feeds nothing and asks from the seeded instant; a second pass resumes from it; the cursor moves only forward per watch and dies with the watch. `e2e`/`continuity`/`http` seed an established watch, since their subject is the dispatch, not the bootstrap. |
||
|
|
2f6c369e02 |
fix(forge): a gitea comment names its thread without issue_url
`comment_event` read the thread number from `issue_url` alone and failed
the whole poll when it could not. The instance behind git.vhaudiquet.fr
sends `issue_url: ""` on every row of the repo-wide `/issues/comments`
feed, so the first comment row failed the pass with
malformed forge response: comment issue_url without a thread number:
and kept failing on every poll since the watch was created — 5296
consecutive failures, no event ever reported, no comment, no pull
request, nothing. The feed being broken was invisible: a watch that has
never polled once looks exactly like a quiet repository.
The number now comes from the first URL that carries one
(`issue_url`, then `pull_request_url`, then `html_url`), and a fragment is
dropped first: a comment's `html_url` points at the comment
(`…/pulls/1#issuecomment-164`), not at its thread. `is_pr` reads the same
three URLs, so a PR comment whose `issue_url` is blank still lands on the
pull request's sequence.
A row with no number anywhere is still a loud parse error — the
fallbacks must not degrade into a silently skipped event.
|