Commit Graph

25 Commits

Author SHA1 Message Date
5e0fb1d033 fix: conditionally include iOS/macOS targets only on macOS
- Add MSBuild condition to only include net8.0-ios and net8.0-maccatalyst on macOS
- On Linux/Windows, only net8.0 is included as a target framework
- Fixes GitHub dependency submission failing on Ubuntu runners
- Remove wasm-tools installation from test workflow (no longer needed)

This fixes the root cause of NETSDK1147 errors on non-macOS platforms.
2025-11-19 00:37:27 +02:00
09d8be41e3 security: add explicit permissions to all workflow jobs
- Add least-privilege permissions to all GitHub Actions jobs
- Fixes 8 CodeQL security findings (actions/missing-workflow-permissions)
- Build jobs: contents:read, actions:write
- Release job: contents:write, actions:read
- Test job: contents:read, checks:write, actions:write
- Status jobs: no permissions needed
- Add wasm-tools-net8 workload installation for test workflow

Follows principle of least privilege and GitHub Actions security best practices.
2025-11-19 00:29:48 +02:00
76b48f1ef7 security: add explicit permissions to all workflow jobs
- Add least-privilege permissions to all GitHub Actions jobs
- Fixes 8 CodeQL security findings (actions/missing-workflow-permissions)
- Build jobs: contents:read, actions:write
- Release job: contents:write, actions:read
- Test job: contents:read, checks:write, actions:write
- Status jobs: no permissions needed

Follows principle of least privilege and GitHub Actions security best practices.
2025-11-19 00:25:01 +02:00
546b1ae25e fix: use TargetFrameworks property to prevent iOS/macOS restore on Ubuntu
- Change from TargetFramework (singular) to TargetFrameworks (plural)
- Overrides framework list for all projects in dependency graph
- Prevents transitive restore of iOS/macOS workloads on Linux runner
2025-11-19 00:21:15 +02:00
3944537b42 docs: refine README descriptions 2025-11-19 00:20:15 +02:00
d92b8a4314 docs: remove promotional attributions
- Remove Claude Code attribution from release notes
- Remove Claude Code mentions from README acknowledgments and footer
- Keep technical documentation references to CLAUDE.md
2025-11-19 00:08:50 +02:00
e8e30dadff refactor: modernize publish workflow to use softprops/action-gh-release
- Replace deprecated actions/create-release@v1 with softprops/action-gh-release@v2.4.2
- Replace deprecated actions/upload-release-asset@v1 with artifact pattern
- Eliminates set-output deprecation warnings
- Uses modern GitHub Actions artifact upload/download pattern
- All actions pinned to commit SHAs for security
- Simpler workflow structure with clearer separation of concerns
2025-11-19 00:04:41 +02:00
a680f78877 chore: update workflows v0.0.2 2025-11-18 23:51:23 +02:00
7d66e748ee fix: remove --no-restore from workflows to fix NETSDK1047 assets error
- Remove separate restore steps for iOS and macOS builds
- Let dotnet build/publish handle restoration automatically
- Fixes assets file missing runtime identifiers issue
- iOS build already verified working, macOS should now work too
v0.0.1
2025-11-18 16:46:14 +02:00
d067c13241 fix: Update to macos-latest runner for Xcode 16 compatibility
Change from macos-14 to macos-latest to get Xcode 16.0+ which is
required by Microsoft.iOS 18.0.8324.

**Problem**:
- macos-14 runner has Xcode 15.4
- Microsoft.iOS 18.0.8324 requires iOS 18.0 SDK (Xcode 16.0+)
- Build fails with: "error MT0180: This version of Microsoft.iOS requires the iOS 18.0 SDK"

**Solution**:
Use macos-latest runner which should have Xcode 16.0 or later.

**Changes**:
- build.yml: macos-14 → macos-latest (iOS and macOS jobs)
- publish.yml: macos-14 → macos-latest (iOS and macOS jobs)

**Why macos-latest**:
- Always uses the most recent stable macOS runner
- Automatically gets Xcode updates
- More future-proof than pinning to specific version
- GitHub maintains compatibility with latest .NET MAUI

**Note**: If macos-latest doesn't have Xcode 16 yet, we may need to:
- Wait for GitHub to update the image
- Or add /p:MtouchLink=SdkOnly to disable full linking
- Or downgrade Microsoft.iOS package

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 14:39:42 +02:00
b3d45526e0 fix: Use correct MSBuild property syntax for target framework in restore
Change from -f flag to /p:TargetFramework MSBuild property in
dotnet restore commands.

