Skip to content
Draft
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
710f54d
test(integration): add status load authority generator
seonghobae Sep 8, 2026
ab1c5ba
test(integration): add real status k6 contract
seonghobae Sep 8, 2026
ff2c56d
test(integration): seed durable status performance fixture
seonghobae Sep 8, 2026
e252d94
test(integration): verify delivery status p95 on PostgreSQL
seonghobae Sep 8, 2026
f7802a8
test(integration): verify status with current k6 stable
seonghobae Sep 8, 2026
0f6562b
fix(integration): honor verified TLS in status benchmark
seonghobae Sep 9, 2026
388d78b
perf(integration): make replay consume one round trip
seonghobae Sep 9, 2026
295332d
perf(integration): collapse replay consume round trip
seonghobae Sep 9, 2026
e05637a
test(integration): cover single-call replay consume
seonghobae Sep 9, 2026
19489da
test(integration): gate replay hot-path repair
seonghobae Sep 9, 2026
6adfd90
chore(integration): expose canonical formatter delta
seonghobae Sep 9, 2026
fd494cd
style(integration): apply canonical replay formatting
seonghobae Sep 9, 2026
547ea77
style(integration): format status authority generator
seonghobae Sep 9, 2026
850d007
style(integration): format delivery status k6
seonghobae Sep 9, 2026
1053da2
test(integration): prove replay consume concurrency in PostgreSQL
seonghobae Sep 9, 2026
a194204
test(integration): verify replay repair and status p95
seonghobae Sep 9, 2026
b15b0dc
style(integration): format replay PostgreSQL acceptance
seonghobae Sep 9, 2026
5c0a8e2
test(integration): expose canonical replay acceptance format
seonghobae Sep 9, 2026
cfb3f5a
style(integration): apply canonical replay acceptance format
seonghobae Sep 9, 2026
9452931
test(integration): restore final status p95 verifier
seonghobae Sep 9, 2026
f4ddeee
test(integration): use dedicated replay acceptance database
seonghobae Sep 9, 2026
a24862e
test(integration): separate runtime and harness database authority
seonghobae Sep 9, 2026
a81c8f2
test(integration): retire completed status p95 verifier
seonghobae Sep 9, 2026
e1e22e3
test(integration): reject mutable replay SQL evidence
seonghobae Sep 16, 2026
b9c4594
ci(integration): verify replay SQL evidence snapshot
seonghobae Sep 16, 2026
b563f70
fix(integration): snapshot replay SQL evidence
seonghobae Sep 16, 2026
8b19326
test(integration): reject hostile replay SQL access
seonghobae Sep 16, 2026
c8282a9
fix(integration): bound hostile replay SQL evidence
seonghobae Sep 16, 2026
8f540c5
test(integration): reject hostile replay request evidence
seonghobae Sep 16, 2026
a200c24
fix(integration): bound replay request evidence access
seonghobae Sep 16, 2026
003dfd0
test(integration): reject expired replay evidence
seonghobae Sep 16, 2026
214e273
fix(integration): reject expired replay evidence in database
seonghobae Sep 16, 2026
f15c094
fix(integration): exclusively create k6 authority bundle
seonghobae Sep 16, 2026
4fc85bf
test(integration): require exact status evidence keys
seonghobae Sep 16, 2026
bab0e71
test(integration): require TLS for signed k6 authority
seonghobae Sep 16, 2026
c0eee74
test(integration): restore TLS k6 current-head acceptance
seonghobae Sep 16, 2026
8020d0f
test(ci): avoid unsupported SQL prettier check
seonghobae Sep 16, 2026
3806f4a
fix(ci): focus replay verifier and build sdk dependency
seonghobae Sep 16, 2026
5c6e051
fix(perf): keep scenario controls out of reserved k6 env
seonghobae Sep 16, 2026
e3da325
fix(perf): align authority fixture with custom controls
seonghobae Sep 16, 2026
ad75adc
fix(perf): remove k6 option env collision
seonghobae Sep 16, 2026
bb1c864
test(perf): profile delivery status latency stages
seonghobae Sep 16, 2026
50ed920
test(perf): retain post-failure latency profile
seonghobae Sep 16, 2026
dc35367
test(perf): isolate server latency profile
seonghobae Sep 16, 2026
448f35b
test(perf): align direct profile with k6 request timing
seonghobae Sep 16, 2026
a149cc8
style(perf): restore canonical profiler formatting
seonghobae Sep 16, 2026
4794e34
style(perf): finish canonical profiler formatting
seonghobae Sep 17, 2026
4fd46c8
style(perf): wrap profiler context secret
seonghobae Sep 17, 2026
26f6cad
ci(perf): expose exact profiler formatting delta
seonghobae Sep 17, 2026
86ace33
style(perf): apply profiler formatting
seonghobae Sep 17, 2026
fc44d0d
ci(perf): retire profiler formatter diagnostic
seonghobae Sep 17, 2026
cf8361b
ci(perf): retire replay verifier after exact green
seonghobae Sep 17, 2026
840c9c2
ci(perf): retire k6 verifier after exact green
seonghobae Sep 17, 2026
a12888b
ci(perf): restore k6 verifier after failed exact head
seonghobae Sep 19, 2026
9ce9f89
chore(perf): retire exact-green k6 verifier
seonghobae Sep 19, 2026
a5de82b
ci(perf): require replicated exact-head p95 evidence
seonghobae Sep 19, 2026
24d8079
ci(perf): retain replicated p95 evidence
seonghobae Sep 19, 2026
7967976
ci(perf): retire proven delivery-status verifier
seonghobae Sep 19, 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
CREATE OR REPLACE FUNCTION plugin_integration.consume_plugin_operator_context_replay(
p_evidence_id uuid,
p_consumed_at timestamptz,
p_expires_at timestamptz
)
RETURNS boolean
LANGUAGE plpgsql
AS $$
DECLARE
consumed_evidence_id uuid;
BEGIN
INSERT INTO plugin_integration.plugin_operator_context_replay_record (
evidence_id,
consumed_at,
expires_at
) VALUES (
p_evidence_id,
p_consumed_at,
p_expires_at
)
ON CONFLICT (evidence_id) DO UPDATE
SET consumed_at = EXCLUDED.consumed_at,
expires_at = EXCLUDED.expires_at
WHERE plugin_integration.plugin_operator_context_replay_record.expires_at < now()
Comment thread
seonghobae marked this conversation as resolved.
Resolved
RETURNING evidence_id INTO consumed_evidence_id;

