Skip to content

fix(install): import the register on a FRESH install, not only on upgrade - #496

Merged
rubenvdlinde merged 1 commit into
developmentfrom
feature/install-repair-hook
Aug 12, 2026
Merged

fix(install): import the register on a FRESH install, not only on upgrade#496
rubenvdlinde merged 1 commit into
developmentfrom
feature/install-repair-hook

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

InitializeSettings — whose own docblock says it initialises settings "on install/upgrade" — was declared only under <post-migration>, so it never ran on install.

Why post-migration never runs on a first install

\OC\Installer::installAppLastSteps:

$previousVersion = $this->config->getAppValue($info["id"], "installed_version", "");
if ($previousVersion !== "") { executeRepairSteps(…, "pre-migration"); }
$ms->migrate("latest", $previousVersion === "");     // schema-only on first install
if ($previousVersion !== "") { executeRepairSteps(…, "post-migration"); }
…
executeRepairSteps($info["id"], $info["repair-steps"]["install"]);   // UNCONDITIONAL

On a first install $previousVersion is "", so both pre- and post-migration are skipped. The upgrade path (AppManager::upgradeApp) runs pre/post-migration and not install. An app needs both blocks carrying the same baseline steps, each idempotent.

Effect: a fresh SoftwareCatalog instance had no register until someone happened to upgrade the app.

Scope

Only InitializeSettings is added. MigrateContactsToNc, BackfillContractApprovalState and RenameDutchCatalogColumns are migrations or backfills over data a fresh install does not have — running them against an empty database is at best a no-op and at worst install-breaking.

<install> sits after </post-migration> per the info.xsd sequence, verified against the schema (including a control confirming the schema rejects the block placed earlier).

Part of a sweep; openconnector and shillinq already carry this block.

🤖 Generated with Claude Code

Nextcloud runs migrateSchemaOnly() on a first install: $previousVersion is
'', so Installer::installAppLastSteps() skips BOTH pre-migration and
post-migration, and <install> is the only unconditional hook. The upgrade
path runs pre/post-migration and NOT install, so an app needs both blocks
carrying the same baseline steps, each idempotent.

Until now this app declared no <install> block at all, so the SoftwareCatalog register
never arrived on a fresh instance.

Only baseline-CREATING steps are added; migrations, backfills, renames and
cross-app ingests stay upgrade-only so they never run against an empty
database. <install> is placed after </post-migration> per the info.xsd
sequence (pre-migration, post-migration, live-migration, install, uninstall),
verified against the schema.
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/softwarecatalog @ 16b15c2

Check PHP Vue Security License Tests
lint
phpcs
phpmd
psalm
phpstan
phpmetrics
eslint
stylelint
build
check-manifest
check-vue-demi
test-l10n
composer ✅ 130/130
npm ✅ 718/718
app:check-code ⏭️
info.xml
REUSE
PHPUnit
Newman ⏭️
Playwright
Hydra gates

Quality workflow — 2026-08-12 19:28 UTC

Download the full PDF report from the workflow artifacts.

@rubenvdlinde
rubenvdlinde merged commit d788cd5 into development Aug 12, 2026
67 of 71 checks passed
@rubenvdlinde
rubenvdlinde deleted the feature/install-repair-hook branch August 12, 2026 19:43
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