fix(explore): null processing-summary param + Svelte 5 reactivity #655
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/explore-loading"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug 1: GET /api/processing-summary?refresh=123 → HTTP 500
Root cause:
ProcessingSummaryService.activities()line 80 —resetCutoff()returnsnullwhenresetEventTypesis empty (thumbnails, metadata, semantic_search). Spring JdbcClient binds null to a Timestamp param without SQL type hint → PostgreSQL throws "could not determine data type of parameter $N" → 500.Fix: Replace null sentinel with
Timestamp.from(Instant.EPOCH). Instant.EPOCH (1970-01-01) includes ALL timestamps — same semantics as "no cutoff". Removed the now-redundantOR :finishedCutoff IS NULLclauses from the SQL.File:
apps/api/src/main/java/dev/memories/api/processing/ProcessingSummaryService.java:80-87Bug 2: /explore page — People and Plants stuck on "Loading..."
Root cause (confirmed by code analysis):
apps/web/src/routes/explore/+page.svelte:170-186—loadDomainInstances()mutatessection.loadingandsection.instanceson objects passed by reference from avoidfire-and-forget async call. In Svelte 5 legacy mode (no$staterunes), mutations to nested properties ofletvariables are NOT automatically tracked — only top-level reassignment triggers re-render. The template never updates because Svelte's compiler doesn't know these mutations happened.Fix: Reassign
domainSections = domainSectionsin thefinallyblock after mutations, forcing Svelte invalidation.File:
apps/web/src/routes/explore/+page.svelte:183-185Runtime check notes
The backend endpoints (
GET /api/discovery/domains/people/class-instancesand plants equivalent) return 200 with valid data. The bug is purely a frontend reactivity issue — the data arrives but the UI never re-renders to show it.Tests
noAuditEventResetRowsDoesNotCauseNullParamErrortoProcessingSummaryServiceTest.java. H2 passes (doesn't reproduce original PG bug) but verifies no NPE on the null→EPOCH conversion path. Comment documents the H2 vs PG difference.svelte-check(0 errors). Manual browser testing recommended.