IF consumed_evidence_id IS NULL THEN
RETURN false;
END IF;

DELETE FROM plugin_integration.plugin_operator_context_replay_record AS replay_record
WHERE replay_record.evidence_id IN (
SELECT expired_record.evidence_id
FROM plugin_integration.plugin_operator_context_replay_record AS expired_record
WHERE expired_record.expires_at < now()
AND expired_record.evidence_id <> p_evidence_id
ORDER BY expired_record.expires_at
FOR UPDATE SKIP LOCKED
LIMIT 32
);

RETURN true;
END;
$$;

COMMENT ON FUNCTION plugin_integration.consume_plugin_operator_context_replay(uuid, timestamptz, timestamptz) IS
'Atomically consumes one Plugin operator evidence identity and performs bounded post-consume expiry cleanup in the same PostgreSQL round trip.';
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { createHmac, randomUUID } from 'node:crypto';
import { writeFile } from 'node:fs/promises';

const DEFAULT_ITERATIONS = 1000;
const MAX_ITERATIONS = 10000;
const WORKSPACE_ID = '11111111-1111-4111-8111-111111111111';
const USER_ID = '22222222-2222-4222-8222-222222222222';
const DELIVERY_ID = '33333333-3333-4333-8333-333333333333';
const PATH = `/v1/plugins/delivery-attempts/${DELIVERY_ID}`;

function fail(message) {
throw new Error(message);
}

function iterations(value) {
const parsed = value === undefined ? DEFAULT_ITERATIONS : Number(value);
if (!Number.isSafeInteger(parsed) || parsed < 1 || parsed > MAX_ITERATIONS) {
return fail('K6_ITERATIONS must be an integer between 1 and 10000');
}
return parsed;
}

function secret(value) {
if (typeof value !== 'string' || Buffer.byteLength(value, 'utf8') < 32) {
return fail(
'INTEGRATION_OPERATOR_CONTEXT_SECRET must contain at least 32 UTF-8 bytes',
);
}
return value;
}

const outputPath = process.argv[2];
if (!outputPath) {
fail('authority output path is required');
}

const count = iterations(process.env.K6_ITERATIONS);
const contextSecret = secret(process.env.INTEGRATION_OPERATOR_CONTEXT_SECRET);
const issuedAt = String(Math.floor(Date.now() / 1000));
const authorities = Array.from({ length: count }, () => {
const evidenceId = randomUUID();
const signature = createHmac('sha256', contextSecret)
.update(
`life-os.integration-operator-context.v1\n${WORKSPACE_ID}\n${USER_ID}\n${evidenceId}\n${issuedAt}\nGET\n${PATH}`,
'utf8',
)
.digest('base64url');

return Object.freeze({
path: PATH,
deliveryId: DELIVERY_ID,
headers: Object.freeze({
'x-life-os-workspace-id': WORKSPACE_ID,
'x-life-os-user-id': USER_ID,
'x-life-os-context-evidence-id': evidenceId,
'x-life-os-context-issued-at': issuedAt,
'x-life-os-context-signature': signature,
}),
});
});

await writeFile(outputPath, `${JSON.stringify(authorities)}\n`, {
encoding: 'utf8',
mode: 0o600,
});
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
83 changes: 83 additions & 0 deletions apps/integration-service/perf/plugin-delivery-attempt-status.k6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import http from 'k6/http';
import { check } from 'k6';
import { SharedArray } from 'k6/data';
import exec from 'k6/execution';

