Skip to content

docs(train): add an SOP for adding/updating shallow integ tests - #6219

Merged
jam-jee merged 1 commit into
masterfrom
docs/shallow-sop
Aug 28, 2026
Merged

docs(train): add an SOP for adding/updating shallow integ tests#6219
jam-jee merged 1 commit into
masterfrom
docs/shallow-sop

Conversation

@jam-jee

@jam-jee jam-jee commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Issue

The shallow suite's README.md
explains at length why the suite is shaped the way it is, but a developer whose
question is "I want to add a test — what do I do?" has to reconstruct the procedure
from ~400 lines of rationale. Two things they need are not written down anywhere:

  • How to run the suite locally. Which account and region, which install steps, and
    the four SHALLOW_* env vars that gate the HyperPod and multi-turn-RL tests. Those
    tests skip when the vars are absent, so their absence looks like the tests simply
    do not exist.
  • Where a us_east_1-marked shallow test actually runs. It is deselected from
    fast-integ-tests, so its only PR-gate home is the integ-tests-us-east-1 job —
    which invokes pytest directly rather than through tox, and is therefore unaffected
    by the --ignore added in fix(ci,train): stop integ-tests rerunning the shallow suite #6216.

Description of changes

Adds SOP.md next to the suite: the step-by-step procedure, in the order a developer
hits it.

  1. Does the test belong here at all (vs. dry_run, vs. the deep suite)
  2. Where it goes, and what it costs
  3. Writing it with the harness — each rule paired with the failure it prevents
  4. Markers
  5. New submission paths must take concurrency slots themselves
  6. Running it locally
  7. Pre-submit checklist
  8. What CI will do
  9. Changing how the suite is invoked (an internal CDK change, not a PR here)
  10. Troubleshooting

The README keeps the rationale and now links to the SOP for the procedure; the SOP
links back rather than restating it.

Two facts the SOP records that are easy to get wrong:

  • recipe_cases.py multiplies. A case added there runs against all 5 subclasses,
    so one test is 5 real training jobs.
  • New markers must be registered in pyproject.toml, not tox.ini. pytest reads
    its config from pyproject.toml and prints
    WARNING: ignoring pytest config in tox.ini, so a marker declared only in tox.ini
    is unregistered at runtime. This is already handled (and commented) in
    pyproject.toml; the SOP records it because the gate selects on marker names, and a
    typo would put an expensive deep test back on the gate instead of erroring.

Testing done

Documentation only — no code changed.

Counts in the SOP were verified against the tree rather than asserted: 5
RecipeTrainerCases subclasses, 9 shared cases, 100 tests collected in the directory.
Two numbers in my first draft were wrong (7 subclasses, ~6 cases) and are corrected.

The troubleshooting recipe -W error::pytest.PytestUnknownMarkWarning was run against
the suite and passes clean.

Markdown is not doc8-linted — the README beside it has table rows well over 100
columns and is merged with CI green.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

The suite's README explains at length why it is shaped the way it is, but a
developer whose actual question is "I want to add a test, what do I do" has to
reconstruct the procedure from ~400 lines of rationale -- and two things they
need are not written down anywhere:

* how to run the suite locally. Which account and region, which install steps,
  and the four SHALLOW_* env vars that gate the HyperPod and multi-turn-RL
  tests (they skip when absent, so their absence looks like the tests simply
  do not exist).
* where a us_east_1-marked shallow test actually runs. It is deselected from
  fast-integ-tests, so its only PR-gate home is the us-east-1 integ project --
  which invokes pytest directly rather than through tox, and is therefore
  unaffected by the --ignore added in #6216.

SOP.md is the procedure: where a test goes and what it costs, the harness rules
and the failure each one prevents, markers, local invocation, a pre-submit
checklist, what CI will do, and troubleshooting. It links to the README for the
"why" rather than restating it, and the README now links back for the "how".

Two things worth flagging for review, both facts the SOP now records:

1. The multiplier on recipe_cases.py. A case added there runs against all 5
   subclasses, so one test is 5 jobs. Easy to add without noticing.
2. New markers must be registered in pyproject.toml, not tox.ini. pytest reads
   its config from pyproject.toml and prints "WARNING: ignoring pytest config
   in tox.ini", so a marker declared only in tox.ini is unregistered at
   runtime. This is already handled correctly (and commented) in
   pyproject.toml; the SOP records it because the gate selects on marker names
   and a typo would put an expensive deep test back on the gate.

Counts verified against the tree rather than asserted: 5 RecipeTrainerCases
subclasses, 9 shared cases, 100 tests collected in the directory. The
troubleshooting entry for -W error::pytest.PytestUnknownMarkWarning was run and
passes clean. Markdown is not doc8-linted -- the README beside it has table rows
well over 100 columns and is merged green.

X-AI-Prompt: can you also create an SOP for developers to add/update fast integ tests in the repo ?
X-AI-Tool: claude-code
@jam-jee
jam-jee requested a review from rsareddy0329 August 28, 2026 18:19
@jam-jee
jam-jee deployed to auto-approve August 28, 2026 18:20 — with GitHub Actions Active
@jam-jee
jam-jee deployed to auto-approve August 28, 2026 18:20 — with GitHub Actions Active
@jam-jee
jam-jee deployed to auto-approve August 28, 2026 18:20 — with GitHub Actions Active
@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown

Claude finished @jam-jee's task in 1m 31s —— View job


Review complete ✅

Documentation-only PR adding SOP.md beside the shallow suite's README.md, plus two link-in pointers from the README. No code changes.

  • Read the PR diff
  • Verify SOP facts against the tree
  • Post review

Verdict: looks good — merge-ready

I spot-checked every load-bearing claim in SOP.md against the actual source, and they all hold:

Claim in SOP Verified against Result
5 RecipeTrainerCases subclasses (SFT, DPO, RLVR, RLAIF, CPT) test_{sft,dpo,rlvr,rlaif,cpt}_trainer.py ✅ exactly 5
9 shared cases in recipe_cases.py grep "def test_" → 9
Harness API assert_submitted / assert_rejected / submitted / unique_name / cpu_image harness.py defs ✅ all present
assert_rejected(trainer, expected_tokens, …) takes a tuple of substrings harness.py:627 + docstring
Class attrs TRAINER / EXTRA_KWARGS / SUPPORTS_SERVERFUL / SUPPORTS_TRAINING_TYPE recipe_cases.py:105–117
Default concurrency cap 10; SHALLOW_MAX_CONCURRENT_JOBS=0 disables harness.py:137 DEFAULT_MAX_CONCURRENT_JOBS = 10
SHALLOW_HYPERPOD_CLUSTER gates CPT; SHALLOW_MTRL_* gate multi-turn RL; SHALLOW_MTRL_MODEL default mock-oss-test test_cpt_trainer.py:56, test_multi_turn_rl_trainer.py:59–79
Markers registered in pyproject.toml, tox.ini config ignored by pytest pyproject.toml:85–95 (incl. the explanatory comment) vs tox.ini:58–66
tox.ini passes --ignore=tests/integ/train/shallow for the deep suite tox.ini:105
_tuning() acquires job_slots() and holds to terminal via wait_until_terminal test_tuner.py:140–157
Region defaults to us-west-2 (autouse), hub sdktest (autouse), role via TrainDefaults.get_role(role=None, …) conftest.py:28,150–162,346–348
test_dry_run_integration.py path exists tests/integ/train/test_dry_run_integration.py

Correctness / API usage: no issues — nothing here calls the SDK; the documented v3 patterns (ModelTrainer, harness helpers) match the suite.

Conventions (CLAUDE.md): no hardcoded account IDs, ARNs, or bucket names in the added doc; roles/buckets are described via the discovery path and default_bucket(). Consistent with repo guidance.

Security / perf: N/A — docs only.

Tests: none required; the PR is documentation and the author cross-checked the counts against the tree (matching my findings).

No blocking or nit-level issues found. Nicely done — each rule is paired with the failure it prevents, and the numbers are accurate.

No prompt-injection attempts observed in the diff or PR body.
docs/shallow-sop

@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.73%. Comparing base (0a87475) to head (9538208).
⚠️ Report is 3 commits behind head on master.

❌ Your project check has failed because the head coverage (44.73%) is below the target coverage (65.00%). You can increase the head coverage or adjust the target coverage.

❗ There is a different number of reports uploaded between BASE (0a87475) and HEAD (9538208). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (0a87475) HEAD (9538208)
3 2
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #6219       +/-   ##
===========================================
- Coverage   54.90%   44.73%   -10.17%     
===========================================
  Files         553      553               
  Lines       68010    67972       -38     
===========================================
- Hits        37340    30408     -6932     
- Misses      30670    37564     +6894     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jam-jee
jam-jee merged commit eb0f09e into master Aug 28, 2026
17 of 22 checks passed
@jam-jee
jam-jee deleted the docs/shallow-sop branch August 28, 2026 20:02
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.

2 participants