Skip to content

[access] refactor(showcases): split DemoShowcasesService::installShowcase into lock and install steps - #1082

Open
rubenvdlinde wants to merge 2 commits into
developmentfrom
quality/i40-showcase-install
Open

rubenvdlinde wants to merge 2 commits into
developmentfrom
quality/i40-showcase-install

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

What changed

DemoShowcasesService::installShowcase (public, signature unchanged) reads as named steps. This PR touches a different method than the open descriptor / partition split of the same file and merges cleanly with it.

  • assertInstallable (unknown id, missing archive — both before the lock is taken, as before).
  • acquireInstallLock (the same "already in progress" refusal, with the lock exception as its cause) and releaseInstallLock, still in a finally so every install attempt releases the lock.
  • installLocked reuses an existing install, replaces it when forced, or installs fresh; the language and force flag travel as a ShowcaseInstallOptions.

Allowed and refused outcomes, the lock key and mode, and the order of the lock, uninstall, insert and marker writes are unchanged.

Characterisation tests

tests/Unit/Service/DemoShowcasesInstallGoldenTest.php was committed first, against the old code, and passes before and after: unknown ids and missing archives refused before the lock, a busy lock refused (with its cause) and not released, an existing install reused under the lock, a forced reinstall uninstalling before inserting, a fresh install marked and released, and a failed install still releasing the lock. Mutation check: ignoring the force flag on the old code turned the reuse golden red; restored before committing.

What ran

  • vendor/bin/phpunit -c phpunit.xml --no-coverage tests/Unit: 2751 tests OK (13 skipped, as on development).
  • vendor/bin/phpcs (two warnings about missing spec tags on getDataDir / setDataDirForTesting, the same as on development) and vendor/bin/phpstan analyse on the touched lib files: no errors.

Figures (touched files lib/Service/DemoShowcasesService.php, lib/Service/ShowcaseInstallOptions.php)

before after
installShowcase complexity 7, 48 lines, 3 parameters complexity 1, 13 lines (signature unchanged)
units over complexity 5, whole file 5 units, 171 lines 4 units, 123 lines (the rest is split in the other open PR)
units over 15 lines of code 9 units, 313 lines 8 units, 265 lines
units over 2 parameters 3 units, 95 lines 3 units, 61 lines

App-wide: unit complexity 4.02 → 4.05, unit interfacing 3.14 → 3.15.

Maintainability floor: compare against development holds.

AI-assisted: prepared with Claude Code (claude-opus-5-5); reviewed by a maintainer before merge.


Generated by Claude Code

…andling before the split

Assisted-by: ClaudeCode:claude-opus-5-5
… lock and install steps

Assisted-by: ClaudeCode:claude-opus-5-5
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.

2 participants