Harden AGE self-infrastructure lifecycle

This commit is contained in:
冰朔 2026-08-14 17:03:46 +08:00
commit f1bd2f031e
3 changed files with 167 additions and 3 deletions

View file

@ -125,6 +125,8 @@ function ageSelfFixture() {
development_id: current.development_id,
task_event_id: current.task_event.task_event_id,
scope_amendment_id: "AMD-AGE-SELF-001",
source_alert_id: "GUARD-1111111111111111",
source_window_number: 8,
path: `/continuity/runtime/${current.thread_id}/PERSONA-CHECKPOINT-W8.hdlp.md`,
sha256: sha("8"),
required_sections: [
@ -226,6 +228,127 @@ test("AGE self binding receipts verify metacognition evidence but grant no reali
);
});
test("a real later compaction window refreshes classification and invalidates the prior binding", () => {
const { current, checkpointEvidence } = ageSelfFixture();
const classified = classifyAgeSelfInfrastructureLane({
lane: current,
requestedLaneKind: LANE_KIND_AGE_SELF_INFRASTRUCTURE,
taskEventId: current.task_event.task_event_id,
checkpointEvidence,
authorizationAmendmentId: "AMD-AGE-SELF-001",
classifiedAt: "2026-08-14T08:34:11.328Z",
});
classified.persona_source_binding = { binding_id: "AGE-BINDING-W8" };
const nextEvidence = {
...checkpointEvidence,
source_alert_id: "GUARD-2222222222222222",
source_window_number: 9,
path: checkpointEvidence.path.replace("W8", "W9"),
sha256: sha("9"),
};
const pointer = {
thread_id: current.thread_id,
development_id: current.development_id,
checkpoint_path: nextEvidence.path,
checkpoint_sha256: nextEvidence.sha256,
};
nextEvidence.current_runtime = {
state: "PERSONA_REVIEWED_CHECKPOINT_ACTIVE",
...pointer,
task_event_id: current.task_event.task_event_id,
};
nextEvidence.by_thread = { ...pointer };
nextEvidence.by_development = { ...pointer };
const refreshed = classifyAgeSelfInfrastructureLane({
lane: classified,
requestedLaneKind: LANE_KIND_AGE_SELF_INFRASTRUCTURE,
taskEventId: current.task_event.task_event_id,
checkpointEvidence: nextEvidence,
authorizationAmendmentId: "AMD-AGE-SELF-001",
classifiedAt: "2026-08-14T08:58:36.614Z",
});
assert.equal(refreshed.lane_kind_history.length, 2);
assert.equal(refreshed.lane_kind_history[1].previous_lane_kind, LANE_KIND_AGE_SELF_INFRASTRUCTURE);
assert.equal(refreshed.persona_source_binding, null);
assert.equal(
refreshed.persona_source_binding_history[0].state,
"STALE_SUPERSEDED_BY_NEW_PERSONA_CHECKPOINT",
);
});
test("a new task event requires a new classification and binding evidence", () => {
const { current, checkpointEvidence } = ageSelfFixture();
let classified = classifyAgeSelfInfrastructureLane({
lane: current,
requestedLaneKind: LANE_KIND_AGE_SELF_INFRASTRUCTURE,
taskEventId: current.task_event.task_event_id,
checkpointEvidence,
authorizationAmendmentId: "AMD-AGE-SELF-001",
classifiedAt: "2026-08-14T08:34:11.328Z",
});
const oldReceipt = createAgeSelfInfrastructureBindingReceipt({
lane: classified,
checkpointEvidence,
authorizationAmendmentId: "AMD-AGE-SELF-001",
createdAt: "2026-08-14T08:34:20.000Z",
});
classified.persona_source_binding = { binding_id: oldReceipt.binding_id };
const rotated = rotateTaskEvent({
lane: classified,
intent: "correction",
requestSummary: "continue with corrected scope",
openedAt: "2026-08-14T09:00:00.000Z",
});
rotated.task_lock.amendments.push({
amendment_id: "AMD-AGE-SELF-002",
kind: "correction",
summary: "Authorize the refreshed AGE self-infrastructure event.",
user_anchor: "Continue this self-infrastructure repair with the correction.",
recorded_at: "2026-08-14T09:00:01.000Z",
});
const nextEvidence = {
...checkpointEvidence,
task_event_id: rotated.task_event.task_event_id,
scope_amendment_id: "AMD-AGE-SELF-002",
source_alert_id: "GUARD-3333333333333333",
source_window_number: 10,
path: checkpointEvidence.path.replace("W8", "W10"),
sha256: sha("a"),
};
const pointer = {
thread_id: rotated.thread_id,
development_id: rotated.development_id,
checkpoint_path: nextEvidence.path,
checkpoint_sha256: nextEvidence.sha256,
};
nextEvidence.current_runtime = {
state: "PERSONA_REVIEWED_CHECKPOINT_ACTIVE",
...pointer,
task_event_id: rotated.task_event.task_event_id,
};
nextEvidence.by_thread = { ...pointer };
nextEvidence.by_development = { ...pointer };
const refreshed = classifyAgeSelfInfrastructureLane({
lane: rotated,
requestedLaneKind: LANE_KIND_AGE_SELF_INFRASTRUCTURE,
taskEventId: rotated.task_event.task_event_id,
checkpointEvidence: nextEvidence,
authorizationAmendmentId: "AMD-AGE-SELF-002",
classifiedAt: "2026-08-14T09:00:02.000Z",
});
assert.equal(refreshed.lane_kind_history.length, 2);
assert.equal(refreshed.lane_kind_history[1].task_event_id, rotated.task_event.task_event_id);
assert.equal(
createAgeSelfInfrastructureBindingReceipt({
lane: refreshed,
checkpointEvidence: nextEvidence,
authorizationAmendmentId: "AMD-AGE-SELF-002",
createdAt: "2026-08-14T09:00:03.000Z",
}).task_event_id,
rotated.task_event.task_event_id,
);
});
test("a host summary cannot substitute for the persona-authored Step Zero checkpoint", () => {
const { current, checkpointEvidence } = ageSelfFixture();
checkpointEvidence.source_kind = "HOST_SUMMARY";