You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .specify/memory/constitution.md
+51-22Lines changed: 51 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,17 @@
1
1
# Bike Tracking Application Constitution
2
-
<!-- Sync Impact Report v1.11.0
3
-
Rationale: Strengthened TDD mandate to require a strict gated sequence: plan failing tests → write failing tests → run and prove failure → user confirms failures → implement → run after each change → all tests pass → consider refactoring. User must explicitly review and approve test failures before implementation begins.
2
+
<!-- Sync Impact Report v1.12.0
3
+
Rationale: Added explicit modularity and contract-first collaboration governance so teams can deliver independently in parallel while preserving interoperability through stable interfaces and versioned contracts.
4
4
Modified Sections:
5
-
- Principle IV: Expanded from single-paragraph statement to explicit 7-step gated TDD workflow with user confirmation gate
6
-
- Development Approval Gates: Renamed and expanded gates 2-7 to reflect the full TDD sequence; added user failure-confirmation gate
7
-
- Definition of Done: Added user-confirmed test failures checkbox; separated green phase from refactor consideration
8
-
- Guardrails: Added non-negotiable TDD cycle guardrail as first item
9
-
Status: Approved — TDD cycle is strictly gated; user must confirm failing tests before implementation proceeds
- Guardrails: Added non-negotiable interface/contract boundary rules for cross-module integration
12
+
Status: Approved — modular architecture and contract-first parallel delivery are now constitutional requirements
10
13
Previous Updates:
14
+
- v1.11.0: Strengthened TDD mandate with a strict gated red-green-refactor workflow requiring explicit user confirmation of failing tests before implementation.
11
15
- v1.10.2: Codified a mandatory post-change verification command matrix so every change runs explicit checks before merge.
12
16
- v1.10.1: 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.
13
17
- v1.10: Added an explicit engineering mindset for small-batch experimentation, continuous learning, complexity management, mandatory change validation, and proactive security teaching/remediation.
@@ -103,6 +107,12 @@ Every change **MUST** be validated end-to-end before merge and before phase tran
103
107
104
108
**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.
105
109
110
+
### IX. Modularity, Interfaces & Contract-First Collaboration
111
+
112
+
System capabilities must be split into cohesive modules with explicit ownership and clear boundaries (for example: identity, rides, projections, analytics, frontend feature areas). Cross-module collaboration must occur through stable interfaces and versioned contracts (API schemas, event schemas, shared DTO contracts), not by direct internal coupling. Teams should define and agree contracts first, then implement modules independently in parallel; integration happens against contracts with compatibility tests before merge. Contract evolution must be backwards compatible by default and versioned when breaking changes are unavoidable.
113
+
114
+
**Rationale**: Strong module boundaries reduce coordination overhead, minimize merge conflicts, and allow teams to move in parallel without blocking each other. Contract-first integration preserves system cohesion as complexity grows and enables safer incremental delivery.
115
+
106
116
## Technology Stack Requirements
107
117
108
118
### Development Environment (Mandatory)
@@ -212,6 +222,17 @@ Run TypeScript linting and formatting via `npm run lint` and `npm run format` in
212
222
213
223
Use `dotnet run --project src/BikeTracking.AppHost` to start the local stack; use GitHub Actions for CI/CD to Azure.
214
224
225
+
### Contract-First Parallel Delivery
226
+
227
+
For features spanning multiple modules, delivery must be organized for parallel execution:
228
+
229
+
1. Define integration seams up front (command/query APIs, event contracts, shared value contracts) and record contract owners.
230
+
2. Freeze a first-pass contract for the slice before implementation starts; changes after freeze require explicit review from impacted owners.
231
+
3. Implement producers and consumers in parallel against contract tests/stubs, not each other's internal code.
232
+
4. Run contract compatibility tests in CI for both directions (provider and consumer) before integration merge.
233
+
234
+
This contract-first workflow complements vertical slices and the TDD gates; it does not replace them.
235
+
215
236
### Post-Change Verification Matrix (Mandatory After Any Change)
216
237
217
238
After **every** code change, run verification commands based on the changed scope. These checks are required before merge and before phase transitions.
@@ -267,6 +288,7 @@ A vertical slice is **production-ready** only when all items are verified:
267
288
-[ ] Integration tests pass; manual E2E test via Playwright (if critical user journey)
268
289
-[ ] All validation layers implemented: client-side (React validation), API (DTO DataAnnotations), database (constraints)
269
290
-[ ] Events stored in event table with correct schema; projections materialized and queryable
291
+
-[ ] Module boundaries preserved; cross-module interactions occur only via approved interfaces/contracts with compatibility evidence
270
292
-[ ] SAMPLE_/DEMO_ data cleaned up; no test data committed to main branch
271
293
-[ ] Deployed to Azure staging environment via GitHub Actions + azd
272
294
-[ ] Pipeline deployment checks pass for the target environment
@@ -320,6 +342,7 @@ Tests suggested by agent must receive explicit user approval before implementati
320
342
- F# domain types successfully marshaled through EF Core value converters
321
343
- Validation attributes enforced on API endpoints
322
344
- F# command handlers compose with C# infrastructure (repositories, services)
345
+
- Cross-module API/event contracts validated for provider-consumer compatibility
323
346
324
347
**Contract Tests** (event schema stability)
325
348
- Event schema versioning
@@ -352,27 +375,30 @@ Tests suggested by agent must receive explicit user approval before implementati
352
375
353
376
1.**Specification Approved**: Spec document completed and user-approved before coding
354
377
2.**Test Plan Approved**: Agent proposes all tests (unit, integration, E2E, security) with rationale for each; test plan explicitly identifies what each test proves and why it will initially fail; user approves the test plan before any code is written
355
-
3.**Failing Tests Written**: Agent writes the tests exactly as approved; no implementation code written yet
356
-
4.**Tests Run & Failures Confirmed by User**: Agent runs the tests and displays the full failure output; **user reviews and explicitly confirms** that tests fail for the right behavioral reasons (not build errors); this gate cannot be bypassed — user approval required before proceeding
357
-
5.**Implementation (Green)**: Code written incrementally to make failing tests pass; tests run after each meaningful change to track progress; no speculative or extra logic added beyond what tests require
358
-
6.**All Tests Pass**: Implementation is complete only when the full test suite is green; agent displays passing test output
359
-
7.**Refactor (Consider)**: With tests green, evaluate the implementation for clarity, duplication, and simplicity; refactor if warranted while keeping tests green; explicitly present refactoring opportunities to user even if skipped
10.**Security Gate**: Security issues are identified, explained to contributors, and remediated or explicitly accepted by user
363
-
11.**Local Deployment**: Slice deployed locally in containers via Aspire, tested manually with Playwright if E2E slice
364
-
12.**Azure Deployment**: Slice deployed to Azure Container Apps via GitHub Actions + azd
365
-
13.**User Acceptance**: User validates slice meets specification and data validation rules observed
378
+
3.**Contract Boundaries Frozen**: Module interfaces and integration contracts are agreed, versioned, and owner-approved before implementation begins; this enables parallel execution without internal coupling
379
+
4.**Failing Tests Written**: Agent writes the tests exactly as approved; no implementation code written yet
380
+
5.**Tests Run & Failures Confirmed by User**: Agent runs the tests and displays the full failure output; **user reviews and explicitly confirms** that tests fail for the right behavioral reasons (not build errors); this gate cannot be bypassed — user approval required before proceeding
381
+
6.**Implementation (Green)**: Code written incrementally to make failing tests pass; tests run after each meaningful change to track progress; no speculative or extra logic added beyond what tests require
382
+
7.**All Tests Pass**: Implementation is complete only when the full test suite is green; agent displays passing test output
383
+
8.**Refactor (Consider)**: With tests green, evaluate the implementation for clarity, duplication, and simplicity; refactor if warranted while keeping tests green; explicitly present refactoring opportunities to user even if skipped
-[ ] Module boundaries remain cohesive and independently deployable/testable where applicable
426
+
-[ ] Interface and contract versioning strategy enforced across APIs/events
399
427
-[ ] Performance SLOs verified: API <500ms p95, projection lag <5s
400
428
-[ ] Observability dashboards in Application Insights show active monitoring
401
429
@@ -404,6 +432,7 @@ Tests suggested by agent must receive explicit user approval before implementati
404
432
Breaking these guarantees causes architectural decay and technical debt accrual:
405
433
406
434
-**TDD cycle is strictly gated and non-negotiable** — implementation code must never be written before failing tests exist, have been run, and the user has reviewed and confirmed the failures. The sequence is always: plan tests → write tests → run and prove failure → get user confirmation → implement → run after each change → verify all pass → consider refactoring. Skipping or reordering any step is prohibited.
435
+
-**Cross-module work is contract-first and interface-bound** — teams must integrate through explicit interfaces and versioned contracts only; direct coupling to another module's internal implementation is prohibited.
407
436
-**No Entity Framework DbContext in domain layer** — domain must remain infrastructure-agnostic. If domain needs persistence logic, use repository pattern abstracting EF.
408
437
-**Secrets management by deployment context** — **Cloud**: all secrets in Azure Key Vault; **Local**: User Secrets or environment variables. No connection strings, API keys, or OAuth secrets in appsettings.json, code, or GitHub. Pre-commit hooks enforce this. **⚠️ This repository is public on GitHub**: any committed secret is immediately and permanently exposed to the internet; treat any accidental secret commit as an immediate security incident requiring credential rotation.
409
438
-**Event schema is append-only** — never mutate existing events. If schema changes needed, create new event type and version old events. Immutability is non-negotiable.
@@ -418,7 +447,7 @@ Breaking these guarantees causes architectural decay and technical debt accrual:
@@ -459,7 +488,7 @@ Breaking these guarantees causes architectural decay and technical debt accrual:
459
488
## Governance
460
489
461
490
### Constitution as Governing Document
462
-
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.
491
+
This constitution supersedes all other project guidance. All architectural decisions, code reviews, deployment approvals, and spec acceptance gates must verify compliance with these nine core principles and technology stack requirements.
463
492
464
493
### Amendment Procedure
465
494
Amendments must:
@@ -499,5 +528,5 @@ Always commit before continuing to a new phase.
0 commit comments