Skip to content

Commit a49ee1d

Browse files
author
aligneddev
committed
constituion: local storage and engineering updates
1 parent cd77a1a commit a49ee1d

2 files changed

Lines changed: 49 additions & 17 deletions

File tree

.specify/memory/constitution.md

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Bike Tracking Application Constitution
2-
<!-- Sync Impact Report v1.10
3-
Rationale: Replaced frontend direction with React (latest stable) + TypeScript + Vite. Updated Principle V and all frontend-related sections for consistency. Added an explicit rule to always reference official React documentation at https://react.dev/.
2+
<!-- Sync Impact Report v1.10.1
3+
Rationale: Clarified the local deployment approach for end-user machines by standardizing SQLite local-file storage as the default profile and documenting safety expectations for storage path and upgrades.
44
Modified Sections:
5-
- Core Principles > V: Frontend stack standardized on React
6-
- Core Principles > VII: Client-side validation references updated to React validation patterns
7-
- Technology Stack Requirements > Frontend: Framework, UI, hosting, API communication, validation, and documentation guidance updated for React
8-
- Development Workflow and checklists: frontend examples and validation references updated to React equivalents
9-
- Monthly Technology Audit and onboarding notes: frontend package/version checks aligned with React
10-
Status: Approved — React is the frontend standard; official React docs are the canonical implementation reference
5+
- Mission > Decision Record: Added rationale for SQLite local-file default on user machines
6+
- Technology Stack Requirements > Data & Persistence: Clarified local database default and user-machine storage profile
7+
- Guardrails: Added explicit local SQLite file safety rule for user-machine installs
8+
Status: Approved — local user-machine deployments default to SQLite local-file storage for simplicity and offline reliability
119
Previous Updates:
10+
- v1.10: Added an explicit engineering mindset for small-batch experimentation, continuous learning, complexity management, mandatory change validation, and proactive security teaching/remediation.
11+
- v1.9: Replaced Blazor WebAssembly frontend direction with Aurelia 2. Updated Principle V and all frontend-related sections for consistency. Added an explicit rule to always reference official Aurelia documentation at https://docs.aurelia.io/.
1212
- v1.8: Scoped Aspire Dashboard to local development only; removed cloud Aspire Dashboard requirement. Clarified local-first deployment priority with Azure as a future target. Strengthened public GitHub repository secret safety guidance.
1313
- v1.7: Clarified that Blazor WASM frontend is fully orchestrated by Aspire locally; a single `dotnet run` command starts the entire application stack including API, database, and WASM frontend.
1414
- v1.6: Adopted Blazor WebAssembly (WASM) as the frontend hosting model, enabling static site hosting for the UI while maintaining containerized API in both local and cloud.
@@ -33,6 +33,7 @@ Previous Updates:
3333
- Why React? Mature, widely adopted TypeScript frontend ecosystem with composable UI patterns, strong tooling, and flexible static hosting for local-first development
3434
- Why Minimal API? Lightweight, performant, integrates seamlessly with Aspire and domain layers
3535
- Why local-first architecture? Users own their data locally; cloud deployment optional for sharing/collaboration
36+
- Why SQLite local-file default for user-machine installs? No separate database install, reliable offline operation, and simpler support/backup through a single user-owned database file
3637

3738
For detailed amendment history, see [DECISIONS.md](./DECISIONS.md).
3839

@@ -80,6 +81,14 @@ All user input **MUST** be validated in three layers: (1) **Client-side (React)*
8081

8182
**Rationale**: Defense-in-depth prevents invalid data from corrupting event store or projections; client-side validation improves UX responsiveness; server-side validation prevents bypass attacks; database constraints provide last-line guarantees. Combined approach ensures data integrity without redundant checks.
8283

84+
### VIII. Experimentation, Learning & Secure Validation
85+
86+
Engineering work should prioritize experimentation in small, reversible batches to discover what software creates the best user value while keeping complexity manageable. Continuous learning is expected in every slice: document what was learned, what complexity was reduced, and what the next increment should test.
87+
88+
Every change **MUST** be validated end-to-end before merge and before phase transitions: solution compiles, coding standards pass, automated tests confirm behavior, and deployment pipeline checks succeed. Security is a first-class requirement on every change: identify issues, explain risks and mitigations to contributors, and remediate vulnerabilities before release.
89+
90+
**Rationale**: Small batches reduce blast radius and improve feedback speed. Continuous learning drives better product decisions under uncertainty. Mandatory validation and security remediation protect reliability, delivery confidence, and user trust.
91+
8392
## Technology Stack Requirements
8493

