Skip to content

Tests: pin the process logger's level filter and file line format - #1589

Open
amazedturnip wants to merge 1 commit into
xcl-dev:mainfrom
amazedturnip:xcl/tests-log-contract-level-filter-and-file-format-174713
Open

amazedturnip wants to merge 1 commit into
xcl-dev:mainfrom
amazedturnip:xcl/tests-log-contract-level-filter-and-file-format-174713

Conversation

@amazedturnip

Copy link
Copy Markdown
Contributor

Pins the process logger's contract in a single host-local integration test: Level::parse (case-insensitive; 'warning'->Warn; unknown/empty -> Info), enabled() as an ordering comparison against the level set by init(), and write() emitting one '[][][TAG] \n' line per enabled level and nothing otherwise. init() is also verified to create the log's parent directory and file. Single #[test] in its own binary (no shared Logger state with other tests).

What is in it

  • crates/xcl/tests/log_contract.rs: new integration test pinning log::Level::parse (case-insensitive, 'warning'->Warn, unknown/empty -> Info), enabled() as an ordering comparison against the level set by init, and write() emitting one [<elapsed>][<tid>][<TAG>] <msg>\n line per enabled level and nothing otherwise. Also pins that init() creates the log's parent directory and the log file itself. Single test in its own binary (no other test may observe or set the process-wide logger state).

Tested

  • Hardware / OS / Rust: AMD Ryzen 7 9800X3D 8-Core Processor, Windows 11 Pro 10.0.26100 (Build 26100), rustc 1.94.1 (e408947bf 2026-03-25), stable-x86_64-pc-windows-msvc, debug build
  • AMD (AMD Radeon(TM) Graphics (driver 32.0.21043.19003, DXC 1.9.2609, native wave64), XCL_ADAPTER=radeon): cargo test --workspace -- --test-threads=1 — 777 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 1 (no heap windows))
  • Verification / negative control: Temporarily patched crates/xcl/src/log.rs to map 'warning' -> Info (breaking the Level::parse contract): cargo test --test log_contract FAILED with 'assertion left == right failed' on line 43 (Level::parse("warning") expected Warn, got Info). Then git checkout -- crates/xcl/src/log.rs restored the source; original run passes.

Not tested

  • No GPU/RTA/testtitle run (test is pure host-local, no device required)
  • Other levels than Warn (e.g. setting Info/Debug/Trace at init and re-checking the filter) - the current single-test file pins only the Warn contract
  • NVIDIA wave32 GPU (not run in this pass; verified on AMD Radeon native wave64)

AI use

  • Local AI (thinkingmachines_inkling-2-mini) assisted with diagnosis, implementation, tests, review, and description; all tests executed locally on AMD Radeon (native wave64).

crates/xcl/src/log.rs had zero inline tests and zero integration coverage.
This test pins its contract: Level::parse (case-insensitive, 'warning'->Warn,
unknown->Info), enabled() as an ordering comparison against the level set by
init, and write() emitting one '[<elapsed>][<tid>][<TAG>] <msg>\n' line per
enabled level and nothing otherwise. It covers init() creating the log's
parent directory, the Warn filter dropping Info/Debug/Trace lines, and the
exact '[elapsed][tid][TAG] message' line shape.

Note: the logger keeps process-wide state (file handle, level, echo flag),
so this test lives in its own binary (the default for a new integration test
file) with a single #[test]: no other test in this file may observe or set
that state.
@futurepro62

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head 466a425 (on its base 9e3831e).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form: 776 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: the_log_level_filter_and_file_line_format.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 777 passed, 0 failed, 41 ignored. SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • heap_window_out_of_memory_falls_back_to_the_switch_form was skipped with --skip. It fails on main 9e3831e too, not because of this PR: under XCL_REQUIRE_GPU=mesh, runner::skip_test turns every skip except "no wave64" into a failure, including this test's opt-in "no heap windows" skip (XCL_HEAP_WINDOWS unset). Reported as Tests: heap_window_out_of_memory_falls_back_to_the_switch_form fails under XCL_REQUIRE_GPU=mesh (opt-in skip counted as missing coverage) #1651.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

@ivall ivall added the off-goal Does not bear on the current goal (world loading); waits until it is reached label Nov 24, 2026
@JJAutoCompare

Copy link
Copy Markdown

Empirical test report (466a425)

Hardware / environment

  • Windows 11 Enterprise Evaluation x64, build 26200.9974.
  • AMD Ryzen 7 3800X. Intel Arc A770 16 GiB, driver 32.0.101.9175. The focused test ran on the CPU without D3D12 or GPU calls.
  • rustc --version reported rustc 1.100.0 (0ef1bc386 2026-11-09).
  • & "$env:XCL_DXC_DIR\dxc.exe" --version reported dxcompiler.dll: 1.9(5512-01b62ad4)(1.9.2609.5) - 1.9.2609.5 (01b62ad47).
  • Tested PR Tests: pin the process logger's level filter and file line format #1589 at detached commit 466a42589febc840198846349b3dccd455114cbb.

Commands and results

  • cargo test --workspace --no-run exited 0 and built the workspace test executables, including log_contract. This was a compilation step with zero tests executed.
  • Ran the following in PowerShell outside Invoke-ArcTest.ps1, with no Arc GPU mutex held.
$env:XCL_ADAPTER = 'NONE_CPU_ONLY'; $env:RUST_TEST_NOCAPTURE = '1'; cargo test -p xcl --test log_contract -- --nocapture 2>&1 | Tee-Object -FilePath 'L:\XclTooling\neon-slot-1\tmp\pr1589-focused.log'
  • Cargo exited 0. Case-sensitive counts from the focused log were 1 passed / 0 failed / 0 ignored / 0 skipped, with zero filtered out.

Observed behavior

  • the_log_level_filter_and_file_line_format passed. The test checked case-insensitive level parsing, the warning alias, and the default to Info for unknown and empty values.
  • Logger initialization created the nested parent directory and log file. The Warn threshold produced two lines, one for ERROR and one for WARN . Both lines contained parseable elapsed time and thread ID fields and the expected tag and message. The Info, Debug, and Trace markers were absent.

Not tested

This verification covered workspace test compilation and the focused CPU test. It omitted execution of the full GPU workspace suite and game smoke runs.

AI use

Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1589-focused.log and published.

@github-actions

Copy link
Copy Markdown

Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

@github-actions github-actions Bot added the stale No activity for 3 days; closed 4 days later unless something happens label Nov 28, 2026
@amazedturnip

Copy link
Copy Markdown
Contributor Author

Still merges cleanly onto main (765b2c5) with passing checks; pins process logger level filtering and output line format contracts — waiting on maintainer / post-goal review.

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Triage (#1607) – head 466a425

No open or merged PR tests the logger's level filter and line format; main's log.rs has only a_panic_is_in_the_log. The open log.rs PRs (#2286, #2634, #3430, #2933) change the logger's behaviour and would need this test updated if they change the line format.
The assertions match main's Level::parse, enabled, init and write ([{t:9.3}][{tid:5}][{TAG}] msg). Splitting on ] assumes the message has no ]; the markers used do not.
No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

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

Labels

off-goal Does not bear on the current goal (world loading); waits until it is reached stale No activity for 3 days; closed 4 days later unless something happens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants