You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c0061ba
Browse filesBrowse the repository at this point in the historyBrowse files
Give a scheduled task a Time zone, and schedule it in that zone (#3114) (#3208)
Written-by: Dev
Fixes#3207
Owner: Dev
Reviewer: Reviewer
Part of #3114
Tier: T1
## What
The scheduled-task form never showed the zone a rule runs in: **Every
day at 09:00** always meant this device's zone, and a stored task's own
zone (the row prints `Every day at 09:00 (Asia/Shanghai)`) was invisible
in the one place that edits it. The form now draws a **Time zone** row
for **Once** / **Every day** / **Every week**
(`data-flybot="task-timezone"`, options from
`Intl.supportedValuesOf('timeZone')`, the rule's own zone first and
`UTC` right after it; a runtime without that API falls back to `[UTC,
Asia/Shanghai]`). **Repeat** is a duration and draws no row, and a cron
rule is kept as stored. The chosen zone is what the form sends:
`whenFromForm` gives daily/weekly rules that `timeZone`, and reads a
**Once** task's `datetime-local` wall clock in it (`2030-01-02 07:05 @
Asia/Tokyo` → `2030-01-01T22:05:00.000Z`); a wall clock the zone skips
(a DST gap) is refused with the form's existing `Pick a date and time`
instead of being moved an hour. Opening **Edit** fills the row from the
task's stored zone, and `wallClockInput` shows the Once time in that
same zone, so save-without-touching does not move the task.
## Checkpoint
<!-- flybot:checkpoint -->
{
"pr": 3208,
"claim": "Dev",
"issue": 3207,
"summary": "The scheduled-task form gains a Time zone row for Once,
Every day and Every week, listing this runtime's IANA zones with the
rule's own zone first. The chosen zone is what the form sends: daily and
weekly rules carry it as time_zone, and a Once task's wall clock is read
in it. A wall clock the zone skips (a DST gap) is refused with `Pick a
date and time`, not moved an hour. Repeat draws no row and a cron rule
is kept as stored; no host, shared-layer or authz file changed.",
"files": [
"core/src/client/schedules.js",
"core/test/schedules-timezone.test.js",
"core/src/client/i18n.js",
"core/test/schedules-client.test.js",
"docs/subsystems/core-client.md",
"changelog.d/3114-scheduled-task-time-zone.added.md",
"core/client.js",
"patches/ds-bot/0001-core-fixes.patch",
"patches/ds-bot/0008-client-bundle.patch",
"patches/ds-bot/files/test/schedules-timezone.test.js"
],
"checks": {
"ran": "TZ=UTC TMPDIR=/data/flybot-tmp npm run verify (exit 0); new file
3/3; four related suites 88/88; node core/scripts/build-client.mjs
--check; node scripts/ds-bot-patches.mjs check && canonical; changelog /
mojibake / testing-layers checks",
"result": "green",
"at": "f0c6a78a34a353154649638361cb419e6eef65d1"
},
"next": "none — ready for review. T1: a green tests-ok at the tip is the
gate; Dev writes no Verdict."
}
<!-- /flybot:checkpoint -->
## Verification at the tip
Tip: `f0c6a78a34a353154649638361cb419e6eef65d1`
Ran:
- `cd core && TZ=UTC TMPDIR=/data/flybot-tmp node --test
test/schedules-timezone.test.js` — 3 tests / 0 pass / 3 fail before the
change (red first, exact failure lines below), 3 / 3 / 0 after it.
- `cd core && TZ=UTC TMPDIR=/data/flybot-tmp node --test
test/schedules-client.test.js test/client-bundle.test.js
test/settings-readonly-pages.test.js test/i18n.test.js` — 88 tests / 88
pass / 0 fail.
- `node core/scripts/build-client.mjs --check` — exit 0 on the committed
`core/client.js` (24855 lines, was 24788).
- `node scripts/ds-bot-patches.mjs check` — exit 1 before `generate`
(`ok 10 patches apply cleanly in order`, then
`core/test/schedules-timezone.test.js: committed but not produced by the
patches` and four `differs from ds-bot/ + patches`); after it, exit 0
with `ok core/ equals ds-bot/ + patches/ds-bot/`; `canonical` — generate
is a no-op.
- `node .github/scripts/changelog.mjs check` — 12 fragments well formed;
`node .github/scripts/check-mojibake.mjs --check` — 0 occurrences of
U+FFFD; `node .github/scripts/testing-layers.mjs --check` — every test
file and workflow classified (914 files).
- `TZ=UTC TMPDIR=/data/flybot-tmp npm run verify` — exit 0, including
`core` lint (0 errors) and `arch-docs`.
- `git diff --numstat main -- core/src core/test docs changelog.d` —
`225 19 6`: the six handwritten files, no host / shared / authz /
plugins / `.github` / `policy` path touched.
Not run:
- **Ordering with #3112.** It is still open (not merged, head
`1969402c`, `dirty`) at this tip, so the rebase contract is not
exercised here. If this cut merges first, #3112 rebases and deletes the
whole duplicate `core/src/client/schedules.js` time-zone hunk
(`timeZoneOptions` / `wallClockInput` / `instantFromWallClock` /
`whenFromForm`, the `timeZone` state, the **Time zone** row and
`formStart`'s `at`), the `i18n.js` `'Time zone'` line and the
`test/schedules-client.test.js` assertion, and re-runs `generate` →
`check` → `canonical` so `patches/ds-bot/0001-core-fixes.patch` and
`patches/ds-bot/files/test/schedules-client.test.js` lose their copy
(spec §1A). If #3112 merges first instead, this cut is void: #3207
closes `not_planned`.
- **A real browser on a narrow window.** The form gains one row (about
44px); the tests drive labels, values and the payload through a VM shim,
not pixels, so a phone-width single screen with **Create task** still
visible was not looked at.
- **A DST gap against the host.** `instantFromWallClock` is asserted to
throw for `2030-03-10T02:30 @ America/New_York` and the form's existing
`catch` turns that into `Pick a date and time`, but no real task was
created in DSH at a skipped wall clock.
- **Nothing on `main`'s own open work.** No host (`core/src/host/**`,
T2), shared-layer (`core/src/shared/**`, T3), `authz.js`, `plugins/**`,
`.github/**` or `policy/**` line changed.
## Red first
The three cases ran against the unchanged client sources:
```
# tests 3 / # pass 0 / # fail 3
not ok 1 - #3110: the scheduled-task form draws a Time zone control for a rule that carries one, and none for a repeat interval
error: 'the form draws no Time zone control: ["Send to","Pick a Bot or group chat","B","Name","What to do","When","Once","Every day","Every week","Repeat","Cancel","Create task"]'
not ok 2 - #3110: an edited daily task shows its own zone, saves it, and its row names the same zone
error: 'the edit form names the zone its task keeps' (expected: true / operator: '==')
not ok 3 - #3110: a Once task's wall clock is read in the form's zone, not this device's
error: 'the form converts a wall clock in its zone' (actual: 'undefined' / expected: 'function')
```
After the change the same command reports 3 / 3 / 0.
## Scope
Six handwritten files (+225/−19): `core/src/client/schedules.js`
(+84/−17), `core/test/schedules-timezone.test.js` (new, 137),
`core/src/client/i18n.js` (+1), `core/test/schedules-client.test.js`
(+1/−1, the form's state seed list takes `start.timeZone` between `unit`
and `busy`), `docs/subsystems/core-client.md` (+1/−1) and
`changelog.d/3114-scheduled-task-time-zone.added.md` (new, 1). Five
generated files: `core/client.js` (+78/−11, 24788 → 24855),
`patches/ds-bot/0001-core-fixes.patch` (+113/−36),
`patches/ds-bot/0008-client-bundle.patch` (+1031/−956),
`patches/ds-bot/files/test/schedules-client.test.js` (+1/−1) and
`patches/ds-bot/files/test/schedules-timezone.test.js` (new, 137).
`patches/ds-bot/topics.json` is untouched.
## Ordering with #3112#3112 is still open (not merged) at this tip and carries the same
`schedules.js` +96/−17 segment, so the rebase list in **Not run** above
is the contract: whoever lands second deletes the duplicate and
regenerates `0001` / `files/` rather than hand-editing a patch.
A scheduled task's form now names the time zone its rule runs in: "Every day at 09:00" carries the zone it was saved with instead of silently meaning this device's zone, a Once task's date and time are read in that zone, and the row and the edit form name the same one ([#3114](https://github.com/ThinkFlowLab/FlyBot/issues/3114)).
0 commit comments