Skip to content

test(uipath-insights): add e2e coverage for the jobs commands - #2551

Open
celestinryf wants to merge 1 commit into
mainfrom
test/uipath-insights-add-e2e-tests
Open

test(uipath-insights): add e2e coverage for the jobs commands#2551
celestinryf wants to merge 1 commit into
mainfrom
test/uipath-insights-add-e2e-tests

Conversation

@celestinryf

@celestinryf celestinryf commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Related to IN-13526.

What

Adds the first e2e coverage for uipath-insights: two task YAMLs with their sidecar checkers (envelope-contract/all_commands_envelope_e2e.yaml, job-health/job_health_investigation_e2e.yaml, check_all_commands_envelope.py, check_job_health_investigation.py) plus a shared _shared/envelope_check.py holding the per-subcommand envelope Code strings from jobs.ts. Five new files, all under tests/tasks/uipath-insights/. The five existing smoke tasks, SKILL.md, and the references are untouched.

Why

The repo requires at least one smoke and one e2e task per skill (tests/README.md:269) and this skill had only smoke. The five smoke tasks grade that command strings were attempted, regardless of outcome, so nothing currently grades whether uip insights jobs returns its shipped contract: Result: Success with the exact per-subcommand Code.

Scope

The seven shipped Jobs commands only, read-only, no tenant mutation and therefore no cleanup. Nothing here teaches the proposed Filters, RBAC, or Alert commands as available. The Filters skill content and its smoke task are a separate PR that waits on those commands reaching cli/main.

Testing

Ran both tasks locally and they passed. Run 2026-08-06_13-34-09, claude-code agent, uip 1.198.0, coder_eval 0.8.10: skill-insights-all-commands-envelope-e2e 1.000 (12/12 criteria), skill-insights-job-health-investigation-e2e 1.000 (9/9). Four earlier runs also passed at 1.000: 2026-08-06_12-25-44, 2026-08-06_12-13-08, 2026-08-04_12-24-50, 2026-08-04_12-29-42. The last run had live job data, so the report-grounding assertion was exercised rather than skipped through the empty-window path. Checker failure paths exercised locally against synthesized artifacts: ungrounded report, rejected envelope, unparseable envelope, missing file, no uip on PATH, probe timeout. scripts/check-task-driver.py and scripts/check-cli-verbs.py are clean.

Limitations

No pytest unit tests for the checkers. maestro-flow, maestro-case and uipath-agents ship them, but running them in CI needs a paths: entry and a job in .github/workflows/test-helpers.yml, outside this PR's ownership. Happy to follow up if the CI owners want it.

The checkers verify that each saved envelope is structurally correct and that the report is grounded in the CLI's response, but not that a given file is the response to its own command. Both tasks need a tenant that answers uip insights jobs; a tenant that rejects the read fails with the CLI's own Message and Instructions rather than degrading.

How to Review

Start with the two check_*.py files and _shared/envelope_check.py. That is where the contract lives. The YAMLs are mostly criteria lists.

Checklist

  • Tests added/updated for new logic — the change is the tests; run evidence above
  • No secrets or credentials in code
  • Commits follow conventional format
  • PR ≤ 400 lines — 603 added lines; the five files are one slice, and a task YAML is not separable from its checker

CI note

The PR gate runs only smoke-tagged tasks, so neither new task is exercised by CI on this PR. The local runs above are the evidence; nightly is where they run on a schedule.

The repo requires at least one e2e task per skill and uipath-insights
had none. The five existing smoke tasks assert that command strings
were attempted, regardless of outcome, so nothing graded whether
uip insights jobs returns its shipped contract. Adds two e2e tasks
with sidecar checkers plus a shared envelope helper.

Scoped to the seven shipped Jobs commands, read-only. Teaches no
proposed Filters, RBAC, or Alert commands as available.
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Claude finished @celestinryf's task in 3m 14s —— View job


PR Review: test(uipath-insights) — e2e coverage for jobs commands

  • Read review criteria and project conventions
  • Read full diff and changed files
  • Check PR conversation for existing feedback
  • Validate task YAML structure and tags
  • Review Python checkers for correctness
  • Check for secrets, cross-skill deps, and conventions
  • Post review findings

Summary

