Schedules document stores a bare time.Duration, so the Web UI asks for nanoseconds #1074

Closed
opened 2026-10-27 13:38:55 +00:00 by sam · 0 comments
Owner

Found while pinning the schema derivation (b5050c75). Same defect class as archie-core-02rm (rate_limit.window), in a document I do not own but the control plane does.

EVIDENCE

internal/infrastructure/cronstore/schedule.go declares Interval time.Duration json:"interval,omitempty" -- a BARE time.Duration, which marshals as its nanosecond count. The schedule documents the UI edits therefore carry interval: 3600000000000 for one hour, and the derived schema correctly says {"type":"integer"} (the schema describes the wire form, not the Go type's name). So the Web UI renders a number input and an operator must type nanoseconds, exactly as they did for rate_limit.window before 02rm.

Contrast: config.Duration and channelDuration are named types with MarshalJSON emitting the string time.ParseDuration reads, and derive as {"type":"string","format":"duration"}. So the same struct can hold both forms, and the schedules document holds the wrong one.

Note the UI now builds a new array row from the schema (blankFromSchema(items)):

  • internal/webui resource-schema.ts, landed as aa650e2c. For schedules that means a new row starts with interval 0 (valid, 0ns) rather than a broken blank string -- so nothing is currently broken, the affordance is just wrong.

FIX DIRECTION

Change cronstore.Schedule.Interval to config.Duration (or an equivalent string-marshalling type) so the document carries "1h0m0s", then the derived schema needs no change at all and the Web UI gets the duration affordance for free. Watch the migration: stored schedules already hold a number, and json.Unmarshal into a string-marshalling type rejects it, so the decode needs to accept both forms the way channelDuration does (archie-core-02rm), and Normalize (the Definition.Normalize hook normalizeSchedules already uses) rewrites it on write.

Close reason

Fixed in 84450ac9: the schedules document writes interval as a duration string, not nanoseconds.


Imported from beads archie-core-4w0c · GitHub #1169 · type bug · priority P3 · created 2026-09-21 · closed 2026-09-26

Found while pinning the schema derivation (b5050c75). Same defect class as archie-core-02rm (rate_limit.window), in a document I do not own but the control plane does. EVIDENCE internal/infrastructure/cronstore/schedule.go declares Interval time.Duration `json:"interval,omitempty"` -- a BARE time.Duration, which marshals as its nanosecond count. The schedule documents the UI edits therefore carry interval: 3600000000000 for one hour, and the derived schema correctly says {"type":"integer"} (the schema describes the wire form, not the Go type's name). So the Web UI renders a number input and an operator must type nanoseconds, exactly as they did for rate_limit.window before 02rm. Contrast: config.Duration and channelDuration are named types with MarshalJSON emitting the string time.ParseDuration reads, and derive as {"type":"string","format":"duration"}. So the same struct can hold both forms, and the schedules document holds the wrong one. Note the UI now builds a new array row from the schema (blankFromSchema(items)): - internal/webui resource-schema.ts, landed as aa650e2c. For schedules that means a new row starts with interval 0 (valid, 0ns) rather than a broken blank string -- so nothing is currently broken, the affordance is just wrong. FIX DIRECTION Change cronstore.Schedule.Interval to config.Duration (or an equivalent string-marshalling type) so the document carries "1h0m0s", then the derived schema needs no change at all and the Web UI gets the duration affordance for free. Watch the migration: stored schedules already hold a number, and json.Unmarshal into a string-marshalling type rejects it, so the decode needs to accept both forms the way channelDuration does (archie-core-02rm), and Normalize (the Definition.Normalize hook normalizeSchedules already uses) rewrites it on write. ### Close reason Fixed in 84450ac9: the schedules document writes interval as a duration string, not nanoseconds. --- _Imported from beads `archie-core-4w0c` · GitHub #1169 · type bug · priority P3 · created 2026-09-21 · closed 2026-09-26_
sam added the lowbug labels 2026-10-27 13:38:55 +00:00
sam self-assigned this 2026-10-27 13:38:55 +00:00
sam closed this issue 2026-10-27 13:38:55 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1074