8594
### Backend & Orchestration
@@ -102,7 +111,7 @@ All user input **MUST** be validated in three layers: (1) **Client-side (React)*
102111

103112
### Data & Persistence
104113
- **Primary Database**:
105-
- **Local Deployment**: SQLite (single-user) or SQL Server LocalDB/Express (multi-user local)
114+
- **Local Deployment**: SQLite local file database (default for single-user and user-machine installs); SQL Server LocalDB/Express optional for advanced multi-user local scenarios
106115
- **Cloud Deployment**: Azure SQL Database (serverless elastic pools in production)
107116
- **Database abstraction**: EF Core provider configured via connection string; application code database-agnostic
108117
- **ORM & Data Access**: Entity Framework Core (latest .NET 10 compatible version) for all database interactions; DbContext per aggregate root; repositories abstract EF Core from domain layer. EF Core value converters integrated for F# type marshaling.
@@ -112,6 +121,10 @@ All user input **MUST** be validated in three layers: (1) **Client-side (React)*
112121
- **Change Event Streaming**:
113122
- **Local Deployment**: In-process event handlers or polling-based projection updates
114123
- **Cloud Deployment**: Azure SQL Change Tracking/Change Data Capture triggering Azure Functions
124+
- **User-Machine Install Profile (Local)**:
125+
- Default to SQLite file storage with no separate database server dependency
126+
- Store database file in a user-writable application-data path (not the application install directory)
127+
- Apply startup migrations automatically and create a pre-migration database backup during upgrades
115128

116129
### Infrastructure & DevOps
117130
- **Hosting**:
@@ -188,12 +201,15 @@ A vertical slice is **production-ready** only when all items are verified:
188201
- [ ] All tests written and failing (red phase complete)
189202
- [ ] Implementation complete; all tests passing (green + refactor phases)
190203
- [ ] Code review: architecture compliance verified, naming conventions followed, validation discipline observed
204+
- [ ] Change validation complete: compile succeeds, coding standards checks pass, automated behavior tests pass
191205
- [ ] Feature branch deployed locally via `dotnet run` (entire Aspire stack: frontend, API, database)
192206
- [ ] Integration tests pass; manual E2E test via Playwright (if critical user journey)
193207
- [ ] All validation layers implemented: client-side (React validation), API (DTO DataAnnotations), database (constraints)
194208
- [ ] Events stored in event table with correct schema; projections materialized and queryable
195209
- [ ] SAMPLE_/DEMO_ data cleaned up; no test data committed to main branch
196210
- [ ] Deployed to Azure staging environment via GitHub Actions + azd
211+
- [ ] Pipeline deployment checks pass for the target environment
212+
- [ ] Security review completed; identified vulnerabilities are explained and fixed (or formally approved risk acceptance)
197213
- [ ] User acceptance testing completed; feature approved for production
198214
- [ ] Commit made to main branch with spec reference in commit message
199215

@@ -279,17 +295,21 @@ Tests suggested by agent must receive explicit user approval before implementati
279295
4. **Implementation (Green)**: Code written to make tests pass
280296
5. **Refactor (Refactor)**: Code cleaned, tests still pass
281297
6. **Code Review**: Implementation reviewed for architecture compliance, naming, performance, validation discipline
282-
7. **Local Deployment**: Slice deployed locally in containers via Aspire, tested manually with Playwright if E2E slice
283-
8. **Azure Deployment**: Slice deployed to Azure Container Apps via GitHub Actions + azd
284-
9. **User Acceptance**: User validates slice meets specification and data validation rules observed
298+
7. **Validation Gate**: Compile/build passes, coding standards checks pass, and automated tests validate behavior
299+
8. **Security Gate**: Security issues are identified, explained to contributors, and remediated or explicitly accepted by user
300+
9. **Local Deployment**: Slice deployed locally in containers via Aspire, tested manually with Playwright if E2E slice
301+
10. **Azure Deployment**: Slice deployed to Azure Container Apps via GitHub Actions + azd
302+
11. **User Acceptance**: User validates slice meets specification and data validation rules observed
285303

286304
### Compliance Audit Checklist
287305

