refactor: rename upload_failed to offline_synced and name the slot windows - #354
Merged
Merged
Conversation
…ndows Review follow-up on #349. upload_failed reads as if the record is bad, but by the time the row exists the upload succeeded - it just arrived through the offline sync queue instead of the realtime path. offline_synced describes how the record arrived rather than implying a failure. scheduled_slot moves from the opaque codes 'A'/'B'/'C' to the windows they already stand for: 'morning' (8:00-12:00), 'afternoon' (12:00-16:00) and 'evening' (16:00+). 'startup' is unchanged and null still means a manual run. Still fits varchar(16). Forward-only migration: 20260807120000_add_upload_failed_and_schedule_context is left byte-identical, so environments that already applied it keep their checksum and their rows. The new 20260824120000_rename_upload_failed_to_offline_synced does an ALTER TABLE ... RENAME COLUMN (values and default preserved) and rewrites the three existing slot codes in place. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Victor1Ja
force-pushed
the
feat/rename-offline-synced-and-slot-names
branch
from
August 24, 2026 12:36
b914676 to
8460a67
Compare
rashan-smith
approved these changes
Aug 25, 2026
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.
Follow-up to the review comment on #349 (posted after that PR merged). Both naming changes, no behaviour change.
1.
upload_failed→offline_syncedBy the time the row exists the upload succeeded — it just came in through the offline sync queue rather than the realtime path.
upload_failedreads like the record is bad or incomplete when the data is fine;offline_synceddescribes how it arrived.schema.prisma:offline_synced Boolean? @default(false)measurement.dto.ts:offline_synced?: boolean+ updated@ApiPropertydescriptionmeasurement.service.ts: bothtoModel()and the DTO mapping (offline_synced: measurement.offline_synced ?? false)mock-objects.ts,measurement.service.spec.ts: renamed2. Slot codes
A/B/C→ time-of-day namesThe slots are fixed windows, so the letters throw away meaning that is already there. Self-documenting in the DB, in the API docs and in dashboard queries.
AmorningBafternoonCeveningstartupstartup(unchanged)scheduled_slotstaysvarchar(16), stillnullfor manual runs. Descriptions updated inschema.prisma,measurement.dto.tsand the test that used to send'A'.Migration: forward-only
The review comment suggested editing
20260807120000_add_upload_failed_and_schedule_contextin place. That migration is left byte-identical here instead, because it already merged tostagingon 2026-08-18 and any environment that has applied it would otherwise fail its checksum and try to re-add columns that already exist.The rename is a new migration,
20260824120000_rename_upload_failed_to_offline_synced:RENAME COLUMNpreserves existing values and theDEFAULT false. The threeUPDATEs rewrite the slot codes already written by the RC builds so the column does not end up with a mix of letters and names — drop them if you would rather leave the existing staging rows as they are.startupandNULLare untouched. Safe to run on an environment that has the old migration and on one that does not.Testing
npx jest— 444 passed, 63 suites, no regressions.npx tsc --noEmitclean.npx prisma generateclean.prettier --checkon the touched files reports only violations that are already present onstaging(measurement.service.spec.ts,mock-objects.ts); left alone to keep the diff readable.Still to land
The frontend counterpart (unicef/project-connect-daily-check-app#83) writes these values and needs the same rename at the same time. The contract doc
project-memory/api-contracts/measurements-v1.mdand the v2.0.4 plan are updated separately (they live outside this repo).🤖 Generated with Claude Code