Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c21bad6
test: expose absent canonical preactivation Reporter selection and du…
adrianwebb Oct 17, 2026
c9ca117
test: deny ambiguous or moved configured reporting authority before p…
adrianwebb Oct 17, 2026
8be8217
test: prove one reporting selection through original native public ad…
adrianwebb Oct 17, 2026
910feb2
fix: retain one governed reporting selection before workday activation
adrianwebb Oct 17, 2026
b9b95f3
fix: retain reporting selection through the original public Workday b…
adrianwebb Oct 17, 2026
4c39819
test: select canonical reporting admission proof in existing API scenes
adrianwebb Oct 17, 2026
d8b880f
test: deny malformed reporting selectors at the original public API b…
adrianwebb Oct 17, 2026
ef5c62e
Keep reporting admission proof within its owning test directory bound
adrianwebb Oct 17, 2026
277ac12
test: retain the original automatic reporting choice through the admi…
adrianwebb Oct 17, 2026
0f77228
fix: retain the resolved reporting choice across original admission
adrianwebb Oct 17, 2026
f724fe5
test: read the retained reporting selection before native workday act…
adrianwebb Oct 17, 2026
3f8bdac
test: require closeout eligibility independently of cooperative plann…
adrianwebb Oct 17, 2026
dd32cdc
fix: reserve configured closeout eligibility independently of coopera…
adrianwebb Oct 17, 2026
d871c48
test: retain exact planning and blocked closeout birth history with o…
adrianwebb Oct 17, 2026
bd222bb
test: select closeout eligibility and independent planning-filter pro…
adrianwebb Oct 17, 2026
af0b2bd
build: adopt the checked canonical Reporter SDK archive and exact dep…
adrianwebb Oct 17, 2026
e32f3ad
Merge checked provider-history staging into the bounded Reporter-sele…
adrianwebb Oct 17, 2026
4e3a952
test: retain the selected joint Reporter through the original public …
adrianwebb Oct 17, 2026
b4736c0
test: require exact original project ordering in retained schedule in…
adrianwebb Oct 17, 2026
41562e7
test: retain immutable births and selected closeout readiness through…
adrianwebb Oct 17, 2026
68f7676
test: bind immutable node births independently of later closeout revi…
adrianwebb Oct 17, 2026
89d6da8
test: retain complete handler inventory and governed Reporter in nati…
adrianwebb Oct 17, 2026
e537117
test: keep native governed profile construction in its existing propo…
adrianwebb Oct 17, 2026
af4e020
test: observe the owning preflight plan without inventing a stored re…
adrianwebb Oct 17, 2026
8b013c2
test: distinguish the read-only preflight projection from the existin…
adrianwebb Oct 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Build the verified native TreeDX engine
working-directory: .treeseed/tools/treedx/apps/api
run: MIX_ENV=dev mix compile
- uses: treeseed-ai/sdk/.github/actions/install-exact-sdk@952195376b53bf39742e64f320f2a3b109cc77c0
- uses: treeseed-ai/sdk/.github/actions/install-exact-sdk@53bdc4d1deeeb78ce8c54a96539f311b2ac361ae
env:
NODE_ENV: production
with:
Expand All @@ -95,7 +95,7 @@ jobs:
- name: Build public API exports before native acceptance consumer regression
run: npm run build:dist
- name: Reproduce native lease transition history before complete verification
run: node node_modules/vitest/vitest.mjs run --config ./vitest.control-plane.config.ts tests/unit/control-plane/capacity/execution/admission/postgres.test.ts tests/unit/control-plane/release/provider-prerequisites.test.ts tests/unit/control-plane/providers/assignments/lifecycle/architecture/terminal-observation-postgres.test.ts tests/unit/control-plane/capacity/execution/graph/persistence/concurrent-results-postgres.test.ts tests/unit/control-plane/providers/assignments/architecture/recovery/operator-recovery-postgres.test.ts tests/unit/control-plane/providers/assignments/architecture/recovery/recovery-observation-postgres.test.ts tests/unit/control-plane/capacity/workdays/scheduling/architecture/workday-start-native.test.ts tests/unit/control-plane/capacity/workdays/lifecycle/concurrent-runs-postgres.test.ts tests/unit/control-plane/capacity/execution/graph/architecture/workday-closeout-persistence.test.ts tests/unit/control-plane/capacity/execution/architecture/initial/admission/session-authority-unit.test.ts tests/unit/control-plane/capacity/planning/assignment-estimate-integration.test.ts tests/unit/control-plane/capacity/planning/estimate-source-native.test.ts tests/unit/control-plane/providers/assignments/architecture/cancellation-persistence.test.ts tests/unit/control-plane/capacity/execution/architecture/initial/admission/resource-closure-unit.test.ts tests/unit/control-plane/capacity/execution/architecture/monitoring/node-status-history-postgres.test.ts tests/unit/control-plane/capacity/accounting/architecture/accounting-history-postgres.test.ts tests/unit/control-plane/capacity/execution/architecture/monitoring/node-review-exhaustion-postgres.test.ts tests/unit/control-plane/capacity/workdays/scheduling/architecture/workday-node-history-native.test.ts tests/unit/control-plane/capacity/execution/admission/discussion-binding.test.ts tests/unit/control-plane/capacity/execution/architecture/admission-replay-authority.test.ts tests/unit/control-plane/capacity/execution/architecture/admission-replay-native.test.ts tests/unit/control-plane/capacity/execution/admission/timeout-postgres.test.ts tests/unit/control-plane/capacity/execution/scheduling/planning/planning-window-evidence.test.ts tests/unit/control-plane/capacity/execution/scheduling/planning/planning-phase-native.test.ts tests/unit/control-plane/capacity/execution/admission/closeout/closeout-admission.test.ts tests/unit/control-plane/capacity/workdays/lifecycle/workday-lifecycle-observations.test.ts tests/unit/control-plane/capacity/execution/reporting/report-context-scope.test.ts tests/unit/control-plane/capacity/execution/reporting/report-context-lifecycle.test.ts tests/unit/control-plane/capacity/execution/architecture/monitoring/node-status-history.test.ts tests/unit/control-plane/capacity/execution/graph/architecture/workday-observation-persistence.test.ts tests/unit/control-plane/capacity/ontology/availability-history.test.ts tests/unit/control-plane/capacity/ontology/availability-postgres.test.ts
run: node node_modules/vitest/vitest.mjs run --config ./vitest.control-plane.config.ts tests/unit/control-plane/governance/proposals/architecture/proposal-decision-native.test.ts tests/unit/control-plane/capacity/execution/admission/postgres.test.ts tests/unit/control-plane/release/provider-prerequisites.test.ts tests/unit/control-plane/providers/assignments/lifecycle/architecture/terminal-observation-postgres.test.ts tests/unit/control-plane/capacity/execution/graph/persistence/concurrent-results-postgres.test.ts tests/unit/control-plane/providers/assignments/architecture/recovery/operator-recovery-postgres.test.ts tests/unit/control-plane/providers/assignments/architecture/recovery/recovery-observation-postgres.test.ts tests/unit/control-plane/capacity/workdays/scheduling/architecture/workday-start-native.test.ts tests/unit/control-plane/capacity/workdays/lifecycle/concurrent-runs-postgres.test.ts tests/unit/control-plane/capacity/execution/graph/architecture/workday-closeout-persistence.test.ts tests/unit/control-plane/capacity/execution/architecture/initial/admission/session-authority-unit.test.ts tests/unit/control-plane/capacity/planning/assignment-estimate-integration.test.ts tests/unit/control-plane/capacity/planning/estimate-source-native.test.ts tests/unit/control-plane/providers/assignments/architecture/cancellation-persistence.test.ts tests/unit/control-plane/capacity/execution/architecture/initial/admission/resource-closure-unit.test.ts tests/unit/control-plane/capacity/execution/architecture/monitoring/node-status-history-postgres.test.ts tests/unit/control-plane/capacity/accounting/architecture/accounting-history-postgres.test.ts tests/unit/control-plane/capacity/execution/architecture/monitoring/node-review-exhaustion-postgres.test.ts tests/unit/control-plane/capacity/workdays/scheduling/architecture/workday-node-history-native.test.ts tests/unit/control-plane/capacity/execution/admission/discussion-binding.test.ts tests/unit/control-plane/capacity/execution/architecture/admission-replay-authority.test.ts tests/unit/control-plane/capacity/execution/architecture/admission-replay-native.test.ts tests/unit/control-plane/capacity/execution/admission/timeout-postgres.test.ts tests/unit/control-plane/capacity/execution/scheduling/planning/planning-window-evidence.test.ts tests/unit/control-plane/capacity/execution/scheduling/planning/planning-phase-native.test.ts tests/unit/control-plane/capacity/execution/admission/closeout/closeout-admission.test.ts tests/unit/control-plane/capacity/workdays/lifecycle/workday-lifecycle-observations.test.ts tests/unit/control-plane/capacity/execution/reporting/report-context-scope.test.ts tests/unit/control-plane/capacity/execution/reporting/report-context-lifecycle.test.ts tests/unit/control-plane/capacity/execution/architecture/monitoring/node-status-history.test.ts tests/unit/control-plane/capacity/execution/graph/architecture/workday-observation-persistence.test.ts tests/unit/control-plane/capacity/ontology/availability-history.test.ts tests/unit/control-plane/capacity/ontology/availability-postgres.test.ts
- run: npm run verify:direct
- name: Verify real PostgreSQL backup-writer migration closure
run: npx vitest run --config vitest.control-plane.config.ts tests/unit/control-plane/services/live/replication-migration-postgres.test.ts
Expand Down
24 changes: 24 additions & 0 deletions guarantees/agent/golden/scenes/component-boundaries.scene.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2858,3 +2858,27 @@ workflow:
verifier: api.golden.provider-availability-current-claim-unit
expect:
status: passed
- id: reporting-selection-plan
action: { verifier: api.golden.reporting-selection-plan }
expect: { status: passed }
- id: reporting-selection-projection
action: { verifier: api.golden.reporting-selection-projection }
expect: { status: passed }
- id: reporting-selection-denials
action: { verifier: api.golden.reporting-selection-denials }
expect: { status: passed }
- id: reporting-selection-native
action: { verifier: api.golden.reporting-selection-native }
expect: { status: passed }
- id: reporting-selection-admission-seal-native
action: { verifier: api.golden.reporting-selection-admission-seal-native }
expect: { status: passed }
- id: reporting-eligibility-required-native
action: { verifier: api.golden.reporting-eligibility-required-native }
expect: { status: passed }
- id: reporting-selection-cooperative-native
action: { verifier: api.golden.reporting-selection-cooperative-native }
expect: { status: passed }
- id: reporting-selection-cooperative-unit
action: { verifier: api.golden.reporting-selection-cooperative-unit }
expect: { status: passed }
40 changes: 40 additions & 0 deletions guarantees/verifiers/golden.verifiers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4834,3 +4834,43 @@ verifiers:
ownerPackage: "@treeseed/api"
testFile: tests/unit/control-plane/capacity/ontology/availability-history.test.ts
testName: "denies a missing current availability claim before every offer lane or seed grant mutation without changing original requests"
api.golden.reporting-selection-plan:
kind: vitestCase
ownerPackage: "@treeseed/api"
testFile: tests/unit/control-plane/capacity/execution/graph/workday-execution-projector.test.ts
testName: "retains one explicitly selected configured Reporter in the canonical applied Workday before activation without a second authority"
api.golden.reporting-selection-projection:
kind: vitestCase
ownerPackage: "@treeseed/api"
testFile: tests/unit/control-plane/capacity/execution/graph/workday-execution-projector.test.ts
testName: "projects only the selected configured closeout Reporter while preserving every participating project planning contributor"
api.golden.reporting-selection-denials:
kind: vitestCase
ownerPackage: "@treeseed/api"
testFile: tests/unit/control-plane/capacity/execution/graph/workday-execution-projector.test.ts
testName: "denies omitted ambiguous foreign duplicate and moved reporting authority without replacing the captured selection"
api.golden.reporting-selection-native:
kind: vitestCase
ownerPackage: "@treeseed/api"
testFile: tests/unit/control-plane/capacity/workdays/scheduling/architecture/reporting/reporting-selection-native.test.ts
testName: "native public preflight and start retain one configured joint Reporter before activation and preserve exact selection through denial and replay"
api.golden.reporting-selection-admission-seal-native:
kind: vitestCase
ownerPackage: "@treeseed/api"
testFile: tests/unit/control-plane/capacity/workdays/scheduling/architecture/reporting/reporting-selection-native.test.ts
testName: "native public start refuses a different automatic Reporter introduced after fresh preflight instead of silently changing the retained closeout identity"
api.golden.reporting-eligibility-required-native:
kind: vitestCase
ownerPackage: "@treeseed/api"
testFile: tests/unit/control-plane/capacity/workdays/scheduling/architecture/reporting/reporting-selection-native.test.ts
testName: "native public preflight denies a Workday with no configured closeout Reporter before any admission or receipt mutation"
api.golden.reporting-selection-cooperative-native:
kind: vitestCase
ownerPackage: "@treeseed/api"
testFile: tests/unit/control-plane/capacity/workdays/scheduling/architecture/reporting/reporting-selection-native.test.ts
testName: "native public admission selects the configured closeout Reporter independently of cooperative planning filters without creating extra planning work"
api.golden.reporting-selection-cooperative-unit:
kind: vitestCase
ownerPackage: "@treeseed/api"
testFile: tests/unit/control-plane/capacity/planning/selection.test.ts
testName: "retains one standing reporting activity beside an exact cooperative selection without changing selected planning work or admitting an empty intersection"
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"@react-email/render": "^2.0.8",
"@treeseed/deployment": "https://github.com/treeseed-ai/deployment/releases/download/0.1.0-rc.321/treeseed-deployment-runtime-0.1.0-rc.321.tgz",
"@treeseed/identity": "0.1.0-rc.19",
"@treeseed/sdk": "git+https://github.com/treeseed-ai/sdk.git#952195376b53bf39742e64f320f2a3b109cc77c0",
"@treeseed/sdk": "git+https://github.com/treeseed-ai/sdk.git#53bdc4d1deeeb78ce8c54a96539f311b2ac361ae",
"@treeseed/treedx": "0.3.0-rc.18",
"drizzle-orm": "^0.45.2",
"hono": "4.13.3",
Expand Down
24 changes: 14 additions & 10 deletions src/api/capacity/policy/execution/workday-execution-projector.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createHash } from 'node:crypto';
import { appliedWorkdaySchema, executionEdgeSchema, executionNodeSchema,
type AgentDefinition, type ExecutionEdge, type ExecutionNode, type ExactEntityReference } from '@treeseed/sdk/agent-capacity';
import { workdayParticipants, type WorkdayParticipant } from './workday-participants.ts';
import { workdayParticipants, selectWorkdayReportingAgent, type WorkdayParticipant } from './workday-participants.ts';
import { modelTurnEstimate } from './model-turn-estimate.ts';

