Repository navigation
Chore/deploy readiness - #37
Merged
Merged
Conversation
The pinned lombok 1.18.30 fails on JDK 22+ (NoSuchFieldException com.sun.tools.javac.code.TypeTag :: UNKNOWN), so the project could only be built on JDK 21. Spring Boot 3.5.13 already manages lombok 1.18.44, which supports current JDKs. Verified: ./mvnw test on JDK 25 -> 123 tests green.
The test profile runs on H2 with Flyway disabled, so a mismatch between V1..Vn and the JPA mapping only surfaced when production booted with ddl-auto=validate. Add PostgresMigrationIT (runs only when POSTGRES_TEST_URL is set) and a CI job with a postgres:16 service that applies the migrations and validates the entity mapping against the resulting schema. Verified RED: a probe migration dropping users.email makes the test fail with Schema-validation: missing column [email] in table [users]. Verified GREEN: 8 migrations applied, 1 test green.
DataLoader seeded users with known passwords (two of them MASTER) whenever the local/demo profile was active, reading an env var directly from System.getenv. A deployment with the wrong profile pointing at a real database could create those accounts. The runner bean now only exists when app.demo-seeds.enabled=true (APP_DEMO_SEEDS_ENABLED=true in the environment); the dev compose files opt in explicitly. Verified: DemoSeedsGateTest fails before the change (bean always created) and passes after it; full suite 126 tests green.
The template defaulted to SPRING_PROFILES_ACTIVE=local and the production compose propagates that value verbatim, so copying the example and forgetting one line booted the app with the development profile against a real database (Swagger public, show-sql, no MASTER bootstrap, demo seeds gated only by env). Default to prod, document that it must stay prod, drop the legacy POSTGRES_* variables that prod no longer uses, and make the demo-seed flag explicit. Verified: docker compose --env-file Docker/.env.example -f Docker/docker-compose.yml --profile full config --quiet -> OK.
Two problems broke the documented development path: - minio/minio:latest is no longer pullable from Docker Hub, so ./run.sh dev failed before starting. Use pgsty/minio, a drop-in fork of the same server (same env vars, CLI and /minio/health/live endpoint). - Spring Boot does not read .env files and run.sh never sourced gradox2/.env, so the local SMTP credentials (and any other local setting) were silently ignored. Parse KEY=VALUE without bash , because values such as the Gmail app password contain spaces. Verified: dev stack up (db + minio healthy), ./run.sh run boots with the local profile, Flyway applies V1..V8, demo seeds create the three files in S3 (bucket gradox2-files created in MinIO), login as the seeded MASTER works.
/admin/** has been implemented (ban/unban, audit, proposals); the inline comment still claimed otherwise.
- 117 -> 126 tests (123 + DemoSeedsGateTest + PostgresMigrationIT). - V1..V7 -> V1..V8 (V8 seeds courses and subjects). - Document the CI migrations job and how to run it locally. - minio/minio is no longer available; the dev stack uses pgsty/minio. - run.sh loads gradox2/.env; app.demo-seeds.enabled gates the demo data. - token_version (V5) does allow revoking issued access tokens.
The .env loader exported every key unconditionally, so a value already set by the invoking shell was silently overwritten. Concretely: exporting APP_DEMO_SEEDS_ENABLED=false and having it as true in .env re-enabled demo seeding, which creates known-password MASTER accounts. The loader now skips keys already present in the environment, matching Spring Boot precedence (environment over file). Verified: bash -n; with APP_DEMO_SEEDS_ENABLED=false in the environment and true in the file, the exported value stays false; a value with spaces (Gmail app password) is still parsed correctly.
Main now ships V9__file_original_filename.sql, so the docs that list V1..V8 and the migration breakdown were one version behind. Also restore the test-suite sequence in TESTING.md: PostgresMigrationIT and DemoSeedsGateTest were inserted before EmailServiceAsyncTest, leaving section 15 at the end. Verified: ./mvnw test -> 126/126 green; PostgresMigrationIT against PostgreSQL 16 -> 9 migrations applied, ddl-auto=validate OK.
TESTING.md claimed 18 test classes; the tree has 17 classes with @test (TestS3Config is a fixture, not a suite). Found by the previous review pass (readability advisory).
CI failed on this branch with: Referential integrity constraint violation: file_proposal FOREIGN KEY(id) REFERENCES proposals(id) ... ; delete from users where id=? The H2 database of the test profile is shared by every test class of the same Spring context, so proposals and files created by earlier classes still point at the users AuthRateLimitIntegrationTest tries to delete. It only survived because some class with a full cleanup usually ran in between; Surefire's filesystem order in CI put GovernanceRulesIntegrationTest right before it. Clean up in dependency order (same list GlobalJourneyIntegrationTest uses). Reproduced: ./mvnw test -Dtest=GovernanceRulesIntegrationTest,AuthRateLimitIntegrationTest -Dsurefire.runOrder=reversealphabetical failed with the same FK violation before the change and passes after it. Verified: full suite 126/126 in default order and with -Dsurefire.runOrder=reversealphabetical.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.