This repository was archived by the owner on May 29, 2026. It is now read-only.
feat(infra): typed initial-state contract#45
Merged
Conversation
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 11:43 UTC
Download the full PDF report from the workflow artifacts.
697469e to
f650e25
Compare
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:03 UTC
Download the full PDF report from the workflow artifacts.
….005 Centralises every Nextcloud IInitialState::provideInitialState call behind a typed PHP builder (InitialStateBuilder + Page enum + MissingInitialStateException) and mirrors it on the JS side with a typed loadInitialState(page) reader that fills defaults and warns on schema-version mismatch. - lib/Service/InitialStateBuilder.php: typed setters per page key, REQUIRED_KEYS map keyed by Page::WORKSPACE / Page::ADMIN, apply() validates and pushes every key plus _schemaVersion (INITIAL_STATE_SCHEMA_VERSION = 1). - lib/Exception/MissingInitialStateException.php: thrown by apply() with page + missing-key context. - lib/Controller/PageController.php and lib/Settings/MyDashAdmin.php: refactored to construct the builder and call apply() — the only sanctioned call sites. - src/utils/loadInitialState.js: per-page key/default tables mirroring the spec Data Model exactly; emits a console.warn on _schemaVersion mismatch. - src/main.js and src/admin.js: load via the reader and provide() each key by identical name (no renaming at the boundary, no ref/reactive wrapping). - tests/Unit/Service/InitialStateBuilderTest.php: per-page apply pushes every key + schema version, missing required key throws, schema-version always pushed (5 tests / 28 assertions). - tests/Unit/Service/InitialStateContractLintTest.php: PHP grep that fails when any file under lib/ outside InitialStateBuilder.php calls provideInitialState() directly. - tests/bootstrap.php: register vendor/nextcloud/ocp PSR-4 autoload as fallback when running outside the Nextcloud container so OCP-interface mocks resolve. PR #42 owns the spec text on origin/feature/replica-spec-proposals. The matching JS-side Vitest scan (loadState\(['"]mydash) is deferred pending PR #43 (chore/add-vitest-setup); a TODO comment in InitialStateContractLintTest references the follow-up.
ac3d46b to
cac8fb3
Compare
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:07 UTC
Download the full PDF report from the workflow artifacts.
4 tasks
rubenvdlinde
added a commit
that referenced
this pull request
Apr 30, 2026
* feat(admin-settings): runtime gating on personal-dashboard creation per REQ-ASET-003 + 015
Implements REQ-ASET-003 (modified) runtime gating: when allow_user_dashboards flag
is OFF, POST /api/dashboards returns HTTP 403 with {status:'error',
error:'personal_dashboards_disabled', message:<translated>}.
- New PersonalDashboardsDisabledException (HTTP 403, stable error code)
- DashboardService::assertPersonalDashboardsAllowed() reads setting with default=false
- DashboardApiController::create() calls assert before permission checks; catches
exception and returns exact spec envelope; read/update/delete untouched
- i18n: English + Dutch strings in all four l10n files (json + js)
- PHPUnit: 7 tests covering envelope shape, readability/editability with flag off,
no-mutation guarantee, default-blocks-creation, defence-in-depth
- REQ-ASET-015 initial-state mirror already done in PR #45 (InitialStateBuilder);
skip per spec instruction
- Fork-side wiring deferred to fork-current-as-personal PR
- Pre-existing: fixed 13 phpcbf-auto-fixable blank-line errors in DashboardApiController
* chore: update SBOM
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This was referenced May 1, 2026
rubenvdlinde
added a commit
that referenced
this pull request
May 3, 2026
….005 (#45) Centralises every Nextcloud IInitialState::provideInitialState call behind a typed PHP builder (InitialStateBuilder + Page enum + MissingInitialStateException) and mirrors it on the JS side with a typed loadInitialState(page) reader that fills defaults and warns on schema-version mismatch. - lib/Service/InitialStateBuilder.php: typed setters per page key, REQUIRED_KEYS map keyed by Page::WORKSPACE / Page::ADMIN, apply() validates and pushes every key plus _schemaVersion (INITIAL_STATE_SCHEMA_VERSION = 1). - lib/Exception/MissingInitialStateException.php: thrown by apply() with page + missing-key context. - lib/Controller/PageController.php and lib/Settings/MyDashAdmin.php: refactored to construct the builder and call apply() — the only sanctioned call sites. - src/utils/loadInitialState.js: per-page key/default tables mirroring the spec Data Model exactly; emits a console.warn on _schemaVersion mismatch. - src/main.js and src/admin.js: load via the reader and provide() each key by identical name (no renaming at the boundary, no ref/reactive wrapping). - tests/Unit/Service/InitialStateBuilderTest.php: per-page apply pushes every key + schema version, missing required key throws, schema-version always pushed (5 tests / 28 assertions). - tests/Unit/Service/InitialStateContractLintTest.php: PHP grep that fails when any file under lib/ outside InitialStateBuilder.php calls provideInitialState() directly. - tests/bootstrap.php: register vendor/nextcloud/ocp PSR-4 autoload as fallback when running outside the Nextcloud container so OCP-interface mocks resolve. PR #42 owns the spec text on origin/feature/replica-spec-proposals. The matching JS-side Vitest scan (loadState\(['"]mydash) is deferred pending PR #43 (chore/add-vitest-setup); a TODO comment in InitialStateContractLintTest references the follow-up.
rubenvdlinde
added a commit
that referenced
this pull request
May 3, 2026
* feat(admin-settings): runtime gating on personal-dashboard creation per REQ-ASET-003 + 015
Implements REQ-ASET-003 (modified) runtime gating: when allow_user_dashboards flag
is OFF, POST /api/dashboards returns HTTP 403 with {status:'error',
error:'personal_dashboards_disabled', message:<translated>}.
- New PersonalDashboardsDisabledException (HTTP 403, stable error code)
- DashboardService::assertPersonalDashboardsAllowed() reads setting with default=false
- DashboardApiController::create() calls assert before permission checks; catches
exception and returns exact spec envelope; read/update/delete untouched
- i18n: English + Dutch strings in all four l10n files (json + js)
- PHPUnit: 7 tests covering envelope shape, readability/editability with flag off,
no-mutation guarantee, default-blocks-creation, defence-in-depth
- REQ-ASET-015 initial-state mirror already done in PR #45 (InitialStateBuilder);
skip per spec instruction
- Fork-side wiring deferred to fork-current-as-personal PR
- Pre-existing: fixed 13 phpcbf-auto-fixable blank-line errors in DashboardApiController
* 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
initial-state-contractper REQ-INIT-001..REQ-INIT-005.OCA\MyDash\Service\InitialStateBuilder(Pageenum + typedsetters +
apply()with required-key enforcement) +MissingInitialStateException.INITIAL_STATE_SCHEMA_VERSION = 1stamped on every payload under_schemaVersion. RefactoredPageController::indexandMyDashAdmin::getFormto use the builder — every other call site toIInitialState::provideInitialStateis forbidden by a PHPUnit grep lint.src/utils/loadInitialState.jswith per-pagedefault tables, schema-version mismatch warning, and a
getDeclaredKeys()helper. Refactored
src/main.jsandsrc/admin.jsto load via the readerand
provide()each key by identical name (REQ-INIT-004 / REQ-INIT-005 — noref/reactive wrap, no rename at boundary).
schema-version always present) + 1 lint test that scans
lib/for strayprovideInitialStatecalls. All 110 tests pass.This change is foundational for the upcoming
runtime-shellcapability.Notes
origin/feature/replica-spec-proposals(PR Add 25 OpenSpec proposals for multi-tenant dashboard platform #42).loadState(['\"]mydashoutsidethe reader) is deferred pending PR chore(test): add Vitest infrastructure #43 (
chore/add-vitest-setup) — thePHP test contains a
TODOreferencing the follow-up. A manualgrepconfirmsno
src/file currently bypasses the reader.tests/bootstrap.phpnow registersvendor/nextcloud/ocpPSR-4 as a fallbackautoloader so OCP-interface mocks resolve when running outside the Nextcloud
Docker container — no impact on in-container behaviour.
Quality gates
pre-existing on development; 725 → 765 — same root cause, no new defects)
1 new lint test)
Test plan