Skip to content

refactor: move the session conformance helpers next to what they test - #5233

Merged
ananthsub merged 1 commit into
mainfrom
ananthsub/layout-testing
Nov 3, 2026
Merged

ananthsub merged 1 commit into
mainfrom
ananthsub/layout-testing

Conversation

@ananthsub

@ananthsub ananthsub commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Dissolves the top-level nemo_gym/testing/ package. It held two conformance helpers that server and agent tests use to check a session's contract. Each now sits next to what it tests, which its imports already allowed:

Old path New path Imports
nemo_gym/testing/session_conformance.py nemo_gym/server_runtime/testing/session_conformance.py core, server_runtime
nemo_gym/testing/agent_session_conformance.py nemo_gym/agents/testing/agent_session_conformance.py agents

harness_capabilities, the proposal's other testing/ module, moved to rollouts/ in #5231: it imports the rollout health code and nothing in the library imports it.

Where this PR sits

The stack lands bottom-up; each PR's base is the branch of the PR before it, so each diff shows only that PR's change.

flowchart LR
  compat["#5167<br/>Old import paths<br/>keep working"]
  linter["#5168<br/>import-linter<br/>layer contract"]
  prep["#5169<br/>Remove path and<br/>name couplings"]
  config["#5189<br/>Move config/"]
  utils["#5195<br/>Move utils/"]
  core["#5203<br/>Move core/"]
  client["#5206<br/>Move client/,<br/>start telemetry/"]
  trajectory["#5209<br/>Move trajectory/"]
  verification["#5210<br/>Move verification/"]
  metrics["#5211<br/>Move metrics/"]
  artifacts["#5212<br/>Move artifacts/"]
  srmods["#5214<br/>Move server_runtime/<br/>modules"]
  su["#5215<br/>Split server_utils"]
  model["#5224<br/>Move models/<br/>modules"]
  modelbase["#5225<br/>Split model<br/>call capture"]
  agents["#5228<br/>Move agents/"]
  data["#5229<br/>Move data/"]
  harbor["#5230<br/>Split the<br/>Harbor task CLI"]
  rollouts["#5231<br/>Move rollouts/"]
  rsplit["#5232<br/>Split the<br/>rollout collector"]
  testing["#5233<br/>Dissolve testing/"]
  orch["#5234<br/>Move orchestration/<br/>modules"]
  sup["#5235<br/>Split the<br/>server supervisor"]
  eval["#5244<br/>Move eval/"]
  env["#5298<br/>Move environment/<br/>registries"]
  cli["#5300<br/>Retire the<br/>cli_setup_command shim"]
  docs["#5385<br/>Describe the<br/>package layout"]
  owners["next<br/>CODEOWNERS:<br/>per-package groups"]
  remove["0.10.0<br/>Remove the<br/>old paths"]
  compat --> linter
  linter --> prep
  prep --> config
  config --> utils
  utils --> core
  core --> client
  client --> trajectory
  trajectory --> verification
  verification --> metrics
  metrics --> artifacts
  artifacts --> srmods
  srmods --> su
  su --> model
  model --> modelbase
  modelbase --> agents
  agents --> data
  data --> harbor
  harbor --> rollouts
  rollouts --> rsplit
  rsplit --> testing
  testing --> orch
  orch --> sup
  sup --> eval
  eval --> env
  env --> cli
  cli --> docs
  docs --> owners
  owners --> remove
  classDef this fill:#fde68a,stroke:#b45309,stroke-width:2px,color:#1f2937
  classDef later fill:#f3f4f6,stroke:#9ca3af,color:#4b5563,stroke-dasharray: 4 3
  class testing this
  class owners,remove later
Loading

How to review

One commit. Its changes:

  1. Renames only. Each testing/ subpackage gets the old package's __init__.py docstring ("Import them from tests, not from server code").
  2. Everything else: nemo_gym.testing is recorded as moved to server_runtime/testing with a longer entry for the agent helper, references are rewritten by scripts/migrate_imports.py, the contract loses its testing layer, and fern/docs.yml redirects the old library reference pages.

