docs(02-01): complete Wave 0 test scaffold plan

- 02-01-SUMMARY.md: classification helper + 5 test scaffolds across PERM-01..06
- STATE.md: progress 73%, decisions logged, session updated
- ROADMAP.md: phase 02 progress 4/7 summaries
This commit is contained in:
Dev
2026-04-02 13:56:02 +02:00
parent 9f2e2f9899
commit 0480f97059
2 changed files with 162 additions and 5 deletions

View File

@@ -3,14 +3,14 @@ gsd_state_version: 1.0
milestone: v1.0 milestone: v1.0
milestone_name: milestone milestone_name: milestone
status: planning status: planning
stopped_at: Completed 02-03-PLAN.md — SiteListService tenant admin API wrapper implemented stopped_at: Completed 02-01-PLAN.md — Wave 0 test scaffold for permissions phase
last_updated: "2026-04-02T11:52:01.104Z" last_updated: "2026-04-02T11:55:45.013Z"
last_activity: 2026-04-02 — Roadmap created, requirements mapped, all 42 v1 requirements assigned to phases last_activity: 2026-04-02 — Roadmap created, requirements mapped, all 42 v1 requirements assigned to phases
progress: progress:
total_phases: 5 total_phases: 5
completed_phases: 1 completed_phases: 1
total_plans: 15 total_plans: 15
completed_plans: 10 completed_plans: 11
percent: 13 percent: 13
--- ---
@@ -61,6 +61,7 @@ Progress: [█░░░░░░░░░] 13%
| Phase 01-foundation P08 | 15 | 2 tasks | 3 files | | Phase 01-foundation P08 | 15 | 2 tasks | 3 files |
| Phase 02-permissions P05 | 1min | 1 tasks | 3 files | | Phase 02-permissions P05 | 1min | 1 tasks | 3 files |
| Phase 02-permissions P03 | 1min | 1 tasks | 5 files | | Phase 02-permissions P03 | 1min | 1 tasks | 5 files |
| Phase 02-permissions P01 | 5min | 2 tasks | 9 files |
## Accumulated Context ## Accumulated Context
@@ -98,6 +99,8 @@ Recent decisions affecting current work:
- [Phase 01-foundation]: 45 tests total: 44 pass, 1 skip (interactive MSAL GetOrCreateContextAsync_CreatesContext — browser/WAM flow excluded from automated suite) - [Phase 01-foundation]: 45 tests total: 44 pass, 1 skip (interactive MSAL GetOrCreateContextAsync_CreatesContext — browser/WAM flow excluded from automated suite)
- [Phase 02-permissions]: DeriveAdminUrl is internal static — enables direct unit testing of admin URL regex without live tenant - [Phase 02-permissions]: DeriveAdminUrl is internal static — enables direct unit testing of admin URL regex without live tenant
- [Phase 02-permissions]: InternalsVisibleTo added to AssemblyInfo.cs — required for test project to access internal DeriveAdminUrl; plan omitted this assembly attribute - [Phase 02-permissions]: InternalsVisibleTo added to AssemblyInfo.cs — required for test project to access internal DeriveAdminUrl; plan omitted this assembly attribute
- [Phase 02-permissions]: Export service stubs created in Plan 02-01 so test project compiles before Plan 03 implementation
- [Phase 02-permissions]: Principal.Email removed from CSOM load expression — Email only exists on User subtype, not Principal base class
### Pending Todos ### Pending Todos
@@ -111,6 +114,6 @@ None yet.
## Session Continuity ## Session Continuity
Last session: 2026-04-02T11:52:01.101Z Last session: 2026-04-02T11:55:36.761Z
Stopped at: Completed 02-03-PLAN.md — SiteListService tenant admin API wrapper implemented Stopped at: Completed 02-01-PLAN.md — Wave 0 test scaffold for permissions phase
Resume file: None Resume file: None

View File

