Skip to content

Weekly[start] partitions (ISO weeks) - #512

Merged
winding-lines merged 4 commits into
mainfrom
weekly-140
Nov 16, 2026
Merged

winding-lines merged 4 commits into
mainfrom
weekly-140

Conversation

@winding-lines

Copy link
Copy Markdown
Contributor

Closes #140

Adds Weekly[first] partitions over a new Week key (morca.week), beside Monthly, Daily and Hourly.

Key format. ISO 8601 weeks, Monday to Sunday, written YYYY-Www (2026-W46 = 2026-11-09..2026-11-15). YYYY is the ISO week-numbering year (the year of the week's Thursday), so 2024-12-30 is 2025-W01, 2021-01-03 is 2020-W53, and a year has 52 or 53 weeks. Year and week are zero-padded, so weeks order as text, which coverage, fills and sensors rely on. Ranges work as for the other time keys: morca backfill p 2026-W50..2027-W02.

What knows weekly keys

  • Weekly[first] / Week exported from morca; weeks_in(year).
  • _internal/timekeys.mojo (is_time_kind, unit_of → week, example, parse, containing, prev): so fill ranges, fill_lag, lag_wait, coverage, follow and backfill parsing work unchanged.
  • Schedules: fill_key fills the week a fire falls in (Current) or the one before (Previous), on the schedule's wall clock, so a Monday 06:00 cron with fills=Previous fills the week that just ended; a week ends Monday 00:00 local.
  • Sensors' map_keys: a day/hour maps to its week, a week to its 7 days / 168 hours, a week to the one or two months it spans, a month to every week with a day in it.
  • Calendar / Coverage card: an ISO year of weeks (?cal=YYYY / ?month=YYYY), cells labelled W46. The Start form has no picker for weekly (as for hourly); the text field works.
  • Docs: DESIGN.md, docs/ui.md, docs/morca-toml.md (fill_lag, the range).

No migration (kind is free text). The registry hash includes the partitions kind, so only pipelines that use Weekly get a new kind; existing hashes are unchanged.

Tests

  • tests/test_steps.mojo: parse/write, ISO year boundaries (52/53-week years, 2020-W53, 2026-W53, 2025-W01 starting 2024-12-30), a 2000–2040 sweep that each week's Monday and successor agree with day arithmetic, ranges across New Year, start refusal, fills, an in-memory weekly pipeline and its describe.
  • tests/test_fill.mojo: last_ended/range_keys over a 53-week year, the time zone at the Monday boundary, fill_lag.
  • tests/test_warehouse.mojo: sensor key mapping to and from weeks.
  • tests/weekly.sh (pixi run test-weekly, in test-scheduler-ui): Monday 06:00 fires with fills=Previous against Postgres, a week backfill that skips done weeks and refuses ones before the start, and the UI calendar of 53 weeks.

🤖 Generated with Claude Code

https://claude.ai/code/session_017TycszSbyw92Efu4ZeCYL6

winding-lines and others added 4 commits November 15, 2026 21:23
A week is ISO 8601, Monday to Sunday, written YYYY-Www (2026-W46) with the
ISO week-numbering year, so it sorts as text and 2024-12-30 is 2025-W01.
Schedules fill the week a fire falls in or the one before; fills, fill_lag,
coverage, sensors' key mapping (a week as the months it spans, a month as
the weeks it touches), backfills and the UI's calendar (an ISO year of
weeks) know weekly keys. Existing pipelines' registry hashes are unchanged.

Closes #140

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017TycszSbyw92Efu4ZeCYL6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017TycszSbyw92Efu4ZeCYL6
@winding-lines
winding-lines merged commit 0e3127e into main Nov 16, 2026
35 checks passed
@winding-lines
winding-lines deleted the weekly-140 branch November 16, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Weekly[start] partitions (ISO weeks)

1 participant