EnergyVenom's picture
Astra: PO/GL actions, usage coverage, assisted sign-in, self-healing, recorder, new top navigation and theme (172a4e22a2bf)
fb62a97 verified
Raw History Blame Contribute Delete
6.47 kB
// Consultant vocabulary. The engine keeps its technical names; the UI speaks the language of an Oracle Fusion
// functional consultant. The exact rule result (GO / NO-GO / HELD) is always shown next to the words in reports.
export const GLOSSARY: { term: string; means: string; technical: string }[] = [
{ term: 'Scenario', means: 'A business test, e.g. "Requisition below threshold approved by the first-level approver".', technical: 'test case (tests/cases YAML)' },
{ term: 'Test run', means: 'One execution of the scenarios for a patch on a test environment.', technical: 'run' },
{ term: 'Your review', means: 'A pause where a person must decide (approve scenarios, or judge failures).', technical: 'human gate' },
{ term: 'Scenario review', means: 'Approve which new or changed scenarios run for this patch.', technical: 'approval gate (approve_cases)' },
{ term: 'Failure analysis', means: 'The system’s suggested cause for each failure (screen change, data, timing, the pod or network, real defect).', technical: 'triage' },
{ term: 'Failure review', means: 'You confirm real defects (they become tickets), mark expected changes, assign owners.', technical: 'human review gate' },
{ term: 'Critical / High / Medium / Low', means: 'Business priority of a scenario. Critical always runs; High runs when chosen or when the patch touches it.', technical: 'P1 / P2 / P3 / P4' },
{ term: 'Ready', means: 'Every required check passed: the patch can go ahead on this evidence.', technical: 'GO' },
{ term: 'Not ready', means: 'At least one required check failed or is not covered yet.', technical: 'NO-GO' },
{ term: 'On hold', means: 'The scenarios are on hold (e.g. until data masking is confirmed), so no decision is made.', technical: 'HELD' },
{ term: 'No coverage (gap)', means: 'No scenario tests this process step yet.', technical: 'coverage-map row without a case' },
{ term: 'Test environment', means: 'The pod the scenarios run against. In this pilot it is a local mock app, not Oracle Fusion.', technical: 'pod' },
];
export const DECISION_WORDS: Record<string, string> = { GO: 'Ready', 'NO-GO': 'Not ready', HELD: 'On hold' };
export const PRIORITY_WORDS: Record<string, string> = { P1: 'Critical', P2: 'High', P3: 'Medium', P4: 'Low' };
export const decisionWords = (d?: string | null) => (d ? DECISION_WORDS[d] ?? d : 'Not decided yet');
export const priorityWords = (p?: string | null) => (p ? PRIORITY_WORDS[p] ?? p : 'Unrated');
export const RUN_STATUS_WORDS: Record<string, string> = {
queued: 'starting', running: 'testing', waiting_approval: 'waiting for your scenario review', waiting_review: 'waiting for your failure review',
completed: 'finished', failed: 'stopped with an error', killed: 'stopped (emergency stop)', cancelled: 'cancelled', interrupted: 'paused, can resume',
};
export const STEP_STATE: Record<string, { label: string; tone: string }> = {
failing: { label: 'Failing', tone: 'red' },
gap: { label: 'No coverage (gap)', tone: 'amber' },
not_tested: { label: 'Affected, not yet tested', tone: 'ink' },
passed: { label: 'Affected and passed', tone: 'green' },
not_affected: { label: 'Not affected by the patch', tone: 'neutral' },
};
export const VERDICT_TONE: Record<string, string> = {
Ready: 'green', 'Not ready': 'red', 'On hold': 'amber', 'Waiting for you': 'amber', Testing: 'ink', 'Not tested yet': 'neutral',
Stopped: 'red', Cancelled: 'neutral', Paused: 'amber', Finished: 'neutral',
};
/** How the failure-review buttons map onto the unchanged human_review answer format. */
export type FailureChoice = 'real_defect' | 'not_defect' | 'expected_change';
export function reviewAnswer(choice: FailureChoice | undefined, extra: { note?: string; waiver?: string; owner?: string }) {
const out: { confirmed?: 'real_defect' | 'not_defect'; note?: string; waiver?: string; owner?: string } = {};
if (choice === 'real_defect') out.confirmed = 'real_defect';
if (choice === 'not_defect') out.confirmed = 'not_defect';
if (choice === 'expected_change') {
out.confirmed = 'not_defect';
out.note = `Expected change from the patch: update the scenario.${extra.note ? ` ${extra.note}` : ''}`;
} else if (extra.note) out.note = extra.note;
if (extra.waiver) out.waiver = extra.waiver;
if (extra.owner) out.owner = extra.owner;
return out;
}
/** The failure analysis's suggested cause, in plain words, with a tone that keeps likely product defects (red) apart
* from causes on the testing side: a changed screen the script must follow, test data, a page slower than the test
* waited (timing), or the pod or network itself (environment: a server error, a refused sign-in, a crashed browser). */
export const FAILURE_CAUSE: Record<string, { words: string; tone: 'red' | 'lav' | 'amber' | 'ink' | 'mint' | 'neutral'; side: 'product' | 'testing' | 'unknown' }> = {
real_defect: { words: 'Likely product defect', tone: 'red', side: 'product' },
ui_change: { words: 'Screen changed: test script needs updating', tone: 'lav', side: 'testing' },
data: { words: 'Test data problem', tone: 'amber', side: 'testing' },
timing: { words: 'Timing: the page was slower than the test waited', tone: 'ink', side: 'testing' },
environment: { words: 'Environment problem (pod or network)', tone: 'mint', side: 'testing' },
unclassified: { words: 'Cause not clear yet', tone: 'neutral', side: 'unknown' },
};
export const failureCause = (category?: string | null) =>
FAILURE_CAUSE[category ?? 'unclassified'] ?? { words: 'Cause not clear yet', tone: 'neutral' as const, side: 'unknown' as const };
/** A run's stop reason for people: newer runs store a plain sentence; older ones may hold "SomeError: text" or a
* traceback, which reads as the text after the class name, or a generic sentence when nothing readable is left. */
export function plainReason(error?: string | null): string {
const raw = (error ?? '').trim();
if (!raw || /^(none|null|undefined)$/i.test(raw)) return '';
if (/^Traceback \(most recent call last\)/.test(raw)) return 'An internal error stopped the test run. An administrator can see the details in the audit log.';
const t = raw.replace(/^(?:[\w.]+\.)?[A-Z]\w*(?:Error|Exception|Engaged|Interrupt)\s*:\s*/, '').trim();
if (!t) return 'An internal error stopped the test run. An administrator can see the details in the audit log.';
const u = t.charAt(0).toUpperCase() + t.slice(1);
return /[.!?]$/.test(u) ? u : `${u}.`;
}