Repository navigation
Commit b14b741
authored
* fix(service): give a Windows cold start room to bind, without loosening zero budget
Reimplements #3039 (author @ntdatt812), whose diagnosis and production logic
are both right.
confirmServiceServing had a fixed 20s deadline and returned as soon as the
clock passed it. A Windows cold start does NTFS ACL hardening and previous-
session journal recovery before the listener exists, so #3009 recorded a
service that bound a few seconds late and then stayed healthy -- reported as a
terminal failure with exit 1. The caller's fallback is to start a second proxy
against a port that is about to be taken, which is worse than waiting.
Windows now gets 45s, every other platform keeps 20s, and the loop knocks once
more after a short grace before calling it dead.
Two changes to #3039 as submitted:
- It relaxed `expect(probes).toBe(1)` to `toBeGreaterThanOrEqual(1)` in the
zero-budget test. That assertion is what stops a future change from sleeping
when the caller asked not to wait, and "at least one" passes against exactly
the version it is meant to forbid. The `waited` guard already preserves the
contract, so the original assertion is restored and the comment says why.
- Its Windows-budget test asserted only `toBeGreaterThan(linux)`, which accepts
21s. The reported service bound past 20s, so the number is the contract: the
test now pins 45_000 absolutely.
Mutation-checked, both restored afterwards:
remove the `waited` guard -> 181 pass / 1 fail, the zero-budget test
remove the grace probe -> 181 pass / 1 fail, the #3009 test
Closes #3009.
* fix(service): forgive only what the code page mangled in a scheduler path
Reimplements #3067 (author @ntdatt812). The diagnosis is right and the
relocation is right: schtasks converts its XML through the console code page
before the bytes exist, so runFile reading as a buffer cannot help. A profile
named outside that page comes back as C:\Users\???\... and the exact
comparison rejected a registration this process had just created correctly,
so `ocx service install` rolled it back (#3064).
The remedy needed narrowing. #3067 compiles every unrepresentable run to
`[^\\/]*`, which forbids a path separator but allows arbitrary ASCII. A
segment that is ENTIRELY non-ASCII then has no anchors left, so
C:\Users\<CJK>\.opencodex\service-launcher.vbs
matches
C:\Users\Admin\.opencodex\service-launcher.vbs
and this process would adopt, repair, or delete another account's task. The
same hole applies to <UserId>, where MACHINE\<CJK> would match MACHINE\Admin.
Its tests use "Người", whose surviving Ng and i letters hide the case.
Here an unrepresentable run may match only a run of substitution characters --
'?' per character, U+FFFD, or nothing -- and every ASCII segment, including
every separator, is matched literally. A foreign account's path fails because
"admin" is not a run of substitutions.
Mutation-checked: widening the class back to `[^\\/]*` gives 186 pass /
1 fail, exactly "rejects another account's path that is merely the same shape".
Closes #3064.
* fix(service): bind scheduler recovery to exact SID
* fix(service): fail closed on ambiguous scheduler ownership
* test(service): lock scheduler ownership guards
* test(service): scope scheduler verification fixtures
* test(service): exercise scheduler ownership oracles
1 parent 0dc01cd commit b14b741
5 files changed
Lines changed: 508 additions & 66 deletions
0 commit comments