@milkenjoyer/toolchain 0.17.0 → 0.17.1
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/README.md +1 -1
- package/STARTS.md +2 -2
- package/dist/starts.mjs +3 -2
- package/package.json +1 -1
- package/src/starts/boat.ts +5 -1
package/README.md
CHANGED
|
@@ -268,4 +268,4 @@ Source checks skip tests/proofs. Runtime story coverage is tracked in #325.
|
|
|
268
268
|
|
|
269
269
|
# Boat start budgets
|
|
270
270
|
|
|
271
|
-
See [Boat start admission](STARTS.md) for `@milkenjoyer/toolchain/starts` in 0.17.
|
|
271
|
+
See [Boat start admission](STARTS.md) for `@milkenjoyer/toolchain/starts` in 0.17.1.
|
package/STARTS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Boat start admission
|
|
2
2
|
|
|
3
|
-
Pin `@milkenjoyer/toolchain` to `0.17.
|
|
3
|
+
Pin `@milkenjoyer/toolchain` to `0.17.1`. Import `admitStart`, `BoatStarts`, `Merges` and `Repo` from `@milkenjoyer/toolchain/starts`. Wrap each create, fork or resume in `admitStart({ repo, jobs: 1, priority: "ordinary" }, start, { deadline })`. Priority is required and accepts `"ordinary"` or `"p0"`. Red main is p0. `Repo` validates an `owner/name`. `deadline` is an absolute epoch time in milliseconds. `start` is a lazy Effect that runs once after admission.
|
|
4
4
|
|
|
5
5
|
Provide `BoatStarts.layer(key, { fetch? })` and `Merges.layer(githubToken, { fetch? })` with redacted credentials. Boat reads the key's default billing wallet. GitHub must see all four repos. Each optional `fetch` supplies that SDK's transport. The pure `decide(request, counts, now)` takes the current epoch time explicitly.
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ Each request counts as `jobs` in every live minute, hour and day window. A paid
|
|
|
10
10
|
|
|
11
11
|
`StartHeld.line` names the refusal. `Unread` means a read failed, history is incomplete or input is invalid. Read failures and incomplete histories retry until the deadline. Invalid plans, repos, jobs and timestamps hold immediately. `Paid` waits for a free quote. `Account` means the request exceeds its account ceiling and waits on minute or hour, or holds on day. `Budget` means the repo exceeds its live share and waits for the kth oldest start to leave the window. A request larger than its repo budget holds. Every wait polls fresh readings until the deadline, then fails `StartHeld` with the waiting line.
|
|
12
12
|
|
|
13
|
-
Repo CI history counts a Boat job without `runStartedAt` as starting now unless Boat reports it settled
|
|
13
|
+
Repo CI history counts a Boat job without `runStartedAt` as starting now unless Boat reports it settled or gives it a `finishedAt`. States the SDK does not list, such as `paused`, follow the same rule. A paused job that GitHub cancelled stops counting once Boat records its end. A start stamped after Boat answers counts at the answer's time. That history omits direct sandbox starts. Admission reserves nothing, so concurrent callers can race.
|
|
14
14
|
|
|
15
15
|
Import `boatJobFindings` from `@milkenjoyer/toolchain/starts`. Add its findings to the existing workflow policy, with every workflow as a `[path, text]` pair. It bounds each closure to `BOAT_JOBS_PER_RUN = 2`, including literal matrices, repeated local reusable calls and `workflow_run` descendants. Each descendant counts once per distinct activity type, or three times when `types` is absent. Dynamic and unresolved graphs produce findings. Keep runner, timeout and concurrency checks.
|
|
16
16
|
|
package/dist/starts.mjs
CHANGED
|
@@ -195,7 +195,8 @@ const Ci = Schema.Struct({
|
|
|
195
195
|
label: Schema.String,
|
|
196
196
|
state: Schema.String.check(Schema.isMinLength(1)),
|
|
197
197
|
queuedAt: Schema.Date,
|
|
198
|
-
runStartedAt: Schema.optional(Schema.NullOr(Schema.Date))
|
|
198
|
+
runStartedAt: Schema.optional(Schema.NullOr(Schema.Date)),
|
|
199
|
+
finishedAt: Schema.optional(Schema.NullOr(Schema.Date))
|
|
199
200
|
}))
|
|
200
201
|
});
|
|
201
202
|
const settled = /* @__PURE__ */ new Set([
|
|
@@ -247,7 +248,7 @@ var BoatStarts = class BoatStarts extends Context.Service()("toolchain/BoatStart
|
|
|
247
248
|
return {
|
|
248
249
|
repo,
|
|
249
250
|
starts: jobs.flatMap((job) => {
|
|
250
|
-
const at = job.runStartedAt?.getTime() ?? (settled.has(job.state) ? void 0 : now);
|
|
251
|
+
const at = job.runStartedAt?.getTime() ?? (settled.has(job.state) || job.finishedAt !== void 0 && job.finishedAt !== null ? void 0 : now);
|
|
251
252
|
return job.label.split("/")[0]?.startsWith("boat") === true && at !== void 0 && at > now - windowMillis.day ? [Math.min(at, now)] : [];
|
|
252
253
|
}),
|
|
253
254
|
complete: jobs.length < 500 || oldest <= now - windowMillis.day
|
package/package.json
CHANGED
package/src/starts/boat.ts
CHANGED
|
@@ -36,6 +36,7 @@ const Ci = Schema.Struct({
|
|
|
36
36
|
state: Schema.String.check(Schema.isMinLength(1)),
|
|
37
37
|
queuedAt: Schema.Date,
|
|
38
38
|
runStartedAt: Schema.optional(Schema.NullOr(Schema.Date)),
|
|
39
|
+
finishedAt: Schema.optional(Schema.NullOr(Schema.Date)),
|
|
39
40
|
})
|
|
40
41
|
),
|
|
41
42
|
});
|
|
@@ -125,7 +126,10 @@ export class BoatStarts extends Context.Service<
|
|
|
125
126
|
starts: jobs.flatMap((job) => {
|
|
126
127
|
const at =
|
|
127
128
|
job.runStartedAt?.getTime() ??
|
|
128
|
-
(settled.has(job.state)
|
|
129
|
+
(settled.has(job.state) ||
|
|
130
|
+
(job.finishedAt !== undefined && job.finishedAt !== null)
|
|
131
|
+
? undefined
|
|
132
|
+
: now);
|
|
129
133
|
return job.label.split("/")[0]?.startsWith("boat") === true &&
|
|
130
134
|
at !== undefined &&
|
|
131
135
|
at > now - windowMillis.day
|