fix(forge): mark a GitHub notification read with PATCH
android / debug (push) Successful in 2m15s
android / release (push) Successful in 2m32s
ci / test (push) Successful in 2m3s
ci / checks (push) Successful in 3m47s
ci / docker (push) Successful in 1m47s
ci / chart (push) Successful in 6s
ci / web (push) Successful in 12s
ci / publish-edge-images (deploy/docker/claw.Dockerfile, rhema-claw) (push) Successful in 1m52s
ci / publish-edge-images (deploy/docker/ui.Dockerfile, rhema-claw-ui) (push) Successful in 9s
ci / publish-edge-chart (push) Successful in 4s
android / debug (push) Successful in 2m15s
android / release (push) Successful in 2m32s
ci / test (push) Successful in 2m3s
ci / checks (push) Successful in 3m47s
ci / docker (push) Successful in 1m47s
ci / chart (push) Successful in 6s
ci / web (push) Successful in 12s
ci / publish-edge-images (deploy/docker/claw.Dockerfile, rhema-claw) (push) Successful in 1m52s
ci / publish-edge-images (deploy/docker/ui.Dockerfile, rhema-claw-ui) (push) Successful in 9s
ci / publish-edge-chart (push) Successful in 4s
GitHub's read route is `PATCH /notifications/threads/{thread_id}`; the
adapter sent PUT, which does not exist, so every call answered 404 and
the thread stayed unread. The account feed then returned the same row
again whenever its `updated_at` moved, and that timestamp is part of the
dedup id: the merge bumped the row once, the reply to that turn bumped it
again, so one assignment ran three turns and the merged PR got two
replies.
The test mounted PUT as well, so it asserted the bug. Both now use
PATCH, whose 205 response `ensure_success` already accepted.
fmt, clippy with -D warnings over all features and targets, the
workspace tests, and the doc build pass.
This commit is contained in:
1 parent
5e7e2dcfe7
commit
eb9f4e9ec5
3 files changed
+16
-12
No files matched your search
@@ -554,7 +554,7 @@ fn notification_row(id: i64, reason: &str, number: u64) -> Value {
|
||||
/// repeat. It keys on the notification's own id, not the thread number —
|
||||
/// the dedup id keeps that integer only as text.
|
||||
#[tokio::test]
|
||||
async fn marking_a_notification_read_puts_its_thread() {
|
||||
async fn marking_a_notification_read_patches_its_thread() {
|
||||
let server = MockServer::start().await;
|
||||
Mock::given(method("GET"))
|
||||
.and(path("/notifications"))
|
||||
@@ -567,7 +567,7 @@ async fn marking_a_notification_read_puts_its_thread() {
|
||||
)
|
||||
.mount(&server)
|
||||
.await;
|
||||
Mock::given(method("PUT"))
|
||||
Mock::given(method("PATCH"))
|
||||
.and(path("/notifications/threads/42188"))
|
||||
.and(header("authorization", "Bearer tok"))
|
||||
.respond_with(ResponseTemplate::new(205))
|
||||
@@ -580,12 +580,12 @@ async fn marking_a_notification_read_puts_its_thread() {
|
||||
forge.mark_read(notification).await.expect("marks read");
|
||||
|
||||
let requests = server.received_requests().await.expect("recording is on");
|
||||
let puts: Vec<_> = requests
|
||||
let patches: Vec<_> = requests
|
||||
.iter()
|
||||
.filter(|request| request.method.as_str() == "PUT")
|
||||
.filter(|request| request.method.as_str() == "PATCH")
|
||||
.collect();
|
||||
assert_eq!(puts.len(), 1, "one read call, on the row's id");
|
||||
assert_eq!(puts[0].url.path(), "/notifications/threads/42188");
|
||||
assert_eq!(patches.len(), 1, "one read call, on the row's id");
|
||||
assert_eq!(patches[0].url.path(), "/notifications/threads/42188");
|
||||
}
|
||||
|
||||
/// A row that reaches the caller with no read key is a shape break, not a
|
||||
|
||||
Reference in new issue
Block a user