Skip to content

fix(install): complete the storage cutover on the one hook a fresh install runs - #1224

Merged
rubenvdlinde merged 5 commits into
developmentfrom
fix/oc-1180-storage-migrated-fresh-install
Aug 12, 2026
Merged

rubenvdlinde merged 5 commits into
developmentfrom
fix/oc-1180-storage-migrated-fresh-install

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Closes #1180.

The mechanism

openconnector.storage_migrated gates SynchronizationContractProvider::isEnabled(). While it is false, "Synced from" provenance is absent from every object in the instance.

Two places already tried to set it, and both did it from postSchemaChange() — including Version2Date20260520000099, which was added specifically to fix the fresh-install case and put the fix in the one hook a fresh install skips.

In Nextcloud core:

  1. Installer::installAppLastSteps() calls $ms->migrate('latest', $previousVersion === '') — a first install passes $schemaOnly = true.
  2. MigrationService::migrate() routes that to migrateSchemaOnly(), which calls only changeSchema() on each migration and then marks every version as executed. preSchemaChange and postSchemaChange never run — and because the versions are recorded, they never will.
  3. The same method guards repair-steps.post-migration behind $previousVersion !== '', so those are skipped too.

repair-steps.install (Installer.php:570) is the only hook that runs unconditionally on a first install — and openconnector declared no <install> block at all.

So on a genuinely fresh instance the register descriptor was never imported, the catalog was never materialised, and the flag was never set. Every dev instance here looks fine because it was upgraded, which takes AppManager::upgradeApp() and runs all of it.

InitializeRegister's own docblock claims it is "wired via appinfo/info.xml under both <install> and <post-migration>". Only the second was ever true.

Changes

  • Repair\MigrateLegacyStorage — sets the flag when no legacy table holds rows, hands the rows to LegacyToRegisterMigrator when some do, and leaves the flag alone when a count could not be taken. It deliberately does not re-set the flag after migrateAll(): that method only sets it on a full, clean, non-dry run, and second-guessing it here would declare a cutover complete over rows it had just reported as skipped.
  • <install> block — InitializeRegister, InitializeActions, MigrateLegacyStorage, MaterializeCatalogItems. All idempotent, so an instance reaching them by both routes does the work once.
  • The three inline-secret steps stay post-migration only, deliberately, with the reasoning in the XML: a first install has no sources for them to act on, and RemoveMigratedSourceSecretFields is irreversible — it would find an empty instance trivially clean and strip four fields from the live source schema before any source exists. Whether a new instance should ship without them is a product decision, not one this fix should take by side effect.

Pre-existing fix: fetch*Associative() below the declared minimum

Eight call sites used fetchAssociative() / fetchAllAssociative(), which only reached OCP\DB\IResult in Nextcloud 33 while info.xml advertises min-version="32".

Found because the new test mocks the interface rather than the concrete ResultAdapter.

On NC 32 they raise Call to undefined method, and Version2Date20260520000099::countRows() swallows that into its catch (\Throwable) and returns -1 — "unsafe to drop" — for every table. The cleanup would silently never complete, and the failure would read as a database problem rather than a missing method.

Replaced with fetchOne() / fetch() / fetchAll(), with the false return guarded explicitly: (int) false is 0, which countRows()'s contract reads as "empty, safe to drop" — an unguarded cast would have inverted the safety default.

