EnergyVenom commited on
Commit
11ee600
·
verified ·
1 Parent(s): 85ce2ca

Deploy Patch Testing Co-worker

Browse files
coworker/api/runner.py CHANGED
@@ -59,6 +59,14 @@ def create_run_record(svc, inputs: dict, actor: str, trigger: str = "manual", or
59
  raise RunError(str(e), e.code, e.status) from e
60
  if not pod["runnable"]:
61
  raise RunError(pod["not_runnable_reason"] or "this pod cannot run tests", "POD_NOT_RUNNABLE", 409)
 
 
 
 
 
 
 
 
62
  rid = new_run_id()
63
  mods = [m.upper() for m in inputs.get("modules") or []]
64
  state = {"run_id": rid, "patch_id": inputs.get("patch_id") or "", "trigger": trigger, "modules_requested": mods,
 
59
  raise RunError(str(e), e.code, e.status) from e
60
  if not pod["runnable"]:
61
  raise RunError(pod["not_runnable_reason"] or "this pod cannot run tests", "POD_NOT_RUNNABLE", 409)
62
+ if pod["kind"] == "fusion": # only business areas with scripts for real Fusion screens can run there
63
+ from ..platform.pod import FusionPodClient
64
+ ready = {a["idPrefix"] for a in FusionPodClient.AREAS}
65
+ asked = [m.upper() for m in inputs.get("modules") or []]
66
+ other = [m for m in asked if m not in ready]
67
+ if not asked or other:
68
+ raise RunError(f"On an Oracle Fusion pod, only these business areas have tests so far: {', '.join(sorted(ready))}. "
69
+ f"Choose {' or '.join(sorted(ready))}" + (f" instead of {', '.join(other)}." if other else "."), "AREA_NOT_ON_FUSION", 409)
70
  rid = new_run_id()
71
  mods = [m.upper() for m in inputs.get("modules") or []]
72
  state = {"run_id": rid, "patch_id": inputs.get("patch_id") or "", "trigger": trigger, "modules_requested": mods,
coworker/tests/test_pods.py CHANGED
@@ -60,6 +60,10 @@ class TestPods(unittest.TestCase):
60
  env = PodRegistry(self.svc.db, self.svc.vault, self.svc.cfg, self.svc.egress, self.svc.audit).executor_env(pod["id"])
61
  self.assertEqual((env["FUSION_BASE_URL"], env["FUSION_USERNAME"], env["FUSION_PASSWORD"]),
62
  ("https://acme-test.fa.ocs.oraclecloud.com", "zz.buyer", secret))
 
 
 
 
63
 
64
  def test_connection_test_is_read_only_and_audited(self):
65
  default = [p for p in self.pods() if p["is_default"]][0]
 
60
  env = PodRegistry(self.svc.db, self.svc.vault, self.svc.cfg, self.svc.egress, self.svc.audit).executor_env(pod["id"])
61
  self.assertEqual((env["FUSION_BASE_URL"], env["FUSION_USERNAME"], env["FUSION_PASSWORD"]),
62
  ("https://acme-test.fa.ocs.oraclecloud.com", "zz.buyer", secret))
63
+ # a business area without Fusion tests is refused up front instead of finishing as "not run"
64
+ r = self.c.post("/api/runs", json={"modules": ["P2P"], "playwright_mode": "stub", "pod_id": pod["id"]}, headers=self.h["consultant"])
65
+ self.assertEqual((r.status_code, r.json()["code"]), (409, "AREA_NOT_ON_FUSION"))
66
+ self.assertIn("AP", r.json()["detail"])
67
 
68
  def test_connection_test_is_read_only_and_audited(self):
69
  default = [p for p in self.pods() if p["is_default"]][0]
web/src/pages/RunGuide.tsx CHANGED
@@ -3,7 +3,7 @@ import { IconArrowLeft, IconArrowRight, IconCheck, IconCircleCheck, IconCircleDa
3
  import { useState } from 'react';
4
  import { Link } from 'react-router-dom';
5
  import type { Schemas } from '../api/client';
6
- import { useApproveCases, useGate, useHumanReview, useRunAction, useRunFailures, useRunReadiness } from '../api/hooks';
7
  import type { ApproveGate, Failure } from '../api/types';
8
  import { Can, ErrorAlert, Pill } from '../components/common';
9
  import { decisionWords, reviewAnswer, type FailureChoice } from '../glossary';
@@ -192,6 +192,7 @@ export function Judge({ r }: { r: Run }) {
192
 
193
  export function Result({ r }: { r: Run }) {
194
  const rd = useRunReadiness(r.run_id);
 
195
  const d = r.decision ?? Object.values(r.decisions ?? {})[0] ?? null;
196
  const mods = rd.data?.modules ?? [];
197
  const failing = mods.reduce((n, m) => n + m.counts.failing, 0);
@@ -222,7 +223,7 @@ export function Result({ r }: { r: Run }) {
222
  <ExcelButton id={r.run_id} label="Download the results (Excel)" />
223
  {r.playwright_mode !== 'stub' && <Button component={Link} to={`/runs/${r.run_id}/proof`} variant="default">See the screens</Button>}
224
  </Group>
225
- <Text size="xs" c="dimmed">Results come from the practice environment (the mock app), not Oracle Fusion.</Text>
226
  </Stack>
227
  );
228
  }
 
3
  import { useState } from 'react';
4
  import { Link } from 'react-router-dom';
5
  import type { Schemas } from '../api/client';
6
+ import { useApproveCases, useGate, usePods, useHumanReview, useRunAction, useRunFailures, useRunReadiness } from '../api/hooks';
7
  import type { ApproveGate, Failure } from '../api/types';
8
  import { Can, ErrorAlert, Pill } from '../components/common';
9
  import { decisionWords, reviewAnswer, type FailureChoice } from '../glossary';
 
192
 
193
  export function Result({ r }: { r: Run }) {
194
  const rd = useRunReadiness(r.run_id);
195
+ const fusion = (usePods().data ?? []).find((p) => p.id === r.pod_id)?.kind === 'fusion';
196
  const d = r.decision ?? Object.values(r.decisions ?? {})[0] ?? null;
197
  const mods = rd.data?.modules ?? [];
198
  const failing = mods.reduce((n, m) => n + m.counts.failing, 0);
 
223
  <ExcelButton id={r.run_id} label="Download the results (Excel)" />
224
  {r.playwright_mode !== 'stub' && <Button component={Link} to={`/runs/${r.run_id}/proof`} variant="default">See the screens</Button>}
225
  </Group>
226
+ <Text size="xs" c="dimmed">{fusion ? `Results come from the Oracle Fusion pod ${r.pod_name ?? ''}.` : 'Results come from the practice environment (the mock app), not Oracle Fusion.'}</Text>
227
  </Stack>
228
  );
229
  }
web/src/pages/SignOffReport.tsx CHANGED
@@ -57,11 +57,11 @@ export function SignOffReport({ id }: { id: string }) {
57
  </Group>
58
  </Group>
59
  <Text size="sm" mt={8} data-testid="decision-explained">
60
- {d === 'GO' ? `${DECISION_WORDS[d]}: every required check passed on the mock app.`
61
  : d === 'HELD' ? `${DECISION_WORDS[d]}: the scenarios of this area are on hold, so no decision is made.`
62
  : `${DECISION_WORDS[d] ?? d}: ${failed.length} required check(s) not met: ${failed.map(([k]) => CRITERIA_WORDS[k] ?? k).join('; ')}.`}
63
  </Text>
64
- <Text size="xs" c="dimmed" mt={4}>Results are from the local mock app, not Oracle Fusion.</Text>
65
  </section>
66
  );
67
  })}
 
57
  </Group>
58
  </Group>
59
  <Text size="sm" mt={8} data-testid="decision-explained">
60
+ {d === 'GO' ? `${DECISION_WORDS[d]}: every required check passed${rep.data?.target?.startsWith('Oracle Fusion') ? ' on the Oracle Fusion pod' : ' on the mock app'}.`
61
  : d === 'HELD' ? `${DECISION_WORDS[d]}: the scenarios of this area are on hold, so no decision is made.`
62
  : `${DECISION_WORDS[d] ?? d}: ${failed.length} required check(s) not met: ${failed.map(([k]) => CRITERIA_WORDS[k] ?? k).join('; ')}.`}
63
  </Text>
64
+ <Text size="xs" c="dimmed" mt={4}>{rep.data?.target?.startsWith('Oracle Fusion') ? `Results are from the ${rep.data.target}.` : 'Results are from the local mock app, not Oracle Fusion.'}</Text>
65
  </section>
66
  );