288306
#### Per-Specification Audit
289-
- [ ] Spec references all seven core principles in acceptance criteria
307+
- [ ] Spec references all eight core principles in acceptance criteria
290308
- [ ] Event schema defined; backwards compatibility verified if updating existing events
291309
- [ ] Data validation implemented at three layers: client (React), API (Minimal API), database (constraints)
292310
- [ ] Test coverage for domain logic ≥85%; F# discriminated unions and ROP patterns tested
311+
- [ ] Every change validated: compile/build, coding standards, automated tests, and pipeline deployment checks
312+
- [ ] Security issues recognized, explained, and remediated (or explicitly accepted by user)
293313
- [ ] All SAMPLE_/DEMO_ data removed from code before merge
294314
- [ ] Secrets NOT committed; `.gitignore` verified; pre-commit hook prevents credential leakage
295315
- [ ] Validation rule consistency: if field required in React form, enforced in API DTOs and database constraints
@@ -328,11 +348,12 @@ Breaking these guarantees causes architectural decay and technical debt accrual:
328348
- **OAuth token required on all user endpoints** — anonymous access forbidden for personal data. Public data endpoints explicitly marked; separate authorization logic. (Optional for single-user local deployment; mandatory for cloud/multi-user.)
329349
- **SAMPLE_/DEMO_ data never in production** — automated linting prevents prefixed data from deploying. Merge blocked if test data detected.
330350
- **Database provider abstraction** — application code must work across SQLite (local), SQL Server LocalDB (local), and Azure SQL (cloud) without provider-specific queries. Use EF Core abstractions; avoid raw SQL unless necessary and provider-agnostic.
351+
- **User-machine local data safety** — local deployments on end-user machines default to SQLite local-file storage in a user-writable app-data path; do not require a separate DB server for single-user installs. Before schema migration, create a backup copy of the SQLite file.
331352

332353
### Onboarding Checklist for New Contributors
333354

334-
1. **Read constitution** (~20 min): Understand mission, seven core principles, technology stack, development workflow
335-
2. **Review decision history** (~15 min): [DECISIONS.md](./DECISIONS.md) explains why F#, why Event Sourcing, why Aspire, why React
355+
1. **Read constitution** (~20 min): Understand mission, eight core principles, technology stack, development workflow
356+
2. **Review decision history** (~15 min): [DECISIONS.md](./DECISIONS.md) explains why F#, why Event Sourcing, why Aspire, why Aurelia 2
336357
3. **Clone repo and bootstrap** (~5 min): `git clone``dotnet tool install --global specify-cli``dotnet run` (Aspire orchestrates frontend, API, database)
337358
4. **Explore specification examples** (~30 min): Review `/specs/` directory; read 2–3 completed specifications to understand vertical slice completeness
338359
5. **Review test examples** (~20 min): Browse `/bikeTracking.Tests/Unit/` and `/bikeTracking.Tests/Integration/` to understand test patterns (F# unit tests, integration test fixtures, E2E Playwright)
@@ -372,7 +393,7 @@ Breaking these guarantees causes architectural decay and technical debt accrual:
372393
## Governance
373394

374395
### Constitution as Governing Document
375-
This constitution supersedes all other project guidance. All architectural decisions, code reviews, deployment approvals, and spec acceptance gates must verify compliance with these seven core principles and technology stack requirements.
396+
This constitution supersedes all other project guidance. All architectural decisions, code reviews, deployment approvals, and spec acceptance gates must verify compliance with these eight core principles and technology stack requirements.
376397

377398
### Amendment Procedure
378399
Amendments must:
@@ -412,5 +433,5 @@ Always commit before continuing to a new phase.
412433

413434
---
414435

415-
**Version**: 1.9.0 | **Ratified**: 2026-03-03 | **Last Amended**: 2026-03-11
436+
**Version**: 1.10.1 | **Ratified**: 2026-03-03 | **Last Amended**: 2026-03-16
416437

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ dotnet run --project src/BikeTracking.AppHost
5656
- PIN plaintext is never stored or emitted in events.
5757
- Future cloud and OAuth expansion will be delivered in a separate feature.
5858

59+
## Local User-Machine Install Approach
60+
61+
For local-first deployment to end-user machines, the default persistence model is a local SQLite file.
62+
63+
- No separate database installation or database service is required.
64+
- The API currently defaults to a local SQLite file named biketracking.local.db.
65+
- Startup applies EF Core migrations automatically to create or update schema.
66+
- For packaged installs, place the SQLite file in a user-writable application-data folder rather than the application install directory.
67+
- Before schema upgrades, create a safety backup copy of the SQLite file.
68+
- Use SQL Server LocalDB or SQL Server Express only when local multi-user requirements exceed the single-user SQLite profile.
69+
5970
## Next Step
6071

6172
Continue with task execution and verification using specs/001-user-signup-pin/tasks.md.

0 commit comments

Comments
 (0)