Public API

Every layout package that exists after this PR has a lazy public API in its __init__.py: the names code outside nemo_gym/ imports from it (servers and their tests, benchmarks, scripts, and code samples in docs and skills), plus every name it already exported, each served from the submodule that defines it on first use. Code outside nemo_gym/ and its tests (servers and their tests, benchmarks, scripts, and docs) imports those names from nemo_gym.<package>, so later moves inside a package leave it alone. Code inside nemo_gym/, and the library's tests under tests/, import from the module that defines each name, so the import-linter contract sees every dependency and a test reads what it patches. A patch target names the module the code under test looks the name up in. AGENTS.md states the rule.

Validation

  • pytest -n 16 tests/unit_tests, also with -W error for the old paths. The only failures are environment-specific and unrelated to the move, as in the other PRs.
  • The simple agent tests, which use the agent helper.
  • lint-imports; pre-commit run on the changed files.
  • Server and agent tests run in CI.

Rollout evidence: N/A. The helpers move unchanged.

Compatibility

  • nemo_gym.testing, nemo_gym.testing.session_conformance, and nemo_gym.testing.agent_session_conformance work until 0.10.0, with one warning each.
  • Open branches: run python scripts/migrate_imports.py <paths>.

Issue

Part of #5166.

@ananthsub
ananthsub added this pull request to stack #5170 October 28, 2026 22:41
@copy-pr-bot

copy-pr-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@ananthsub ananthsub changed the title ananthsub/layout testing refactor: move the session conformance helpers next to what they test Oct 28, 2026
@ananthsub ananthsub added the feature New capabilities, enhancements, or enablement work label Oct 28, 2026
@ananthsub
ananthsub requested a review from yaoyu-33 October 28, 2026 22:42
@ananthsub ananthsub added area:core Shared APIs, servers, telemetry, health, and registries needs-review PR is ready for code review and waiting on a reviewer labels Oct 28, 2026
@ananthsub
ananthsub marked this pull request as ready for review October 28, 2026 22:42
@ananthsub
ananthsub requested a review from a team as a code owner October 28, 2026 22:42
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 28, 2026 22:42
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

@ananthsub
ananthsub force-pushed the ananthsub/layout-testing branch from c95acde to 01324ae Compare October 29, 2026 15:51
@ananthsub
ananthsub removed this pull request from stack #5170 October 29, 2026 15:55
@ananthsub
ananthsub added this pull request to stack #5319 October 29, 2026 15:56
@ananthsub
ananthsub force-pushed the ananthsub/layout-testing branch from 01324ae to 65da242 Compare October 29, 2026 16:27
@ananthsub
ananthsub force-pushed the ananthsub/layout-testing branch from 65da242 to 396edff Compare October 29, 2026 16:45
@ananthsub
ananthsub force-pushed the ananthsub/layout-testing branch from 396edff to 72ca5e5 Compare October 29, 2026 17:01
@ananthsub
ananthsub force-pushed the ananthsub/layout-testing branch from 72ca5e5 to 34c8c5a Compare October 29, 2026 18:25
testing/session_conformance.py moves to server_runtime/testing/ with the
package's __init__.py, and testing/agent_session_conformance.py to
agents/testing/, which gets a copy of that __init__.py.

Record nemo_gym.testing as moved to server_runtime/testing, with a
longer entry for the agent helper, rewrite in-repo references with
scripts/migrate_imports.py, drop the contract's testing layer, and
redirect the old library reference pages in fern/docs.yml.

Regenerate the public API of each layout package that exists here from
what non-test code outside nemo_gym imports, and point code outside
nemo_gym, tests included, at nemo_gym.<package>.

Signed-off-by: Ananth Subramaniam <[email protected]>

This branch was previously deployed

1 inactive deployment
public — 0e2d6aa9 Deployed Nov 3, 2026 by copy-pr-bot[bot] via release / finalize / notify #9597
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core Shared APIs, servers, telemetry, health, and registries feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant