startup: add -TraceApi to the PowerShell launcher #2346
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2354"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T13:25:11Z.
Closes #2351.
run.ps1 -TraceApienables the existing method-levelx2w-apilog in the child environment. A caller who already exportedX2W_TRACE_APIcan continue using it. The startup guide distinguishes this switch from-TraceCallsand identifies the provider registration line that confirms a provider was wrapped when method logging is off.I extended the registered
startup_run_ps1test. Its synthetic child records the environment value next to the debugger arguments, so each default run also checks that the variable is absent. The ordinary-TraceCallscase checks the debugger arguments independently of API tracing.Select-Stringcheck found the parameter and assignment. The documentation check passed for 19 files and 457 links.Agent environment and model: Codex + GPT-6.2 Astra xhigh.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:30:55Z.
Review: COMMENTED
Review of head
e160bb222dc3e893969d4018191cfd89ff6f9bbbVerdict: no blocking findings (P1=0, P2=0).
Scope:
tools/startup/run.ps1(+-TraceApi, setsX2W_TRACE_API=1),docs/startup-runtime.md,tests/startup_run_ps1_check.py. Matches the "Done when" list of #2351.Checked:
X2W_TRACE_APIis read insrc/startup_stubs/runtime_proxy.cpp:181viaenv_on, so the switch maps to an existing opt-in. Thex2w-runtime provider ... (proxied as #%d)line quoted in the docs exists atruntime_proxy.cpp:371.X2W_TRACE_APIis left alone.[argv, X2W_TRACE_API]. The default run expects it to be absent. The new-TraceApicase with inherited0expects1. The inherited1case without the switch expects1. The-TraceCallscase still checks the debugger args. The three new cases cover the behaviors named in the PR.Commands executed locally in a worktree of this head:
git diff --stat origin/main...HEAD: 3 files, +23/-6python3 tests/docs_links_check.py: self-test passed, 19 files, 457 linkspython3 tests/bidi_controls_check.py: 1641 files, no bidirectional controlsgit diff --check origin/main...HEAD: cleanpython3 tests/startup_run_ps1_check.py: exit 0, but only in "text only: not a Windows host" modeMutation: I deleted the
if ($TraceApi) { $env:X2W_TRACE_API = "1" }line and reran the check on Linux. It still passed. The Linux run does not execute PowerShell, so it cannot kill this mutation. The kill depends on the Windows CI job, which passed on this head. The PR body also reports killing the same mutation in both shells. I did not rerun it on Win2025: this is a launcher/docs change with no shader or C++ change.Nits (non-blocking):
-TraceApiparameter and the assignment line would help. The PR body says aSelect-Stringcheck was run by hand, but nothing in the test does this.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:39:50Z.
Review: COMMENTED
Review of head
907dbf9580e28fe2c5d90e20254e0b2bb35e9805(changes:tools/startup/run.ps1,tests/startup_run_ps1_check.py,docs/startup-runtime.md).Findings: P1 = 0, P2 = 0
What I checked:
run.ps1:-TraceApisetsX2W_TRACE_API=1before the debugger launch.env_on()insrc/startup_stubs/local_log.h:18accepts only a value starting with1, so"1"is correct. The variable is set only when the switch is passed, so it leaves-TraceCallsalone.[argv, X2W_TRACE_API]. The new cases cover the switch with an inherited"0"(must become"1") and an inherited"1"without the switch (must stay"1"). The test also clears anyX2W_TRACE_APIinherited from the caller, so the other cases are not skewed.runtime_proxy.cpp:371(x2w-runtime provider ... (proxied as #N)).Commands run locally on the PR head (all clean):
python3 tests/startup_run_ps1_check.py --text-only->startup run.ps1 exit code: 0 failed (text only: requested)python3 tests/docs_links_check.py->Checked 19 Markdown files and 457 links.python3 tests/bidi_controls_check.py->no bidirectional controls.git diff --check origin/main...HEAD-> no outputMutations (both killed, then reverted with
git checkout -- .):X2W_TRACE_API = "1"changed to"0"->FAIL text: missing -TraceApi environment opt-in before launchif ($TraceApi) {...}line deleted -> same FAILNot run: the PowerShell execution cases (no
pwsh/powershellon this Linux host). The Windows CI job covers them. No Win2025 run was needed, since there are no shader or C++ changes.Nit (optional): the text check only matches the exact
if ($TraceApi) { $env:X2W_TRACE_API = "1" }form, so a harmless reformat would trip it. The runtime cases on Windows cover the behaviour, so this is fine.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T13:34:34Z.
907dbf95adds the text-only checks for the switch declaration and the guarded environment assignment before launch. The text-only entry point passed. Deleting the assignment, making it unconditional, or renaming the switch each produced the intended diagnostic. The original behavioral tests also ran locally under Windows PowerShell 5.1 and PowerShell 7.