Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions tools/verify-webapi-aot-demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ def write_project(directory: Path, feed: Path, packages: Path, version: str) ->
return project_path


def publish_nativeaot(project: Path, output: Path, log: Path, env: dict[str, str]) -> Path:
completed = subprocess.run(
def _publish(project: Path, output: Path, env: dict[str, str], verbosity: str) -> subprocess.CompletedProcess[str]:
return subprocess.run(
[
"dotnet",
"publish",
Expand All @@ -134,7 +134,7 @@ def publish_nativeaot(project: Path, output: Path, log: Path, env: dict[str, str
"-o",
str(output),
"-v",
"quiet",
verbosity,
],
cwd=project.parent,
env=env,
Expand All @@ -143,11 +143,21 @@ def publish_nativeaot(project: Path, output: Path, log: Path, env: dict[str, str
stderr=subprocess.STDOUT,
check=False,
)


def publish_nativeaot(project: Path, output: Path, log: Path, env: dict[str, str]) -> Path:
completed = _publish(project, output, env, "quiet")
log.write_text(completed.stdout, encoding="utf-8")
if completed.returncode != 0:
# The macOS NativeAOT native-link step has intermittently flaked here with clang exit 1,
# and "-v quiet" swallows the linker's (clang/ld) stderr, so the cause is invisible in CI.
# Re-publish once at detailed verbosity purely to capture that error for diagnosis. This
# does not change the outcome -- the original failure still fails the gate.
diagnostic = _publish(project, output, env, "detailed")
log.write_text(diagnostic.stdout, encoding="utf-8")
fail(
"NativeAOT web API publish failed\n"
f"exit={completed.returncode}\nlog={log}\n{completed.stdout}"
f"exit={completed.returncode}\nlog={log}\n{diagnostic.stdout}"
Comment on lines +157 to +160

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not overwrite the first failed publish output.

If Line 149 fails and Line 156 succeeds, Line 157 replaces the only stdout from the failing publish with a successful retry. The verifier then fails using exit={completed.returncode} while log and the emitted body describe a different run, which breaks the diagnostic-only purpose of this change for intermittent flakes. Preserve the original quiet output and append the detailed retry instead of replacing it.

Suggested fix
     completed = _publish(project, output, env, "quiet")
     log.write_text(completed.stdout, encoding="utf-8")
     if completed.returncode != 0:
         # The macOS NativeAOT native-link step has intermittently flaked here with clang exit 1,
         # and "-v quiet" swallows the linker's (clang/ld) stderr, so the cause is invisible in CI.
         # Re-publish once at detailed verbosity purely to capture that error for diagnosis. This
         # does not change the outcome -- the original failure still fails the gate.
         diagnostic = _publish(project, output, env, "detailed")
-        log.write_text(diagnostic.stdout, encoding="utf-8")
+        combined_output = (
+            "=== initial quiet publish (failed) ===\n"
+            f"{completed.stdout}\n"
+            "=== diagnostic detailed retry ===\n"
+            f"{diagnostic.stdout}"
+        )
+        log.write_text(combined_output, encoding="utf-8")
         fail(
             "NativeAOT web API publish failed\n"
-            f"exit={completed.returncode}\nlog={log}\n{diagnostic.stdout}"
+            f"exit={completed.returncode}\nlog={log}\n{combined_output}"
         )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
log.write_text(diagnostic.stdout, encoding="utf-8")
fail(
"NativeAOT web API publish failed\n"
f"exit={completed.returncode}\nlog={log}\n{completed.stdout}"
f"exit={completed.returncode}\nlog={log}\n{diagnostic.stdout}"
combined_output = (
"=== initial quiet publish (failed) ===\n"
f"{completed.stdout}\n"
"=== diagnostic detailed retry ===\n"
f"{diagnostic.stdout}"
)
log.write_text(combined_output, encoding="utf-8")
fail(
"NativeAOT web API publish failed\n"
f"exit={completed.returncode}\nlog={log}\n{combined_output}"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/verify-webapi-aot-demo.py` around lines 157 - 160, The retry logging in
verify_webapi_aot_demo currently overwrites the original failed publish output,
so preserve the first publish’s stdout/stderr and append the retry diagnostics
instead of replacing them. Update the failure handling around the
publish/diagnostic flow in verify-webapi-aot-demo.py so fail() reports the
original quiet output from the first failed run while still including the later
detailed retry output for context, using the existing diagnostic and completed
values to keep the logs aligned with the actual failure.

Sources: Coding guidelines, Path instructions

)

qyl_warnings = [
Expand Down