Skip to content

test(ci): conditional head scan and jittered watch passes (P7-AUTO-11) - #548

Merged
acamarata merged 1 commit into
land/p7f-pluginsfrom
gaps/p7-auto-11
Oct 30, 2026
Merged

acamarata merged 1 commit into
land/p7f-pluginsfrom
gaps/p7-auto-11

Conversation

@acamarata

Copy link
Copy Markdown
Contributor

P7-AUTO-11's conditional-request acceptance had no proof in #543. TestConditionalRequests is named in its verify line, and ScanHeads had no test at all. Stacked on #543 (base land/p7f-plugins).

  • internal/providers/github/reconcile/scan_conditional_test.go, TestScanHeadsConditional: on the HOST-17 fixture forge, after a full scan an unchanged repository answers 304 on the repo and pull list (plus the branch list when extra branches are configured). ScanHeads then makes no further request: 2 or 3 conditional requests, zero non-304. A new pull request is read in full and its head reported.
  • internal/watch/conditional_test.go, TestConditionalRequests: a 304 scan keeps the previous heads and reruns nothing. A 304 before any full scan acts on nothing. Two hosts get distinct phase offsets, and their waits fall in [0.9, 1.1) of the interval. The quota stop is already covered by TestQuotaStopsPass.

Bug fixed

Engine.ScanHeads documents HeadScan.Calls ("requests made, 304s included"), but it always returned 0. The deferred res.Calls = s.used wrote a local copy after return res, ... had already copied it. The results are now named. Nothing reads Calls yet, so behaviour is otherwise unchanged.

Verification (local, scoped)

  • go test -mod=vendor -count=1 ./internal/providers/github/reconcile/ ./internal/watch/: ok, ok (full packages).
  • go vet and gofmt are clean.

Not covered here

cmd/serve_watch_test.go is still absent. Its behaviours are proven in internal/watch.

Ticket: P7-AUTO-11

TestScanHeadsConditional: after a full scan, an unchanged repository costs
two (three with extra branches) conditional 304 requests and nothing more;
a new pull request is read in full. TestConditionalRequests: a 304 scan
keeps the previous heads, and two hosts poll at distinct offsets with a
wait inside [0.9, 1.1) of the interval.

fix(ci): ScanHeads returned Calls as 0 on every path because the deferred
count wrote a local copy; the result is now named.
@acamarata
acamarata merged commit f1c4f03 into land/p7f-plugins Oct 30, 2026
16 of 19 checks passed
@acamarata

Copy link
Copy Markdown
Contributor Author

Folded into #543 (land/p7f-plugins) to land in one CI run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant