feat: verify native Windows client probe and preserve unknown APT outcome
Rust development slice / linux (push) Failing after 7s
Rust development slice / linux (push) Failing after 7s
This commit is contained in:
@@ -5,7 +5,7 @@ const crypto = require('node:crypto');
|
||||
const { isDeepStrictEqual: equal } = require('node:util');
|
||||
const { chromium } = require('../../web/node_modules/playwright');
|
||||
const root = path.resolve(__dirname, '../..');
|
||||
const assert = v => { if (!v) throw new Error('APT UI contract mismatch'); };
|
||||
const assert = v => { if (!v) { const error = new Error('APT UI contract mismatch'); Error.captureStackTrace(error, assert); throw error; } };
|
||||
function readPrivate(file) {
|
||||
const s = fs.lstatSync(file);
|
||||
assert(s.isFile() && !s.isSymbolicLink() && s.uid === process.getuid() && (s.mode & 0o777) === 0o600 && s.size < 1048576);
|
||||
@@ -80,7 +80,12 @@ function checkAction(p, expected) {
|
||||
assert(pending.approval_state === 'pending_approval' && pending.job_count === 0 && pending.execution_state === null);
|
||||
await op.getByRole('button', { name: 'Unveränderlichen Plan zur Prüfung öffnen' }).click();
|
||||
const plan = JSON.parse(await detail.locator('pre').innerText());
|
||||
assert(equal(plan, expected.plan) && plan.jobs.length === 1 && plan.resolved_targets.length === 1);
|
||||
// Submission changes request metadata, never the fixed plan bytes/jobs.
|
||||
// Require the new pending state explicitly and compare EVERY other field.
|
||||
const { approval_state: currentState, ...currentPlan } = plan;
|
||||
const { approval_state: preparedState, ...preparedPlan } = expected.plan;
|
||||
assert(currentState === 'pending_approval' && preparedState === null);
|
||||
assert(equal(currentPlan, preparedPlan) && plan.jobs.length === 1 && plan.resolved_targets.length === 1);
|
||||
assert(crypto.createHash('sha256').update(Buffer.from(plan.plan_payload_bytes)).digest('hex') === plan.plan_hash);
|
||||
const p = plan.jobs[0].payload; checkAction(p, expected);
|
||||
assert(p.agent_id === expected.agent_id && p.asset_id === expected.asset_id && p.tenant_id === expected.tenant_id && Date.parse(p.start_before) > Date.now());
|
||||
|
||||
Reference in New Issue
Block a user