mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-02 10:44:52 +01:00
test: bind blocked Stop retirement oracle to supported identity states
This commit is contained in:
1 parent
6e5349cdbd
commit
bc33f09cae
5 files changed
+213
-43
No files matched your search
@@ -50,9 +50,12 @@ export async function runtimeAuthority(input: {
|
||||
r.native_session_id, r.runner_instance_id, r.status, r.process_pid, r.process_group_id, r.process_started_at,
|
||||
r.runner_profile_json->'nativeExecutionInput'->'binding'->>'executionWorkspaceId' as admitted_execution_workspace_id,
|
||||
r.result_json->'nativeCancellation'->>'dispatchState' as cancellation_dispatch_state,
|
||||
r.result_json->'nativeCancellation' as native_cancellation,
|
||||
i.seq as process_identity_seq, i.payload as process_identity, i.source_event_id as process_identity_source_event_id,
|
||||
s.seq as process_stopped_seq, s.payload as process_stopped, s.source_event_id as process_stopped_source_event_id,
|
||||
p.seq as process_lifecycle_seq, p.event_type as process_lifecycle_event_type, p.source_event_id as process_lifecycle_source_event_id,
|
||||
l.id as lease_id, l.environment_id, l.provider, l.provider_lease_id,
|
||||
l.status as lease_status, l.cleanup_status as lease_cleanup_status, l.released_at as lease_released_at,
|
||||
c.part as checkpoint_part, octet_length(c.material::text) as checkpoint_header_bytes
|
||||
from heartbeat_runs r
|
||||
join environment_leases l on l.heartbeat_run_id = r.id and l.company_id = r.company_id
|
||||
@@ -64,6 +67,10 @@ export async function runtimeAuthority(input: {
|
||||
left join lateral (select seq, payload, source_event_id from heartbeat_run_events e where e.run_id = r.id
|
||||
and e.company_id = r.company_id and e.event_type = 'native.local_process_stopped'
|
||||
and e.source_event_id is null order by seq desc limit 1) s on true
|
||||
left join lateral (select seq, event_type, source_event_id from heartbeat_run_events e where e.run_id = r.id
|
||||
and e.company_id = r.company_id and e.event_type in ('native.process_start_requested',
|
||||
'native.process_identity_recorded', 'native.local_process_stopped')
|
||||
and e.source_event_id is null order by seq desc limit 1) p on true
|
||||
where r.company_id = ${input.companyId} and r.native_issue_id = any(${input.issueIds}::uuid[])`;
|
||||
expect(rows).toHaveLength(input.issueIds.length);
|
||||
expect(new Set(rows.map((row: any) => row.issue_id)).size).toBe(input.issueIds.length);
|
||||
|
||||
@@ -277,6 +277,74 @@ function assertOptionalShared(row, companyId, runId) {
|
||||
assert(timestamp(cancellation.recordedAt));
|
||||
}
|
||||
}
|
||||
// Mirrors acknowledgedNativeStopExecutionHasStopped's two local identity states;
|
||||
// independent PID/group absence is mandatory in either state, never inferred from ACK.
|
||||
export function assertAuthoritativeRetirement(e) {
|
||||
const before = e.authorityBefore?.rows?.[0], after = e.authorityAfter?.rows?.[0];
|
||||
for (const row of [before, after]) {
|
||||
assert.equal(row?.company_id, e.companyId); assert.equal(row?.run_id, e.runId);
|
||||
assert.equal(row.issue_id, e.issueId); assert.equal(row.runtime_mode, 'native');
|
||||
}
|
||||
assert.equal(after.status, 'cancelled'); assert.equal(after.cancellation_dispatch_state, 'acknowledged');
|
||||
assertIntentAudit(e.ack); assert.equal(e.ack.intent.dispatchState, 'acknowledged');
|
||||
assert.equal(e.ack.company_id, e.companyId); assert.equal(e.ack.run_id, e.runId); assert.equal(e.ack.issue_id, e.issueId);
|
||||
assert.deepEqual(after.native_cancellation, e.ack.intent, 'Snapshot must contain the same audited own ACK');
|
||||
assert.deepEqual([e.processesAfter?.runnerAbsent, e.processesAfter?.groupAbsent,
|
||||
e.processesAfter?.providerAbsent, e.processesAfter?.providerGroupAbsent], [true,true,true,true]);
|
||||
assert.equal(e.processesAfter.group, e.processesBefore.group);
|
||||
assert.equal(e.processesAfter.providerGroup, e.processesBefore.providerGroup);
|
||||
for (const process of [e.processesBefore.runner, e.processesBefore.provider]) {
|
||||
assert(Number.isSafeInteger(process.pid) && process.pid > 1 && process.birth);
|
||||
assert(Number.isSafeInteger(process.group) && process.group > 1);
|
||||
}
|
||||
assert.equal(e.processesBefore.runner.group, e.processesBefore.group);
|
||||
assert.equal(e.processesBefore.group, before.process_group_id);
|
||||
assert.equal(e.processesBefore.runner.pid, before.process_pid);
|
||||
assert.equal(e.processesBefore.provider.group, e.processesBefore.providerGroup);
|
||||
const birth = value => {
|
||||
if (value === null) return null;
|
||||
assert(value instanceof Date || typeof value === 'string');
|
||||
assert(Number.isFinite(new Date(value).getTime())); return new Date(value).toISOString();
|
||||
};
|
||||
const sequence = value => { assert(/^[1-9]\d*$/.test(String(value))); return BigInt(value); };
|
||||
const originalBirth = birth(before.process_started_at), identitySeq = sequence(before.process_identity_seq);
|
||||
assert(originalBirth !== null, 'Missing captured authoritative original process birth');
|
||||
assert.equal(before.process_identity_source_event_id, null);
|
||||
assert.equal(before.process_identity?.targetKind, 'local'); assert(before.process_identity.hostname);
|
||||
assert.equal(before.process_identity.processPid, before.process_pid);
|
||||
assert.equal(before.process_identity.processGroupId, before.process_group_id);
|
||||
assert.equal(before.process_identity.processStartedAt, originalBirth);
|
||||
assert.equal(after.process_identity_source_event_id, null);
|
||||
assert.equal(sequence(after.process_identity_seq), identitySeq, 'A later identity is a different launch');
|
||||
assert.deepEqual(after.process_identity, before.process_identity);
|
||||
assert.equal(e.lease?.heartbeatRunId, e.runId); assert.equal(e.lease.companyId, e.companyId);
|
||||
assert.equal(e.lease.id, before.lease_id); assert(before.lease_id);
|
||||
assert.equal(after.lease_id, before.lease_id); assert.equal(after.environment_id, before.environment_id);
|
||||
assert.equal(e.lease.provider, 'local'); assert.equal(e.lease.providerLeaseId, null);
|
||||
assert.equal(after.provider, 'local'); assert.equal(after.provider_lease_id, null);
|
||||
for (const lease of [e.lease, { releasedAt: after.lease_released_at, status: after.lease_status, cleanupStatus: after.lease_cleanup_status }]) {
|
||||
assert(lease.releasedAt && ['released','expired','failed'].includes(lease.status)); assert.notEqual(lease.cleanupStatus, 'failed');
|
||||
}
|
||||
const cleared = after.process_pid === null && after.process_group_id === null;
|
||||
if (cleared) assert.equal(after.process_started_at, null);
|
||||
else {
|
||||
assert.equal(after.process_pid, before.process_pid); assert.equal(after.process_group_id, before.process_group_id);
|
||||
assert.equal(birth(after.process_started_at), originalBirth);
|
||||
}
|
||||
const noReceipt = [after.process_stopped_seq, after.process_stopped, after.process_stopped_source_event_id].every(value => value === null);
|
||||
if (noReceipt) assert.equal(cleared, false, 'Cleared identity requires authoritative retirement evidence');
|
||||
else {
|
||||
assert(sequence(after.process_stopped_seq) > sequence(after.process_identity_seq));
|
||||
assert.equal(after.process_stopped_source_event_id, null);
|
||||
assert.deepEqual(after.process_stopped, { processPid: before.process_pid, processGroupId: before.process_group_id,
|
||||
processStartedAt: originalBirth });
|
||||
}
|
||||
assert.equal(after.process_lifecycle_source_event_id, null);
|
||||
assert.equal(after.process_lifecycle_event_type, noReceipt ? 'native.process_identity_recorded' : 'native.local_process_stopped');
|
||||
assert.equal(sequence(after.process_lifecycle_seq), noReceipt ? identitySeq : sequence(after.process_stopped_seq),
|
||||
'A later process start or identity invalidates prior retirement evidence');
|
||||
return cleared ? 'cleared-identity-with-authoritative-retirement' : 'retained-identity-after-physical-exit';
|
||||
}
|
||||
export function assertFunctional(e) {
|
||||
metrics(e); observerBrackets(e);
|
||||
assert.equal(e.prelude?.individualDeltas, WORKLOAD.prelude); assert.equal(e.prelude?.uniqueIdentities, WORKLOAD.prelude);
|
||||
@@ -302,28 +370,8 @@ export function assertFunctional(e) {
|
||||
}
|
||||
assert.equal(e.ack.company_id, e.companyId); assert.equal(e.ack.run_id, e.runId); assert.equal(e.ack.issue_id, e.issueId);
|
||||
assert.equal(e.stopHttpStatus, 200);
|
||||
assert.deepEqual([e.processesAfter?.runnerAbsent, e.processesAfter?.groupAbsent, e.processesAfter?.providerAbsent, e.processesAfter?.providerGroupAbsent], [true,true,true,true]);
|
||||
assert.equal(e.processesAfter.group, e.processesBefore.group);
|
||||
assert.equal(e.processesAfter.providerGroup, e.processesBefore.providerGroup);
|
||||
assert(e.timing.httpSettledAtMs >= e.timing.releaseRequestedAtMs);
|
||||
const before = e.authorityBefore?.rows?.[0], after = e.authorityAfter?.rows?.[0];
|
||||
for (const row of [before, after]) { assert.equal(row?.company_id, e.companyId); assert.equal(row?.run_id, e.runId); assert.equal(row.runtime_mode, 'native'); }
|
||||
assert.equal(after.status, 'cancelled'); assert.equal(after.cancellation_dispatch_state, 'acknowledged');
|
||||
assert(BigInt(after.process_stopped_seq) > BigInt(before.process_identity_seq));
|
||||
assert.equal(after.process_stopped_source_event_id, null);
|
||||
assert.equal(after.process_stopped.processPid, e.processesBefore.runner.pid);
|
||||
assert.equal(after.process_stopped.processGroupId, e.processesBefore.group);
|
||||
for (const process of [e.processesBefore.runner, e.processesBefore.provider]) {
|
||||
assert(Number.isSafeInteger(process.pid) && process.pid > 1 && process.birth);
|
||||
assert(Number.isSafeInteger(process.group) && process.group > 1);
|
||||
}
|
||||
assert.equal(e.processesBefore.runner.group, e.processesBefore.group);
|
||||
assert.equal(e.processesBefore.group, before.process_group_id);
|
||||
assert.equal(e.processesBefore.runner.pid, before.process_pid);
|
||||
assert.equal(e.processesBefore.provider.group, e.processesBefore.providerGroup);
|
||||
assert.equal(e.lease?.heartbeatRunId, e.runId); assert.equal(e.lease.companyId, e.companyId);
|
||||
assert.equal(e.lease.provider, 'local'); assert.equal(e.lease.providerLeaseId, null);
|
||||
assert(e.lease.releasedAt && ['released','expired','failed'].includes(e.lease.status)); assert.notEqual(e.lease.cleanupStatus, 'failed');
|
||||
assert.equal(e.authoritativeRetirementState, assertAuthoritativeRetirement(e));
|
||||
const transcript = e.transcript;
|
||||
assert.equal(transcript?.persistedAfterReload, true); assert.equal(transcript?.ordered, true);
|
||||
assert.equal(transcript.resultAcceptedEvents, 0); assert.equal(transcript.preludeCount, WORKLOAD.prelude);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { PROTOCOL, WORKLOAD as W, WORKLOAD_SHA256, METRICS, isAppendLockQuery, assertHeldSample,
|
||||
assertIntentAudit, metrics, registration, noiseEnvelope, comparePairs, assertFunctional, observerBrackets, assertNoiseEnvelope, PRECISION_RULE, cleanupCancellationEligible, cleanupOwnedRunBeforeClockClose } from './native-ingestion-blocked-stop-protocol.mjs';
|
||||
assertIntentAudit, metrics, registration, noiseEnvelope, comparePairs, assertFunctional, assertAuthoritativeRetirement, observerBrackets, assertNoiseEnvelope, PRECISION_RULE, cleanupCancellationEligible, cleanupOwnedRunBeforeClockClose } from './native-ingestion-blocked-stop-protocol.mjs';
|
||||
const evidence = (shift = 0) => ({ protocol: PROTOCOL, workloadSha256: WORKLOAD_SHA256, complete: true, cleanup: { complete: true },
|
||||
timing: { actionAtMs: 1000, requestAtMs: 1005, releaseRequestedAtMs: 2005, releaseCommitAckAtMs: 2007,
|
||||
absenceObservedAtMs: 2030 + shift, ackObservedAtMs: 2040 + shift } });
|
||||
@@ -57,7 +57,10 @@ test('registered companion is 50 separate alternating arms with fresh B0 and B1
|
||||
});
|
||||
|
||||
const functional = () => {
|
||||
const e = evidence(), identity = { company_id: 'c', run_id: 'r', runtime_mode: 'native', process_pid: 10, process_group_id: 10 };
|
||||
const e = evidence(), identity = { company_id: 'c', run_id: 'r', issue_id: 'i', runtime_mode: 'native', process_pid: 10, process_group_id: 10,
|
||||
process_started_at: '2026-11-04T00:00:00.000Z', process_identity_seq: '1', process_identity_source_event_id: null,
|
||||
process_identity: { targetKind: 'local', hostname: 'fixture-host', processPid: 10, processGroupId: 10, processStartedAt: '2026-11-04T00:00:00.000Z' },
|
||||
lease_id: 'lease', environment_id: 'environment', provider: 'local', provider_lease_id: null };
|
||||
return { ...e, variant: 'b0', startedAtMs: 100, finishedAtMs: 3000, companyId: 'c', runId: 'r', issueId: 'i', epochMs: 900,
|
||||
prelude: { individualDeltas: 1000, uniqueIdentities: 1000, verifiedBeforeEpochAtMs: 850 },
|
||||
visibleBeforeLock: [0,1,2], lock: { id: 'r', company_id: 'c', holder_pid: 88 },
|
||||
@@ -69,10 +72,14 @@ const functional = () => {
|
||||
{ kind: 'ack-query', startedAtMs: 2039, completedAtMs: 2040, durationMs: 1, value: true },
|
||||
{ kind: 'process-check', startedAtMs: 2025, completedAtMs: 2026, durationMs: 1, value: false },
|
||||
{ kind: 'process-check', startedAtMs: 2029, completedAtMs: 2030, durationMs: 1, value: true }], processesBefore: processes(), processesAfter: { runnerAbsent: true, groupAbsent: true, providerAbsent: true, providerGroupAbsent: true, group: 10, providerGroup: 11 },
|
||||
authorityBefore: { rows: [{ ...identity, process_identity_seq: '1' }] },
|
||||
authorityAfter: { rows: [{ ...identity, status: 'cancelled', cancellation_dispatch_state: 'acknowledged', process_stopped_seq: '20',
|
||||
process_stopped_source_event_id: null, process_stopped: { processPid: 10, processGroupId: 10 } }] },
|
||||
lease: { heartbeatRunId: 'r', companyId: 'c', provider: 'local', providerLeaseId: null, releasedAt: 'time', status: 'released', cleanupStatus: 'success' },
|
||||
authorityBefore: { rows: [{ ...identity }] },
|
||||
authorityAfter: { rows: [{ ...structuredClone(identity), status: 'cancelled', cancellation_dispatch_state: 'acknowledged', native_cancellation: intentRow().intent,
|
||||
process_pid: null, process_group_id: null, process_started_at: null, process_stopped_seq: '20',
|
||||
process_stopped_source_event_id: null, process_stopped: { processPid: 10, processGroupId: 10, processStartedAt: identity.process_started_at },
|
||||
process_lifecycle_seq: '20', process_lifecycle_event_type: 'native.local_process_stopped', process_lifecycle_source_event_id: null,
|
||||
lease_status: 'released', lease_cleanup_status: 'success', lease_released_at: 'time' }] },
|
||||
authoritativeRetirementState: 'cleared-identity-with-authoritative-retirement',
|
||||
lease: { id: 'lease', heartbeatRunId: 'r', companyId: 'c', provider: 'local', providerLeaseId: null, releasedAt: 'time', status: 'released', cleanupStatus: 'success' },
|
||||
transcript: { individualDeltas: 3, uniqueSourceIdentities: 3, persistedAfterReload: true, ordered: true, resultAcceptedEvents: 0,
|
||||
preludeCount: 1000, seen: [{ index: 0 },{ index: 1 },{ index: 2 }], deltas: [0,1,2].map(index => ({ runId: 'r', eventType: 'item.delta',
|
||||
sourceInstanceId: 'source', sourceEventId: `id${index}`, sourceSeq: index+1, payload: { text: `[00${index}] ` } })) },
|
||||
@@ -90,6 +97,78 @@ test('functional oracle accepts complete correlated proof and rejects plausible
|
||||
for (const mutate of mutations) { const e = functional(); mutate(e); assert.throws(() => assertFunctional(e)); }
|
||||
});
|
||||
|
||||
const retained = (e = functional(), receipt = false) => {
|
||||
const before = e.authorityBefore.rows[0], after = e.authorityAfter.rows[0];
|
||||
Object.assign(after, { process_pid: before.process_pid, process_group_id: before.process_group_id, process_started_at: before.process_started_at });
|
||||
if (!receipt) Object.assign(after, { process_stopped_seq: null, process_stopped: null, process_stopped_source_event_id: null,
|
||||
process_lifecycle_seq: before.process_identity_seq, process_lifecycle_event_type: 'native.process_identity_recorded' });
|
||||
e.authoritativeRetirementState = 'retained-identity-after-physical-exit'; return e;
|
||||
};
|
||||
test('retained original identity with NULL retirement receipt passes only with independent exit, own ACK and released lease', () => {
|
||||
const e = retained();
|
||||
assert.equal(assertAuthoritativeRetirement(e), 'retained-identity-after-physical-exit'); assertFunctional(e);
|
||||
assert.equal(e.authorityAfter.rows[0].process_stopped, null);
|
||||
});
|
||||
test('cleared identity requires bound server retirement; a bound optional receipt also validates for retained identity', () => {
|
||||
const cleared = functional(); assert.equal(assertAuthoritativeRetirement(cleared), 'cleared-identity-with-authoritative-retirement');
|
||||
assertFunctional(cleared); assertFunctional(retained(functional(), true));
|
||||
});
|
||||
test('both states require valid captured authoritative original birth, including before JSON serialization', () => {
|
||||
for (const factory of [functional, retained]) {
|
||||
const valid = factory(), before = valid.authorityBefore.rows[0], after = valid.authorityAfter.rows[0];
|
||||
before.process_started_at = new Date(before.process_started_at);
|
||||
if (after.process_started_at !== null) after.process_started_at = new Date(after.process_started_at);
|
||||
assertFunctional(valid); assertFunctional(JSON.parse(JSON.stringify(valid)));
|
||||
for (const mutate of [e => {
|
||||
const original = e.authorityBefore.rows[0], current = e.authorityAfter.rows[0];
|
||||
original.process_started_at = null; original.process_identity.processStartedAt = null;
|
||||
current.process_identity.processStartedAt = null; current.process_started_at = null;
|
||||
if (current.process_stopped) current.process_stopped.processStartedAt = null;
|
||||
}, e => { delete e.authorityBefore.rows[0].process_started_at; },
|
||||
e => { e.authorityBefore.rows[0].process_started_at = 'not-a-birth'; e.authorityBefore.rows[0].process_identity.processStartedAt = 'not-a-birth'; }]) {
|
||||
const invalid = factory(); mutate(invalid);
|
||||
assert.throws(() => assertFunctional(invalid));
|
||||
}
|
||||
}
|
||||
});
|
||||
test('cleared identity rejects absent, unbound, partial or later-invalidated retirement evidence', () => {
|
||||
const mutations = [
|
||||
row => { row.process_stopped_seq = null; row.process_stopped = null; },
|
||||
row => { row.process_stopped_seq = null; }, row => { row.process_stopped_source_event_id = 'provider-event'; },
|
||||
row => { row.process_stopped.processPid = 99; }, row => { row.process_stopped.processGroupId = 99; },
|
||||
row => { row.process_stopped.processStartedAt = '2026-11-04T00:00:01.000Z'; }, row => { delete row.process_stopped.processStartedAt; },
|
||||
row => { row.process_stopped_seq = '1'; }, row => { row.process_started_at = '2026-11-04T00:00:00.000Z'; },
|
||||
row => { row.process_lifecycle_seq = '21'; row.process_lifecycle_event_type = 'native.process_start_requested'; },
|
||||
row => { row.process_identity_seq = '21'; }, row => { row.process_lifecycle_seq = '21'; },
|
||||
row => { row.process_lifecycle_source_event_id = 'provider-event'; }];
|
||||
for (const mutate of mutations) { const e = functional(); mutate(e.authorityAfter.rows[0]); assert.throws(() => assertAuthoritativeRetirement(e)); }
|
||||
});
|
||||
test('retained identity rejects changed PID, group, birth, server identity or later launch and verifies optional receipts', () => {
|
||||
const mutations = [row => { row.process_pid = null; }, row => { row.process_group_id = null; },
|
||||
row => { row.process_pid = 99; }, row => { row.process_group_id = 99; },
|
||||
row => { row.process_started_at = '2026-11-04T00:00:01.000Z'; }, row => { row.process_started_at = null; },
|
||||
row => { row.process_identity.processStartedAt = 'other'; }, row => { row.process_identity_seq = '2'; },
|
||||
row => { row.process_lifecycle_seq = '2'; row.process_lifecycle_event_type = 'native.process_start_requested'; },
|
||||
row => { row.process_identity_source_event_id = 'provider-event'; }, row => { delete row.process_stopped; }];
|
||||
for (const mutate of mutations) { const e = retained(); mutate(e.authorityAfter.rows[0]); assert.throws(() => assertAuthoritativeRetirement(e)); }
|
||||
const optional = retained(functional(), true); optional.authorityAfter.rows[0].process_stopped.processPid = 99;
|
||||
assert.throws(() => assertAuthoritativeRetirement(optional));
|
||||
});
|
||||
test('neither retirement state bypasses physical process/group absence, own audited ACK or exact lease cleanup', () => {
|
||||
const mutations = [e => { delete e.processesAfter.providerGroupAbsent; }, e => { e.processesAfter.groupAbsent = false; },
|
||||
e => { e.processesAfter.runnerAbsent = false; }, e => { e.processesAfter.providerAbsent = false; },
|
||||
e => { e.authorityAfter.rows[0].native_cancellation.intentId = 'other'; }, e => { e.ack.audits.pop(); },
|
||||
e => { e.authorityAfter.rows[0].status = 'failed'; }, e => { e.lease.id = 'other'; },
|
||||
e => { e.authorityAfter.rows[0].lease_id = 'other'; }, e => { e.lease.releasedAt = null; },
|
||||
e => { e.authorityAfter.rows[0].lease_released_at = null; }, e => { e.authorityAfter.rows[0].lease_cleanup_status = 'failed'; },
|
||||
e => { e.authorityAfter.rows[0].provider = 'remote'; }];
|
||||
for (const factory of [functional, retained]) for (const mutate of mutations) {
|
||||
const e = factory(); mutate(e); assert.throws(() => assertAuthoritativeRetirement(e));
|
||||
}
|
||||
const forged = retained(); forged.authoritativeRetirementState = 'cleared-identity-with-authoritative-retirement';
|
||||
assert.throws(() => assertFunctional(forged));
|
||||
});
|
||||
|
||||
test('shared decision is correlated when present and absent run-only decisions stay valid', () => {
|
||||
const row = intentRow(); assertIntentAudit(row);
|
||||
row.intent.decisionId = 'decision'; row.audits[1].details.decisionId = 'decision';
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Existing-history blocked Stop companion (prospective instrumentation v2)
|
||||
# Existing-history blocked Stop companion (prospective instrumentation v3)
|
||||
|
||||
Status: v2 local source and pure oracle calibration only. No v2 application, browser,
|
||||
Status: v3 local source and pure oracle calibration only. No v3 application, browser,
|
||||
PostgreSQL, VM or quantitative arm has run. No runtime qualification or performance
|
||||
claim follows from the pure tests. Execution needs lead release after independent
|
||||
source review. This is separate from the immutable H5c 50-arm campaign.
|
||||
|
||||
## Preserved v1 qualification failure and v2 correction
|
||||
## Preserved v1/v2 qualification failures and prospective corrections
|
||||
|
||||
The one v1 qualification at `200396d5` failed before the emission epoch because
|
||||
the probe assumed the provider shared the Runner process group. Actual Runner
|
||||
@@ -30,6 +30,46 @@ to a passed functional oracle; exact owned cleanup after a failed qualification
|
||||
is separate negative evidence. New source review and runtime qualification are
|
||||
required. Protocol name, workload, precision rule and all deadlines are unchanged.
|
||||
|
||||
The one v2 qualification at `6e5349cd` reached acknowledged native cancellation,
|
||||
cancelled settlement and independently observed Runner/provider PID and group
|
||||
absence. It then failed the probe's unconditional requirement for an immediate
|
||||
`native.local_process_stopped` event: the row still retained original PID/group
|
||||
2286265, its latest server identity sequence was 19, and the stop receipt was NULL.
|
||||
Transcript, reload and the later lease gate were not reached. That requirement
|
||||
exceeded the supported product contract. The failed trial and
|
||||
its observed timings remain negative evidence, cannot supply a v3 timing arm or
|
||||
noise sample, and are not reclassified as a qualified measurement.
|
||||
|
||||
V3 reads final authority after the existing lease-release poll in one existing
|
||||
READ ONLY REPEATABLE READ snapshot, including the native cancellation intent,
|
||||
lease cleanup and latest server-authored process lifecycle fence. It adds no
|
||||
poll, wait budget or timing shift: ACK and physical-absence observations retain
|
||||
their original boundaries. `assertAuthoritativeRetirement` records either
|
||||
`retained-identity-after-physical-exit` or
|
||||
`cleared-identity-with-authoritative-retirement`. Both require cancelled state,
|
||||
the same own audited ACK, the original owned local lease released without failed
|
||||
cleanup, and independently observed absence of both exact PIDs and both groups.
|
||||
Retained mutable PID/group/birth and latest server identity must exactly match
|
||||
the captured original identity. An absent retirement receipt is valid only in
|
||||
that retained state. If a receipt is present, it must still bind to the original
|
||||
PID/group/birth. Cleared mutable identity requires that bound server-authored
|
||||
retirement receipt, later than the latest identity, with no later process start
|
||||
or identity event. Partial, changed or relaunched identity is rejected.
|
||||
|
||||
The authoritative product basis is
|
||||
`server/src/services/acknowledged-native-stop.ts`,
|
||||
`acknowledgedNativeStopExecutionHasStopped`: after local lease cleanup, retained
|
||||
PID/group use the host's ESRCH observations; cleared fields require
|
||||
`hasNativeLocalProcessStop`. In `native-local-process-stop.ts`,
|
||||
`recordNativeLocalProcessStop` records the original PID/group/birth before identity
|
||||
clearing, while `hasNativeLocalProcessStop` rejects a later server start/identity.
|
||||
`releaseSettledNativeRunProcess` separately gates retirement on coordinator,
|
||||
provider and lease state. Native cancellation ACK persistence in
|
||||
`native-session-executor.ts` does not itself retire process identity. The event is
|
||||
authoritative identity-clearing evidence, not a universal immediate Stop receipt
|
||||
or a substitute for physical process observation. This is a probe correction;
|
||||
it includes no product change or attribution of a product defect.
|
||||
|
||||
## Registration and ownership
|
||||
|
||||
Explicit config: `tests/e2e/playwright-native-ingestion-blocked-stop.config.ts`.
|
||||
@@ -77,10 +117,11 @@ Release records both COMMIT request and COMMIT response acknowledgement. Neither
|
||||
is claimed to be the exact PostgreSQL commit instant. Independent observations
|
||||
then require the cancellation intent and its own matching committed audit,
|
||||
native acknowledged dispatch and its own matching acknowledgement audit,
|
||||
normal cancelled settlement, successful Stop HTTP, server-authored
|
||||
`native.local_process_stopped` receipt for the exact prior PID/group, independently
|
||||
absent runner/group/provider/provider-group, and the exact owned local lease released without
|
||||
failed cleanup. Transcript checks require complete compact payloads, unique source
|
||||
normal cancelled settlement, successful Stop HTTP, independently absent
|
||||
runner/group/provider/provider-group, and the exact owned local lease released
|
||||
without failed cleanup. The coherent final snapshot must meet the retained or
|
||||
cleared identity contract above; cleared fields require the bound server-authored
|
||||
`native.local_process_stopped` retirement receipt. Transcript checks require complete compact payloads, unique source
|
||||
identities, ordered canonical prefix, original emission clocks, zero accepted
|
||||
results, and persistence after reload. The raw transport recovery policy stays
|
||||
unchanged: raw fixture emissions after the canonical prefix are not represented
|
||||
|
||||
@@ -7,7 +7,7 @@ import { json } from "./agent-chat.shared";
|
||||
import { runtimeAuthority, processAbsent } from "./fixtures/native-ingestion-blocked-stop-authority";
|
||||
import { openClock } from "./fixtures/native-ingestion-blocked-stop-clock";
|
||||
import { ownedDatabase, cancellationSnapshot, blockers } from "./fixtures/native-ingestion-blocked-stop-db";
|
||||
import { PROTOCOL, WORKLOAD as W, WORKLOAD_SHA256, assertHeldSample, assertIntentAudit, isAppendLockQuery, metrics, assertFunctional, cleanupOwnedRunBeforeClockClose }
|
||||
import { PROTOCOL, WORKLOAD as W, WORKLOAD_SHA256, assertHeldSample, assertIntentAudit, isAppendLockQuery, metrics, assertFunctional, assertAuthoritativeRetirement, cleanupOwnedRunBeforeClockClose }
|
||||
from "./fixtures/native-ingestion-blocked-stop-protocol.mjs";
|
||||
import { observeRunSettlement } from "./fixtures/native-ingestion-h5.mjs";
|
||||
|
||||
@@ -241,14 +241,6 @@ test("existing-history Stop preserves its durable barrier behind a real blocked
|
||||
await expect.poll(() => stopSettled, { timeout: W.acknowledgementAfterSettlementMs,
|
||||
intervals: [W.pollIntervalMs] }).toBe(true);
|
||||
const response = await stopRequest.response(); expect(response?.ok()).toBe(true); report.stopHttpStatus = response!.status();
|
||||
report.authorityAfter = await runtimeAuthority({ appRoot, companyId: company.id, environmentId: environment.id,
|
||||
issueIds: [issue.id], transport: "local", afterStop: true });
|
||||
const stopped = report.authorityAfter.rows[0];
|
||||
expect(stopped.status).toBe("cancelled"); expect(stopped.cancellation_dispatch_state).toBe("acknowledged");
|
||||
expect(BigInt(stopped.process_stopped_seq)).toBeGreaterThan(BigInt(row.process_identity_seq));
|
||||
expect(stopped.process_stopped_source_event_id).toBeNull();
|
||||
expect(stopped.process_stopped.processPid).toBe(processes.runner.pid);
|
||||
expect(stopped.process_stopped.processGroupId).toBe(processes.group);
|
||||
let lease: any;
|
||||
await expect.poll(async () => {
|
||||
lease = (await json(await request.get(`/api/environments/${environment.id}/leases`)))
|
||||
@@ -257,6 +249,9 @@ test("existing-history Stop preserves its durable barrier behind a real blocked
|
||||
}, { timeout: W.leaseAfterSettlementMs }).toBe(true);
|
||||
expect(lease.provider).toBe("local"); expect(lease.providerLeaseId).toBeNull();
|
||||
report.lease = lease;
|
||||
report.authorityAfter = await runtimeAuthority({ appRoot, companyId: company.id, environmentId: environment.id,
|
||||
issueIds: [issue.id], transport: "local", afterStop: true });
|
||||
report.authoritativeRetirementState = assertAuthoritativeRetirement(report);
|
||||
const seen = await visible(), events = await readEvents();
|
||||
const deltas = events.map(event => event.payload?.prpEvent).filter(event => event?.eventType === "item.delta"
|
||||
&& String(event.payload?.text).startsWith(`[${code}`));
|
||||
|
||||
Reference in new issue
Block a user