@@ -0,0 +1,154 @@
---
phase: 02-permissions
plan: 01
subsystem: testing
tags: [xunit, tdd, permissions, csom, csv-export, html-export, classification]
requires:
- phase: 01-foundation
provides: OperationProgress model, xUnit test infrastructure, AsyncRelayCommand patterns
provides:
- PermissionEntryHelper static helper (IsExternalUser, FilterPermissionLevels, IsSharingLinksGroup)
- 5 test scaffold files covering PERM-01 through PERM-06
- Classification tests (7 green) validating pure-function helper logic
- Export service stubs (CsvExportService, HtmlExportService) — NotImplementedException placeholders for Plan 03
- PermissionsService compile fixes (Principal.Email removed, folder param corrected to ListItem)
affects: [02-02, 02-03, 02-04, 02-06]
tech-stack:
added: []
patterns:
- "Test scaffold: skipped stubs for CSOM-dependent tests, real [Fact] for pure-function tests"
- "Export service stubs with NotImplementedException — replaced in Plan 03"
- "PermissionEntryHelper: pure static classification logic, no dependencies"
key-files:
created:
- SharepointToolbox/Core/Helpers/PermissionEntryHelper.cs
- SharepointToolbox.Tests/Services/PermissionsServiceTests.cs
- SharepointToolbox.Tests/ViewModels/PermissionsViewModelTests.cs
- SharepointToolbox.Tests/Services/PermissionEntryClassificationTests.cs
- SharepointToolbox.Tests/Services/Export/CsvExportServiceTests.cs
- SharepointToolbox.Tests/Services/Export/HtmlExportServiceTests.cs
- SharepointToolbox/Services/Export/CsvExportService.cs
- SharepointToolbox/Services/Export/HtmlExportService.cs
modified:
- SharepointToolbox/Services/PermissionsService.cs
key-decisions:
- "Export service stubs created in Plan 02-01 (not Plan 03) so test project compiles before implementation"
- "PermissionEntryHelper placed in main project Core/Helpers — pure static, no coupling to test project"
- "Principal.Email removed from CSOM load expression — Email only exists on User (CSOM Principal subtype), not Principal base"
- "folder param in GetFolderPermissionsAsync changed to ListItem (SecurableObject) instead of Folder (not a SecurableObject)"
patterns-established:
- "Skip-stub pattern: CSOM-dependent tests use [Fact(Skip=...)] so they compile and report in test count without requiring live SharePoint"
- "Pure-function tests: no Skip needed for static helper logic — run immediately and validate contracts"
requirements-completed: [PERM-01, PERM-02, PERM-03, PERM-04, PERM-05, PERM-06]
duration: 5min
completed: 2026-04-02
---
# Phase 2 Plan 1: Wave 0 Test Scaffold Summary
**PermissionEntryHelper static classification helpers plus 5 test scaffold files covering PERM-01 through PERM-06, with 7 immediately-passing classification tests and 6 stub/skip tests waiting on Plan 02/03 implementations**
## Performance
- **Duration:** 5 min
- **Started:** 2026-04-02T11:48:37Z
- **Completed:** 2026-04-02T11:53:52Z
- **Tasks:** 2
- **Files modified:** 9
## Accomplishments
- `PermissionEntryHelper.cs` with `IsExternalUser`, `FilterPermissionLevels`, and `IsSharingLinksGroup` — pure static, 7 tests green immediately
- 5 test scaffold files created covering PERM-01 through PERM-06 (PERM-07 covered by Phase 1)
- `CsvExportService` and `HtmlExportService` stub placeholders so export tests compile now; full implementation deferred to Plan 03
- Fixed two pre-existing compile errors in `PermissionsService.cs`: removed `Principal.Email` (only on `User`) and corrected folder param to `ListItem` (a `SecurableObject`)
## Task Commits
Each task was committed atomically:
1. **Task 1: Scaffold PermissionsService, ViewModel, and classification test stubs** - `a9f6bde` (test)
2. **Task 2: Scaffold export service test stubs** - `83464a0` (test)
3. **Rule 3 + Rule 1 - Service stubs and PermissionsService bug fixes** - `9f2e2f9` (fix)
## Files Created/Modified
- `SharepointToolbox/Core/Helpers/PermissionEntryHelper.cs` — IsExternalUser, FilterPermissionLevels, IsSharingLinksGroup static helpers
- `SharepointToolbox.Tests/Services/PermissionsServiceTests.cs` — 2 skipped stubs (PERM-01, PERM-04)
- `SharepointToolbox.Tests/ViewModels/PermissionsViewModelTests.cs` — 1 skipped stub (PERM-02)
- `SharepointToolbox.Tests/Services/PermissionEntryClassificationTests.cs` — 7 real [Fact] tests (PERM-03)
- `SharepointToolbox.Tests/Services/Export/CsvExportServiceTests.cs` — 3 real [Fact] tests (PERM-05), fail until Plan 03
- `SharepointToolbox.Tests/Services/Export/HtmlExportServiceTests.cs` — 3 real [Fact] tests (PERM-06), fail until Plan 03
- `SharepointToolbox/Services/Export/CsvExportService.cs` — NotImplementedException stub so export tests compile
- `SharepointToolbox/Services/Export/HtmlExportService.cs` — NotImplementedException stub so export tests compile
- `SharepointToolbox/Services/PermissionsService.cs` — Bug fixes: removed Principal.Email, corrected Folder→ListItem param
## Decisions Made
- Export service stubs created in Plan 02-01 so that the test project compiles. Without stubs, the export test files cause CS0234 (namespace not found) blocking ALL tests from running. Plan 03 replaces the stubs with real implementations.
- `PermissionEntryHelper` placed in main project `Core/Helpers` — it's shared logic used by both `PermissionsService` (production) and tests. Keeping it in the main project avoids any test→production dependency inversion.
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 3 - Blocking] Created CsvExportService and HtmlExportService stubs**
- **Found during:** Task 2 (export test scaffold)
- **Issue:** Export test files reference `SharepointToolbox.Services.Export.*` which doesn't exist yet, causing CS0234 compilation failures that block all tests
- **Fix:** Created `Services/Export/CsvExportService.cs` and `Services/Export/HtmlExportService.cs` with `NotImplementedException` stubs matching the method signatures from the `<interfaces>` block
- **Files modified:** SharepointToolbox/Services/Export/CsvExportService.cs, SharepointToolbox/Services/Export/HtmlExportService.cs
- **Verification:** `dotnet build` succeeds; test project compiles
- **Committed in:** `9f2e2f9`
**2. [Rule 1 - Bug] Fixed Principal.Email in PermissionsService CSOM load expression**
- **Found during:** Task 2 (first full build after adding export stubs)
- **Issue:** `ra.Member.Email` causes CS1061 — `Principal` doesn't have `Email` (only `User` does)
- **Fix:** Removed `ra.Member.Email` from the CSOM Include expression; `UserLogins` uses `LoginName` which is on `Principal`
- **Files modified:** SharepointToolbox/Services/PermissionsService.cs
- **Verification:** Build succeeds, no CS1061
- **Committed in:** `9f2e2f9`
**3. [Rule 1 - Bug] Fixed Folder→ListItem parameter in GetFolderPermissionsAsync**
- **Found during:** Task 2 (same build)
- **Issue:** `ExtractPermissionsAsync` expects `SecurableObject`; `Folder` is not a `SecurableObject` (CS1503). The `ListItem` variable (`item`) IS a `SecurableObject`.
- **Fix:** Changed `folder` argument to `item` in the `ExtractPermissionsAsync` call; `folder` is still loaded for URL/name metadata
- **Files modified:** SharepointToolbox/Services/PermissionsService.cs
- **Verification:** Build succeeds, no CS1503
- **Committed in:** `9f2e2f9`
---
**Total deviations:** 3 auto-fixed (1 blocking, 2 bugs)
**Impact on plan:** All auto-fixes required for test compilation. Bugs 2 and 3 were pre-existing in PermissionsService.cs from a prior plan execution. No scope creep — stubs and bug fixes are minimal correctness work.
## Issues Encountered
- `SiteListServiceTests.cs` (from commit `5c10840`) had a spurious compilation error on first build pass, but resolved after fresh `dotnet build` — likely stale obj/ cache. No action needed.
- Export service stubs throw `NotImplementedException` at runtime, causing 6 test failures in the suite. This is the expected state until Plan 03.
## User Setup Required
None - no external service configuration required.
## Next Phase Readiness
- Classification helper and test scaffold complete — Plan 02-02 can create interfaces/models with tests already waiting
- Export service stubs in place — Plan 03 can replace `throw new NotImplementedException()` with real implementations, making the 6 failing export tests turn green
- `PermissionsService.cs` compile errors fixed — Plan 02-04 (PermissionsViewModel) and 02-06 (integration) can build immediately
## Self-Check: PASSED
All 9 key files verified present on disk. All 3 task commits (a9f6bde, 83464a0, 9f2e2f9) confirmed in git log.
---
*Phase: 02-permissions*
*Completed: 2026-04-02*