refactor: centralize host evidence actions (#194)

This commit is contained in:
Eyejoker
2026-05-30 00:08:28 +09:00
committed by GitHub
parent adf9c16b9a
commit 46b5543cb5
8 changed files with 193 additions and 143 deletions

View File

@@ -0,0 +1,41 @@
import { describe, expect, it } from 'vitest';
import {
ARTIFACT_EVIDENCE_KINDS,
DB_EVIDENCE_ACTIONS,
DEPLOY_EVIDENCE_ACTIONS,
GITHUB_EVIDENCE_ACTIONS,
HOST_EVIDENCE_ACTIONS,
isArtifactEvidenceKind,
isDbEvidenceAction,
isDeployEvidenceAction,
isGitHubEvidenceAction,
isHostEvidenceAction,
} from '../src/evidence-actions.js';
describe('evidence action constants', () => {
it('keeps host evidence actions as the composed allowlist', () => {
expect(HOST_EVIDENCE_ACTIONS).toEqual([
'ejclaw_service_status',
'ejclaw_service_logs',
'ejclaw_role_runtime_config',
...DEPLOY_EVIDENCE_ACTIONS,
...DB_EVIDENCE_ACTIONS,
...GITHUB_EVIDENCE_ACTIONS,
]);
});
it('recognizes scoped evidence actions', () => {
expect(isHostEvidenceAction('github_run_jobs')).toBe(true);
expect(isDbEvidenceAction('db_recent_scheduled_tasks')).toBe(true);
expect(isDeployEvidenceAction('ejclaw_artifact_metadata')).toBe(true);
expect(isGitHubEvidenceAction('github_workflow_file')).toBe(true);
expect(isHostEvidenceAction('cat /etc/shadow')).toBe(false);
});
it('recognizes artifact evidence kinds', () => {
expect(ARTIFACT_EVIDENCE_KINDS).toContain('runner_dist');
expect(isArtifactEvidenceKind('runner_dist')).toBe(true);
expect(isArtifactEvidenceKind('../secret')).toBe(false);
});
});