Repository navigation
fix(sync): a 200 nobody can parse is a FAILED page, not an empty source - #1227
Merged
Merged
Conversation
When a source answered 200 with a body no parser could read — overwhelmingly
an HTML login or redirect page returned to a fetch with no session —
`fetchSinglePageData()` returned an empty page with no `failed` flag.
Upstream that is indistinguishable from a source that genuinely had nothing:
the run reports success, `found: 0`, and nothing is transferred. No error, no
alert, and any monitoring keyed on run status sees a clean run. The only
signal that data did not move is a `found: 0` that looks like an empty source.
The hard part is not spotting the login page, it is spotting it WITHOUT
breaking pagination. `[]` and `{}` decode cleanly to an empty array, and that
is exactly how a paginated source says "no more pages" — so the test cannot be
`empty($result)`. It is now whether any parser UNDERSTOOD the body, tracked
separately from whether the body held anything, via `json_last_error()`.
An HTML document is also refused the XML parser entirely. A minimal login page
— `<html><body>Please log in</body></html>` — is well-formed XML, so it used
to parse, come back non-empty, and walk on into object extraction to die there
on "cannot determine the position of objects in the return body": a confusing
complaint about the source's shape when the real problem is that nobody was
logged in. A source that genuinely serves HTML declares
`Source.configuration.format: "html"` (oc#107) and is handled well before this
point, so an HTML document reaching here means nothing expected one.
`failed` is the flag `fetchAllPages()` already checks BEFORE its
end-of-pagination test (REQ-009), so marking it here also stops downstream
cleanup treating the page as "nothing left in the source".
The log names the shape and points at credentials — a `failed` flag with a
generic message sends whoever reads it hunting a phantom empty source.
Nine tests, and the ones that matter most are the negative ones: an empty JSON
array, an empty JSON object and an empty body must all stay non-failures, and
genuine XML must still parse. Those are what an over-eager fix breaks —
failing `[]` would turn the last page of every sync in the fleet into an error.
Positive control: disabling the new branch turns four red.
The e2e quarantine notes are corrected — the symptom they describe no longer
happens — and both now carry the issue number, which was the original
complaint on #1190.
Refs #1190. The FIXTURE half stays open: that Source points at an
authenticated localhost endpoint, so it tests Nextcloud's auth middleware
rather than the sync engine, and `sourceType: 'register/schema'` is not the
way out — reading FROM a register/schema is `@todo: implement`.
rubenvdlinde
requested review from
SudoThijn,
WilcoLouwerse,
bbrands02,
remko48 and
rjzondervan
as code owners
August 12, 2026 08:22
Contributor
Quality Report — ConductionNL/openconnector @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ✅ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| build | ✅ | ||||
| build | ✅ | ||||
| check-specs | ✅ | ||||
| test-l10n | ✅ | ||||
| composer | ✅ | ✅ 152/152 | |||
| npm | ✅ | ✅ 551/551 | |||
| PHPUnit | ✅ | ||||
| Newman | ✅ | ||||
| Playwright | ✅ | ||||
| Hydra gates | ✅ |
Quality workflow — 2026-08-12 08:40 UTC
Download the full PDF report from the workflow artifacts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1190 — fixes the product half. The fixture half stays open, deliberately; see below.
A 200 that is not a success
When a source answered 200 with a body no parser could read — overwhelmingly an HTML login or redirect page returned to a fetch with no session —
fetchSinglePageData()returned an empty page with nofailedflag.Upstream that is indistinguishable from a source that genuinely had nothing. The run reports success,
found: 0, nothing is transferred. No error, no alert, and any monitoring keyed on run status sees a clean run. The only signal that data did not move is afound: 0that looks like an empty source.The hard part is not spotting the login page
It is spotting it without breaking pagination.
[]and{}decode cleanly to an empty array — that is exactly how a paginated source says "no more pages". So the test cannot beempty($result); failing on that would turn the last page of every sync in the fleet into an error.The test is now whether any parser understood the body, tracked separately from whether the body held anything, via
json_last_error().HTML is refused the XML parser
A minimal login page —
<html><body>Please log in</body></html>— is well-formed XML. It used to parse, come back non-empty, and walk on into object extraction to die there onCannot determine the position of objects in the return body: a confusing complaint about the source's shape when the real problem is that nobody was logged in.I found this by writing the test, not by reading the code — the first HTML case passed only because its markup had an unclosed
<input>. Two shapes, two paths, and only one of them was covered.A source that genuinely serves HTML declares
Source.configuration.format: "html"(oc#107) and is handled well before this point, so an HTML document reaching here means nothing expected one.Why
failedand not an exceptionfailedis the flagfetchAllPages()already checks before its end-of-pagination test (REQ-009), so marking it here also stops downstream cleanup treating the page as "nothing left in the source". The plumbing existed; only this case never set it.The log names the shape and points at credentials — a
failedflag with a generic message sends whoever reads it hunting a phantom empty source.Tests
Nine, and the ones that matter most are the negative ones:
[]{}The
looksLikeHtmlDocument()helper is only ever used to sharpen the log line, never to decide anything — andtestNonHtmlGarbageFailsWithoutClaimingHtmlexists because without it the helper could returntrueunconditionally and every other test would still pass.Positive control: disabling the new branch turns four of the nine red.
Verification
FlowConcurrency, which CI provides).[OK] No errors. phpcs clean.What stays open
The fixture half of #1190. That Source points at
http://localhost/…/openregister/api/objects/…, so it exercises Nextcloud's auth middleware rather than the sync engine. It needs an external-shaped source that answers without a Nextcloud session — andsourceType: 'register/schema'is not the way out: reading from a register/schema is@todo: implementingetAllObjectsFromSource(). Verifying a replacement needs the full e2e stack, so it is not attempted here.Both
test.fixmeblocks now carry the issue number — the original complaint on #1190 — and the first one's written reason is corrected, because the symptom it described no longer happens: the run now fails loudly instead of succeeding withfound: 0.