fix(forge): poll gitea comments on instances that send an empty issue_url #1
@@ -18,7 +18,7 @@ use rhema_core::{Content, Message, MockProvider, ModelOutput, Role, Session, Sto
|
|||||||
use rhema_rsd::{ResourceKey, SqliteStore, Store};
|
use rhema_rsd::{ResourceKey, SqliteStore, Store};
|
||||||
use serde_json::{Value, json};
|
use serde_json::{Value, json};
|
||||||
use tokio_stream::StreamExt;
|
use tokio_stream::StreamExt;
|
||||||
use wiremock::matchers::{method, path};
|
use wiremock::matchers::{method, path, query_param};
|
||||||
use wiremock::{Mock, MockServer, ResponseTemplate};
|
use wiremock::{Mock, MockServer, ResponseTemplate};
|
||||||
|
|
||||||
/// The scripted assistant turn: one text reply, nothing else.
|
/// The scripted assistant turn: one text reply, nothing else.
|
||||||
@@ -232,21 +232,34 @@ impl rhema_core::ModelProvider for RecordingProvider {
|
|||||||
/// One quiet GitHub repo, for the watches test: an issues list with a
|
/// One quiet GitHub repo, for the watches test: an issues list with a
|
||||||
/// single closed issue and a quiet comments feed.
|
/// single closed issue and a quiet comments feed.
|
||||||
async fn mount_github(server: &MockServer) {
|
async fn mount_github(server: &MockServer) {
|
||||||
|
// The issues feed filters by `since` server-side, as GitHub does: a
|
||||||
|
// watch seeded at *now* sees nothing, and one rewound to before the
|
||||||
|
// row sees it. Without the filter a fresh watch would replay whatever
|
||||||
|
// the mock always answers.
|
||||||
|
let row = json!([{
|
||||||
|
"id": 1007,
|
||||||
|
"number": 7,
|
||||||
|
"state": "closed",
|
||||||
|
"title": "crash on save",
|
||||||
|
"user": { "login": "alice" },
|
||||||
|
"labels": [],
|
||||||
|
"body": "steps to reproduce…",
|
||||||
|
"created_at": "2026-10-01T09:00:00Z",
|
||||||
|
"updated_at": "2026-10-02T10:00:00Z",
|
||||||
|
"closed_at": "2026-10-02T10:00:00Z",
|
||||||
|
"html_url": "https://github.com/acme/widgets/issues/7"
|
||||||
|
}]);
|
||||||
Mock::given(method("GET"))
|
Mock::given(method("GET"))
|
||||||
.and(path("/repos/acme/widgets/issues"))
|
.and(path("/repos/acme/widgets/issues"))
|
||||||
.respond_with(ResponseTemplate::new(200).set_body_json(json!([{
|
.and(query_param("since", "2026-10-01T00:00:00Z"))
|
||||||
"id": 1007,
|
.respond_with(ResponseTemplate::new(200).set_body_json(row))
|
||||||
"number": 7,
|
.with_priority(1)
|
||||||
"state": "closed",
|
.mount(server)
|
||||||
"title": "crash on save",
|
.await;
|
||||||
"user": { "login": "alice" },
|
Mock::given(method("GET"))
|
||||||
"labels": [],
|
.and(path("/repos/acme/widgets/issues"))
|
||||||
"body": "steps to reproduce…",
|
.respond_with(ResponseTemplate::new(200).set_body_json(json!([])))
|
||||||
"created_at": "2026-10-01T09:00:00Z",
|
.with_priority(2)
|
||||||
"updated_at": "2026-10-02T10:00:00Z",
|
|
||||||
"closed_at": "2026-10-02T10:00:00Z",
|
|
||||||
"html_url": "https://github.com/acme/widgets/issues/7"
|
|
||||||
}])))
|
|
||||||
.mount(server)
|
.mount(server)
|
||||||
.await;
|
.await;
|
||||||
Mock::given(method("GET"))
|
Mock::given(method("GET"))
|
||||||
|
|||||||
Reference in new issue
Block a user