type Row = Record<string, unknown>;
Expand Down Expand Up @@ -34,9 +34,10 @@ export interface ActiveWorkdayProjectionSource {
}

function sourceRef(workday: ReturnType<typeof appliedWorkdaySchema.parse>): ExactEntityReference {
const { schemaVersion, id, teamId, executionMode, policyId, policyRevision, policySnapshot, startsAt, endsAt } = workday;
const { schemaVersion, id, teamId, executionMode, policyId, policyRevision, policySnapshot, startsAt, endsAt, reportingAgentId } = workday;
return { store: 'postgresql', model: 'workday', id, revision: policyRevision,
digest: digest({ schemaVersion, id, teamId, executionMode, policyId, policyRevision, policySnapshot, startsAt, endsAt }) };
digest: digest({ schemaVersion, id, teamId, executionMode, policyId, policyRevision, policySnapshot, startsAt, endsAt,
...(reportingAgentId === undefined ? {} : { reportingAgentId }) }) };
}

function edge(teamId: string, fromNodeId: string, toNodeId: string, provenance: ExecutionEdge['provenance'],
Expand Down Expand Up @@ -172,13 +173,16 @@ export function projectActiveWorkdays(input: { teamId: string; revision: number;
}
}
}
for (const projectId of projectIds) {
const candidates = Object.entries(input.profiles).filter(([key, definition]) =>
key === `${projectId}:${definition.agentClass}` && definition.activityProfiles.reporting);
if (candidates.length > 1) throw new Error(`Ambiguous reporting profile selection for project ${projectId}.`);
const reporter = candidates[0]?.[1];
const reporting = reporter?.activityProfiles.reporting;
if (!reporter || !reporting) continue;
const selectedReporter = selectWorkdayReportingAgent(Object.entries(input.profiles).flatMap(([key, definition]) =>
projectIds.filter(projectId => key === `${projectId}:${definition.agentClass}`).map(projectId => ({ projectId, definition }))), workday.reportingAgentId);
if (selectedReporter) {
const { projectId, definition: reporter } = selectedReporter;
if (workday.reportingAgentId !== undefined) {
const frozen = array(record(record(source.parameters.agentProfilesByProjectId)[projectId]).agents)
.map(entry => record(entry).definition).filter(definition => text(record(definition).id) === workday.reportingAgentId);
if (frozen.length !== 1 || stable(frozen[0]) !== stable(reporter)) throw new Error('The selected reporting profile differs from its frozen Workday authority.');
}
const reporting = reporter.activityProfiles.reporting!;
const reporterId = `reporting:${workday.id}:${projectId}/${reporter.id}`;
const report = executionNodeSchema.parse({ schemaVersion: 'treeseed.execution-node/v1', id: reporterId,
teamId: input.teamId, projectId, workdayId: workday.id, kind: 'reporting', pairRole: null,
Expand Down
10 changes: 10 additions & 0 deletions src/api/capacity/policy/execution/workday-participants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createHash } from 'node:crypto';
import { CapacityGovernanceError } from '../../database.ts';
import { validateAgentDefinitionModel, type AgentDefinition } from '@treeseed/sdk/agent-capacity';

type Row = Record<string, unknown>;
Expand Down Expand Up @@ -62,3 +63,12 @@ export function workdayParticipants(parameters: Row): WorkdayParticipant[] {
}
return participants.sort((left, right) => left.id.localeCompare(right.id));
}

/** Resolve one configured closeout profile without changing planning participation. */
export function selectWorkdayReportingAgent(candidates: Array<{projectId: string; definition: AgentDefinition}>, selection?: unknown) {
const eligible=candidates.filter(candidate=>candidate.definition.activityProfiles.reporting);
const selected=selection===undefined?eligible:eligible.filter(candidate=>candidate.definition.id===selection);
if((selection!==undefined && selected.length!==1)||selected.length>1) throw new CapacityGovernanceError(
'capacity_workday_reporting_selection_invalid','Select exactly one eligible configured reporting agent from the participating projects.',409);
return selected[0] ?? null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ export function compileWorkdayAgentProfileSnapshot(agentClasses: unknown[], sele
'Workday selectors must identify eligible activity profiles exactly.', 409, { unknown });
if (!agents.length) throw new CapacityGovernanceError('capacity_workday_agent_selection_empty',
'Workday selection resolved no eligible activity profiles.', 409);
// Cooperative selectors cannot remove the standing closeout activity.
// Preserve the original empty/unknown selection denials before reserving it.
for (const entry of available) if (entry.definition.activityProfiles.reporting) {
const selected = agents.find(candidate => candidate.definition === entry.definition);
if (selected) { if (!selected.activities.includes('reporting')) selected.activities.push('reporting'); }
else agents.push({ ...entry, activities: ['reporting'] });
}
agents.sort((left, right) => left.definition.id.localeCompare(right.definition.id));
const revision = createHash('sha256').update(stable(agents)).digest('hex');
return { revision, agents };
}
Expand Down
Loading
Loading