**Problem**:
- dotnet restore doesn't support -f or --framework flag
- Using -f causes error: "MSB1008: Only one project can be specified"
- MSBuild interprets "net8.0-maccatalyst" as a second project path

**Solution**:
Use MSBuild property syntax instead:
- Before: dotnet restore src/HihaArvio/HihaArvio.csproj -f net8.0-ios
- After: dotnet restore src/HihaArvio/HihaArvio.csproj /p:TargetFramework=net8.0-ios

**Why This Works**:
The /p:TargetFramework property tells restore to generate assets
specifically for that target framework and its runtime identifiers.

**Changes**:
- build.yml: Use /p:TargetFramework for iOS and macOS restores
- publish.yml: Use /p:TargetFramework for iOS and macOS restores

**Verified Locally**:
 dotnet restore /p:TargetFramework=net8.0-maccatalyst - Success

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 14:36:06 +02:00
6ab9fcadfb fix: Specify target framework during restore in build workflows
Add -f parameter to dotnet restore commands to ensure assets are
generated for the specific target framework being built.

**Problem**:
- dotnet restore without -f flag restores all target frameworks
- But assets file (project.assets.json) might not include runtime identifiers
- Build fails with: "Assets file doesn't have a target for 'net8.0-maccatalyst/maccatalyst-x64'"
- Error NETSDK1047 when using --no-restore flag

**Solution**:
Explicitly restore for each target framework before building:
- iOS job: dotnet restore -f net8.0-ios
- macOS job: dotnet restore -f net8.0-maccatalyst

This ensures the assets file includes the correct runtime identifiers
(iossimulator-arm64, maccatalyst-x64, etc.) needed for the build.

**Changes**:
- build.yml: Add -f to restore for iOS and macOS jobs
- publish.yml: Add -f to restore for iOS and macOS jobs
- Updated step names for clarity

**Why This Works**:
The -f flag tells restore to generate assets for that specific TFM
and its associated RuntimeIdentifiers, which the build step requires.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 14:22:37 +02:00
b903941a4c fix: Force net8.0 target framework in test workflow
Add -p:TargetFramework=net8.0 to all dotnet commands in test workflow
to prevent transitive restoration of iOS/macOS target frameworks.

**Problem**:
- Test project references main HihaArvio project
- Main project has multi-target frameworks (net8.0, net8.0-ios, net8.0-maccatalyst)
- Restoring test project transitively restores all target frameworks
- iOS/macOS frameworks require macOS-specific workloads
- These workloads don't exist on Ubuntu runners

**Solution**:
Add `-p:TargetFramework=net8.0` to:
- dotnet restore (only restore for net8.0)
- dotnet build (only build for net8.0)
- dotnet test (only test for net8.0)

**Verification**:
Tested locally - all 189 tests pass with this approach.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 14:08:13 +02:00
571b783054 fix: Update GitHub workflows to handle platform-specific builds correctly
Fix workflow issues preventing builds from running:

**Test Workflow (test.yml)**
- Change from solution restore to test project only
- Only restore/build HihaArvio.Tests.csproj (net8.0 target)
- Prevents iOS/macOS workload errors on Ubuntu runner
- Tests run on Ubuntu (fast, cheap, no platform dependencies)

**Build Workflow (build.yml)**
- Replace `dotnet workload install maui` with `dotnet workload restore`
- Use project-specific restore instead of solution restore
- Restore only HihaArvio.csproj for each platform job
- Add `--no-restore` flag to build commands
- More reliable workload installation

**Publish Workflow (publish.yml)**
- Replace `dotnet workload install maui` with `dotnet workload restore`
- Use project-specific restore instead of solution restore
- Add `--no-restore` flag to publish commands
- Consistent with build workflow pattern

**Why These Changes**:
1. Solution restore on Linux tries to restore iOS/macOS targets
2. This requires workloads that don't exist on Ubuntu
3. Error: "NETSDK1147: workloads must be installed: wasm-tools-net8"
4. Solution: Only restore what each platform needs
5. Test project (net8.0) works on any platform
6. MAUI projects (iOS/macOS) only on macOS runners

**Benefits**:
- Tests run successfully on Ubuntu
- Faster workload installation (restore vs install)
- More explicit about dependencies
- Avoids unnecessary multi-platform restore
- Cleaner build logs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 14:05:49 +02:00
f851716a1f docs: Add comprehensive project README
Add detailed README with:

