Skip to content

Commit 5c743eb

Browse files
aligneddevaligneddev
andauthored
ADDED TDD (#14)
Co-authored-by: aligneddev <aligneddev@github.com>
1 parent 7e191c3 commit 5c743eb

2 files changed

Lines changed: 46 additions & 23 deletions

File tree

.specify/memory/constitution.md

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Bike Tracking Application Constitution
2-
<!-- Sync Impact Report v1.10.2
3-
Rationale: Codified a mandatory post-change verification command matrix so every change runs explicit checks before merge.
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.
44
Modified Sections:
5-
- Development Workflow: Added mandatory post-change verification matrix and command requirements
6-
- Definition of Done: Requires matrix execution evidence for changed scope
7-
- Compliance Audit Checklist: Requires matrix execution and recorded evidence
8-
- Guardrails: Added non-negotiable requirement to run matrix commands after every change
9-
Status: Approved — impacted-layer checks are mandatory after any change; auth/cross-layer changes also require E2E verification
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
1010
Previous Updates:
11+
- v1.10.2: Codified a mandatory post-change verification command matrix so every change runs explicit checks before merge.
1112
- 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.
1213
- v1.10: Added an explicit engineering mindset for small-batch experimentation, continuous learning, complexity management, mandatory change validation, and proactive security teaching/remediation.
1314
- 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/.
@@ -62,9 +63,19 @@ Every domain action (ride recorded, expense added, savings recalculated) generat
6263

6364
### IV. Quality-First Development (Test-Driven)
6465

65-
Red-Green-Refactor cycle is **non-negotiable**: tests written first, approved by user, then fail, then implementation follows. Unit tests validate pure logic (target 85%+ coverage). Integration tests verify each vertical slice end-to-end. Contract tests ensure event schemas remain backwards compatible. Security tests validate OAuth isolation and data access. **Agent must suggest tests with rationale; user approval required before implementation.**
66+
Red-Green-Refactor cycle is **non-negotiable** and follows a strict, gate-controlled sequence:
6667

67-
**Rationale**: Tests act as executable specifications; catches bugs early; refactoring confidence; documents intended behavior; prevents regressions.
68+
1. **Plan**: Every specification and planning phase **must** include a test plan that explicitly identifies failing tests to be written — what will fail, why, and what it proves.
69+
2. **Write Failing Tests**: Before any implementation code is written, the agent writes the tests that define the expected behavior. Tests are committed in failing state.
70+
3. **Run & Prove Failure**: The failing tests are executed and their output is shown to the user. The user **must review and confirm** that tests fail for the right reasons (not infrastructure or compilation errors — genuine behavioral failures).
71+
4. **Implement**: Only after user confirmation of red tests does implementation begin. Implementation must target making the failing tests pass — no speculative or extra logic.
72+
5. **Run After Each Change**: Tests are run after each meaningful implementation change to track incremental progress toward green.
73+
6. **All Tests Pass**: Implementation is complete only when all tests pass. No merge occurs until the full test suite is green.
74+
7. **Consider Refactoring**: Once tests are green, evaluate the implementation for clarity, duplication, and simplicity. Refactor while keeping tests green. Refactoring is optional but explicitly encouraged at this stage.
75+
76+
Unit tests validate pure logic (target 85%+ coverage). Integration tests verify each vertical slice end-to-end. Contract tests ensure event schemas remain backwards compatible. Security tests validate OAuth isolation and data access. **Agent must suggest tests with rationale; user approval required before implementation. User must confirm test failures before implementation begins.**
77+
78+
**Rationale**: Tests act as executable specifications; catches bugs early; refactoring confidence; documents intended behavior; prevents regressions. Requiring user review of red tests proves that tests are meaningful and not vacuously passing.
6879

6980
### V. User Experience Consistency & Accessibility
7081

@@ -244,9 +255,11 @@ After the application structure is built, implementation proceeds in **vertical
244255
A vertical slice is **production-ready** only when all items are verified:
245256

246257
- [ ] Specification written, approved by user, linked to spec directory
247-
- [ ] Test plan approved (unit, integration, E2E, security, performance tests identified)
248-
- [ ] All tests written and failing (red phase complete)
249-
- [ ] Implementation complete; all tests passing (green + refactor phases)
258+
- [ ] Test plan approved (unit, integration, E2E, security, performance tests identified; each test's expected failure reason documented)
259+
- [ ] All tests written and failing (red phase complete); failing test output shown to user
260+
- [ ] **User confirmed test failures**: user reviewed failing test output and approved that failures are behavioral, not structural
261+
- [ ] Implementation complete; all tests run after each meaningful change; all tests passing (green phase complete)
262+
- [ ] Refactoring considered: implementation evaluated for clarity/duplication/simplicity with tests green; any refactoring applied with tests still passing
250263
- [ ] Code review: architecture compliance verified, naming conventions followed, validation discipline observed
251264
- [ ] Change validation complete: compile succeeds, coding standards checks pass, automated behavior tests pass
252265
- [ ] Post-change verification matrix executed for the impacted scope and evidence recorded
@@ -338,16 +351,18 @@ Tests suggested by agent must receive explicit user approval before implementati
338351
### Development Approval Gates
339352

340353
1. **Specification Approved**: Spec document completed and user-approved before coding
341-
2. **Tests Approved**: Agent proposes tests; user approves test plan
342-
3. **Tests Fail (Red)**: Proposed tests run and fail without implementation
343-
4. **Implementation (Green)**: Code written to make tests pass
344-
5. **Refactor (Refactor)**: Code cleaned, tests still pass
345-
6. **Code Review**: Implementation reviewed for architecture compliance, naming, performance, validation discipline
346-
7. **Validation Gate**: Compile/build passes, coding standards checks pass, and automated tests validate behavior
347-
8. **Security Gate**: Security issues are identified, explained to contributors, and remediated or explicitly accepted by user
348-
9. **Local Deployment**: Slice deployed locally in containers via Aspire, tested manually with Playwright if E2E slice
349-
10. **Azure Deployment**: Slice deployed to Azure Container Apps via GitHub Actions + azd
350-
11. **User Acceptance**: User validates slice meets specification and data validation rules observed
354+
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
360+
8. **Code Review**: Implementation reviewed for architecture compliance, naming, performance, validation discipline
361+
9. **Validation Gate**: Compile/build passes, coding standards checks pass, and automated tests validate behavior
362+
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
351366

352367
### Compliance Audit Checklist
353368

@@ -388,6 +403,7 @@ Tests suggested by agent must receive explicit user approval before implementati
388403

389404
Breaking these guarantees causes architectural decay and technical debt accrual:
390405

406+
- **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.
391407
- **No Entity Framework DbContext in domain layer** — domain must remain infrastructure-agnostic. If domain needs persistence logic, use repository pattern abstracting EF.
392408
- **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.
393409
- **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.
@@ -483,5 +499,5 @@ Always commit before continuing to a new phase.
483499

484500
---
485501

486-
**Version**: 1.10.2 | **Ratified**: 2026-03-03 | **Last Amended**: 2026-03-18
502+
**Version**: 1.11.0 | **Ratified**: 2026-03-03 | **Last Amended**: 2026-03-20
487503

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ dotnet run --project src/BikeTracking.AppHost
8888

8989
## Git Credentials Setup (DevContainer)
9090

91+
https://code.visualstudio.com/remote/advancedcontainers/sharing-git-credentials was very helpful.
92+
93+
# Make sure you're running as an Administrator on your Windows host to manage the ssh-agent service:
94+
Set-Service ssh-agent -StartupType Automatic
95+
Start-Service ssh-agent
96+
Get-Service ssh-agent
97+
9198

9299
I did this to avoid getting commits from the wrong user. This is optional for you. If you have the straight forward setup, you don't need to mount ~/.ssh as the Forwarding should work fine.
93100

0 commit comments

Comments
 (0)