Skip to content

[TRTLLM-17556][test] Run every harmony parsing unit test in the CPU stage - #21411

Merged
JunyiXu-nv merged 1 commit into
NVIDIA:mainfrom
JunyiXu-nv:dev-junyix-feat-serve-harmony-test-registration
Nov 2, 2026
Merged

JunyiXu-nv merged 1 commit into
NVIDIA:mainfrom
JunyiXu-nv:dev-junyix-feat-serve-harmony-test-registration

Conversation

@JunyiXu-nv

@JunyiXu-nv JunyiXu-nv commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Dev Engineer Review

The change replaces the class-level entry in tests/integration/test_lists/test-db/l0_cpu.yml with a file-level entry for unittest/llmapi/apps/test_harmony_parsing.py. This registers the test file without changing production code or test code. Review finding counts are unavailable.

QA Engineer Review

Only the CPU test-list file changed. The entry now selects the entire test file instead of only TestStripIncompleteMessagesReporting. The objectives report 56 tests collected and passing locally; CPU-stage CI confirmation is not available here. Coverage verdict: needs follow-up until CI confirms the tests run in the intended stages.

Per-File QA Perspective

  • tests/integration/test_lists/test-db/l0_cpu.yml: The file-level entry adds test_harmony_parsing.py to the CPU test list. Verify that the intended CPU stages run the complete file.

Description

tests/unittest/llmapi/apps/test_harmony_parsing.py has 55 test functions (56 collected items), but the CPU test list registered only its TestStripIncompleteMessagesReporting class (6 functions, 7 items), so 49 functions had never run in CI: streaming and non-streaming tool calls on the analysis channel, non-functions recipients, reasoning_content, stream metadata, remaining tokens on done, delta merging, cached tokens in usage info, and stream_options. This PR replaces the class-level node id in l0_cpu.yml with a file-level entry, so the whole file runs in the CPU stages (CPU-Generic-x86-1/2, CPU-Generic-arm-1/2).

