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
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`.
This commit was merged in pull request #1.
This commit is contained in:
1 parent
b6327a458f
commit
504330b1b5
1 file changed
+18
-5
@@ -18,7 +18,7 @@ use rhema_core::{Content, Message, MockProvider, ModelOutput, Role, Session, Sto
|
||||
use rhema_rsd::{ResourceKey, SqliteStore, Store};
|
||||
use serde_json::{Value, json};
|
||||
use tokio_stream::StreamExt;
|
||||
use wiremock::matchers::{method, path};
|
||||
use wiremock::matchers::{method, path, query_param};
|
||||
use wiremock::{Mock, MockServer, ResponseTemplate};
|
||||
|
||||
/// The scripted assistant turn: one text reply, nothing else.
|
||||
@@ -232,9 +232,11 @@ impl rhema_core::ModelProvider for RecordingProvider {
|
||||
/// One quiet GitHub repo, for the watches test: an issues list with a
|
||||
/// single closed issue and a quiet comments feed.
|
||||
async fn mount_github(server: &MockServer) {
|
||||
Mock::given(method("GET"))
|
||||
.and(path("/repos/acme/widgets/issues"))
|
||||
.respond_with(ResponseTemplate::new(200).set_body_json(json!([{
|
||||
// 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",
|
||||
@@ -246,7 +248,18 @@ async fn mount_github(server: &MockServer) {
|
||||
"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"))
|
||||
.and(path("/repos/acme/widgets/issues"))
|
||||
.and(query_param("since", "2026-10-01T00:00:00Z"))
|
||||
.respond_with(ResponseTemplate::new(200).set_body_json(row))
|
||||
.with_priority(1)
|
||||
.mount(server)
|
||||
.await;
|
||||
Mock::given(method("GET"))
|
||||
.and(path("/repos/acme/widgets/issues"))
|
||||
.respond_with(ResponseTemplate::new(200).set_body_json(json!([])))
|
||||
.with_priority(2)
|
||||
.mount(server)
|
||||
.await;
|
||||
Mock::given(method("GET"))
|
||||
|
||||
Reference in new issue
Block a user