@ai-dossier/sched 0.57.5 → 0.57.7
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 +4 -1
- package/dist/batch-dispatch.d.ts.map +1 -1
- package/dist/batch-dispatch.js +19 -11
- package/dist/batch-dispatch.js.map +1 -1
- package/dist/dossier-root.d.ts +26 -0
- package/dist/dossier-root.d.ts.map +1 -0
- package/dist/dossier-root.js +87 -0
- package/dist/dossier-root.js.map +1 -0
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +83 -74
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/dist/state.d.ts +18 -0
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +25 -0
- package/dist/state.js.map +1 -1
- package/dist/types.d.ts +16 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1499,7 +1499,7 @@ after-the-fact recovery, not a missing-data bug.
|
|
|
1499
1499
|
queue data.
|
|
1500
1500
|
- **Schema**: state/config files from #460 (schema 1.0.0), #464 (1.1.0), #468 (1.2.0),
|
|
1501
1501
|
#472 (1.3.0), #500 (1.4.0), #505 (1.5.0), #504 (1.6.0), #523 (1.7.0) and #524 (1.8.0)
|
|
1502
|
-
load and migrate to the current schema (1.
|
|
1502
|
+
load and migrate to the current schema (1.30.0 — 1.24.0 was #810: no backfill,
|
|
1503
1503
|
`kind`/`branch` optional, absent = an `evicted` record with no branch) automatically
|
|
1504
1504
|
(slot `branch`/`last_head`/`pid_start`, slot `role` (inferred from the
|
|
1505
1505
|
unit's queue entry, with the persisted `phase` as a fallback — #500), entry
|
|
@@ -1529,6 +1529,9 @@ after-the-fact recovery, not a missing-data bug.
|
|
|
1529
1529
|
Schema 1.29.0 (#844): `SlotEntry` gains `kill_sent_at`/`kill_escalated_at` (the
|
|
1530
1530
|
SIGTERM → SIGKILL escalation anchor and its journal dedup marker; `null`/`null`
|
|
1531
1531
|
backfilled, cleared when the slot goes idle).
|
|
1532
|
+
Schema 1.30.0 (#637): `QueueEntry` gains `ground_truth_unreachable_condition` (the
|
|
1533
|
+
`ground-truth-unreachable` streak's stable per-site key — a changed key starts a new
|
|
1534
|
+
streak; `null` backfilled, cleared with the other entry dedup markers).
|
|
1532
1535
|
- **`max_slots`** bounds live units (`assigned | running | recovering`); dependency
|
|
1533
1536
|
edges gate readiness — an issue with an unmerged dependency, and a batch behind an
|
|
1534
1537
|
unmerged batch, are never runnable.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-dispatch.d.ts","sourceRoot":"","sources":["../src/batch-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAUH,OAAO,EAIL,KAAK,YAAY,EAGjB,KAAK,gBAAgB,EAGtB,MAAM,gBAAgB,CAAC;AAUxB,OAAO,EAcL,KAAK,gBAAgB,EAGrB,KAAK,SAAS,EAEf,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"batch-dispatch.d.ts","sourceRoot":"","sources":["../src/batch-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAUH,OAAO,EAIL,KAAK,YAAY,EAGjB,KAAK,gBAAgB,EAGtB,MAAM,gBAAgB,CAAC;AAUxB,OAAO,EAcL,KAAK,gBAAgB,EAGrB,KAAK,SAAS,EAEf,MAAM,YAAY,CAAC;AAGpB,OAAO,EAGL,KAAK,WAAW,EAcjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,EAAE,UAA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AAM,EAAE,WAAW,EACnB,QAAQ,EAAE,gBAAgB,GACzB,eAAe,CAgSjB"}
|
package/dist/batch-dispatch.js
CHANGED
|
@@ -113,6 +113,7 @@ const anchor_close_1 = require("./anchor-close");
|
|
|
113
113
|
const attribution_1 = require("./attribution");
|
|
114
114
|
const dispatch_1 = require("./dispatch");
|
|
115
115
|
const dispatch_health_1 = require("./dispatch-health");
|
|
116
|
+
const dossier_root_1 = require("./dossier-root");
|
|
116
117
|
const groundtruth_1 = require("./groundtruth");
|
|
117
118
|
const journal_1 = require("./journal");
|
|
118
119
|
const readiness_1 = require("./readiness");
|
|
@@ -537,7 +538,7 @@ function runBatchSetup(deps, batch, now) {
|
|
|
537
538
|
return { ok: false, reason: 'no-anchor' };
|
|
538
539
|
const date = now.toISOString().slice(0, 10).replaceAll('-', '');
|
|
539
540
|
const branch = `batch/${batch.id}-${date}`;
|
|
540
|
-
const worktree = path.join(deps.repoDir,
|
|
541
|
+
const worktree = path.join((0, dossier_root_1.worktreesDirFor)(deps.repoDir), `batch-${batch.id}-${date}`);
|
|
541
542
|
if (!attribution_1.SAFE_REF_RE.test(branch) || !attribution_1.SAFE_REF_RE.test(batch.base_branch)) {
|
|
542
543
|
return { ok: false, reason: 'invalid-branch-name' };
|
|
543
544
|
}
|
|
@@ -546,7 +547,7 @@ function runBatchSetup(deps, batch, now) {
|
|
|
546
547
|
// this is the actual point where it becomes a filesystem path — the same
|
|
547
548
|
// containment check teardown applies on the way OUT must hold on the way IN.
|
|
548
549
|
const root = deps.exec('git', ['rev-parse', '--show-toplevel'], deps.repoDir) ?? deps.repoDir;
|
|
549
|
-
if (!(
|
|
550
|
+
if (!isSafeBatchWorktree(deps, root, worktree)) {
|
|
550
551
|
return { ok: false, reason: 'invalid-worktree-path' };
|
|
551
552
|
}
|
|
552
553
|
const runId = deps.exec('ai-dossier', ['runstate', 'mint', '--issue', String(batch.anchor)], deps.repoDir);
|
|
@@ -622,9 +623,19 @@ function runBatchSetup(deps, batch, now) {
|
|
|
622
623
|
function memberBranchFor(batchId, memberIndex, issue) {
|
|
623
624
|
return `batch/${batchId}-m${memberIndex}-${issue}`;
|
|
624
625
|
}
|
|
626
|
+
/**
|
|
627
|
+
* Containment for a batch/member worktree: under the git toplevel's worktree
|
|
628
|
+
* roots (`isSafeWorktree`) OR under the `.dossier/` project root's — the root
|
|
629
|
+
* `worktreesDirFor` builds paths from (#759), which in a nested layout
|
|
630
|
+
* (`.dossier/` above the checkout) is not the git toplevel.
|
|
631
|
+
*/
|
|
632
|
+
function isSafeBatchWorktree(deps, gitRoot, worktree) {
|
|
633
|
+
return ((0, teardown_1.isSafeWorktree)(path.resolve(gitRoot), worktree) ||
|
|
634
|
+
(0, teardown_1.isSafeWorktree)((0, dossier_root_1.projectRootFor)(deps.repoDir), worktree));
|
|
635
|
+
}
|
|
625
636
|
/** The worktree path a cold member-worktree prep creates for one member. */
|
|
626
637
|
function memberWorktreePathFor(deps, batchId, memberIndex, issue) {
|
|
627
|
-
return path.join(deps.repoDir,
|
|
638
|
+
return path.join((0, dossier_root_1.worktreesDirFor)(deps.repoDir), `batch-${batchId}-m${memberIndex}-${issue}`);
|
|
628
639
|
}
|
|
629
640
|
/**
|
|
630
641
|
* Prepare the CURRENT member's own worktree and branch (#677, AC5): a
|
|
@@ -674,7 +685,7 @@ function prepareMemberWorktree(deps, batch, memberIndex, issue, now) {
|
|
|
674
685
|
return { ok: false, reason: 'invalid-member-branch-name' };
|
|
675
686
|
const fsExists = deps.fsExists ?? ((p) => fs.existsSync(p));
|
|
676
687
|
const root = deps.exec('git', ['rev-parse', '--show-toplevel'], deps.repoDir) ?? deps.repoDir;
|
|
677
|
-
if (!(
|
|
688
|
+
if (!isSafeBatchWorktree(deps, root, worktree)) {
|
|
678
689
|
return { ok: false, reason: 'invalid-member-worktree-path' };
|
|
679
690
|
}
|
|
680
691
|
// All-or-nothing rollback for the cold path (same contract as
|
|
@@ -3212,10 +3223,7 @@ function clearBatchDedupMarker(deps, batch, currentReason, clearedFields, now) {
|
|
|
3212
3223
|
* `since`/`ticks`/whether to announce.
|
|
3213
3224
|
*/
|
|
3214
3225
|
function advanceBatchDedupStreak(priorReason, priorSince, priorTicks, reason, now) {
|
|
3215
|
-
|
|
3216
|
-
const ticks = isNewStreak ? 1 : priorTicks + 1;
|
|
3217
|
-
const since = isNewStreak || priorSince === null ? now.toISOString() : priorSince;
|
|
3218
|
-
return { since, ticks, announce: isNewStreak || ticks % types_1.JOURNAL_DEDUP_REANNOUNCE_TICKS === 0 };
|
|
3226
|
+
return (0, state_1.advanceStreak)({ since: priorSince, ticks: priorTicks }, priorReason !== reason, now);
|
|
3219
3227
|
}
|
|
3220
3228
|
/**
|
|
3221
3229
|
* Reset a batch's `pr-watch-failed` dedup marker (#630/#633). A no-op when no
|
|
@@ -4113,7 +4121,7 @@ function teardownBatch(deps, batchId) {
|
|
|
4113
4121
|
// accepts paths in pool state) and can legitimately live outside either
|
|
4114
4122
|
// `isSafeWorktree` root when `.worktree-pool.json` configures a custom
|
|
4115
4123
|
// `pool_dir` — mirrors `runTeardown`'s own internal skip for `poolClaimed`.
|
|
4116
|
-
if (batch.pool_claimed !== true && !(
|
|
4124
|
+
if (batch.pool_claimed !== true && !isSafeBatchWorktree(deps, root, batch.worktree)) {
|
|
4117
4125
|
journalEvent(deps, 'teardown-failed', unit(batchId), {
|
|
4118
4126
|
reason: 'unsafe-worktree-path',
|
|
4119
4127
|
detail: batch.worktree,
|
|
@@ -4313,7 +4321,7 @@ function spawnParallelMembers(deps, config, dispatch, batchId, now, result) {
|
|
|
4313
4321
|
const reusable = next.run !== undefined &&
|
|
4314
4322
|
fsExists(next.run.worktree) &&
|
|
4315
4323
|
(next.run.pool_claimed ||
|
|
4316
|
-
(
|
|
4324
|
+
isSafeBatchWorktree(deps, deps.exec('git', ['rev-parse', '--show-toplevel'], deps.repoDir) ?? deps.repoDir, next.run.worktree));
|
|
4317
4325
|
if (next.run !== undefined && reusable) {
|
|
4318
4326
|
member = {
|
|
4319
4327
|
branch: next.run.branch,
|
|
@@ -4510,7 +4518,7 @@ function landParallelRun(deps, batch, run, now) {
|
|
|
4510
4518
|
}
|
|
4511
4519
|
if (!run.pool_claimed) {
|
|
4512
4520
|
const root = deps.exec('git', ['rev-parse', '--show-toplevel'], deps.repoDir) ?? deps.repoDir;
|
|
4513
|
-
if (!(
|
|
4521
|
+
if (!isSafeBatchWorktree(deps, root, run.worktree)) {
|
|
4514
4522
|
return fail('unsafe-member-worktree', `member worktree ${run.worktree} is outside the repo's worktree roots`);
|
|
4515
4523
|
}
|
|
4516
4524
|
}
|