With this change, harmony unit plus end-to-end coverage in CI goes from 38 of 87 test functions (this file's 6 registered functions (7 items), the 23 channel-validation tests, and the 9 gpt-oss end-to-end tests in l0_h100.yml) to 87 of 87.

All 49 newly registered tests pass locally against current main with no test change needed (run and results under Test Coverage). Note for reviewers of future harmony renames — the file's try/except ImportError guard has two failure modes: a break in the first guarded import statement (the harmony_adapter names) fails collection loudly, because a module-level type annotation still references HarmonyStreamState; a break in any later guarded import (the openai_protocol, openai_server or postprocess_handlers names) skips all 56 tests with "harmony_adapter not importable" and the CPU stage stays green. So a green stage alone does not prove the tests ran — run with -rs and check for that skip reason, or count the collected items in the stage log. That is also why this registration comes first: later serve-refactor changes rename exactly the symbols this file imports, and CI should fail loudly, not skip silently, when one of them breaks.

This is preparation for the trtllm-serve refactor (epic TRTLLM-17056): the newly running tests pin exactly the behaviors that the planned change routing gpt-oss through the standard OpenAI chat handler will touch.

Coordination with open PRs touching this file (no action needed whichever merges first):

Behavior

No behavior change. Production code is not touched; no test file is modified. The only effect is that 49 existing unit tests start running in the CPU pre-merge stages.

CI bookkeeping

  • Test lists: tests/integration/test_lists/test-db/l0_cpu.yml line 260 — class-level node id replaced by the file-level entry unittest/llmapi/apps/test_harmony_parsing.py (block stays alphabetical).
  • Multi-GPU trigger table: none. CODEOWNERS: none. legacy-files.txt: none (no Python file changes).

Test Coverage

No new test; the PR's effect is that 49 existing functions start running in CI. Everything below was run on this branch (base main at a9be700) with tensorrt_llm 1.4.0rc3 and openai_harmony installed, LLM_MODELS_ROOT pointing at a root containing datasets/tiktoken_vocab/o200k_base.tiktoken:

  • LLM_MODELS_ROOT=$HOME/llm-models-ci pytest -m cpu_only -rs tests/unittest/llmapi/apps/test_harmony_parsing.py → 56 passed, 0 skipped, 0 failed; no "harmony_adapter not importable" skip, no other skip line.
  • Same command over this file plus test_harmony_channel_validation.py → 79 passed (56 + 23), 0 skipped; no "not importable" and no "not available in this version" skip lines.
  • pytest -m cpu_only --collect-only -q tests/unittest/llmapi/apps/test_harmony_parsing.py → 56 tests collected (55 functions; one is parametrized into 2 items).
  • Static import-guard check: each of the 11 try-imported names (HarmonyAdapter, HarmonyStreamState, _create_response_message, _create_usage_info, get_harmony_adapter, handle_streaming_response, StreamOptions, _logit_bias_to_embedding_bias, OpenAIServer, ChatCompletionPostprocArgs, chat_harmony_streaming_post_processor) is defined in its module on main (git show origin/main:tensorrt_llm/serve/<module>.py | grep -c -E "^(async )?(def|class) <name>\b" → 1 for each), so the module is not being skipped today.
  • python scripts/check_test_list.py --validate → OK, 2087 unique test entries validated.
  • python scripts/check_test_list.py --l0 → passes.
  • python scripts/test_to_stage_mapping.py --tests "unittest/llmapi/apps/test_harmony_parsing.py" → CPU-Generic-arm-1, CPU-Generic-arm-2, CPU-Generic-x86-1, CPU-Generic-x86-2.
  • grep -c "pytest.mark.cpu_only" tests/unittest/llmapi/apps/test_harmony_parsing.py → 1. The stage passes a file-level entry's path to pytest directly, so what keeps the entry honest is the real cpu_only mark under -m cpu_only (an unmarked module would have every test deselected) together with pytest exiting with code 5 when nothing is selected, which fails the stage loudly.
  • Wider serve CPU suites: pytest -m cpu_only tests/unittest/llmapi/apps tests/unittest/disaggregated -q → 3676 passed, 4 failed, 1 skipped, 2 xfailed. The 4 failures are local-environment artifacts, not related to this change (which touches no Python): test_render_standalone.py::TestCpuOnlyStartup::test_the_launcher_loads_a_cuda_stub_only_when_the_driver_is_missing shells out to the trtllm-render console script and passes once the script is on PATH; the three test_cluster_storage.py::TestEtcdClusterStorage::test_watch* tests are timing-sensitive and pass or fail non-deterministically on the shared box used for the run (each passed in at least one re-run).
  • pytest tests/unittest/api_stability -q → 64 passed.

To confirm in this PR's CI: the CPU stage logs show test_harmony_parsing.py with 56 items run and passed (not a smaller count, which would mean a silent collection gap).

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

🤖 Generated with Claude Code

…tage

tests/unittest/llmapi/apps/test_harmony_parsing.py has 55 test functions
(56 collected items), but the CPU test list registered only its
TestStripIncompleteMessagesReporting class, so 49 of them (tool calls on
the analysis channel, reasoning_content, delta merging, usage info and
stream options) never ran in CI. Replace the class-level node id in
l0_cpu.yml with a file-level entry so the whole file runs in the CPU
stages.

The whole file passes locally against current main: 56 passed, 0 skipped,
0 failed, with no test skipped as "harmony_adapter not importable".

Signed-off-by: JunyiXu-nv <219237550+JunyiXu-nv@users.noreply.github.com>
@JunyiXu-nv
JunyiXu-nv requested review from a team as code owners November 2, 2026 05:11
@JunyiXu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run

@coderabbitai

coderabbitai Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 1989cf4 and 30c7e36.

Files selected for processing: 1
  • tests/integration/test_lists/test-db/l0_cpu.yml

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Walkthrough

The CPU integration test list now registers the full test_harmony_parsing.py file instead of only TestStripIncompleteMessagesReporting.

Changes

CPU Harmony test registration

Layer / File(s) Summary
Register the full test file
tests/integration/test_lists/test-db/l0_cpu.yml
The test list entry now selects all tests in test_harmony_parsing.py instead of selecting only TestStripIncompleteMessagesReporting.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: litaotju

Merge Risk: Minimal · up to 30c7e

No merge-blocking issue was identified in this test-registration change.

Pre-merge checks: Passed 5
Check name Status Explanation
Description check Passed The description includes the required Description, Test Coverage, and PR Checklist sections. It clearly explains the issue, the file-level test-list change, expected coverage, validation commands, res…
Title check Passed The title clearly identifies the ticket, test-related change, and primary objective: running all harmony parsing unit tests in the CPU stage.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes the required Description, Test Coverage, and PR Checklist sections. It clearly explains the issue, the file-level test-list change, expected coverage, validation commands, results, and the absence of production behavior changes.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #81910 [ run ] triggered by Bot. Commit: 30c7e36 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #81910 [ run ] completed with state SUCCESS. Commit: 30c7e36
/LLM/main/L0_MergeRequest_PR pipeline #67558 completed with status: 'SUCCESS'

CI Report

Link to invocation

@brnguyen2 brnguyen2 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.

Approving — the comments below are optional touch-ups, not blockers.

This adds the whole file with no other changes. One optional follow-up: your description says a break in a later guarded import skips all 56 tests while the stage stays green (test_harmony_parsing.py:49-55). The upcoming serve refactor renames exactly those symbols, so that silent skip is the most likely way this coverage gets lost again. Consider either dropping the try/except (these are in-tree imports, so a failure should break collection) or narrowing it to the one optional dependency it is meant to guard. Then CI fails on a rename instead of skipping the tests.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

Automatically added "ci: full pre-merge approved" because this PR has satisfied the required GitHub review approvals. Unresolved review conversations and other required checks remain independent merge requirements.

@JunyiXu-nv
JunyiXu-nv merged commit 25e52e9 into NVIDIA:main Nov 2, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants