instar 1.3.551 → 1.3.552
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +25 -0
- package/dist/commands/server.js.map +1 -1
- package/dist/config/ConfigDefaults.d.ts.map +1 -1
- package/dist/config/ConfigDefaults.js +13 -0
- package/dist/config/ConfigDefaults.js.map +1 -1
- package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
- package/dist/core/PostUpdateMigrator.js +16 -0
- package/dist/core/PostUpdateMigrator.js.map +1 -1
- package/dist/core/types.d.ts +24 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/scaffold/templates.d.ts.map +1 -1
- package/dist/scaffold/templates.js +1 -0
- package/dist/scaffold/templates.js.map +1 -1
- package/dist/scheduler/JobScheduler.d.ts +33 -0
- package/dist/scheduler/JobScheduler.d.ts.map +1 -1
- package/dist/scheduler/JobScheduler.js +75 -0
- package/dist/scheduler/JobScheduler.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +20 -20
- package/src/scaffold/templates.ts +1 -0
- package/upgrades/1.3.552.md +23 -0
- package/upgrades/side-effects/ws43-role-guard.md +40 -0
- package/upgrades/ws43-role-guard.eli16.md +47 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# ELI16 — WS4.3 role-guard-at-spawn (a state-writing job can't run on the wrong machine)
|
|
2
|
+
|
|
3
|
+
## The problem
|
|
4
|
+
|
|
5
|
+
When I run on more than one computer, exactly one of them is "in charge" at a
|
|
6
|
+
time (it holds a token called the *lease*). The other is a standby — it is
|
|
7
|
+
deliberately read-only, so two computers can't both scribble on the same shared
|
|
8
|
+
notebook and corrupt it.
|
|
9
|
+
|
|
10
|
+
My scheduled jobs are a problem here. The job scheduler only starts up on the
|
|
11
|
+
in-charge computer. But here's the gap: if that computer LOSES the lease while
|
|
12
|
+
it's still running (it gets demoted to standby mid-shift), nobody turns its
|
|
13
|
+
scheduler off. Its cron timers keep ticking. So a job that WRITES to the shared
|
|
14
|
+
notebook could fire on a computer that is now supposed to be read-only — the
|
|
15
|
+
exact double-writer corruption the standby rule exists to prevent. It's a
|
|
16
|
+
classic timing hole: the scheduler checked "am I in charge?" at startup, but the
|
|
17
|
+
answer can go stale before the job actually runs.
|
|
18
|
+
|
|
19
|
+
## What this change does
|
|
20
|
+
|
|
21
|
+
Right before the scheduler spawns a job, it re-checks — at that very moment, not
|
|
22
|
+
at startup — two things:
|
|
23
|
+
|
|
24
|
+
1. Is this a STATE-WRITING job? (The job opts in by marking itself
|
|
25
|
+
`"writesState": true`.)
|
|
26
|
+
2. Do I currently hold the lease?
|
|
27
|
+
|
|
28
|
+
If it's a state-writing job AND I do NOT hold the lease, the scheduler refuses
|
|
29
|
+
to start it, writes down why ("role-guard" skip), and raises one calm heads-up
|
|
30
|
+
note. The job isn't lost: the cron timer fires on EVERY computer, and the one
|
|
31
|
+
that actually holds the lease passes the check and runs it. So the refusal
|
|
32
|
+
re-routes the work to the right machine all by itself.
|
|
33
|
+
|
|
34
|
+
It's the same kind of just-in-time re-check the message router already does
|
|
35
|
+
before it spawns a session — catch the stale answer at the last possible moment.
|
|
36
|
+
|
|
37
|
+
## Why it's safe to ship
|
|
38
|
+
|
|
39
|
+
It's dark by default (behind a flag), and it only ever affects jobs that
|
|
40
|
+
explicitly mark themselves state-writing. On a single computer you always hold
|
|
41
|
+
the lease, so it never fires. If the flag is off, or the check itself errors, the
|
|
42
|
+
job spawns exactly like today — the guard can only ever REFUSE work that would
|
|
43
|
+
have been unsafe, never block work that was fine.
|
|
44
|
+
|
|
45
|
+
## Parent principle
|
|
46
|
+
|
|
47
|
+
Cross-Machine Coherence — One Agent, Robust Under Degraded Conditions.
|