fix(platform): address round 2 review findings
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
# Test Evidence: Constraint-specific account uniqueness feedback
|
||||
|
||||
- **Test type:** Web
|
||||
- **Requirement IDs:** `ACC-019`, `DB-003`
|
||||
- **Scenario IDs:** `AC-ACC-005` (Intern creation uniqueness boundary)
|
||||
- **Test class/method:** `com.lab.labtimesheet.feature.account.controller.AccountWebIntegrationTest#duplicateNormalizedStudentCodeIsReportedOnStudentCodeRatherThanEmail`
|
||||
- **Implementation commit:** `pending`
|
||||
|
||||
## Protected behavior
|
||||
|
||||
A case- and whitespace-normalized duplicate Intern student code is reported on the student-code field. A distinct
|
||||
email is not falsely labeled as duplicate, and unknown uniqueness constraints fall back to a non-specific conflict.
|
||||
|
||||
## Test method
|
||||
|
||||
MockMvc creates one Intern through the authenticated CSRF-protected production form and then submits a second Intern
|
||||
with a distinct email and the same student code in different case with surrounding whitespace. PostgreSQL 18.4
|
||||
enforces the real Flyway expression index; the controller maps Hibernate's known constraint name to the form field.
|
||||
|
||||
## Hand-derived expected result
|
||||
|
||||
The second request returns HTTP 200 on `accounts/new`, retains the safe display name, shows the student-code conflict,
|
||||
and does not claim that the distinct email already exists.
|
||||
|
||||
## 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=AccountWebIntegrationTest#duplicateNormalizedStudentCodeIsReportedOnStudentCodeRatherThanEmail test
|
||||
```
|
||||
|
||||
**Observed result**
|
||||
|
||||
```text
|
||||
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
|
||||
PostgreSQL reported uq_intern_profiles_student_code_ci, but the form displayed "this email already exists".
|
||||
BUILD FAILURE
|
||||
PostgreSQL: 18.4
|
||||
```
|
||||
|
||||
## GREEN
|
||||
|
||||
**Command**
|
||||
|
||||
```text
|
||||
./mvnw -Dtest=AccountWebIntegrationTest#duplicateNormalizedStudentCodeIsReportedOnStudentCodeRatherThanEmail 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=TimeConfigurationTest,BootstrapIntegrationTest,SmtpOnboardingWebIntegrationTest,AccountActivationIntegrationTest,AccountWebIntegrationTest,BootstrapOnboardingWebIntegrationTest,JavaMailSmtpProbeTest,SecurityResponseIntegrationTest test
|
||||
Tests run: 22, Failures: 0, Errors: 0, Skipped: 0
|
||||
BUILD SUCCESS
|
||||
PostgreSQL: 18.4
|
||||
```
|
||||
|
||||
## External-test boundaries
|
||||
|
||||
The test covers the two Platform-owned normalized identity constraints. It does not enumerate later-iteration feature
|
||||
constraints or perform a real-browser accessibility pass.
|
||||
@@ -18,14 +18,15 @@ non-secret values and show actionable errors. All state-changing browser operati
|
||||
MockMvc drives the production controllers, Bean Validation, Thymeleaf rendering, Spring Security filter chain, JPA
|
||||
services, and PostgreSQL 18.4. SMTP is replaced only at its network adapter. The tests inspect rendered status,
|
||||
buttons, warnings, validation messages, password non-retention, CSRF denial, ordered deferral navigation, and the
|
||||
failed-probe response while verifying that activation remains unavailable.
|
||||
failed-probe response while verifying that activation remains unavailable and raw adapter diagnostics are absent.
|
||||
|
||||
## Hand-derived expected result
|
||||
|
||||
Successful bootstrap lands on `/admin/smtp?onboarding`. A saved draft shows Test but not Activate; a successful test
|
||||
shows Activate; activation clears the restricted warning. Deferral exposes warnings one through five in order, Back
|
||||
and Configure on every screen, and Finish only on screen five. Invalid data returns HTTP 200 with field/global errors
|
||||
and no submitted password. A failed SMTP probe displays its safe error and leaves the draft untested.
|
||||
and no submitted password. A failed SMTP probe displays fixed operator guidance and leaves the draft untested without
|
||||
rendering the adapter's diagnostic.
|
||||
|
||||
## RED
|
||||
|
||||
@@ -89,5 +90,5 @@ PostgreSQL: 18.4
|
||||
## External-test boundaries
|
||||
|
||||
The SMTP adapter is in-memory here, so this does not prove external Mailpit/server interoperability. MockMvc is not a
|
||||
real browser or accessibility run. The test exposes only the adapter's safe failure message fixture and never a raw
|
||||
password, integration secret, or activation bearer token.
|
||||
real browser or accessibility run. The test uses a non-secret diagnostic fixture only to prove that raw adapter text
|
||||
is absent; it never exposes a password, integration secret, or activation bearer token.
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
# Test Evidence: Sanitized SMTP failure feedback
|
||||
|
||||
- **Test type:** Web
|
||||
- **Requirement IDs:** `INT-005`, `INT-008`
|
||||
- **Scenario IDs:** `AC-INT-002` (failed-draft browser boundary)
|
||||
- **Test class/method:** `com.lab.labtimesheet.feature.integration.controller.SmtpOnboardingWebIntegrationTest#failedSmtpTestRendersActionableFeedbackWithoutActivatingTheDraft`
|
||||
- **Implementation commit:** `pending`
|
||||
|
||||
## Protected behavior
|
||||
|
||||
An SMTP test failure renders fixed actionable guidance but never renders the external adapter's arbitrary diagnostic.
|
||||
The failed draft remains untested and cannot be activated.
|
||||
|
||||
## Test method
|
||||
|
||||
MockMvc saves a valid SMTP draft, configures the in-memory network adapter to throw a distinctive non-secret raw
|
||||
diagnostic, and submits the authenticated CSRF-protected test action. It checks the production controller and
|
||||
Thymeleaf response for the fixed message, absence of the raw diagnostic, and absence of the activation action.
|
||||
|
||||
## Hand-derived expected result
|
||||
|
||||
The response is HTTP 200 on `smtp/form`, contains the fixed operator message, omits the adapter diagnostic, and does
|
||||
not offer Activate SMTP.
|
||||
|
||||
## 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=SmtpOnboardingWebIntegrationTest#failedSmtpTestRendersActionableFeedbackWithoutActivatingTheDraft test
|
||||
```
|
||||
|
||||
**Observed result**
|
||||
|
||||
```text
|
||||
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
|
||||
The fixed guidance was absent and the rendered smtpActionError contained the adapter's distinctive diagnostic.
|
||||
BUILD FAILURE
|
||||
PostgreSQL: 18.4
|
||||
```
|
||||
|
||||
## GREEN
|
||||
|
||||
**Command**
|
||||
|
||||
```text
|
||||
./mvnw -Dtest=SmtpOnboardingWebIntegrationTest#failedSmtpTestRendersActionableFeedbackWithoutActivatingTheDraft 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=TimeConfigurationTest,BootstrapIntegrationTest,SmtpOnboardingWebIntegrationTest,AccountActivationIntegrationTest,AccountWebIntegrationTest,BootstrapOnboardingWebIntegrationTest,JavaMailSmtpProbeTest,SecurityResponseIntegrationTest test
|
||||
Tests run: 22, Failures: 0, Errors: 0, Skipped: 0
|
||||
BUILD SUCCESS
|
||||
PostgreSQL: 18.4
|
||||
```
|
||||
|
||||
## External-test boundaries
|
||||
|
||||
The SMTP adapter is in-memory, so this does not prove live server interoperability. The diagnostic is a deterministic
|
||||
non-secret fixture; no password, credential, or activation token is logged or recorded.
|
||||
Reference in New Issue
Block a user