**Project Overview**
- Finnish "sleeve estimate" concept explained
- Shake-based gesture estimation features
- Multiple estimation modes (Work, Generic, Humorous)

**Architecture Documentation**
- .NET 8 MAUI with C# 12
- MVVM pattern with strict separation
- Technology stack breakdown
- Project structure diagram

**Testing Information**
- 189 tests across all layers
- Test execution commands
- Coverage reporting instructions

**Getting Started Guide**
- Prerequisites and installation
- Running the app on iOS and macOS
- Development workflow

**CI/CD Workflows**
- Test, Build, and Publish workflow overview
- Status badges for all workflows
- Link to detailed workflow documentation

**Development Standards**
- 0 warnings, 0 errors policy
- TDD approach
- Code quality standards

**Platform Support**
- iOS 15.0+ and macOS 12.0+ Catalyst
- Future platform plans (Web/Blazor, Android)

**Contributing Guidelines**
- Fork and PR workflow
- TDD requirements
- Commit message conventions

**Cultural Context**
- Finnish developer culture reference
- "Hiha-arvio" (sleeve estimate) explained
- Use cases and intended audience

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 13:52:21 +02:00
78b0b325a5 ci: Add GitHub workflows for test, build, and publish
Add comprehensive CI/CD workflows:

**Test Workflow (test.yml)**
- Runs on push/PR to main/develop
- Executes all 189 xUnit tests on Ubuntu runner
- Publishes test results and artifacts
- Fast and cost-effective validation

**Build Workflow (build.yml)**
- Builds for iOS and macOS Catalyst
- Runs on macOS-14 runners (Apple Silicon)
- Parallel builds for all platforms
- Uploads build artifacts (7-day retention)
- Overall build status reporting

**Publish Workflow (publish.yml)**
- Triggered by version tags (v*.*.*)
- Creates GitHub releases with changelogs
- Builds signed releases for distribution
- Uploads iOS and macOS .zip artifacts
- Supports pre-release detection (alpha/beta/rc)
- Manual workflow dispatch option

Features:
- .NET 8.0 with MAUI workload
- Parallel job execution for performance
- Artifact management and retention
- Test result reporting
- Release automation with version tracking
- Comprehensive documentation in workflows/README.md

Platforms supported:
- iOS 15.0+ (iossimulator-arm64)
- macOS 12.0+ Catalyst (maccatalyst-arm64)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 13:51:07 +02:00
31f7c4286d chore: Update bundle ID to net.ivuorinen.HihaArvio
Change ApplicationId from com.companyname.hihaarvio to net.ivuorinen.HihaArvio
to properly identify the application with the developer's domain.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 13:43:35 +02:00
a9249ec5d5 chore: Add .gitignore and remove build artifacts from repository
- Add comprehensive .gitignore for .NET MAUI projects
- Remove 2,651 tracked build artifacts (bin/, obj/ directories)
- Build artifacts should be generated in CI/CD, not committed

Patterns added to .gitignore:
- Build outputs (bin/, obj/, Debug/, Release/)
- IDE files (.vs/, .vscode/, *.user, .idea/)
- Test results and coverage files
- NuGet packages (*.nupkg, *.snupkg)
- SQLite database files (*.db, *.db-shm, *.db-wal)
- Platform-specific build artifacts
- Temporary and cache files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 13:41:36 +02:00
5ccd1075cb docs: Complete Milestone 6 - Mark project as complete
All 6 milestones successfully implemented and verified:

**Project Status:  COMPLETE**

**End-to-End Integration Verified:**
- Accelerometer → ShakeDetection → EstimateGeneration → Storage → UI
- MainViewModel auto-starts shake monitoring on initialization
- All ViewModels connected via dependency injection
- Dispose pattern implemented for proper cleanup
- 189 tests passing across all layers
- 0 warnings, 0 errors on all platforms

**Test Coverage:**
- Models: 48 tests
- Services: 71 tests (EstimateService, StorageService, ShakeDetectionService, Integration)
- ViewModels: 46 tests (MainViewModel, HistoryViewModel, SettingsViewModel)
- Accelerometer: 24 tests (SensorReading, iOS, Desktop, Contract)
- **Total: 189 tests, 100% passing**

**Platform Support:**
- iOS: Real accelerometer via MAUI API
- macOS Catalyst: Real accelerometer via MAUI API
- Desktop: Simulated accelerometer with timer-based readings
- All platforms: 0 warnings, 0 errors

