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
14.5 kB

Triage and reporting (patch testing, all module packs)

Owner: Triage and Reporting. Python 3 standard library only (PyYAML used if installed, otherwise a small built-in reader).

All results this tool processes today come from Playwright runs against the local mock P2P app, not Oracle Fusion. There is no Fusion pod access. The reports say so on every page.

One command

python3 triage/run_triage.py            # reads automation/results/results.json (fixed default; no auto-discovery)
python3 triage/run_triage.py path/to/results.json             # an explicit path overrides the default
python3 triage/run_triage.py --module O2C                       # one module pack (default P2P)
python3 triage/run_triage.py --module all                       # one report per module + index
python3 triage/run_triage.py --include-p2                        # P2 cases also count toward C1 coverage (default: P1 only)
python3 triage/run_triage.py --event-due                         # event-driven cases are due this cycle (in scope whatever their tier)

Writes reports/go-no-go.md, reports/go-no-go.html and reports/triage.json. Exit codes (same for reports/generate_report.py):

Code Meaning
0 GO (with --module all: every module GO)
1 NO-GO in at least one module (QA rule)
2 WAITING: results file missing, nothing generated
3 HELD: no module is NO-GO, but at least one module is HELD (every case on execution_hold)

NO-GO wins over HELD, HELD wins over GO. Stray JSON files elsewhere are never read. When the exit code is 2, nothing is generated and nothing is invented.

Unit tests (synthetic fixtures only): python3 -m unittest discover -s triage/tests -v

What it needs from automation/

Playwright's standard JSON reporter, e.g. in playwright.config.ts:

reporter: [['list'], ['json', { outputFile: 'test-results/results.json' }], ['html', { open: 'never' }]],
use: { trace: 'retain-on-failure', screenshot: 'only-on-failure' },
retries: 1,

