feat(docs): complete P2.6 type safety cleanup and P2.7 system invariants
P2.6: Type Safety Cleanup - Replaced 'any' return types in vite-plugin.ts with concrete types (UserConfig, transform return type) - Documented TypeScript mixin 'any[]' exception in PlatformServiceMixin.ts - Audit confirmed: zero 'any' in codebase except documented TS mixin limitation - All external boundaries use 'unknown', all data payloads use 'Record<string, unknown>' P2.7: System Invariants Documentation - Created SYSTEM_INVARIANTS.md documenting all 6 enforced invariants - Added to docs/00-INDEX.md under Policy & Contracts section - Each invariant includes: What, Why, How, Where Progress Docs Updates: - Updated 00-STATUS.md: marked P2.6/P2.7 complete, added type safety invariant note - Updated 01-CHANGELOG-WORK.md: added 2025-12-22 entries for P2.6/P2.7 - Updated 03-TEST-RUNS.md: added P2.6 type safety audit test run - Updated P2-DESIGN.md: marked P2.6 acceptance criteria complete - Updated SYSTEM_INVARIANTS.md: added Type Safety Notes section Baseline Tag: - Created v1.0.11-p0-p1.4-p1.5-p2.6-p2.7-complete TypeScript compilation: ✅ PASSES Build: ✅ PASSES CI: ✅ All checks pass
This commit is contained in:
@@ -0,0 +1,179 @@
|
||||
# ChatGPT Feedback Package
|
||||
|
||||
**Purpose:** Minimal, structured package for efficient ChatGPT collaboration.
|
||||
**Owner:** Development Team
|
||||
**Last Updated:** 2025-12-22
|
||||
**Status:** active
|
||||
|
||||
**Usage:** Copy this entire document + changed files only (not the whole repo).
|
||||
|
||||
---
|
||||
|
||||
## What Changed Since Last Review
|
||||
|
||||
**Date:** 2025-12-22
|
||||
|
||||
### Files Changed
|
||||
- **P1.4 COMPLETE**: Created shared core types module (`src/core/`)
|
||||
- `errors.ts`: ErrorCode enum, DailyNotificationError class
|
||||
- `enums.ts`: PermissionState, ScheduleKind, HistoryKind, etc.
|
||||
- `contracts.ts`: Schedule, ContentCache, Config, Callback, History interfaces
|
||||
- `events.ts`: EventLog with schemaVersion, EVENT_CODES constants
|
||||
- `guards.ts`: Runtime validators
|
||||
- `index.ts`: Curated public exports
|
||||
- **P1.4 COMPLETE**: Migrated consumers to use core types
|
||||
- `observability.ts`: Now imports EVENT_CODES/EventLog from `./core/events`
|
||||
- `definitions.ts`: Re-exports core contracts/enums instead of duplicating
|
||||
- `web.ts`: Uses canonical types from `./core` via `definitions.ts`
|
||||
- **P1.4 COMPLETE**: Core module purity enforcement
|
||||
- Platform import blocking: comprehensive regex detects Node builtins + Capacitor/React
|
||||
- Export validation: Node-based check for `package.json.exports['./core']`
|
||||
- Source checks (pre-build) + artifact checks (post-build) in `verify.sh`
|
||||
- **P0.5 COMPLETE**: Fixed packaging issues (exports["./web"] paths, tightened "files" field)
|
||||
- **P0.6 COMPLETE**: Enhanced verify.sh with forbidden files check (hard-fail on xcuserdata/xcuserstate/DerivedData/ios/App/)
|
||||
- **Packaging**: `npm pack --dry-run | grep -E "xcuserdata|xcuserstate|DerivedData|ios/App/"` now returns empty
|
||||
- **Exports**: Fixed `exports["./web"]` to point to actual build artifacts (`dist/esm/web.{js,d.ts}`)
|
||||
- **Files field**: Tightened from `"ios/"` to specific subpaths (`ios/Plugin/`, `ios/Tests/`, `ios/*.podspec`, etc.)
|
||||
|
||||
---
|
||||
|
||||
**Date:** 2025-12-16
|
||||
|
||||
### Files Changed
|
||||
- Created progress tracking system (`docs/progress/*`)
|
||||
- Documentation consolidation completed
|
||||
- **PHASE 1 COMPLETE**: Removed 21 Java files from `src/android/`
|
||||
- **PHASE 3 COMPLETE**: Created `scripts/verify.sh` and local CI (`ci/run.sh`)
|
||||
- **P0 COMPLETE**: Fixed build breakage (`src/web.ts`), podspec reference, markdown lint paths
|
||||
- **P1 COMPLETE**: Added build + pack checks to verify.sh
|
||||
- **P3 COMPLETE**: Updated parity matrix (iOS has persistence: CoreData + SQLite)
|
||||
- **P0.4 COMPLETE**: Added `.npmignore` as belt-and-suspenders safety net
|
||||
- **PARITY FIX**: iOS rollover is actually implemented - updated parity matrix
|
||||
- **RECOVERY TESTS COMPLETE**: Added iOS recovery tests (`DailyNotificationRecoveryTests.swift`) + test helper (`TestDBFactory.swift`)
|
||||
|
||||
### Commits
|
||||
- `c39bd7c` - docs: Consolidate documentation structure
|
||||
- `3f15352` - chore: Add zip and gz files to .gitignore
|
||||
- (Pending) - refactor: Remove native code from src/ directories
|
||||
- (Pending) - feat: Add verification script and CI workflow
|
||||
|
||||
---
|
||||
|
||||
## Current Blockers / Questions
|
||||
|
||||
*None currently. See [02-OPEN-QUESTIONS.md](./02-OPEN-QUESTIONS.md) for details.*
|
||||
|
||||
---
|
||||
|
||||
## Files to Review (Short List)
|
||||
|
||||
### Priority Files (Changed/New)
|
||||
- `docs/progress/00-STATUS.md` - Current status (PHASE 1 & 3 complete)
|
||||
- `docs/progress/04-PARITY-MATRIX.md` - Feature parity tracking
|
||||
- `scripts/verify.sh` - ✅ Created (verification entrypoint)
|
||||
- `ci/run.sh` - ✅ Created (local CI entrypoint)
|
||||
- `ci/README.md` - ✅ Created (local CI documentation)
|
||||
|
||||
### Context Files (If Needed)
|
||||
- `src/android/` - Check for native code (PHASE 1)
|
||||
- `src/ios/` - Check for native code (PHASE 1)
|
||||
- `ios/Plugin/` - iOS persistence implementation (PHASE 2)
|
||||
|
||||
---
|
||||
|
||||
## Verify Output Summary
|
||||
|
||||
**Last Run:** 2025-12-22
|
||||
**Status:** ✅ PUBLISH-SAFE + CORE MODULE VALIDATED
|
||||
**Commands:** `./ci/run.sh` (wraps `./scripts/verify.sh`) + `npm pack --dry-run | grep -E "xcuserdata|xcuserstate|DerivedData|ios/App/"`
|
||||
|
||||
**Results:**
|
||||
- ✅ Build: `npm run build` succeeds
|
||||
- ✅ Package: `npm pack --dry-run` includes `CapacitorDailyNotification.podspec`
|
||||
- ✅ Forbidden files check: **Empty** (no xcuserdata, xcuserstate, DerivedData, ios/App/)
|
||||
- ✅ Exports: `exports["./web"]` and `exports["./core"]` paths fixed to match actual build artifacts
|
||||
- ✅ Files field: Tightened from `"ios/"` to specific subpaths
|
||||
- ✅ TypeScript: All types compile correctly
|
||||
- ✅ Web implementation: `src/web.ts` implements all interface methods
|
||||
- ✅ Core module: Source checks pass (no platform imports), artifact checks pass (build outputs exist)
|
||||
- ✅ Core module: Export validation passes (`package.json.exports['./core']` exists and valid)
|
||||
|
||||
**All P0 + P1.4 checks passed. Package is publish-safe with correct exports, no forbidden files, and core module is pure.**
|
||||
|
||||
---
|
||||
|
||||
## Current Phase
|
||||
|
||||
**PHASE 1** - ✅ COMPLETE
|
||||
**PHASE 2** - ✅ COMPLETE (iOS persistence confirmed)
|
||||
**PHASE 3** - ✅ COMPLETE
|
||||
**PHASE 4 (P1.4)** - ✅ COMPLETE (Shared core types module)
|
||||
|
||||
**Next Phase:** PHASE 5 - Docs Consolidation
|
||||
|
||||
**Completed Tasks:**
|
||||
1. ✅ Removed 21 Java files from `src/android/` (duplicates)
|
||||
2. ✅ Verified npm packaging (package.json "files" field tightened)
|
||||
3. ✅ Created `scripts/verify.sh` verification entrypoint
|
||||
4. ✅ Created `ci/run.sh` local CI entrypoint (wraps verify.sh)
|
||||
5. ✅ Moved GitHub Actions template to `docs/_reference/` (reference only, not used)
|
||||
6. ✅ Fixed `exports["./web"]` paths (P0.6)
|
||||
7. ✅ Tightened `package.json` "files" field to exclude test app and Xcode user state (P0.5)
|
||||
8. ✅ Enhanced verify.sh with forbidden files check (hard-fail on xcuserdata/xcuserstate/DerivedData/ios/App/)
|
||||
9. ✅ Created shared core types module (`src/core/`) with errors/enums/contracts/events/guards (P1.4)
|
||||
10. ✅ Migrated consumers (observability.ts, definitions.ts, web.ts) to use core types (P1.4)
|
||||
11. ✅ Core module purity enforcement (platform import blocking, export validation) (P1.4)
|
||||
|
||||
---
|
||||
|
||||
## Next Actions
|
||||
|
||||
1. **PHASE 5** - Reduce doc overlap (archive duplicates)
|
||||
2. **P1.5** - Move iOS/App test harness out of published tree (optional)
|
||||
3. **P2.6** - Replace TS `any` with `unknown`/generics
|
||||
4. **P2.7** - Create SYSTEM_INVARIANTS.md
|
||||
5. **P2 Enhancement** - Combined edge case tests (DST + duplicate + cold start)
|
||||
|
||||
## iOS Rollover Implementation Status
|
||||
|
||||
**Status:** ✅ **IMPLEMENTED** (was incorrectly marked as missing)
|
||||
|
||||
**Mechanism:**
|
||||
- iOS uses `NotificationCenter` pattern for decoupled rollover
|
||||
- `AppDelegate.userNotificationCenter(_:willPresent:)` posts `DailyNotificationDelivered` event
|
||||
- Plugin listens via `NotificationCenter.default.addObserver()` in `load()`
|
||||
- `handleNotificationDelivery()` → `processRollover()` → `scheduler.scheduleNextNotification()`
|
||||
- Notifications include `notification_id` and `scheduled_time` in `userInfo` (line 161-165 in `DailyNotificationScheduler.swift`)
|
||||
|
||||
**Why it was marked as missing:**
|
||||
- Parity matrix was outdated
|
||||
- Rollover uses different pattern than Android (NotificationCenter vs direct call)
|
||||
- Implementation exists but wasn't verified in parity doc
|
||||
|
||||
## iOS Recovery Testing Status
|
||||
|
||||
**Status:** ✅ **IMPLEMENTED**
|
||||
|
||||
**Test Coverage:**
|
||||
- `test_recovery_ignores_invalid_records_and_continues()` - Invalid/corrupt records don't crash recovery
|
||||
- `test_recovery_handles_null_fields()` - Null/empty required fields handled gracefully
|
||||
- `test_recovery_dedupes_duplicate_delivery_events()` - Duplicate delivery events result in single rollover
|
||||
- `test_recovery_rollover_idempotent_when_called_twice()` - Rollover is idempotent (can be called multiple times)
|
||||
- `test_recovery_after_cold_start_reconciles_state()` - Cold start recovery reconciles state correctly
|
||||
- `test_recovery_migration_safety_unknown_fields()` - Unknown/missing fields don't crash decode paths
|
||||
|
||||
**Test Infrastructure:**
|
||||
- `TestDBFactory.swift` - Helper for creating test databases and injecting invalid data
|
||||
- Tests use temporary databases for isolation
|
||||
- Tests verify no crashes and graceful error handling
|
||||
|
||||
**Equivalent to Android TEST 4:**
|
||||
- Both platforms now have automated recovery testing
|
||||
- Both test invalid data handling, duplicate prevention, and idempotency
|
||||
|
||||
---
|
||||
|
||||
**Last Updated:** 2025-12-22
|
||||
**Package Version:** 1.0.11
|
||||
**Baseline Tag:** `v1.0.11-p0-p1.4-complete` (P0 + P1.4 milestone)
|
||||
|
||||
Reference in New Issue
Block a user