Repository navigation
fix: analytics 500s, production-safe config, optional credentials, CI - #11
Merged
Merged
Conversation
- Timeline: DATE_TRUNC on a TIMESTAMP column comes back as java.sql.Timestamp, which the code read as Instant (ClassCastException). The value is read as UTC wall-clock time, so the hour is right whatever the JVM time zone. - Engagement refresh: Postgres could not type ":nowUtc - INTERVAL '90 days'" and failed with "timestamp > interval". The parameter is cast to timestamp. - Integration tests for both (the JVM runs in Africa/Lagos, so a time-zone shift of the timeline hour is caught too).
… image - Logging: INFO by default instead of DEBUG for Spring Security/Web/Data; raise per package with LOGGING_LEVEL_<PACKAGE>. - CORS: one config in SecurityConfig, origins from CORS_ALLOWED_ORIGINS (default any), never credentials (auth is a Bearer header). Removes the unused CorsConfig and the spring.mvc.cors block, which Spring Boot ignored. - Swagger server URL comes from APP_BASE_URL instead of a personal ngrok URL. - Optional settings no longer stop the app from starting: RESEND_API_KEY, MAIL_*, AWS keys (blank = SDK default chain, e.g. an IAM role), AWS_S3_BUCKET and IPINFO_TOKEN. Unconfigured senders are skipped; image uploads without a bucket return 503 with a clear message. - build.gradle: one AWS BOM (2.25.27) instead of modules pinned at two versions, duplicate yauaa removed, unused MaxMind GeoIP2 removed. The resolved runtime classpath is otherwise unchanged. - Dockerfile: the runtime image runs as an unprivileged user. - Tests for the optional settings, CORS, and starting with only the required settings. README and .env.example updated.
op-techy
force-pushed
the
fix/analytics-config-hardening
branch
from
December 2, 2026 22:05
f89249b to
44dd1f5
Compare
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.
Summary
Found by re-running the whole app end to end in Docker after #10.
Bugs
GET /api/analytics/campaigns/{id}/timeline).DATE_TRUNCon aTIMESTAMPcolumn comes back asjava.sql.Timestamp, but the code read it asInstant(ClassCastException). It is now read as UTC wall-clock time, so the hour is right whatever the JVM time zone.POST /api/analytics/engagement-scores/refresh). Postgres could not type:nowUtc - INTERVAL '90 days'and failed withoperator does not exist: timestamp > interval. The parameter is now cast totimestamp.Configuration
INFOby default instead ofDEBUGfor Spring Security, Web and Data. Raise a package withLOGGING_LEVEL_<PACKAGE>=DEBUG.SecurityConfig:CORS_ALLOWED_ORIGINS(default*)CorsConfigand thespring.mvc.corsblock, which Spring Boot ignoresAPP_BASE_URLinstead of a hardcoded personal ngrok URL.RESEND_API_KEY,MAIL_*,IPINFO_TOKEN,AWS_S3_BUCKET, AWS keysyauaaremovedappuser..github/workflows/ci.ymlruns the unit, integration and scale tests and builds the Docker image on every PR and push tomain.CORS_ALLOWED_ORIGINSto the frontend's domain in production. Without it any origin is allowed, as before.APP_BASE_URL, so make sure it is the public URL.Not changed
PageImpl) format may change. The only way to silence it is to switch to theVIA_DTOformat, which movestotalElementsand the other paging fields underpageand would break the frontend. That needs coordination with the frontend.bucket4jand the Caffeine/cache starter aren't used by any code yet. They're labelled as planned work (BE-3/BE-4), so I left them in.Test plan
./gradlew test: 353/353 passed (6 new: optional senders, IPinfo, CORS config, CORS preflight)./gradlew integrationTest: 27/27 passed (4 new)./gradlew scaleTest: 9/9 passedpostgres:16-alpinewith only DB, JWT,APP_BASE_URL,AWS_FROM_EMAILandCORS_ALLOWED_ORIGINSset:appAPP_BASE_URL