Implements Spec 095. What changed - Registers 4 Graph resources in the contract registry (plus required subresource template) - Refactors in-scope call sites to resolve Graph paths via the registry (no ad-hoc endpoints for these resources) - Adds/updates regression tests to prevent future drift (missing registry entries and endpoint string reintroduction) - Includes full SpecKit artifacts under specs/095-graph-contracts-registry-completeness/ Validation - Focused tests: - `vendor/bin/sail artisan test --compact tests/Feature/Graph/GraphContractRegistryCoverageSpec095Test.php tests/Feature/SettingsCatalogDefinitionResolverTest.php` Notes - Livewire v4.0+ / Filament v5 compliant (no UI changes). - No new routes/pages; no RBAC model changes. Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #114
6.3 KiB
Tasks: Graph Contracts Registry Completeness
Input: Design documents from /specs/095-graph-contracts-registry-completeness/
Prerequisites: plan.md, spec.md, research.md, data-model.md, contracts/
Tests: Required (Pest). Acceptance evidence is automated tests only.
Phase 1: Setup (Shared Infrastructure)
Purpose: Ensure the feature workspace and reference docs are in place.
- T001 Confirm spec artifacts are present and up to date in specs/095-graph-contracts-registry-completeness/spec.md and specs/095-graph-contracts-registry-completeness/plan.md
- T002 [P] Review current contract registry structure in config/graph_contracts.php
- T003 [P] Review current contract helper patterns in app/Services/Graph/GraphContractRegistry.php
- T021 If any additional unregistered Graph resources are discovered during review/implementation, record them in specs/095-graph-contracts-registry-completeness/research.md under a “Follow-ups (out of scope)” section and do not expand this spec’s implementation scope
Phase 2: Foundational (Blocking Prerequisites)
Purpose: Establish baseline patterns used by subsequent story work.
- T004 Review existing contract coverage test patterns in tests/Feature/Graph/GraphContractRegistryCoverageSpec081Test.php
Checkpoint: Foundation ready — user story work can begin.
Phase 3: User Story 1 — Drift coverage is complete (Priority: P1) 🎯 MVP
Goal: The contract registry explicitly models the four required resources and the template subresource.
Independent Test: A single Pest test file can assert the registry contains the required resources and subresource template.
- T005 [P] [US1] Create a new coverage test file in tests/Feature/Graph/GraphContractRegistryCoverageSpec095Test.php
- T006 [US1] Add contract type entries for the four required resources in config/graph_contracts.php
- T007 [US1] Add a subresource template for “Configuration Policy Template → setting templates” in config/graph_contracts.php
- T008 [US1] Implement registry assertions for the four resources + subresource template in tests/Feature/Graph/GraphContractRegistryCoverageSpec095Test.php
- T009 [US1] Verify the MVP by running the focused test command documented in specs/095-graph-contracts-registry-completeness/quickstart.md
Checkpoint: US1 complete when the new coverage test passes and the registry contains the four resources + template subresource.
Phase 4: User Story 2 — Graph calls are registry-backed (Priority: P2)
Goal: The five in-scope call sites resolve paths via the contract registry (no hardcoded endpoint substrings for these resources).
Independent Test: A regression guard can fail if hardcoded endpoint substrings are reintroduced in the five in-scope files.
- T010 [US2] Add/adjust registry path helpers needed by call sites in app/Services/Graph/GraphContractRegistry.php
- T011 [P] [US2] Refactor Graph template calls to use registry-backed paths in app/Services/Intune/ConfigurationPolicyTemplateResolver.php
- T012 [P] [US2] Refactor settings catalog definition calls to use registry-backed paths in app/Services/Intune/SettingsCatalogDefinitionResolver.php
- T013 [P] [US2] Refactor settings catalog category calls to use registry-backed paths in app/Services/Intune/SettingsCatalogCategoryResolver.php
- T014 [P] [US2] Refactor role assignment create/update/list calls to use registry-backed paths in app/Services/Intune/RbacOnboardingService.php
- T015 [P] [US2] Refactor role assignment health/read calls to use registry-backed paths in app/Services/Intune/RbacHealthService.php
Checkpoint: US2 complete when all five call sites use registry-backed paths for the four governed resources.
Phase 5: User Story 3 — Regressions are prevented (Priority: P3)
Goal: Automated tests fail if registry entries are removed or if call sites revert to ad-hoc endpoint strings.
Independent Test: Pest tests fail within a single run for either (a) missing registry entries or (b) hardcoded endpoints in in-scope files.
- T016 [P] [US3] Add string-regression guard assertions for the five in-scope files in tests/Feature/Graph/GraphContractRegistryCoverageSpec095Test.php
- T017 [US3] Ensure regression guard failure messages identify the missing resource or offending file in tests/Feature/Graph/GraphContractRegistryCoverageSpec095Test.php
- T018 [US3] Run the acceptance tests (focused) documented in specs/095-graph-contracts-registry-completeness/quickstart.md
Checkpoint: US3 complete when tests fail on simulated regressions and pass on the final implementation.
Phase 6: Polish & Cross-Cutting Concerns
- T019 [P] Apply formatting to changed files using
vendor/bin/sail bin pint --dirty(config/graph_contracts.php and app/Services/Graph/GraphContractRegistry.php) - T020 Run a targeted regression suite that includes the new coverage test and any directly impacted existing tests (tests/Feature/Graph/GraphContractRegistryCoverageSpec095Test.php and tests/Feature/SettingsCatalogDefinitionResolverTest.php)
Dependencies & Execution Order
Dependency Graph (User Story Order)
graph LR
Setup[Phase 1: Setup] --> Foundational[Phase 2: Foundational]
Foundational --> US1[US1: Registry coverage]
US1 --> US2[US2: Call sites registry-backed]
US2 --> US3[US3: Regression guards]
US3 --> Polish[Phase 6: Polish]
User Story Dependencies
- US1 has no dependencies beyond Foundational.
- US2 depends on US1 (registry entries must exist before call sites can reference them).
- US3 depends on US1 and US2 (guards validate the final state).
Parallel Execution Examples
User Story 1
- Can be split as:
- T005 (create test skeleton) can proceed in parallel with T006/T007 planning, but assertions should be written before implementation.
User Story 2
- After T010 is complete, these can run in parallel (different files):
- T011, T012, T013, T014, T015
User Story 3
- After US2 is complete, T016 can be implemented independently and validated via T018.
Implementation Strategy
MVP First (US1 only)
- Complete Phase 1–2
- Complete US1 (T005–T009)
- Stop and validate via the focused test
Incremental Delivery
- US1 → US2 → US3, running acceptance tests after each checkpoint.