This repository was archived by the owner on May 29, 2026. It is now read-only.
feat(admin-templates): primary-group routing resolver#49
Merged
Conversation
Pure read-only `AdminTemplateService::resolvePrimaryGroup(string $userId): string` that walks the admin-configured `group_order` setting (PR #44) and returns the first matching Nextcloud group, or the literal sentinel `Dashboard::DEFAULT_GROUP_ID` ('default') when no match exists. Single source of truth for downstream resolvers (REQ-DASH-013, REQ-DASH-018, etc.) — workspace rendering and dashboard resolution code paths MUST consume this method instead of inlining the algorithm. Tolerates stale (deleted) group IDs in `group_order` and unknown user IDs without throwing, per REQ-TMPL-012 final scenarios. Includes table-driven PHPUnit coverage of every REQ-TMPL-012 scenario: priority-order match, no overlap, empty group_order, configured-but-not-member, deleted/stale entries, unknown user. Also pins the literal 'default' sentinel and asserts the resolver performs zero writes (read-only contract). Internal helper `pickFirstMatch(array, array): ?string` is exposed as a static pure function for direct unit tests of the intersection logic. Out of scope (per change proposal): refactoring existing PageController / DashboardService call sites to consume the resolver — that's incremental work for a follow-up PR. This PR provides the resolver and locks its contract.
Contributor
Quality Report — ConductionNL/mydash @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ✅ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| composer | ✅ | ✅ 103/103 | |||
| npm | ✅ | ✅ 342/342 | |||
| PHPUnit | ⏭️ | ||||
| Newman | ⏭️ | ||||
| Playwright | ⏭️ |
Quality workflow — 2026-04-30 12:22 UTC
Download the full PDF report from the workflow artifacts.
rubenvdlinde
added a commit
that referenced
this pull request
May 3, 2026
* feat(admin-templates): primary-group resolver per REQ-TMPL-012..013 Pure read-only `AdminTemplateService::resolvePrimaryGroup(string $userId): string` that walks the admin-configured `group_order` setting (PR #44) and returns the first matching Nextcloud group, or the literal sentinel `Dashboard::DEFAULT_GROUP_ID` ('default') when no match exists. Single source of truth for downstream resolvers (REQ-DASH-013, REQ-DASH-018, etc.) — workspace rendering and dashboard resolution code paths MUST consume this method instead of inlining the algorithm. Tolerates stale (deleted) group IDs in `group_order` and unknown user IDs without throwing, per REQ-TMPL-012 final scenarios. Includes table-driven PHPUnit coverage of every REQ-TMPL-012 scenario: priority-order match, no overlap, empty group_order, configured-but-not-member, deleted/stale entries, unknown user. Also pins the literal 'default' sentinel and asserts the resolver performs zero writes (read-only contract). Internal helper `pickFirstMatch(array, array): ?string` is exposed as a static pure function for direct unit tests of the intersection logic. Out of scope (per change proposal): refactoring existing PageController / DashboardService call sites to consume the resolver — that's incremental work for a follow-up PR. This PR provides the resolver and locks its contract. * chore: update SBOM --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Implements REQ-TMPL-012 (primary-group resolution algorithm) and REQ-TMPL-013 (single routing authority) from the
group-routingchange proposal.AdminTemplateService::resolvePrimaryGroup(string $userId): string— walks the admin-configuredgroup_ordersetting and returns the first matching Nextcloud group ID, or the literal sentinelDashboard::DEFAULT_GROUP_ID('default') when no match exists.pickFirstMatch(array $orderedGroups, array $userGroups): ?stringexposed asstaticfor direct intersection-logic unit tests.group_orderand unknown user IDs without throwing — cleanup is the admin UI's responsibility.Builds on
AdminSettingsService::getGroupOrder(): arrayaccessor (already merged ondevelopment)Dashboard::DEFAULT_GROUP_ID = 'default'constant (already merged ondevelopment)Single-source-of-truth contract
This is the single routing authority for primary-group resolution. Every workspace-rendering and dashboard-resolution code path (REQ-DASH-013, REQ-DASH-018, …) MUST consult this resolver instead of inlining the algorithm. Parallel implementations are forbidden by REQ-TMPL-013.
Out of scope
Refactoring existing call sites in
PageController::indexandDashboardService::getVisibleDashboardsto consumeresolvePrimaryGroupis intentionally deferred to follow-up PRs (incremental work, one consumer per PR). This PR provides the resolver and locks its contract.Test plan
./vendor/bin/phpunit— 186/186 tests pass (17 new tests inAdminTemplateServiceTest)composer phpcs(PHPCS strict) — clean onlib/composer phpmd— cleanPermissionService,ConditionalService,AdminController); none inAdminTemplateService.phpgroup_order, configured-but-not-member, deleted/stale group, unknown userexpects(never())on every write surfaceSpec source
openspec/changes/group-routing/{proposal,tasks,specs/admin-templates/spec}.mdon branchfeature/replica-spec-proposals.