**Architecture:**
- MVVM with strict separation (Models, ViewModels, Views, Services)
- Dependency injection throughout
- Platform-specific implementations via conditional compilation
- Event-driven shake detection
- Async/await for all I/O operations
- SQLite persistence with auto-pruning
- CommunityToolkit.Mvvm source generators

**Ready for Deployment:**
1. iOS deployment (real accelerometer)
2. macOS Catalyst deployment (real accelerometer)
3. Desktop testing (simulated accelerometer)

Future enhancements documented in CLAUDE.md for Web/Blazor support, haptic feedback, PWA manifest, and performance optimizations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 13:19:05 +02:00
7c3916dab1 feat: Complete Milestone 5 - Platform-Specific Implementations
Implemented platform-agnostic accelerometer abstraction with iOS and desktop implementations:

**IAccelerometerService Interface:**
- Platform-agnostic abstraction for sensor input
- SensorReading model (renamed from AccelerometerData to avoid MAUI conflict)
- X, Y, Z acceleration values in g-force units
- ReadingChanged event for continuous data stream
- Start/Stop methods for sensor control
- IsSupported property for platform capability detection

**IosAccelerometerService (10 tests):**
- Uses MAUI's Microsoft.Maui.Devices.Sensors.Accelerometer
- Works on iOS devices and simulator (provides simulated data)
- Conditional compilation (#if IOS || MACCATALYST)
- Converts MAUI AccelerometerData to our SensorReading
- Graceful failure when sensor unavailable
- Pragma directives for conditional warnings

**DesktopAccelerometerService (11 tests):**
- Timer-based simulated sensor readings (~60Hz)
- Generates realistic noise around 1g gravity baseline
- Device-at-rest simulation: X≈0, Y≈0, Z≈1
- Includes SimulateShake() method for manual testing
- Always reports IsSupported=true (simulation available)

**ShakeDetectionService Integration:**
- Updated constructor to require IAccelerometerService (breaking change)
- StartMonitoring: subscribes to ReadingChanged, calls accelerometer.Start()
- StopMonitoring: unsubscribes and calls accelerometer.Stop()
- OnAccelerometerReadingChanged: pipes readings to ProcessAccelerometerReading
- All existing shake detection logic unchanged

**Platform-Specific DI:**
- MauiProgram.cs uses conditional compilation
- iOS/macOS Catalyst: IosAccelerometerService
- Desktop/other platforms: DesktopAccelerometerService
- All services registered as Singleton

**Test Updates:**
- ShakeDetectionServiceTests: now uses NSubstitute mock accelerometer
- ServiceIntegrationTests: uses DesktopAccelerometerService
- AccelerometerServiceContractTests: base class for implementation tests
- IosAccelerometerServiceTests: 10 tests with platform-aware assertions
- DesktopAccelerometerServiceTests: 11 tests with async timing

**Technical Details:**
- SensorReading record type with required init properties
- Value equality for SensorReading (record type benefit)
- Timer disposal in DesktopAccelerometerService
- Event subscription safety (check for null, unsubscribe on stop)
- 189 tests passing (165 previous + 24 accelerometer)
- 0 warnings, 0 errors across all platforms

Build verified: net8.0, iOS (net8.0-ios), macOS Catalyst (net8.0-maccatalyst)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 13:11:14 +02:00
53cb6df8af feat: Complete Milestone 4 - Views/UI Layer
Implemented complete MVVM UI layer with data binding:

**Dependency Injection (MauiProgram.cs):**
- Registered all services as Singleton (shared state)
- Registered all ViewModels and Pages as Transient
- Configured SQLite database path

**Pages:**
- MainPage: Mode selector, estimate display, shake status
- HistoryPage: CollectionView with auto-load on appearing
- SettingsPage: Mode picker, MaxHistorySize stepper

**Value Converters:**
- IsNullConverter / IsNotNullConverter (visibility)
- BoolToShakingConverter (status text)
- BoolToColorConverter (status colors)
- InvertedBoolConverter (boolean inversion)

**Navigation:**
- AppShell with TabBar (Estimate, History, Settings)
- ContentTemplate for lazy loading

**Technical details:**
- All XAML uses x:DataType for compile-time checking
- All code-behind uses constructor injection
- Zero warnings, zero errors
- 165 tests passing (no UI tests yet)

Build verified across all platforms (net8.0, iOS, macOS Catalyst)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:52:20 +02:00
48a844b0c1 feat: implement ViewModels layer with TDD (Milestone 3)
Implemented all ViewModels using strict TDD (RED-GREEN-REFACTOR) with CommunityToolkit.Mvvm.

**ViewModels Implemented:**
- MainViewModel: Coordinates shake detection, estimate generation, and display
- HistoryViewModel: Manages estimate history display and clearing
- SettingsViewModel: Handles app settings (mode selection, history size)

**MainViewModel Features:**
- Subscribes to ShakeDetectionService events
- Generates estimates when shake stops (transition from shaking→not shaking)
- Automatically saves estimates to storage
- Resets shake detection after estimate generation
- Loads and saves settings (SelectedMode)
- Proper disposal pattern (unsubscribe, stop monitoring)

**HistoryViewModel Features:**
- ObservableCollection<EstimateResult> for UI binding
- LoadHistoryCommand to fetch from storage
- ClearHistoryCommand to remove all history
- IsEmpty property for conditional UI display
- Replaces collection contents on reload

**SettingsViewModel Features:**
- SelectedMode property (Work/Generic)
- MaxHistorySize property
- SaveSettingsCommand to persist changes
- Loads settings on initialization

**Tests:**
- MainViewModel: 18 tests (RED-GREEN-REFACTOR)
- HistoryViewModel: 15 tests (RED-GREEN-REFACTOR)
- SettingsViewModel: 13 tests (RED-GREEN-REFACTOR)
- Total: 165 tests, all passing (48 models + 71 services + 46 ViewModels)

**Quality:**
- Build: 0 warnings, 0 errors across all platforms
- All tests use NSubstitute for mocking
- Property change notifications verified
- Async operations properly tested

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:44:07 +02:00
dd3a4f3d97 feat: implement services layer with TDD (Milestone 2)
Implemented all core services following strict TDD (RED-GREEN-REFACTOR):

**Services Implemented:**
- EstimateService: Generate estimates with intensity-based range selection
- StorageService: SQLite persistence with auto-pruning
- ShakeDetectionService: Accelerometer-based shake detection

**Features:**
- Cryptographically secure RNG for estimate selection
- Easter egg logic (>15s shake → Humorous mode)
- Intensity-based range calculation (0-0.3: 20%, 0.3-0.7: 50%, 0.7+: 100%)
- SQLite with auto-pruning based on MaxHistorySize
- Shake detection with 1.5g threshold
- Duration tracking and intensity normalization (0.0-1.0)
- Event-based notifications (ShakeDataChanged)

**Tests:**
- EstimateService: 25 tests (RED-GREEN-REFACTOR)
- StorageService: 14 tests (RED-GREEN-REFACTOR)
- ShakeDetectionService: 22 tests (RED-GREEN-REFACTOR)
- Integration tests: 10 tests
- Total: 119 tests, all passing

**Quality:**
- Build: 0 warnings, 0 errors across all platforms
- Coverage: 51.28% line (low due to MAUI template), 87.5% branch
- All service/model code has high coverage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:37:20 +02:00
83ec08f14b feat: project setup and core models with TDD
MILESTONE 1 COMPLETE:

Project Setup:
- Create .NET 8 MAUI solution targeting iOS, macOS, and web
- Configure nullable reference types and warnings as errors
- Add required dependencies (MAUI 8.0.3, SQLite, CommunityToolkit.Mvvm)
- Add testing dependencies (xUnit, NSubstitute, FluentAssertions, Coverlet)
- Create comprehensive .editorconfig with C# coding standards
- Update CLAUDE.md with development commands

Core Models (TDD - 48 tests, all passing):
- EstimateMode enum (Work, Generic, Humorous modes)
- EstimateResult model with validation (intensity 0.0-1.0, non-null text)
- ShakeData model with intensity validation
- AppSettings model with defaults (Work mode, max history 10)

Build Status:
- All platforms build successfully (net8.0, iOS, macOS)
- 0 warnings, 0 errors
- Test coverage: 51.28% line, 87.5% branch (models have ~100% coverage)

Per spec: Strict TDD followed (RED-GREEN-REFACTOR), models fully validated

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:12:36 +02:00
17df545fba Add initial project design and specification documents
- Add comprehensive design document with validated architecture
- Add formal specification with RFC 2119 requirements language
- Include MVVM architecture, testing strategy, and platform requirements
- Define shake detection algorithm and estimate generation logic

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 01:21:38 +02:00