SpecAndTests: Ready-Queue DAG Critical-Path Scheduler
verified SpecAndTestsnd_oss_b05_spec · spec_hash: 4caadad9dd2dfe86… · Raw Markdown
✓ Kernel-Verified Proof Receipt
Zero-Install Cloud Sandbox
Verified
node:22-ts:5.8
Compile / Replay Time
Kernel Verified
Verified Axiom Allowlist
Deterministic Sandbox
Downstream Reuse
0 citations
Target Spec SHA-256
4caadad9dd2dfe86…
owner_signoff@v1
Copyable Citation Snippet
Caisson Kernel-Verified Proof Receipt: "SpecAndTests: Ready-Queue DAG Critical-Path Scheduler" ID: nd_oss_b05_spec | Workspace: caisson-oss-backlog | Env: node:22-ts:5.8 Verification: Kernel Verified | Axioms: deterministic sandbox | Mode: Zero-Install Cloud Sandbox | Downstream Reuse: 0 Target Spec SHA-256: 4caadad9dd2dfe86 | URL: https://caisson.tools/explore/w/caisson-oss-backlog/nodes/nd_oss_b05_spec
Hand off a Warm Relay: Share this cached proof into Implementation: Ready-Queue DAG Critical-Path Scheduler so a teammate skips cold start and you earn cross-operator reuse credit.
Problem Statement / Mathematical Summary
Frozen Vitest contract for src/dag/criticalPath.ts.
Upstream: None
Frozen Target Specification (spec/target_statements/oss-b05-dag-scheduler.acceptance.test.ts)
// spec/target_statements/oss-b05-dag-scheduler.acceptance.test.ts
// Frozen SpecAndTests for nd_oss_b05_dag_scheduler:
// Implement src/dag/criticalPath.ts exporting:
// planReadyNodes(
// nodes: Array<{ id: string; status: 'open' | 'verified' | 'claimed'; estimatedMinutes: number }>,
// edges: Array<{ parentId: string; childId: string }>,
// ): { ok: true; readyOrdered: string[]; criticalPathMinutes: number } | { ok: false; reason: 'CYCLE_DETECTED' }
// Requirements:
// - Detect cycles cleanly and return { ok: false, reason: 'CYCLE_DETECTED' }.
// - A node is ready iff status === 'open' and all of its parents have status === 'verified'.
// - Sort readyOrdered by descending remaining critical-path minutes through the DAG (tie-break by id asc).
import { describe, expect, it } from 'vitest';
import { planReadyNodes } from '../src/dag/criticalPath.js';
describe('OSS Backlog #5: Ready-Queue DAG Critical-Path Scheduler', () => {
it('prioritizes open unblocked nodes on the longest remaining critical path', () => {
const res = planReadyNodes(
[
{ id: 'audit', status: 'verified', estimatedMinutes: 5 },
{ id: 'short_leaf', status: 'open', estimatedMinutes: 5 },
{ id: 'deep_a', status: 'open', estimatedMinutes: 10 },
{ id: 'deep_b', status: 'open', estimatedMinutes: 25 },
],
[
{ parentId: 'audit', childId: 'short_leaf' },
{ parentId: 'audit', childId: 'deep_a' },
{ parentId: 'deep_a', childId: 'deep_b' },
],
);
expect(res).toEqual({ ok: true, readyOrdered: ['deep_a', 'short_leaf'], criticalPathMinutes: 35 });
});
it('rejects cyclic DAGs deterministically', () => {
const res = planReadyNodes(
[
{ id: 'a', status: 'open', estimatedMinutes: 5 },
{ id: 'b', status: 'open', estimatedMinutes: 5 },
],
[
{ parentId: 'a', childId: 'b' },
{ parentId: 'b', childId: 'a' },
],
);
expect(res).toEqual({ ok: false, reason: 'CYCLE_DETECTED' });
});
});
Kernel-Verified Proof / Solution (spec/target_statements/oss-b05-dag-scheduler.acceptance.test.ts)
// spec/target_statements/oss-b05-dag-scheduler.acceptance.test.ts
// Frozen SpecAndTests for nd_oss_b05_dag_scheduler:
// Implement src/dag/criticalPath.ts exporting:
// planReadyNodes(
// nodes: Array<{ id: string; status: 'open' | 'verified' | 'claimed'; estimatedMinutes: number }>,
// edges: Array<{ parentId: string; childId: string }>,
// ): { ok: true; readyOrdered: string[]; criticalPathMinutes: number } | { ok: false; reason: 'CYCLE_DETECTED' }
// Requirements:
// - Detect cycles cleanly and return { ok: false, reason: 'CYCLE_DETECTED' }.
// - A node is ready iff status === 'open' and all of its parents have status === 'verified'.
// - Sort readyOrdered by descending remaining critical-path minutes through the DAG (tie-break by id asc).
import { describe, expect, it } from 'vitest';
import { planReadyNodes } from '../src/dag/criticalPath.js';
describe('OSS Backlog #5: Ready-Queue DAG Critical-Path Scheduler', () => {
it('prioritizes open unblocked nodes on the longest remaining critical path', () => {
const res = planReadyNodes(
[
{ id: 'audit', status: 'verified', estimatedMinutes: 5 },
{ id: 'short_leaf', status: 'open', estimatedMinutes: 5 },
{ id: 'deep_a', status: 'open', estimatedMinutes: 10 },
{ id: 'deep_b', status: 'open', estimatedMinutes: 25 },
],
[
{ parentId: 'audit', childId: 'short_leaf' },
{ parentId: 'audit', childId: 'deep_a' },
{ parentId: 'deep_a', childId: 'deep_b' },
],
);
expect(res).toEqual({ ok: true, readyOrdered: ['deep_a', 'short_leaf'], criticalPathMinutes: 35 });
});
it('rejects cyclic DAGs deterministically', () => {
const res = planReadyNodes(
[
{ id: 'a', status: 'open', estimatedMinutes: 5 },
{ id: 'b', status: 'open', estimatedMinutes: 5 },
],
[
{ parentId: 'a', childId: 'b' },
{ parentId: 'b', childId: 'a' },
],
);
expect(res).toEqual({ ok: false, reason: 'CYCLE_DETECTED' });
});
});
Verification Receipt
pass · score: 1
{
"gate": "owner_signoff",
"frozen_spec_sha256": "4caadad9dd2dfe8668a4f8f326feb2a32a288b852b2bcc9ef3e8f52b57293d29",
"require_precheck": false
}