Adds the first e2e coverage for uipath-insights: two task YAMLs that grade the shipped uip insights jobs contract against a live tenant, three sidecar Python checkers (two per-task, one shared), all under tests/tasks/uipath-insights/. The existing smoke tasks are untouched.

Change-by-Change Review

1. tests/tasks/uipath-insights/_shared/envelope_check.py

Severity: OK

Well-structured shared module. Key design decisions are sound:

  • CODES dict mirrors the canonical Code strings from jobs.ts — single source of truth for the contract.
  • probe_live_cli (line 113–168) issues a minimal 60-minute window read to distinguish "bad tenant" from "bad artifact" — the timeout hierarchy is correct: LIVE_PROBE_TIMEOUT (45s) < run_command.timeout (60s) < turn_timeout (600s).
  • _error_context (line 63–70) trims to 300 chars per field; probe_live_cli trims stderr to 200 chars (line 141) — both prevent token-bearing URLs from reaching CI logs. Good security practice.
  • has_signal (line 98–110) correctly handles nested structures for data-agnostic validation.
  • process_names (line 171–191) handles the CLI's nested-array column format ([[1]]) gracefully.

2. tests/tasks/uipath-insights/envelope-contract/all_commands_envelope_e2e.yaml

Severity: OK

12 criteria covering all 7 subcommands: 1 skill_triggered, 7 command_executed, 2 file_exists, 1 run_command (weight 5.0), 1 advisory --output json check with pass_threshold: 0. Tags [uipath-insights, e2e, mode:operate, lifecycle:discover] are all valid per the taxonomy. The summary command pattern (line 51) correctly accepts both --time-range 1440 and --started-after with epoch-ms. run_limits overrides (expected_turns: 24, turn_timeout: 600) are reasonable for a focused read-only task. No sandbox or agent block — inherits cleanly from the experiment.

3. tests/tasks/uipath-insights/envelope-contract/check_all_commands_envelope.py

Severity: OK

Clean orchestrator: runs the live probe first (so a tenant rejection names itself before per-file diagnostics), then validates all 7 envelopes. The sys.path.insert pattern (line 22) is consistent with the repo convention used by dozens of other checkers.

4. tests/tasks/uipath-insights/job-health/check_job_health_investigation.py

Severity: OK

The report-grounding logic (line 58–87) is the most interesting part of the PR. The checker validates that the agent's report is tied to real CLI output, not invented prose — when top-failures.json names failing processes, the report must mention at least one of them. Empty-window case is handled correctly: empty_window stays True only when no envelope carries signal, and all envelope failures increment errors so the overall exit is still 1 even though _check_report would be lenient. The REPORT_MIN_CHARS = 120 threshold (line 55) is justified by the comment — compact "no history" reports pass while placeholder output is rejected.

5. tests/tasks/uipath-insights/job-health/job_health_investigation_e2e.yaml

Severity: OK

9 criteria covering the diagnostic investigation journey. Tags [uipath-insights, e2e, mode:diagnose, lifecycle:discover] are valid. The failure-details criterion is correctly weighted higher (2.0) as the deepest drill-down step. The prompt is goal-oriented ("our automations have felt unreliable") rather than prescriptive — lets the skill teach the workflow.

What's Missing

Nothing identified. CODEOWNERS already covers both /skills/uipath-insights/ and /tests/tasks/uipath-insights/. No @uipath/cli in env_packages. No secrets or personal paths. The skill now has 5 smoke tests + 2 e2e tests, meeting the minimum coverage requirement.

Area Ratings

Area Status Notes
Frontmatter N/A No skill frontmatter changed
E2E Tests OK Two well-structured e2e tasks with valid tags, proper criteria weights, and sidecar checkers
Skill Body N/A SKILL.md and references untouched
References & Assets N/A No changes
Repo Hygiene OK No secrets, no @uipath/cli in env_packages, CODEOWNERS already covers the path, sys.path.insert follows repo convention

Issues for Manual Review

  • Tenant entitlement: Both tasks require a tenant that answers uip insights jobs. The PR notes this and the checkers handle it with clear diagnostics, but whether the nightly runner's tenant is entitled for Insights queries is a runtime concern outside code review.
  • CLI Code strings: The CODES dict in envelope_check.py is sourced from cli/packages/insights-tool/src/commands/jobs.ts. If those Code strings change in a future CLI release, the checkers will fail. The author is aware (the docstring cites the source), but there's no automated sync — worth noting for maintenance.