67
  })}
web/src/pages/StartRunWizard.tsx CHANGED
@@ -17,6 +17,8 @@ const DEMO_FAILURES = [
17
  type Knob = (typeof DEMO_FAILURES)[number]['key'];
18
 
19
  /** Guided "start a test run": where (pod) → what (modules) → how (run type) → review. */
 
 
20
  export function StartRunForm({ initialModules = ['P2P'] }: { initialModules?: string[] }) {
21
  const pods = usePods();
22
  const kill = useKill();
@@ -38,11 +40,14 @@ export function StartRunForm({ initialModules = ['P2P'] }: { initialModules?: st
38
  if (podId === null && list.length) setPodId((list.find((p) => p.is_default && p.runnable) ?? list.find((p) => p.runnable) ?? list[0]).id);
39
  }, [list, podId]);
40
  const pod = list.find((p) => p.id === podId);
 
 
41
  // Business areas come from the pod itself: what the Scout last read from the connected pod (mock), or what the admin
42
  // registered for an Oracle Fusion pod. The fixed list is only a fallback before the pod has been read once.
43
  const profile = usePodProfile();
44
  const reported = (profile.data?.modules ?? []).map((m) => m.module).filter(Boolean);
45
- const fromPod = pod?.kind === 'mock' && pod.runnable ? reported : pod?.modules ?? [];
 
46
  const areas = fromPod.length ? MODULES.filter((m) => fromPod.includes(m)).concat(fromPod.filter((m) => !MODULES.includes(m))) : MODULES;
47
  const toggle = (m: string) => setModules((s) => (s.includes(m) ? s.filter((x) => x !== m) : [...s, m]));
48
 
 
17
  type Knob = (typeof DEMO_FAILURES)[number]['key'];
18
 
19
  /** Guided "start a test run": where (pod) → what (modules) → how (run type) → review. */
20
+ const FUSION_AREAS = ['AP'];
21
+
22
  export function StartRunForm({ initialModules = ['P2P'] }: { initialModules?: string[] }) {
23
  const pods = usePods();
24
  const kill = useKill();
 
40
  if (podId === null && list.length) setPodId((list.find((p) => p.is_default && p.runnable) ?? list.find((p) => p.runnable) ?? list[0]).id);
41
  }, [list, podId]);
42
  const pod = list.find((p) => p.id === podId);
43
+ // switching to a Fusion pod selects the areas that can run there
44
+ useEffect(() => { if (pod?.kind === 'fusion') setModules((s) => (s.every((m) => FUSION_AREAS.includes(m)) && s.length ? s : [...FUSION_AREAS])); }, [pod?.kind]);
45
  // Business areas come from the pod itself: what the Scout last read from the connected pod (mock), or what the admin
46
  // registered for an Oracle Fusion pod. The fixed list is only a fallback before the pod has been read once.
47
  const profile = usePodProfile();
48
  const reported = (profile.data?.modules ?? []).map((m) => m.module).filter(Boolean);
49
+ // a Fusion pod offers only the business areas that have tests for real Fusion screens (Payables for now)
50
+ const fromPod = pod?.kind === 'mock' && pod.runnable ? reported : pod?.kind === 'fusion' ? FUSION_AREAS : pod?.modules ?? [];
51
  const areas = fromPod.length ? MODULES.filter((m) => fromPod.includes(m)).concat(fromPod.filter((m) => !MODULES.includes(m))) : MODULES;
52
  const toggle = (m: string) => setModules((s) => (s.includes(m) ? s.filter((x) => x !== m) : [...s, m]));
53