Skip to content

Restore resBuildResult fields for failed builds#453

Merged
edolstra merged 1 commit intomainfrom
eelcodolstra/nix-391
May 8, 2026
Merged

Restore resBuildResult fields for failed builds#453
edolstra merged 1 commit intomainfrom
eelcodolstra/nix-391

Conversation

@edolstra
Copy link
Copy Markdown
Collaborator

@edolstra edolstra commented May 7, 2026

Motivation

Context

Summary by CodeRabbit

  • Bug Fixes

    • Made JSON build-failure logging payloads more consistent so logged results reliably reflect failure details.
    • Ensured timed-out builds record timeout status and error message in JSON logs.
  • Tests

    • Added functional test coverage verifying JSON logging for timeout scenarios.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6278d5f3-8dd1-4d65-b988-3e48312cb52d

📥 Commits

Reviewing files that changed from the base of the PR and between 3853269 and b3ca704.

📒 Files selected for processing (3)
  • src/libstore/build/derivation-building-goal.cc
  • src/libstore/build/substitution-goal.cc
  • tests/functional/logging.sh
✅ Files skipped from review due to trivial changes (1)
  • src/libstore/build/substitution-goal.cc

📝 Walkthrough

Walkthrough

This PR refactors goal failure logging across two build system components and adds test coverage. Failure result JSON payloads now use structured intermediate variables instead of inline exceptions, and a functional test verifies JSON logging of timed-out builds.

Changes

Build Failure JSON Logging Refactor

Layer / File(s) Summary
Failure Result JSON Refactor
src/libstore/build/derivation-building-goal.cc, src/libstore/build/substitution-goal.cc
DerivationBuildingGoal::doneFailure() and PathSubstitutionGoal::doneFailure() now extract build results into local variables and pass them directly to KeyedBuildResult for JSON serialization, removing inline exception embedding from the logger payload. Both handlers assign Goal::doneFailure() result to a local variable for return.
JSON Logging Test Coverage
tests/functional/logging.sh
New functional test verifies that JSON logs correctly record timed-out builds with status:TimedOut and matching error messages.

🎯 2 (Simple) | ⏱️ ~12 minutes


🐰 The logs once held exceptions raw,
Now structured results flow through the door,
With timeouts captured in JSON's jaw—
Failures logged cleaner than ever before! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly matches the main objective of the changeset: restoring resBuildResult fields for failed builds in the build and substitution goal files.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch eelcodolstra/nix-391

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with 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.

Inline comments:
In `@tests/functional/logging.sh`:
- Line 44: The rm invocation uses an unquoted expansion (rm $TEST_ROOT/log.json)
which can suffer word-splitting/globbing; update the rm call to use a quoted
expansion of the TEST_ROOT variable with the filename (for example use a quoted
${TEST_ROOT}/log.json or "$TEST_ROOT/log.json") so the path is treated as a
single argument and globbing is prevented.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6c2d361a-87d1-4f2f-9374-275120ae7ecc

📥 Commits

Reviewing files that changed from the base of the PR and between a09ec4c and 3853269.

📒 Files selected for processing (3)
  • src/libstore/build/derivation-building-goal.cc
  • src/libstore/build/substitution-goal.cc
  • tests/functional/logging.sh

Comment thread tests/functional/logging.sh Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

@github-actions github-actions Bot temporarily deployed to pull request May 7, 2026 19:57 Inactive
@edolstra edolstra force-pushed the eelcodolstra/nix-391 branch from 3853269 to b3ca704 Compare May 7, 2026 19:58
@github-actions github-actions Bot temporarily deployed to pull request May 7, 2026 20:02 Inactive
@edolstra edolstra enabled auto-merge May 7, 2026 20:07
@edolstra edolstra added this pull request to the merge queue May 8, 2026
Merged via the queue into main with commit da8e677 May 8, 2026
31 checks passed
@edolstra edolstra deleted the eelcodolstra/nix-391 branch May 8, 2026 01:06
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