Add reviewed Windows scope completion and idle certificate renewal; deploy completion API
Rust development slice / linux (push) Failing after 7s
Rust development slice / linux (push) Failing after 7s
This commit is contained in:
@@ -4,11 +4,22 @@ import { renderToStaticMarkup } from 'react-dom/server';
|
||||
import { PlanInput, record, RecordValue, Session, validateInput } from './api';
|
||||
import { sha256, validateSensitiveInput, verifyPlanIntegrity } from './safety';
|
||||
import { verifyScriptPlan } from './script-console';
|
||||
import { agentUpdateApprovalBlockers, agentUpdatePlanJobs, verifyAgentUpdatePlan, uploadAgentUpdateArtifact } from './agent-updates';
|
||||
import { agentUpdateApprovalBlockers, agentUpdatePlanJobs, verifyAgentUpdatePlan, uploadAgentUpdateArtifact, validateAgentUpdateAction } from './agent-updates';
|
||||
vi.mock('react-dom/client', () => ({ createRoot: () => ({ render: vi.fn() }) }));
|
||||
// Actual rmm-domain serde/codec output; synthetic signatures are NOT update trust.
|
||||
const golden = JSON.parse(readFileSync(new URL('../../tests/agent_update/codec-golden.json', import.meta.url), 'utf8')) as Record<string, RecordValue>;
|
||||
const fixture = (name = 'linux_full') => structuredClone(golden[name]!) as RecordValue;
|
||||
it('retains the exact optional Windows clock transition before approval and rejects null or changed shape', () => {
|
||||
const action = record(record(record((record(fixture('windows_pair').payload).jobs as unknown[])[0]).payload).action);
|
||||
const transition = record(record(action.update).peer_pin_transition);
|
||||
transition.time_profile = { schema_version: 1, old_time_profile_sha256: '21'.repeat(32), new_time_profile_sha256: '22'.repeat(32), agent_qualification_sha256: '23'.repeat(32), helper_qualification_sha256: '24'.repeat(32) };
|
||||
const projected = validateAgentUpdateAction(action, 'system');
|
||||
expect(record(record(projected.update).peer_pin_transition).time_profile).toEqual(transition.time_profile);
|
||||
for (const value of [null, {}, { ...record(transition.time_profile), ready: true }, { ...record(transition.time_profile), schema_version: 2 }, { ...record(transition.time_profile), new_time_profile_sha256: '21'.repeat(32) }]) {
|
||||
const changed = structuredClone(action); record(record(changed.update).peer_pin_transition).time_profile = value;
|
||||
expect(() => validateAgentUpdateAction(changed, 'system')).toThrow();
|
||||
}
|
||||
});
|
||||
async function rehashed(change: (raw: RecordValue) => void): Promise<RecordValue> {
|
||||
const p = fixture(), raw = record(p.payload); change(raw);
|
||||
const bytes = new TextEncoder().encode(JSON.stringify(raw)); p.plan_payload_bytes = Array.from(bytes); p.plan_hash = await sha256(bytes);
|
||||
|
||||
Reference in New Issue
Block a user