Merge commit '692b23e9b9891d360882671d8247965b44920b2f' into work/reports-ui

# Conflicts:
#	src/main/resources/templates/accounts/activate.html
#	src/main/resources/templates/accounts/new.html
#	src/main/resources/templates/bootstrap/form.html
This commit is contained in:
sechmachine
2026-08-15 03:32:40 +07:00
81 changed files with 2595 additions and 130 deletions
+4 -4
View File
@@ -1,10 +1,10 @@
# 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`
- **Requirement IDs:** `ACC-008``ACC-012`, `ACC-014`, `ACC-019`, `ACC-020`, `NOT-008`, `SEC-002``SEC-004`
- **Scenario IDs:** `AC-ACC-004` (Mentor path), `AC-ACC-005` (Mentor/Intern paths), `AC-ACC-006` (initial delivery failure only)
- **Test class/method:** `com.lab.labtimesheet.feature.account.service.AccountActivationIntegrationTest#smtpGatedCreationHashesSingleUseActivationAndRetainsFailedDeliveryHistory`
- **Implementation commit:** `this milestone commit`
- **Implementation commit:** `98a52a1ac23591fa1cd30b7b175da81ec607e521`; start-date guard added in `6181984cf85f184be39513d6313f9cbe8267add5`
## Protected behavior
@@ -65,4 +65,4 @@ BUILD SUCCESS
## External-test boundaries
The recording SMTP boundary proves the exact in-memory handoff but not Mailpit/network delivery. MVC creation, activation, login, role denial, and logout are covered separately by `AccountWebIntegrationTest`; resend, password reset, session invalidation after credential/state changes, lock/deactivation, and production origin/readiness hardening remain separate slices.
The recording SMTP boundary proves the exact in-memory handoff but not Mailpit/network delivery. MVC creation, activation, login, role denial, logout, and the additional-Admin path are covered separately by `AccountWebIntegrationTest`. This test covers only the Mentor path of SMTP gating and the Mentor/Intern paths of hash-only creation; it does not claim all-role coverage for AC-ACC-004/005. It covers the initial failure/invalidation part of AC-ACC-006, not resend. Resend, password reset, session invalidation after credential/state changes, lock/deactivation, and production origin/readiness hardening remain separate slices.
+2 -2
View File
@@ -2,9 +2,9 @@
- **Test type:** Integration
- **Requirement IDs:** `ACC-002, ACC-014, ACC-020ACC-021, PRJ-017, ATT-007`
- **Scenario IDs:** `AC-ACC-002, AC-ATT-001`
- **Scenario IDs:** No direct acceptance-scenario mapping (cross-feature API regression)
- **Test class/method:** `com.lab.labtimesheet.feature.account.service.BootstrapIntegrationTest.exposesIdentityAndDateAwareInternEligibilityWithoutPersistenceTypes`
- **Implementation commit:** `this milestone commit`
- **Implementation commit:** `1235204bf1298599264a07943ca1167432556bd2`
## Protected behavior
@@ -1,18 +1,18 @@
# Test Evidence: Atomic first administrator bootstrap
- **Test type:** Integration
- **Requirement IDs:** `ACC-001ACC-004, SEC-001SEC-002, GOV-013`
- **Scenario IDs:** `AC-ACC-001, AC-ACC-002, AC-SEC-001`
- **Requirement IDs:** `ACC-001ACC-003, ACC-009, SEC-001`
- **Scenario IDs:** `AC-ACC-001, AC-ACC-002`
- **Test class/method:** `com.lab.labtimesheet.feature.account.service.BootstrapIntegrationTest`
- **Implementation commit:** `this milestone commit`
- **Implementation commit:** `bc70db1d0d8eaa68bb8e22db44e38af27b0fa945`; restart characterization added in `8ff6ee3d873db909b1ce9df690f7a3abb2c3c79d`
## Protected behavior
Before initialization only bootstrap and health are reachable. Concurrent valid submissions create exactly one active Admin, atomically persist initialization, and permanently close bootstrap. The public account service resolves the winning Admin by normalized email or ID without exposing JPA entities or repositories.
Before initialization only bootstrap, bootstrap assets, health, and error rendering are reachable. Concurrent valid submissions create exactly one active Admin, atomically persist initialization, and permanently close bootstrap. A separately started Spring application context connected to the same PostgreSQL database observes the initialized state and cannot create another Admin.
## Test method
A PostgreSQL 18.4 integration test releases two Java 25 virtual-thread-safe requests onto the same service concurrently and asserts the row-locked outcomes and database state through Spring Data JPA. MockMvc checks pre/post-bootstrap route exposure, and the account API is checked against the actual concurrent winner.
A PostgreSQL 18.4 integration test releases two Java 25 tasks onto the same service concurrently and asserts the row-locked outcomes and database state through Spring Data JPA. MockMvc checks pre/post-bootstrap route exposure. A characterization method then starts and closes an independent servlet application context against the same container datasource and verifies the durable state through the public bootstrap service.
## Hand-derived expected result
@@ -47,16 +47,19 @@ The public bootstrap behavior did not exist.
export JAVA_HOME=/opt/homebrew/opt/openjdk@25
export PATH="$JAVA_HOME/bin:/opt/homebrew/opt/node@24/bin:$PATH"
export DOCKER_HOST=unix:///Users/sechmachine/.orbstack/run/docker.sock
./mvnw -Dtest=BootstrapIntegrationTest,SmtpAccountIntegrationTest test
./mvnw -Dtest=BootstrapIntegrationTest test
```
**Observed result**
```text
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0
BUILD SUCCESS
```
The independent-context restart assertion was added as characterization coverage for an evidence gap. No
retrospective RED is claimed because the persisted implementation already satisfied it when the test was added.
## Affected suite
**Command and result**
@@ -0,0 +1,72 @@
# Test Evidence: Internship cannot activate before its business start date
- **Test type:** Integration
- **Requirement IDs:** `ACC-019`, `ACC-020`
- **Scenario IDs:** `AC-ACC-010` (start-date transition only)
- **Test class/method:** `com.lab.labtimesheet.feature.account.service.AccountActivationIntegrationTest#internshipCannotActivateBeforeItsBusinessStartDate`
- **Implementation commit:** `6181984cf85f184be39513d6313f9cbe8267add5`
## Protected behavior
An active Intern account cannot move its separately stored internship from `NOT_STARTED` to `ACTIVE` before the
configured inclusive start date in the application's injected business timezone.
## Test method
The PostgreSQL 18.4 test creates and activates an Intern account through the production SMTP/account services. Its
internship starts one business day after the fixed test clock. The Admin attempts the lifecycle transition and the
test reloads the profile through the owning feature repository.
## Hand-derived expected result
The service throws an actionable start-date error and the persisted internship remains `NOT_STARTED`.
## 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=AccountActivationIntegrationTest#internshipCannotActivateBeforeItsBusinessStartDate test
```
**Observed result**
```text
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
Expected code to raise a throwable, but the internship activated before its start date.
BUILD FAILURE
```
## GREEN
**Command**
```text
./mvnw -Dtest=AccountActivationIntegrationTest#internshipCannotActivateBeforeItsBusinessStartDate test
```
**Observed result**
```text
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
BUILD SUCCESS
PostgreSQL: 18.4
```
## Affected suite
**Command and result**
```text
./mvnw -Dtest=BootstrapIntegrationTest,SmtpOnboardingWebIntegrationTest,AccountActivationIntegrationTest,AccountWebIntegrationTest,BootstrapOnboardingWebIntegrationTest,JavaMailSmtpProbeTest,SecurityResponseIntegrationTest test
Tests run: 20, Failures: 0, Errors: 0, Skipped: 0
BUILD SUCCESS
```
## External-test boundaries
This covers only the early-activation guard. It does not claim the later scheduler, completion, withdrawal, transfer,
or session-lifecycle portions of AC-ACC-010.
@@ -4,7 +4,7 @@
- **Requirement IDs:** `ARC-001ARC-008, DB-003DB-012, OPS-003, TST-001TST-010`
- **Scenario IDs:** `AC-DB-001, AC-OPS-002, AC-TST-001`
- **Test class/method:** `com.lab.labtimesheet.config.PlatformFoundationTest.flywayCreatesApprovedPostgresCatalog`, `com.lab.labtimesheet.config.PlatformFoundationTest.testClockIsDeterministic`
- **Implementation commit:** `this milestone commit`
- **Implementation commit:** `4b37f8fd05804d2d76e11cec1afce52919f2eb59`
## Protected behavior
+5 -5
View File
@@ -2,9 +2,9 @@
- **Test type:** Integration
- **Requirement IDs:** `INT-001INT-008, ACC-011, SEC-001`
- **Scenario IDs:** `AC-INT-001, AC-INT-002, AC-ACC-004`
- **Scenario IDs:** `AC-INT-001, AC-INT-002`
- **Test class/method:** `com.lab.labtimesheet.feature.integration.service.SmtpIntegrationTest.failedSmtpTestNeverActivatesDraftAndSecretsRemainEncrypted`
- **Implementation commit:** `this milestone commit`
- **Implementation commit:** `bc70db1d0d8eaa68bb8e22db44e38af27b0fa945`
## Protected behavior
@@ -32,8 +32,8 @@ export DOCKER_HOST=unix:///Users/sechmachine/.orbstack/run/docker.sock
**Observed result**
```text
SmtpAccountIntegrationTest.java: cannot find symbol class SmtpConfigurationService
SmtpAccountIntegrationTest.java: cannot find symbol class SmtpProbe
The pre-refactor RED test source, then named SmtpAccountIntegrationTest.java, reported missing
SmtpConfigurationService and SmtpProbe symbols.
17 compilation errors
BUILD FAILURE
```
@@ -48,7 +48,7 @@ The SMTP revision and controllable delivery boundaries were absent.
export JAVA_HOME=/opt/homebrew/opt/openjdk@25
export PATH="$JAVA_HOME/bin:/opt/homebrew/opt/node@24/bin:$PATH"
export DOCKER_HOST=unix:///Users/sechmachine/.orbstack/run/docker.sock
./mvnw -Dtest=BootstrapIntegrationTest,SmtpAccountIntegrationTest test
./mvnw -Dtest=SmtpIntegrationTest test
```
**Observed result**