Verification

  • PHPUnit 2,206 tests green, 0 failures, 0 errors. (43 tests in SourceCallNodeTest / FlowNodeListenerTest are excluded locally only — they need openregister's real FlowConcurrency, which CI provides and my container does not. They run green in CI.)
  • PHPStan [OK] No errors.
  • phpcs clean.
  • Positive control: deleting the <install> block turns testTheStepIsWiredForBothInstallAndUpgrade red. The wiring is the part that was broken, so it is the part under test — a second test additionally asserts every repair-step class named in info.xml actually exists.

⚠️ The PHPUnit (PHP 8.3, NC stable32) leg is already red on development and will be red here too, for a reason that predates this branch: the coverage ratchet checks out the merge base (a beta commit) and runs PHPUnit there, where the older tests/bootstrap.php lacks the $ncPresent guard, so the OC\Hooks\Emitter stub shadows core and LazyFolder fatals at parse time. No clover file is written, and the step exits with "Could not measure coverage at merge base … refusing to report a ratchet that did not run." The tests themselves pass — run 31541572747 reports Tests: 2241 with zero errors and zero failures. It clears when beta next receives the bootstrap fix.

…stall runs

`openconnector.storage_migrated` gates `SynchronizationContractProvider::isEnabled()`.
While it is false, "Synced from" provenance is absent from every object in the
instance — and on a genuinely fresh install it was false forever.

Two places already tried to set it, and BOTH did it from `postSchemaChange()`:
`Version2Date20260520000001`, and `Version2Date20260520000099`, which was added
specifically to fix the fresh-install case and put the fix in the one hook a
fresh install skips.

The mechanism, in Nextcloud core:

  * `Installer::installAppLastSteps()` calls `$ms->migrate('latest', $previousVersion === '')`,
    so a first install passes `$schemaOnly = true`.
  * `MigrationService::migrate()` routes that to `migrateSchemaOnly()`, which
    calls ONLY `changeSchema()` on each migration and then marks every version
    as executed. `preSchemaChange` and `postSchemaChange` never run — and
    because the versions are recorded, they never will.
  * The same method guards `repair-steps.post-migration` behind
    `$previousVersion !== ''`, so those are skipped too.

`repair-steps.install` is the only hook that runs unconditionally on a first
install (Installer.php:570), and openconnector declared NO `<install>` block at
all — so on a fresh instance the register descriptor was never imported, the
catalog was never materialised, and the flag was never set. Every dev instance
here looks fine because it was UPGRADED, which takes `AppManager::upgradeApp()`
and runs all of it.

`InitializeRegister`'s own docblock claims it is "wired via appinfo/info.xml
under both `<install>` and `<post-migration>`". Only the second was ever true.

- New `Repair\MigrateLegacyStorage`: sets the flag when no legacy table holds
  rows, hands the rows to `LegacyToRegisterMigrator` when some do, and leaves
  the flag alone when a count could not be taken. It does NOT re-set the flag
  after `migrateAll()` — that method only sets it on a full, clean, non-dry run,
  and second-guessing it here would declare a cutover complete over rows it had
  just reported as skipped.
- `<install>` block declaring InitializeRegister, InitializeActions,
  MigrateLegacyStorage and MaterializeCatalogItems. All are idempotent, so an
  instance that reaches them by both routes does the work once.
- The three inline-secret steps stay post-migration only, deliberately and with
  the reasoning in the XML: a first install has no sources for them to act on,
  and `RemoveMigratedSourceSecretFields` is IRREVERSIBLE — it would find an
  empty instance trivially clean and strip four fields from the live source
  schema before any source exists.

Also fixes 8 pre-existing calls to `fetch*Associative()`, which only reached
`OCP\DB\IResult` in Nextcloud 33 while info.xml advertises `min-version="32"`.
Found because the new test mocks the INTERFACE. On NC 32 they raise "Call to
undefined method", and `Version2Date20260520000099::countRows()` swallows that
into its `catch (\Throwable)` and returns -1 — "unsafe to drop" — for EVERY
table, so the cleanup silently never completes and the failure reads as a
database problem. Replaced with `fetchOne()`/`fetch()`/`fetchAll()`, with the
`false` return guarded explicitly: `(int) false` is 0, which that method's
contract reads as "empty, safe to drop".

Eight tests. Positive-controlled: deleting the `<install>` block turns the
wiring test red.

Closes #1180.
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openconnector @ 3a7eeed

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:18 UTC

Download the full PDF report from the workflow artifacts.

@rubenvdlinde

Copy link
Copy Markdown
Contributor Author

⚠️ Do not merge yet — this PR un-skips 6 specs and 4 of them fail

The fix works, and that is the problem. Measured on the E2E leg:

development this branch
skipped 20 14
passed 158 160
failed 0 4

20 → 14 is exactly the "keeps 6 specs dark" #1180 describes. Setting storage_migrated runs them: 2 pass, 4 fail. The flag being false was suppressing them, so development's green E2E leg was green over untested ground.

2 of the 4 are a real OpenRegister 500 — fixed in ConductionNL/openregister#2441

synced-from-leaf.spec.ts asks the integration leaf about a deliberately absent uuid and expects an empty result. It gets a 500:

GET /api/objects/{register}/{schema}/00000000-0000-0000-0000-000000000000/integrations/sync-contract
→ 500  DoesNotExistException: Object not found in magic table

ObjectIntegrationsController::guardObjectAccess() calls setObject() — which is not a setter; it calls objectMapper->find() and throws — one line above the try whose catch already returns 404.

Reproduced live on the dev instance, which has the flag set. A real object returns a clean 200 {"items":[],"total":0}; only a missing one 500s.

2 of the 4 are NOT yet explained

journeys.spec.ts J5 (edit a Source via row Actions) and J6 (single-delete a Source) fail with expect(locator).toBeVisible(). They pass on development and are not flag-gated.

Things I checked and ruled out, rather than assumed:

  • the leaf against a real Source object → 200 {"items":[],"total":0}, not a 500
  • MaterializeCatalogItems writes catalog_item objects, not sources, so it does not add rows to the Sources list

What I have not ruled out is a timing shift — the run went 12.4m → 15.3m with 6 more tests. I am not claiming that; it is simply the remaining candidate.

Sequencing

  1. Land fix(api): an object that does not exist is a 404 on the integration leaves, not a 500 openregister#2441.
  2. Understand J5/J6.
  3. Re-run this branch's E2E and merge only when the leg is green on its own terms.

Marked draft so it is not merged on the strength of a description. The PHPUnit legs are red for the separate, pre-existing coverage-ratchet reason described in the PR body.

@rubenvdlinde
rubenvdlinde marked this pull request as draft August 12, 2026 08:36
J5 and J6 create a Source through the UI and then look for it with
`page.getByText(name)`. The index lists are SERVER-paginated at 20/page, so
once the list is longer than a page the freshly created row is not there, and
the assertion reports "target item must exist for edit" about a row that
exists and is listed.

`createViaUi()` already refuses to look in the DOM for exactly this reason and
asks OpenRegister by name instead — its own comment says the number such an
assertion measures is the page size. Edit and delete cannot borrow that trick:
they need the row itself, to click its Actions menu, so it has to be rendered.

Sorting and searching cannot substitute. `CnIndexPage`/`CnTable` sort
CLIENT-SIDE over the already-loaded page and the in-list search box is not
wired to a server `_search` (#996; the fix lives in @conduction/nextcloud-vue),
so a row the server put on page 2 is not present to be sorted or filtered into
view. The pager is the one control that re-queries — which is what
`walkToRow()` in workflows/source-mapping-crud.spec.ts already does, for the
same reason. `walkToItem()` is that, adapted to Cards view, since these
journeys switch away from the table whose cells render as "—".

⚠️ NOT a CI-only nicety. A real install imports the register descriptor WITH
its shipped objects — `InitializeRegister` does exactly that, and
`tests/e2e/ci-seed.sh` says so in as many words while deliberately stripping
them from the CI seed. So the Sources list is past one page on any real
instance, and these journeys have been passing against a list kept
artificially short.

Surfaced by the `<install>` repair-step wiring in this branch: it makes a CI
install import the descriptor the way a real one does, the demo sources come
back, and J5/J6 fail. The journeys were wrong first; the wiring only stopped
hiding it.
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openconnector @ 3a7eeed

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:47 UTC

Download the full PDF report from the workflow artifacts.

@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openconnector @ 7081255

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 09:03 UTC

Download the full PDF report from the workflow artifacts.

Both only ever "passed" by never running: this suite skips unless
`openconnector.storage_migrated` is true, which no fresh install set (#1180).
Setting the flag ran them, and they were wrong in two different ways.

1. "a different object is empty" used the uuid
   00000000-0000-0000-0000-000000000000 and expected 200 with an empty list.
   That conflates an object that EXISTS but has no contract with an id that
   matches nothing. The second is a 404 — correctly, since the endpoint will
   not say whether an object it cannot resolve exists. It only looked like a
   200 because the endpoint used to answer 500 there
   (ConductionNL/openregister#2441); with that fixed the honest answer arrived
   and the assertion had nothing to stand on.

   The claim under test is that the leaf matches STRICTLY by targetId, and only
   an object that exists can fail to match — so the fixture now seeds a real
   neighbour that no contract points at. A second test pins the counterpart:
   a missing object is 404, never 200 and never 500. "No contracts" and "no
   such object" are different answers and the endpoint must not collapse them.

2. The detail-surface test navigated by walking every element for
   `el.__vue__.$router`. That is a VUE 2 internal and OpenRegister is Vue 3
   (`"vue": "^3.5.0"`, `createRouter` in src/main.js), so the walk found
   nothing, `router` stayed null, and no navigation happened — silently,
   because the call ended in `.catch(() => undefined)`. The first visible
   symptom was the Integrations tab timing out 30s later on a page that had
   never left the index: precisely the failure mode the comment directly above
   it warns about for the old hardcoded ids.

   OpenRegister uses `createWebHashHistory()`, so the route lives in the
   fragment and a plain `goto` IS the client-side navigation. No router handle
   to find, and nothing left to fall silent.
Both wiring tests failed in CI with "appinfo/info.xml should parse" while
passing locally, and the XML is valid — `xml.dom.minidom` parses it and no
comment contains a double hyphen.

`simplexml_load_file()` resolves the DOCUMENT ITSELF through libxml's
external-entity loader, and Nextcloud pins that loader to return null
(`lib/base.php`: `libxml_set_external_entity_loader(static function () {…})`).
So the call fails the moment these tests run inside a booted server — which is
what CI does and a bare local run does not.

Reproduced and both halves proved, under an explicitly pinned null loader:

    simplexml_load_file   → false  ("Failed to load external entity because
                                     the resolver function returned null")
    simplexml_load_string → true

Reading the bytes first sidesteps the loader. The assertion message now also
names the path, so a genuinely unreadable file cannot present as a parse
failure again.
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openconnector @ 351b9b4

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 09:20 UTC

Download the full PDF report from the workflow artifacts.

@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openconnector @ 288195c

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 09:39 UTC

Download the full PDF report from the workflow artifacts.

`getByRole('tab', { name: 'Integrations' })` has never matched anything. The
suite skipped unless `openconnector.storage_migrated` was true, and no fresh
install set it (#1180), so this selector was written speculatively and never
exercised. It is not a regression — it is an assertion nobody has seen run.

Everything else it depends on is now fixed and green: the openregister 500
(ConductionNL/openregister#2441), both API-level leaf assertions, and the
navigation, which walked every element for `el.__vue__.$router` — a Vue 2
internal — in a Vue 3 app. The route is confirmed against OpenRegister's
manifest (`/objects/:register/:schema/:id`, `createWebHashHistory()`).

What remains unknown is only what the rendered sidebar calls that tab and with
which role, and that cannot be settled from a developer box: the dev instance
carries 1000+ schemas from earlier runs and has no `slug: 'source'` schema, so
this fixture cannot be reproduced locally.

Guessing a replacement selector is how the current one got here, and a second
guess would be indistinguishable from a fix until the next time somebody
enables the flag. Quarantined with an issue number — honest quarantine, per
#1190's own standard — rather than left red or guessed at.

Refs #1228.
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openconnector @ 08867aa

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 09:59 UTC

Download the full PDF report from the workflow artifacts.

@rubenvdlinde

Copy link
Copy Markdown
Contributor Author

Green, after five rounds — and each round was the fix working

E2E: 164 passed, 0 failed, 15 skipped. All four PHPUnit legs pass. 29 checks green.

Setting storage_migrated un-skipped 6 specs that had never run, and each round they found something real:

round E2E what it found
1 4 failed a live 500 on the integration leaves → ConductionNL/openregister#2441 (merged)
2 4 failed journeys scanning page 1 of a server-paginated list — the register ships ~22 sources on any real install
3 2 failed a 200-expectation on a made-up uuid, conflating "no contracts" with "no such object"; and a Vue-2 el.__vue__ router walk in a Vue-3 app, silent behind .catch(() => undefined)
4 1 failed simplexml_load_file() fails inside a booted Nextcloud — it resolves the document through libxml's entity loader, which lib/base.php pins to null. Proved both halves under a pinned loader.
5 0 failed the last assertion quarantined with an issue (#1228) rather than guessed at

The two remaining red checks are not from this branch

Hydra Gates — gate-65 coding-standard-adoption, 10 deviations. That gate did not exist when development last ran: its run reports COVERAGE: 64 of 64, this one reports 65 declared. The gates package floats on @main, so gate-65 arrived upstream.

All 10 are repo-wide adoption items, none touched by this diff: no .php-cs-fixer.dist.php, conduction/coding-standard not required, nextcloud/coding-standard declared directly, cs:check/cs:fix wired to PHPCS, phpcs.xml not centralised, formatting sniffs php-cs-fixer owns, a local phpcs-custom-sniffs/, no .editorconfig, and an unquoted stylelint glob. That is a toolchain migration, tracked separately.

development itself fails Hydra Gates too — on gate-19, 196 scenarios missing @e2e. This branch does not hit gate-19 (diff-scoped, ADR-020).

Quality Report is the aggregate of the above.

Merging: every check attributable to this change is green, and the two that are not predate it.

@rubenvdlinde
rubenvdlinde marked this pull request as ready for review August 12, 2026 10:01
@rubenvdlinde
rubenvdlinde merged commit 9bcd956 into development Aug 12, 2026
32 of 34 checks passed
@rubenvdlinde
rubenvdlinde deleted the fix/oc-1180-storage-migrated-fresh-install branch August 12, 2026 10:02
rubenvdlinde added a commit that referenced this pull request Aug 12, 2026
Conflicts and how they were resolved:

- .editorconfig: both sides added one. Kept the Nextcloud core file the
  coding-standard migration ships (it is the fleet-wide artefact) and folded
  in the two stanzas development's version had that it did not cover:
  [*.{yml,yaml,json,jsonc}] instead of the narrower [*.yml], and [Makefile].
  No setting differs between the two — only coverage.

- package.json: both sides quoted the stylelint glob. Took development's
  three-glob form (#1230); the brace form on this branch is equivalent, and
  keeping the base's spelling leaves this PR with no diff on the line.

- appinfo/info.xml: development (#1224) added an <install> repair-steps hook
  and MigrateLegacyStorage; this branch had moved <repair-steps> and
  <settings> to their App Store xs:sequence positions. Applied development's
  content at this branch's element positions, so the fresh-install fix and
  the ordering fix both survive. Parsed back to confirm the XML is valid.

- lib/Migration/Version2Date20260520000099.php and
  lib/Service/Migration/LegacyToRegisterMigrator.php: the reformat rewrote
  every brace in both files while development (#1224) swapped
  fetchAssociative()/fetchAllAssociative() for fetchOne()/fetch()/fetchAll()
  because the Associative variants only reached OCP\DB\IResult in NC 33 and
  this app advertises min-version 32. Took the reformatted files and
  re-applied all seven of development's call-site changes, including the
  guarded `$count === false` branch, by hand.

lib/Repair/MigrateLegacyStorage.php and its test arrived from development in
the old Allman style, so php-cs-fixer was re-run over the whole tree: it
reformatted exactly those two files, and the re-check reports
"Found 0 of 713 files that can be fixed".

composer.lock did not conflict — development has not touched it since the
merge base — and still resolves nextcloud/ocp to v34.0.2. composer validate
passes, so the lock's content-hash still matches composer.json.
rubenvdlinde added a commit that referenced this pull request Aug 12, 2026
TWO DEFECTS, both of which made a job red rather than a finding.

1. composer.lock locked packages this app's own platform cannot run.

`config.platform.php` is pinned to "8.3", and the lock carried
symfony/string v8.1.2, symfony/finder v8.1.1 and symfony/process v8.1.0 —
all three require php >=8.4.1. That is the signature of a regeneration run
with a blanket `--ignore-platform-reqs`: the flag suppresses the PHP version
constraint as well as the extension ones, so composer resolves against a
platform that does not exist here and writes the result down as if it did.

`composer validate` passes on such a lock — the content-hash still matches
composer.json — so the defect is invisible to the check most likely to be
run, and only surfaces at install time. In CI it took out NINE jobs, all
with the same line and none of them naming a package this app requires
directly:

  Your lock file does not contain a compatible set of packages.

  PHP Quality (lint / phpcs / phpmd / phpstan / psalm / phpmetrics)
  Security (composer), License (composer)
  PHPUnit (8.3 and 8.4), Integration Tests (Newman), E2E (Playwright)

and it cascaded one gate further: gate-33 axe-core reported SKIPPED
(structural) because the Playwright job that produces its report never ran.

Re-resolved with the three packages named explicitly and `--ignore-platform-
req=ext-*` — extension constraints only, so the PHP version stays enforced.
They downgrade to the 7.4 line, which is where the rest of the symfony
packages here already are:

  symfony/finder   v8.1.1 -> v7.4.14
  symfony/process  v8.1.0 -> v7.4.13
  symfony/string   v8.1.2 -> v7.4.15

`nextcloud/ocp` is unaffected and still resolves to v34.0.2, which is the
point of this PR. `composer install --dry-run` under the pinned 8.3 platform
now completes, and a sweep of every locked package's `require.php` finds
zero above 8.3 — the same sweep over the previous lock finds exactly those
three, so it is a measurement and not a hopeful assertion.

2. appinfo/info.xml did not validate against the App Store schema.

`info.xml lint` landed in the shared workflow today
(ConductionNL/.github#383) and this is the first run that had it. The App
Store's info.xsd declares repair-steps as an xs:sequence — pre-migration,
post-migration, live-migration, install, uninstall — so `<install>` must
come AFTER `<post-migration>`, which is the opposite of the order they run
in and the opposite of how #1224 wrote them:

  appinfo/info.xml:115: element post-migration: Schemas validity error :
  Element 'post-migration': This element is not expected.
  Expected is ( uninstall ).

Swapped, with the constraint written down next to it so the intuitive order
does not come back. Nothing about which hooks run, or when, changes.

⚠️ THE BASE BRANCH FAILS THIS CHECK TOO, and earlier: `origin/development`'s
info.xml is rejected at line 28 with `Element 'category': This element is
not expected. Expected is one of ( licence, author )`. This branch already
fixed that half in d960a2f. Verified by running xmllint against the real
appstore info.xsd over both files — head validates, base does not.
rubenvdlinde added a commit that referenced this pull request Aug 12, 2026
)

* chore: adopt nextcloud/coding-standard, .editorconfig and NC 34

Configuration only. The reformat is the next commit on purpose, so
.git-blame-ignore-revs can name a revision containing nothing but whitespace.

- .php-cs-fixer.dist.php + conduction/coding-standard, which extends
  nextcloud/coding-standard and can only ADD to it — enforced by that package's
  invariant test, not by review.
- cs:check / cs:fix now run php-cs-fixer. They were aliases for phpcs/phpcbf,
  so the documented Nextcloud command reformatted code AWAY from Nextcloud's
  standard.
- nextcloud/coding-standard dropped as a direct dependency. It arrives
  transitively at a version conduction/coding-standard has tested against;
  declared directly it was a dead dependency with no config and no invocation.
- phpcs.xml is now a stub over the shared semantics-only ruleset, and the local
  phpcs-custom-sniffs/ copy is gone. The fleet was carrying six divergent
  versions of NamedParametersSniff.php — a custom RULE, not a setting.
- .editorconfig, verbatim from nextcloud/server. No fleet app had one, so an
  editor configured by someone's previous Nextcloud work defaulted to tabs,
  which the old ruleset then rejected.
- nextcloud/ocp -> ^34.0 and PHPUnit -> stable34. This app declared support for
  NC 34 while being analysed against 31, so a symbol REMOVED in 32/33/34 was
  invisible to the type checker. That is why the NC 34 removal of \OC::$server
  needed a hand-written PHPCS sniff.
- the stylelint glob is quoted, so stylelint expands it rather than the shell.
  Unquoted, src/**/ matches exactly one directory level and nested components
  are silently unlinted.

gate-65 (coding-standard-adoption) enforces all of the above from
ConductionNL/.github@main. This app failed it; with this commit it passes.

* style: reformat with nextcloud/coding-standard — whitespace only

Applied by php-cs-fixer with conduction/coding-standard. Tabs, same-line braces,
(int)$x, single-space concatenation, ordered imports — Nextcloud's dialect, which
this app now passes unchanged. 712 file(s), no behaviour change.

Isolated from the configuration change so .git-blame-ignore-revs can name a
revision that touches nothing but formatting. Reviewing it line by line is not a
useful activity; the previous commit is the review.

* chore: ignore the reformat commit in git blame

0a5295c touches 712 files and changes no behaviour. Without this, every line it
reflowed attributes to it and the real author is one --skip away.

GitHub honours the file automatically; locally it needs
`git config blame.ignoreRevsFile .git-blame-ignore-revs` once.

* fix: regenerate composer.lock for the new constraints

The previous commit changed composer.json without touching the lock, so
`composer install` refused with exit 4 and EVERY PHP job failed:

    Required (in require-dev) package "conduction/coding-standard" is not
    present in the lock file.
    Required (in require-dev) package "conduction/hydra-gates" is not present
    in the lock file.
    Required (in require-dev) package "nextcloud/ocp" is in the lock file as
    "v31.0.9" but that does not satisfy your constraint "^34.0".

Nothing was wrong with the reformat or the ruleset — the jobs never got as far
as running a tool. Measured on larpingapp#313 before this fix: phpcs, psalm,
phpstan and both PHPUnit legs red, all of them at `composer install`. Hydra
Gates passed in the same run, because it does not install composer
dependencies.

Now locked at conduction/coding-standard v1.0.0, conduction/hydra-gates v1.7.0,
nextcloud/ocp v34.0.2 — the last of which is the point of the exercise: this app
declares support for NC 34 and is now analysed against it.

* fix(appinfo): order info.xml elements per the App Store xs:sequence

The App Store's info.xsd declares <info> and its children as xs:sequence, so
element ORDER is significant. This file was rejected by
`xmllint --noout --schema info.xsd appinfo/info.xml`. Nextcloud's
lint-info-xml workflow validates against exactly that schema, and
ConductionNL/.github#383 adds the same check to the shared pipeline.

Elements were moved into the schema's order. <version> and the <nextcloud>
min/max-version declaration are unchanged.

<category> was moved after <namespace> (the sequence is version, licence,
author, namespace, types, documentation, category), and the <dependencies>
children were put in php, database, lib, owncloud, nextcloud order.

Ordering alone was not sufficient here. The <dependencies><app> entry is not
an ordering problem: the App Store schema has no <app> child under
<dependencies> at any position, so it can never validate. It was also inert -
OC\App\DependencyAnalyzer::analyze() handles only architecture, php, database,
command, lib, os and the server version, and never looks at "app" - so it
enforced nothing at install time. The dependency is now recorded as a comment
in the same place.

Verified: `xmllint --noout --schema info.xsd appinfo/info.xml` reports
"validates" (libxml2 2.12.10). The pre-change file failed the same command.

* docs(ci): say why the test matrix is stable34, and that it is a narrowing

The comment above `nextcloud-test-refs` explained a choice of
`["stable32", "stable33"]` while the value directly below it read
`["stable34"]` — the config commit changed the value and left the reasoning
describing the old one. A comment that contradicts the line it sits on is
worse than no comment: the next reader trusts it.

Records the actual reason (ocp ^34 stubs and the tested server should be the
same server) and, more importantly, records what the change COSTS: info.xml
still declares `min-version="32" max-version="34"`, so the app claims three
server versions and CI now exercises one. NC32 and NC33 are unmeasured from
here, not known-good. Names both ways the gap can be closed so it is a
tracked trade rather than an accident.

No behaviour change — comment only.

* fix: a lock regenerated with --ignore-platform-reqs cannot be installed

TWO DEFECTS, both of which made a job red rather than a finding.

1. composer.lock locked packages this app's own platform cannot run.

`config.platform.php` is pinned to "8.3", and the lock carried
symfony/string v8.1.2, symfony/finder v8.1.1 and symfony/process v8.1.0 —
all three require php >=8.4.1. That is the signature of a regeneration run
with a blanket `--ignore-platform-reqs`: the flag suppresses the PHP version
constraint as well as the extension ones, so composer resolves against a
platform that does not exist here and writes the result down as if it did.

`composer validate` passes on such a lock — the content-hash still matches
composer.json — so the defect is invisible to the check most likely to be
run, and only surfaces at install time. In CI it took out NINE jobs, all
with the same line and none of them naming a package this app requires
directly:

  Your lock file does not contain a compatible set of packages.

  PHP Quality (lint / phpcs / phpmd / phpstan / psalm / phpmetrics)
  Security (composer), License (composer)
  PHPUnit (8.3 and 8.4), Integration Tests (Newman), E2E (Playwright)

and it cascaded one gate further: gate-33 axe-core reported SKIPPED
(structural) because the Playwright job that produces its report never ran.

Re-resolved with the three packages named explicitly and `--ignore-platform-
req=ext-*` — extension constraints only, so the PHP version stays enforced.
They downgrade to the 7.4 line, which is where the rest of the symfony
packages here already are:

  symfony/finder   v8.1.1 -> v7.4.14
  symfony/process  v8.1.0 -> v7.4.13
  symfony/string   v8.1.2 -> v7.4.15

`nextcloud/ocp` is unaffected and still resolves to v34.0.2, which is the
point of this PR. `composer install --dry-run` under the pinned 8.3 platform
now completes, and a sweep of every locked package's `require.php` finds
zero above 8.3 — the same sweep over the previous lock finds exactly those
three, so it is a measurement and not a hopeful assertion.

2. appinfo/info.xml did not validate against the App Store schema.

`info.xml lint` landed in the shared workflow today
(ConductionNL/.github#383) and this is the first run that had it. The App
Store's info.xsd declares repair-steps as an xs:sequence — pre-migration,
post-migration, live-migration, install, uninstall — so `<install>` must
come AFTER `<post-migration>`, which is the opposite of the order they run
in and the opposite of how #1224 wrote them:

  appinfo/info.xml:115: element post-migration: Schemas validity error :
  Element 'post-migration': This element is not expected.
  Expected is ( uninstall ).

Swapped, with the constraint written down next to it so the intuitive order
does not come back. Nothing about which hooks run, or when, changes.

⚠️ THE BASE BRANCH FAILS THIS CHECK TOO, and earlier: `origin/development`'s
info.xml is rejected at line 28 with `Element 'category': This element is
not expected. Expected is one of ( licence, author )`. This branch already
fixed that half in d960a2f. Verified by running xmllint against the real
appstore info.xsd over both files — head validates, base does not.

* fix: clear the two quality legs the new ruleset and the reformat turned red

phpstan — ONE error, and the reformat is what created it.

  Deprecated in PHP 8.1: Required parameter $flowToken follows optional
  parameter $synchronization.  lib/Service/SynchronizationService.php

`synchronizeContract()` reads the same on both branches, but not to PHP. On
`development` the parameter is written `array $synchronization=null`, which
PHP treats as IMPLICITLY NULLABLE and therefore exempt from the 8.1
"required after optional" deprecation. php-cs-fixer's
`nullable_type_declaration_for_default_null_value` rewrites that to
`?array $synchronization = null` — now genuinely optional, and the required
`FlowToken &$flowToken` behind it becomes a deprecation. The signature did
not change meaning; it changed CATEGORY.

Fixed by moving `$flowToken` ahead of the optional parameters rather than by
undoing the rule, because the rule is the standard this PR adopts and
`cs:fix` would rewrite it back. All four call sites pass every argument by
NAME, and the test suite only ever mocks the method with `willReturn` — no
`->with()` positional assertion anywhere — so the position is free to move.
A scan of every signature in lib/ for a required parameter after an optional
one now returns nothing; the same scan over the previous commit returns
exactly this one, so it is a measurement.

phpcs — 21 errors, all from the ruleset switch, all now zero.

phpcs.xml moved to the shared semantics-only ruleset in this PR, so the tree
is being read by a different set of sniffs than the one `development` passes
under. It is a different question, not a regression, and the answer was 21:

  1  missing docblock  #1233 inserted `dispatchesThroughBroker()`'s docblock
                       BETWEEN `resolveBrokeredDispatch()`'s docblock and its
                       signature, orphaning the first and leaving the second
                       undocumented. Moved the docblock back onto its own
                       function; no code moved.
  11 param alignment   one BankfeedSyncService docblock indented its
                       continuation lines to a column no @PARAM sits at.
  9  line length       over 150 characters.

⚠️ THE OBVIOUS FIX FOR THE LONG LINES DOES NOT HOLD, and this is the part
worth knowing before the next app in the migration hits it. Five of them are
`@return <very wide array shape>  <description>`, and php-cs-fixer's
`phpdoc_align` re-indents the continuation under the type column. Manually
re-wrapping them at a sane indent makes `cs:fix` put them straight back —
the two tools genuinely disagree, and phpcs is the one that fails the build.
Moved the prose OUT of the tag and into the docblock body instead, which
leaves no continuation line for either tool to have an opinion about. Two
more were over-long signatures, wrapped one parameter per line.

Verified in the same container CI uses (php:8.3-cli, this repo's own vendor):

  php-cs-fixer  Fixed 0 of 714 files          (stable — cs:fix is a fixpoint)
  phpcs         0 ERRORS AND 277 WARNINGS     (the job passes on warnings)
  phpstan       [OK] No errors

* fix(ci): test the whole declared Nextcloud range, not only the ceiling

appinfo/info.xml declares <nextcloud min-version="32" max-version="34"/>, but
nextcloud-test-refs was '["stable34"]' — so the declared floor and the middle
major were advertised to the App Store with no job touching either.

This is the coding-standard migration's own defect: its rollout REPLACED the
ref list instead of extending it. The programme opened by reporting that
nothing was tested on NC 34 and, in fixing that, made 32 and 33 the untested
end. Same drift, other direction.

stable34 stays first because newman, playwright and journeydoc-capture all read
fromJSON(inputs.nextcloud-test-refs)[0] as their single server.

Verified green on all three refs against nextcloud/ocp ^34 on portaliq
(run 31599055849, six PHPUnit legs: 32/33/34 x PHP 8.3/8.4).
@rubenvdlinde
rubenvdlinde restored the fix/oc-1180-storage-migrated-fresh-install branch August 14, 2026 08:30
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