function boundedInteger(name, fallback, minimum, maximum) {
const raw = __ENV[name];
const value = raw === undefined || raw === '' ? fallback : Number(raw);
if (!Number.isInteger(value) || value < minimum || value > maximum) {
throw new Error(
`${name} must be an integer between ${minimum} and ${maximum}`,
);
}
return value;
}

const iterations = boundedInteger('K6_ITERATIONS', 1000, 1, 10000);
const vus = boundedInteger('K6_VUS', 10, 1, 100);
const authorityFile = __ENV.K6_AUTHORITY_FILE;
const baseUrl = __ENV.K6_BASE_URL;

if (!authorityFile) {
throw new Error('K6_AUTHORITY_FILE is required');
}
if (!baseUrl || !/^http:\/\/127\.0\.0\.1:\d+$/u.test(baseUrl)) {
throw new Error('K6_BASE_URL must be an explicit loopback HTTP endpoint');
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}

const authorities = new SharedArray('plugin-delivery-status-authority', () => {
const parsed = JSON.parse(open(authorityFile));
if (!Array.isArray(parsed) || parsed.length !== iterations) {
throw new Error(
'authority bundle must contain exactly K6_ITERATIONS entries',
);
}
return parsed;
});

export const options = {
scenarios: {
plugin_delivery_status: {
executor: 'shared-iterations',
vus,
iterations,
maxDuration: '45s',
},
},
thresholds: {
'http_req_duration{endpoint:plugin_delivery_status}': ['p(95)<20'],
'http_req_failed{endpoint:plugin_delivery_status}': ['rate==0'],
checks: ['rate==1'],
},
summaryTrendStats: ['avg', 'med', 'p(90)', 'p(95)', 'p(99)', 'max'],
};
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

export default function () {
const authority = authorities[exec.scenario.iterationInTest];
if (!authority) {
throw new Error('missing unique authority for iteration');
}

const response = http.get(`${baseUrl}${authority.path}`, {
headers: authority.headers,
redirects: 0,
timeout: '2s',
tags: { endpoint: 'plugin_delivery_status' },
});

check(response, {
'status is 200': (result) => result.status === 200,
'status evidence matches delivery': (result) =>
result.status === 200 &&
result.json('deliveryId') === authority.deliveryId,
'status evidence remains credential-free': (result) =>
result.status === 200 &&
!Object.prototype.hasOwnProperty.call(result.json(), 'claimToken') &&
!Object.prototype.hasOwnProperty.call(
result.json(),
'claimTokenDigest',
) &&
!Object.prototype.hasOwnProperty.call(result.json(), 'credential'),
Comment thread
seonghobae marked this conversation as resolved.
Resolved
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
BEGIN;

INSERT INTO plugin_integration.plugin_installation_record (
installation_id,
workspace_id,
installed_by_user_id,
plugin_id,
plugin_contract_version,
manifest_sha256,
granted_capabilities,
installation_status,
installed_at,
revoked_at
) VALUES (
'77777777-7777-4777-8777-777777777777',
'11111111-1111-4111-8111-111111111111',
'22222222-2222-4222-8222-222222222222',
'life-os.performance.status',
'life-os.plugin.v1',
repeat('0', 64),
ARRAY[]::text[],
'active',
clock_timestamp() - INTERVAL '10 minutes',
NULL
);

INSERT INTO plugin_integration.plugin_delivery_origin_grant_record (
authority_version,
grant_id,
installation_id,
workspace_id,
granted_by_user_id,
origin_uri,
grant_status,
granted_at,
revoked_at
) VALUES (
'life-os.plugin-delivery-origin.v1',
'66666666-6666-4666-8666-666666666666',
'77777777-7777-4777-8777-777777777777',
'11111111-1111-4111-8111-111111111111',
'22222222-2222-4222-8222-222222222222',
'https://performance.example.test',
'active',
clock_timestamp() - INTERVAL '9 minutes',
NULL
);

INSERT INTO plugin_integration.plugin_delivery_attempt_record (
authority_version,
delivery_id,
grant_id,
installation_id,
workspace_id,
requested_by_user_id,
delivery_status,
attempt_count,
max_attempts,
requested_at,
updated_at,
next_attempt_at,
terminal_at,
last_outcome_code
) VALUES (
'life-os.plugin-delivery-attempt.v1',
'33333333-3333-4333-8333-333333333333',
'66666666-6666-4666-8666-666666666666',
'77777777-7777-4777-8777-777777777777',
'11111111-1111-4111-8111-111111111111',
'22222222-2222-4222-8222-222222222222',
'pending',
0,
3,
clock_timestamp() - INTERVAL '1 minute',
clock_timestamp() - INTERVAL '1 minute',
clock_timestamp() + INTERVAL '5 minutes',
NULL,
NULL
);

COMMIT;
Loading