Case IDs are read with qa/audit.py's own case_ids_from_tags() on the spec-level tags (the report, its C5 recount and the audit call the same function, so they cannot drift; without qa/audit.py the identical triage/ids.py tag_case_id is used). Case IDs are read only from case-ID tags (@P2P-INV-001; Playwright's JSON stores tags without the @, both forms are accepted). They are never read from test/describe titles, file names, fixme/skip reasons or any other annotation text: a recipe name such as DR-O2C-INT-003 in a fixme reason once created a fake "DR" module. qa/audit.py has no dedicated case annotation, so none is read here either ({type:'case'} annotations are ignored). A test without a case-ID tag is "unassigned" (see Modules). qa/audit.py now also reads IDs from tags only (results and scripts: literal '@<CASE-ID>' strings in the script source). Priority tiers (P1–P4) come from priority: (or risk:) in tests/cases/*.yaml, read with QA's loader. Add { type: 'owner', description: '<name>' } to a test so a flaky result has an owner.

Classification (triage/classifier.py)

Rule-based, deterministic and auditable. Each error message, stack and failing code line produces weighted signals. Scores per class are combined with noisy-OR. Confidence is top * (1 - 0.8 * second/top), so conflicting signals lower it. Confidence below 0.6 is flagged needs human review.

Class Main signals
UI change strict mode violation, element(s) not found / resolved to 0 elements, element type changed, URL/title assertion
Timing the page was slower than the wait: page.goto/navigation/waitFor* timeouts, test timeout, element not visible/stable/enabled, intermediate status (Pending/Processing)
Environment the pod or the network, not the product: HTTP 5xx, sign-in refused (password, locked user, no sign-in page), Oracle's edge (Akamai) Access Denied, browser crashed or out of memory, network errors (net::ERR_*, connection refused), a whole pass that stopped before it reported (runner lost or overran)
Data HTTP 4xx, validation/required-field errors, record/supplier/PO not found, duplicate/already exists
Real defect assertion mismatch on business values (amount, total, status, match, hold, approval, tax, payment...)
Unclassified nothing matched: confidence 0, human required

A locator wait that times out without ever resolving is ambiguous (UI change or slow page). Both classes get scored and confidence stays low. Tests that Playwright marks flaky (failed, then passed on retry) are counted as flaky, not failed. Their failed attempt is still classified.

Go/no-go rule (reports/generate_report.py)

There is one rule: QA's exit criteria from qa/test-strategy.md section 5, using the definitions in section 6. The decision is GO only if all six criteria hold:

# QA criterion How it is evaluated (deterministic)
C1 Every in-scope case has a script, and every in-scope script was run. In scope means P1 plus untiered cases by default, and P1 + P2 + untiered with --include-p2; with --event-due also every event-driven case. Retired, held and tolerant cases are never in scope (see Lifecycle). P3/P4 cases (and P2 cases without the flag) are listed under open gaps and never block. QA's patch qa/proposed-generate_report-C1-tiered.patch is applied, with one fix on top: an unrun script blocks only if it maps to an in-scope case or to no known case. Mapping uses qa/audit.py's load_cases / load_scripts / find_ids. No designed cases means not met. A stand-in script counts toward C1 (QA §2a).
C2 Every in-scope P1 case passed. Every P2 failure has a triage verdict. No P2 failure is a real defect unless a human waived it or reclassified it. Tier comes from the case priority (or risk) field: P1/critical, P2/high, P3/medium, P4/low. "Passed" means passed on the first attempt, so a P1 failure always blocks, and so do flaky, skipped and not-run P1 cases. A verdict is any class except unclassified. A P2 failure classified real_defect, at any confidence and confirmed or not, blocks GO. Only a waiver or "confirmed": "not_defect" in reports/human-review.json unblocks it (Chief of Staff decision, 9 Oct 2026).
C3 Flaky rate is at most 5% of executed tests, and every flaky test has an owner Over gating entries only (tolerant/held/retired entries excluded). Executed = passed + failed + flaky. The owner comes from a Playwright annotation {type:'owner'} or from human-review.json.
C4 False-fail rate is reported, with its denominator Non-defect failures / triaged failures. A low-confidence non-defect verdict only counts after a human confirms it, and until then is shown as unconfirmed.
C5 Report counts match what qa/audit.py recomputes from the raw results qa/audit.py parse_playwright_json is run on the same file and the counts are compared.
C6 Report says "mock app, not Oracle Fusion" and lists the open gaps Always written into the report.

The count tables use the | Label | N | layout that qa/audit.py reads. A unit test checks that the audit extracts the right numbers from both the MD and the HTML report. Rules from earlier versions (a real defect at confidence >= 0.6 blocking, high-risk pass rate >= 95%, run errors blocking) were removed. Failures on P3/P4 cases do not block, but they are listed as open gaps.

Lifecycle fields (tests/README.md; qa/test-strategy.md §2b)

Read with qa/audit.py's own case_flags / case_class / scope_of; precedence retired > held > tolerant. Each class has its own non-blocking report section.

Field Treatment
status: retired (+ superseded_by) Out of every scope; never a coverage gap. Listed with its successor. Successor check as in the audit: warning if superseded_by is missing, the successor is not in tests/cases, or the successor is itself retired. A retired case with a script or result is flagged in Open gaps.
suite: tolerant / go_no_go: false Never gates C1 or C2; its result entries are excluded from C3 (flaky) and the C2 P2-defect check. Own section with its own P/F/Fl/S. Warning if only one of the two fields is set.
execution_hold (+ reason) Not run, not blocking, listed with the reason. If every case of a module is held (or retired), the module decision is HELD with the reason (not NO-GO), exit code 3.
schedule: event-driven Listed. Tier scope by default; with --event-due every non-retired/held/tolerant event-driven case is in scope and blocking whatever its tier.
condition Tier scope unchanged; listed with the condition text.

Separate suites (read exactly like qa/audit.py: qa.parse_playwright_json + qa.case_ids_from_tags + qa.in_module):

  • automation/results/tolerant/results.tolerant.pwjson feeds only the section "Tolerant suite (does not affect GO/NO-GO)" (its own P/F/Fl/S and per-case result). Never in the main totals, C1-C6 or the verdicts.
  • automation/results/held/results.held.pwjson: runs of held cases on the mock with synthetic data are allowed (Chief of Staff decision, 9 Oct 2026 18:30 IST), as qa/audit.py records them. They are shown in a neutral note, "Held cases run on mock only (synthetic data, allowed by Chief of Staff 9 Oct 18:30 IST; not counted)", in the module report and the index (runs, case IDs, file). They are never counted and the module stays HELD.
  • HOLD BREACH is used only for held cases that have entries in the main results.json (the audit flags these as "should be none"): a red banner in the module report, a section at the top of go-no-go-all.md, and a line in the CLI output.

Coverage split: every report and the index show "P1 in scope: N fully covered, M stand-in only" (plus not covered), using the audit's sets: qa.load_scripts full/stand-in IDs, then result entries (audit parse) are authoritative, so a case whose entries are all @stand-in is stand-in only. The index column is "P1 in scope: coverage".

Counts: Total/Executed/Passed/Failed/Flaky/Skipped include every result entry of the module, including tolerant/held/retired entries, because qa/audit.py counts them that way (C5 parity). A "Gating subset" line below the table excludes them. "Designed cases" counts every case file of the module including retired ones (same base as the audit); the report also shows the active count excluding retired. "Scripts" is always shown (0 when none) so C5 can compare it for every module.

Stand-in (substitute) cases

A test tagged @stand-in (also @standin, @substitute, or "stand-in" in its title) covers its case by a substitute path. For example, P2P-INV-006 uses a REST import instead of the Excel spreadsheet upload (QA strategy §2a). The report lists these cases in their own section, "Stand-in (substitute) coverage: NOT real coverage". They are treated like this:

  • C1: a stand-in satisfies coverage, as QA decided.
  • Counts: stand-in test results are included in Total/Executed/Passed/Failed/Flaky/Skipped, because they are real Playwright runs against the mock and qa/audit.py counts them too, so C5 stays consistent. C2 applies to them like any other test.
  • Fully covered: stand-ins are excluded from the "fully covered in-scope case(s)" figure, so the real UI path is still shown as untested.

Modules (--module, default P2P)

Every report covers one module pack. Counts, C1–C6, stand-ins, triage verdicts and triage.json are all computed per module:

  • Cases and scripts: qa.load_cases(root, warnings, module) and qa.load_scripts(root, known, id_re, module).
  • Result entries: filtered with qa.in_module(ids, module), where ids are the test's case-ID tags only (see above). Modules come from designed cases (qa.case_module) and from case-ID tags, never from free text.
  • C5: compares against an independent recount that qa/audit.py --module <m> would produce.

Tests with no module ID tag: a test such as P2P-SMOKE-001 belongs to P2P from its prefix. A test with no recognisable case ID is kept and counted in every module's report. That matches qa.in_module, so C5 stays equal to the audit. It is also listed in an "Unassigned tests (no module case ID)" section, so it is never silently dropped. An unscripted or unrun ID-less script is treated as scope-unknown and blocks C1 in every module. Give such a test a case ID to assign it. With --module all, module totals can therefore overlap.

Output paths (--out-dir, default reports/):

Module Files
P2P reports/go-no-go.md, reports/go-no-go.html, reports/triage.json (unchanged legacy paths)
any other module M reports/<m>/go-no-go.{md,html} and reports/<m>/triage.json, lower-case (e.g. reports/o2c/)
--module all the above for each module, plus the index reports/go-no-go-all.md (one decision per module; there is no combined decision)

With --out-dir X, the same scheme applies under X. For example, --include-p2 --out-dir reports/include-p2 gives reports/include-p2/ for P2P and reports/include-p2/o2c/ for O2C.

Optional human input goes in reports/human-review.json. Keys are a case ID or a full test title:

{ "P2P-INV-003": { "confirmed": "real_defect", "waiver": "accepted by <name> on <date>", "owner": "<name>" } }

confirmed takes real_defect or not_defect. The classifier never confirms anything itself.

Files

  • triage/classifier.py: parser and classifier (CLI: python3 triage/classifier.py results.json --cases-dir tests/cases -o out.json)
  • triage/run_triage.py: reads the default (or given) results file, classifies, writes reports in one command
  • triage/ids.py: the one shared case-ID / tag / stand-in parser. It is module-neutral: <MODULE>-<AREA>[-...]-<N> (MODULE matches [A-Z][A-Z0-9]{1,5}, e.g. P2P, O2C, R2R) plus TC-.... The classifier, the report (case mapping, stand-ins, report title) and tag parsing all use it.
  • triage/risk.py: the one shared tier mapping (QA: P1/critical, P2/high, P3/medium, P4/low; high-risk = P1 or P2), used by both the classifier and the report
  • reports/generate_report.py: Markdown and HTML go/no-go (--results file.json or --triage triage.json)
  • triage/tests/: unit tests. fixtures/FIXTURE_* are synthetic and hand-written, not real runs.