Skip to content

refactor(showcases): split DemoShowcasesService descriptor, widget partition and payload lookup into named steps - #1071

Open
rubenvdlinde wants to merge 2 commits into
developmentfrom
quality/i40-showcases-steps
Open

rubenvdlinde wants to merge 2 commits into
developmentfrom
quality/i40-showcases-steps

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

What changed

Four DemoShowcasesService methods read as named steps:

  • describeShowcase → readShowcaseManifest → descriptorFor (thumbnailUrl, installedDashboardUuid).
  • partitionWidgets (public, signature unchanged) reads the registered Nextcloud widget ids (registeredWidgetIds) before LaunchPad's own types, as before, and keeps a widget when isPlaceable says so (tile, LaunchPad type or registered type); unknown widgets with an id are skipped, in order.
  • getLaunchpadWidgetTypes → readWidgetTypesFile → typeSet, still cached and still loud when the list is missing.
  • loadDashboardPayload closes the archive after firstDashboardEntry (isDashboardEntryName, decodeZipEntry) and throws the same two messages.

Behaviour is unchanged: same descriptors, warnings, partitions, payloads and exception messages. The install / uninstall paths, which hold the install lock, are untouched.

Characterisation tests

tests/Unit/Service/DemoShowcasesBranchesTest.php was committed first, against the old code, and passes before and after: corrupt archive, missing and scalar manifest, manifest defaults with the install state, the partition of a mixed list (non-array entries, unknown ids, registered and LaunchPad types, tiles, empty ids) with its order, the first decodable dashboards/*.json entry, an archive with no dashboard entry and an archive that cannot be opened.

What ran

  • vendor/bin/phpunit -c phpunit.xml --no-coverage tests/Unit: 2753 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 lib/Service/DemoShowcasesService.php: no errors.

Figures (touched file lib/Service/DemoShowcasesService.php)

before after
units over complexity 5 5 units, 171 lines 1 unit, 48 lines (installShowcase, untouched)
units over 15 lines of code 9 units, 313 lines 6 units, 209 lines
units over 2 parameters 3 units, 95 lines 3 units, 95 lines

App-wide: unit complexity 4.02 → 4.08, unit size 3.40 → 3.41.

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

…ayload branches before the split

Assisted-by: ClaudeCode:claude-opus-5-5
…rtition and payload lookup into named 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