Merge commit '8b48e281f7e860af435ae35b16c4edeb139286dc' into work/tasks
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
# Test Evidence: SMTP-gated account creation and activation
|
||||
|
||||
- **Test type:** Integration
|
||||
- **Requirement IDs:** `ACC-008`–`ACC-014`, `ACC-019`, `ACC-020`, `NOT-008`, `SEC-005`, `SEC-007`
|
||||
- **Scenario IDs:** `AC-ACC-001`, `AC-ACC-002`, `AC-ACC-003`, `AC-ACC-007`
|
||||
- **Test class/method:** `com.lab.labtimesheet.feature.account.service.AccountActivationIntegrationTest#smtpGatedCreationHashesSingleUseActivationAndRetainsFailedDeliveryHistory`
|
||||
- **Implementation commit:** `this milestone commit`
|
||||
|
||||
## Protected behavior
|
||||
|
||||
An active Admin can create pending Mentor/Intern accounts only while a tested SMTP revision is active. The raw activation secret exists only in the immediate email, PostgreSQL stores only its SHA-256 hash, activation is single-use, and a failed initial delivery keeps history while invalidating that token. Activating an Intern's lifecycle separately makes the account eligible only inside its inclusive internship dates. Reporting reads account counts through the Account service boundary.
|
||||
|
||||
## Test method
|
||||
|
||||
The PostgreSQL 18.4 integration test bootstraps the first Admin, proves creation is blocked before SMTP activation, activates a recorded SMTP boundary, and exercises production account creation/activation. It independently hashes the captured raw link token, inspects persisted state through platform-owned repositories, simulates delivery failure, activates an Intern lifecycle, checks date boundaries, and checks the service-level summary used by reporting.
|
||||
|
||||
## Hand-derived expected result
|
||||
|
||||
The first non-bootstrap creation attempt adds zero rows. A delivered Mentor is pending with no password until one successful activation; replay fails. A failed Intern delivery leaves one pending account and one invalidated token. After the successful Intern is activated at both account and internship levels, the final state has three active accounts (Admin, Mentor, Intern), one pending account, and one active internship.
|
||||
|
||||
## RED
|
||||
|
||||
**Command**
|
||||
|
||||
```text
|
||||
JAVA_HOME=/opt/homebrew/opt/openjdk@25 DOCKER_HOST=unix:///Users/sechmachine/.orbstack/run/docker.sock ./mvnw -Dtest=AccountActivationIntegrationTest test
|
||||
```
|
||||
|
||||
**Observed result**
|
||||
|
||||
```text
|
||||
BUILD FAILURE. Test compilation reported five missing account-activation API/model symbols, including CreateAccountCommand, TokenPurpose, and UserActionTokenRepository. No test ran.
|
||||
```
|
||||
|
||||
After the first GREEN implementation, the exact-expiry assertion was added and observed RED before exposing the persisted expiry:
|
||||
|
||||
```text
|
||||
BUILD FAILURE. AccountActivationIntegrationTest could not compile because UserActionToken#getExpiresAt() did not exist.
|
||||
```
|
||||
|
||||
## GREEN
|
||||
|
||||
**Command**
|
||||
|
||||
```text
|
||||
JAVA_HOME=/opt/homebrew/opt/openjdk@25 DOCKER_HOST=unix:///Users/sechmachine/.orbstack/run/docker.sock ./mvnw -Dtest=AccountActivationIntegrationTest test
|
||||
```
|
||||
|
||||
**Observed result**
|
||||
|
||||
```text
|
||||
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
|
||||
BUILD SUCCESS
|
||||
```
|
||||
|
||||
## Affected suite
|
||||
|
||||
**Command and result**
|
||||
|
||||
```text
|
||||
JAVA_HOME=/opt/homebrew/opt/openjdk@25 DOCKER_HOST=unix:///Users/sechmachine/.orbstack/run/docker.sock ./mvnw test
|
||||
Tests run: 9, Failures: 0, Errors: 0, Skipped: 0
|
||||
BUILD SUCCESS
|
||||
```
|
||||
|
||||
## External-test boundaries
|
||||
|
||||
The recording SMTP boundary proves the exact in-memory handoff but not Mailpit/network delivery or a browser following the link. MVC activation forms, resend, password reset, session invalidation, lock/deactivation, and production origin/readiness hardening remain separate Iteration 1 or later slices.
|
||||
@@ -0,0 +1,99 @@
|
||||
# Test Evidence: Attendance PostgreSQL persistence and calendar rules
|
||||
|
||||
- **Test type:** Integration
|
||||
- **Requirement IDs:** `ATT-002`, `ATT-005`, `ATT-007`, `ATT-008`, `ATT-010`, `CAL-001`, `CAL-006`, `CAL-007`, `CAL-009`, `AUTH-003`, `RPT-004`
|
||||
- **Scenario IDs:** `AC-ATT-003`, `AC-ATT-004`, `AC-CAL-003`, `AC-CAL-004`
|
||||
- **Test class/method:** `com.lab.labtimesheet.feature.attendance.service.AttendancePersistenceIntegrationTest`
|
||||
- **Implementation commit:** `pending (committed with this evidence)`
|
||||
|
||||
## Protected behavior
|
||||
|
||||
PostgreSQL stores server-time punches with the seeded applied-policy foreign key,
|
||||
enforces one row per Intern/date, and returns the attached policy in history.
|
||||
Admin-only manual calendar changes affect check-in, past events are immutable,
|
||||
stale edits are rejected, and Mentor/Admin/own-history scopes are enforced.
|
||||
|
||||
## Test method
|
||||
|
||||
A Spring Boot integration test migrates a real PostgreSQL 18.4 Testcontainer,
|
||||
creates and activates a valid Intern exclusively through public account and SMTP
|
||||
service/DTO boundaries, invokes the transactional attendance services, and
|
||||
asserts persisted rows and denied state transitions.
|
||||
|
||||
## Hand-derived expected result
|
||||
|
||||
The 1970 seed has ID 1 and a 30-minute checkout grace. An event created for
|
||||
2026-08-14 while server business date is 2026-08-13 blocks check-in on that
|
||||
date. After business date advances to 2026-08-15, that event cannot change.
|
||||
An update from version 0 advances the row, so a second version-0 edit is stale.
|
||||
|
||||
## RED
|
||||
|
||||
**Command**
|
||||
|
||||
```text
|
||||
export JAVA_HOME=/opt/homebrew/opt/openjdk@25
|
||||
export PATH="$JAVA_HOME/bin:$PATH"
|
||||
export DOCKER_HOST=unix:///Users/sechmachine/.orbstack/run/docker.sock
|
||||
./mvnw -Dtest=AttendancePersistenceIntegrationTest test
|
||||
```
|
||||
|
||||
**Observed result**
|
||||
|
||||
```text
|
||||
[ERROR] cannot find symbol: class AttendanceApplicationService
|
||||
[ERROR] cannot find symbol: class CalendarApplicationService
|
||||
[INFO] 8 errors
|
||||
[INFO] BUILD FAILURE
|
||||
Process exited 1 before Testcontainers startup because the required persistence/application services did not exist.
|
||||
```
|
||||
|
||||
The optimistic-edit assertion was separately observed RED:
|
||||
|
||||
```text
|
||||
./mvnw -Dtest=AttendancePersistenceIntegrationTest test
|
||||
[ERROR] method updateManual ... actual and formal argument lists differ in length
|
||||
[INFO] 4 errors
|
||||
[INFO] BUILD FAILURE
|
||||
Process exited 1 because update did not yet accept an expected version.
|
||||
```
|
||||
|
||||
## GREEN
|
||||
|
||||
**Command**
|
||||
|
||||
```text
|
||||
export JAVA_HOME=/opt/homebrew/opt/openjdk@25
|
||||
export PATH="$JAVA_HOME/bin:$PATH"
|
||||
export DOCKER_HOST=unix:///Users/sechmachine/.orbstack/run/docker.sock
|
||||
./mvnw -Dtest=AttendancePersistenceIntegrationTest,AttendanceControllerTest test
|
||||
```
|
||||
|
||||
**Observed result**
|
||||
|
||||
```text
|
||||
PostgreSQL 18.4 container started and Flyway applied V1.
|
||||
AttendancePersistenceIntegrationTest: Tests run: 6, Failures: 0, Errors: 0, Skipped: 0
|
||||
BUILD SUCCESS
|
||||
Process exited 0.
|
||||
```
|
||||
|
||||
## Affected suite
|
||||
|
||||
**Command and result**
|
||||
|
||||
```text
|
||||
export JAVA_HOME=/opt/homebrew/opt/openjdk@25
|
||||
export PATH="$JAVA_HOME/bin:$PATH"
|
||||
export DOCKER_HOST=unix:///Users/sechmachine/.orbstack/run/docker.sock
|
||||
./mvnw -Dtest='*Attendance*Test' test
|
||||
Tests run: 26, Failures: 0, Errors: 0, Skipped: 0
|
||||
BUILD SUCCESS
|
||||
Process exited 0.
|
||||
```
|
||||
|
||||
## External-test boundaries
|
||||
|
||||
This test does not prove cross-request check-in races, production authentication
|
||||
configuration, shared-shell integration, HolidayAPI, leave creation/decision,
|
||||
corrections, schedulers, or later policy scheduling.
|
||||
Reference in New Issue
Block a user