Conclusion

Clean PR. The test design is thoughtful — data-agnostic validation, live probe for early tenant diagnostics, report grounding to prevent invented summaries, and proper timeout hierarchy. Code follows repo conventions throughout. No issues found that would require changes. Approve.


@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Claude finished @celestinryf's task in 5m 0s —— View job


Coder-eval task lint (advisory)

2 task YAMLs changed; verdict counts: 0 Critical, 0 High, 0 Medium, 0 Low, 2 OK.

Rubric: .claude/commands/lint-task.md. This check is advisory and never blocks merge.

Evidence of passing run

  • ✅ Author confirms passing run: "Ran both tasks locally and they passed. Run 2026-08-06_13-34-09skill-insights-all-commands-envelope-e2e 1.000 (12/12 criteria), skill-insights-job-health-investigation-e2e 1.000 (9/9). Four earlier runs also passed at 1.000."

Per-task lint

tests/tasks/uipath-insights/envelope-contract/all_commands_envelope_e2e.yaml — verdict: OK

No issues. Strong criteria mix: 7 command_executed checks verify each subcommand was invoked with a time-range flag, and the run_command checker (weight 5.0) validates all 7 envelope files structurally (Result, Code, Data) plus a live CLI probe. The two file_exists checks (lines 104–114) give partial-credit signal for a subset of files; the checker covers the rest. Filename specification in the prompt (lines 28–31) is a ground-truth anchor — the checker needs exact filenames. Advisory --output json criterion (line 124, pass_threshold: 0) is correctly non-gating.

tests/tasks/uipath-insights/job-health/job_health_investigation_e2e.yaml — verdict: OK

No issues. The prompt asks the agent to write job-health-report.md (line 33), which could trigger the self-report axis — but the checker cross-validates report content against CLI output: when top-failures.json reports failing processes, the report must name one of them (checker lines 78–86). The primary evidence remains the 4 envelope files (validated by the same run_command checker at weight 5.0) and 4 command_executed criteria. The empty-window fallback (120-char minimum, no grounding check) is a deliberate, documented trade-off for the shared tenant's sparse history — not a coverage gap. Investigation-journey shape (summary → top-failures → failures-by-reason → failure-details) is goal-specified, not procedure-prescribed: the prompt names the questions to answer, not the commands to run.

Within-PR duplicates

  • No duplicate clusters detected. The two tasks share 4 subcommands (summary, top-failures, failures-by-reason, failure-details) but test materially different operations: all-commands-envelope is breadth-first mode:operate covering all 7 subcommands with envelope-only validation; job-health-investigation is depth-first mode:diagnose covering 4 subcommands plus a grounded markdown report. Different mode tags, different artifact sets, different checker logic.

Conclusion

  • ✅ All changed tasks pass the rubric. Evidence of passing run confirmed.

@rliuup rliuup left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with nits.

walk(item)

if isinstance(data, dict):
walk(data.get("ProcessName"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (non-blocking): data.get("ProcessName") pins the runtime-payload casing and fails silently — under a camelCase Data this returns [] while has_signal still reports signal, so _check_report skips the grounding branch and the task still scores 1.000 with the report ungraded against CLI output. The repo's existing fix for this class is the case-insensitive _get_ci accessor in uipath-maestro-flow/_shared/flow_check.py; tests/scripts/test_runtime_payload_key_casing.py won't flag it here since it only guards finalStatus/elementExecutions.

- type: command_executed
description: "Agent ran summary with the 24-hour window (or an absolute epoch-ms range)"
tool_name: "Bash"
command_pattern: 'uip\s+insights\s+jobs\s+summary\s.*--(time-range[=\s]+1440|started-after[=\s]+\d{13})'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (non-blocking): .* crosses &&/;/|, so a neighbouring command in the same Bash invocation satisfies the flag — summary --time-range 60 > summary.json && ... completed-timeline --time-range 1440 ... passes this 24-hour-window criterion, and a summary with no time flag at all passes too. [^&;|\n]* (the form #2552 uses, or the lookahead style in uipath-test/link_automation_and_run.yaml) closes both; the 10 sibling patterns across the two YAMLs have the same shape.

@suranabhavya suranabhavya left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants