Skip to content

refactor(nightly): extract shared workload verification helpers for simple and clickhouse tests - #1064

Merged
janzak-dev merged 4 commits into
mainfrom
refactor/nightly-common-verifier-extraction
Oct 6, 2026
Merged

janzak-dev merged 4 commits into
mainfrom
refactor/nightly-common-verifier-extraction

Conversation

@janzak-dev

@janzak-dev janzak-dev commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Refactors the two preexisting nightly E2E verifier scripts (tools/nightly_tests/simple_job_verify.py and tools/nightly_tests/clickhouse_metrics_job_verify.py) and extracts only the shared workload verification primitives they use into tools/nightly_tests/common.py and tools/nightly_tests/xmc_entities_validator.py.

Stack Context (GitHub Stack #1065)

Motivation & Context

Previously, simple_job_verify.py (131 lines) and clickhouse_metrics_job_verify.py (167 lines) duplicated experiment validation, work unit validation, jobset container topology validation, ClickHouse endpoint resolution, and dashboard hydration assertions. Extracting these shared step runners into common.py and enhancing xmc_entities_validator.py reduces both scripts to declarative ~60-line specifications and provides a clean foundation for subsequent verifiers.

Key Changes

  • tools/nightly_tests/common.py & tools/nightly_tests/common_test.py:
    • Added assert_experiment, assert_work_units, assert_work_unit_jobsets, assert_clickhouse_metrics, assert_dashboard_chart_data, _print_workload_banner, _print_workload_summary, and verify_standard_workload (plus a module-level TODO(xmc) tracking the follow-up split of common.py into focused helper modules once this stack lands).
    • Contains strictly the helpers used by simple_job_verify.py and clickhouse_metrics_job_verify.py (artifact helpers are deferred to Layer 2 where artifact verifiers are introduced).
  • tools/nightly_tests/xmc_entities_validator.py & tools/nightly_tests/xmc_entities_validator_test.py:
    • Added public validate_work_unit_jobsets to encapsulate WorkUnit JobSet container topology inspection inside the validator module without cross-module calls to private _fetch_raw_work_units or _validate_jobset_containers.
    • Extracted _log_and_check_clickhouse_metrics and _verify_single_chart_data so _verify_dashboard_and_chart_data_once verifies all charts on a dashboard when expected_chart_id is omitted while keeping all functions $\le 30$ lines.
  • tools/nightly_tests/simple_job_verify.py & tools/nightly_tests/clickhouse_metrics_job_verify.py:
    • Refactored to delegate standard workload checks to common.verify_standard_workload, common.assert_clickhouse_metrics, and common.assert_dashboard_chart_data.

Verification & Testing

  • Live Nightly Examples E2E Run: GitHub Actions Run #37292133824 (at commit 5e8f128c) passed 100% green across all jobs:
    • Build Example Container Images: ✅ success (19s)
    • Run & Verify: Simple Job (3 Multi-Unit Batch) (simple_job_verify.py): ✅ success (2m20s)
    • Run & Verify: ClickHouse Metrics Job (clickhouse_metrics_job_verify.py): ✅ success (1m18s)
    • Aggregate Examples Results: ✅ success (7s)
  • Unit tests: bazel test //tools/nightly_tests/... (all 4 test targets pass, including stub-boundary tests for verify_standard_workload and subTest branch coverage for assert_dashboard_chart_data).
  • Pre-commit hooks: ./.githooks/pre-commit passed cleanly.

TAG=agy
CONV=acf882de-1561-404c-ba2e-ae0940451165

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request refactors the nightly test verification scripts by consolidating common validation logic into a unified verify_standard_workload function and extracting helper assertion functions to common.py, supported by new unit tests. Feedback on the changes highlights two key areas: first, in verify_standard_workload, the default fallback for workers should include all job names from expected_jobs rather than just the first one to prevent ignoring other jobs in multi-job workloads; second, the updated dashboard validation now strictly verifies all associated charts, which may lead to unexpected failures if any optional charts are empty.

Comment thread tools/nightly_tests/common.py Resolved
@janzak-dev
janzak-dev marked this pull request as ready for review October 5, 2026 10:03
@github-actions
github-actions Bot requested a review from VLukiantsev October 5, 2026 10:04
@janzak-dev janzak-dev added the priority::2-high top of mind. should not wait. label Oct 5, 2026
Comment thread tools/nightly_tests/common.py Resolved
Comment thread tools/nightly_tests/common.py Resolved
Comment thread tools/nightly_tests/common.py Resolved
Comment thread tools/nightly_tests/common.py Resolved
Comment thread tools/nightly_tests/common.py Resolved
Comment thread tools/nightly_tests/common_test.py Resolved
Comment thread tools/nightly_tests/common.py Resolved
Comment thread tools/nightly_tests/common.py Resolved
Comment thread tools/nightly_tests/common.py Resolved
Comment thread tools/nightly_tests/common.py Resolved
@VLukiantsev

Copy link
Copy Markdown
Collaborator

PR description reconciliation

The description lists _format_container_summary and _resolve_target_work_unit as added to tools/nightly_tests/common.py, but neither exists anywhere at head 5e8f128c (likely moved to #1057). The "refactor" framing also doesn't disclose two semantic changes raised inline:

  • Work-unit count for the ClickHouse verifier is now overridable by --expected_work_units / NUM_WORK_UNITS (previously pinned to 1).
  • Dashboard strictness is now inferred from XMANAGER_UI_URL.

Could you update the description to match the actual diff (and call out those behavior changes if they're intentional)?

- Add public validate_work_unit_jobsets in xmc_entities_validator and
  delegate common.assert_work_unit_jobsets to it.
- Pin WorkUnit count in verify_standard_workload to len(workers) so
  NUM_WORK_UNITS in the environment does not inflate single-unit checks.
- Drop unused strict_required parameter and XMANAGER_UI_URL strictness
  inference from assert_dashboard_chart_data.
- Unpack tuple-packed assignments, restore timeout duration in dashboard
  hydration error message, and restore WorkUnits/Workers/Timeout/Title
  fields in banner and summary output.
- Document follow-up responsibility split TODO in common.py docstring and
  expand stub-boundary and strictness unit tests.
@janzak-dev
janzak-dev requested a review from VLukiantsev October 5, 2026 12:20
Comment thread tools/nightly_tests/common.py Resolved
@janzak-dev
janzak-dev requested a review from VLukiantsev October 6, 2026 08:10

@VLukiantsev VLukiantsev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. All review threads addressed and verified at 8af88d69; CI green. Reminder: please track the common.py split TODO in a follow-up issue once the stack lands.

@janzak-dev
janzak-dev added this pull request to the merge queue Oct 6, 2026
Merged via the queue into main with commit 779479f Oct 6, 2026
11 checks passed
@janzak-dev
janzak-dev deleted the refactor/nightly-common-verifier-extraction branch October 6, 2026 10:12
janzak-dev added a commit that referenced this pull request Oct 7, 2026
Split tools/nightly_tests/common.py and common_test.py into five
domain-focused modules with 1-to-1 unit test files and remove common.py:
- verifier_cli.py: CLI flags, parsing helpers, and run_main entrypoint
- endpoint_resolution.py: ESS, Dashboard, ClickHouse, and UI URL resolvers
- ess_session.py: ESS gRPC channel context manager and error decorator
- verification_report.py: console banner and success summary formatters
- workload_verification.py: standard and dashboard workload orchestrators

Update all nightly verifier binaries, BUILD.bazel targets, and workflow
comments to import the new domain modules directly.

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

Labels

priority::2-high top of mind. should not wait.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants