Skip to content

Fix xcparse log producing junk data in action.txt#21

Open
davidbean-hash wants to merge 2 commits into
masterfrom
devin/1779386205-fix-log-junk-data
Open

Fix xcparse log producing junk data in action.txt#21
davidbean-hash wants to merge 2 commits into
masterfrom
devin/1779386205-fix-log-junk-data

Conversation

@davidbean-hash
Copy link
Copy Markdown
Owner

@davidbean-hash davidbean-hash commented May 21, 2026

Change Description:

Fixes the bug where xcparse log writes raw serialized ActivityLogSection data (containing internal type metadata like [T[K2:_nV18:ActivityLogSection]K10:domainType...) to action.txt and build.txt instead of clean, human-readable log output.

Root cause: extractLogs() used xcresulttool export which exports the raw binary representation of log objects from the xcresult bundle. This binary format includes internal structure/type metadata that is not meant for human consumption.

Fix: Replace the raw export approach with structured extraction:

  1. Use xcresulttool get --format json to retrieve the log as structured JSON
  2. Decode the JSON into proper ActivityLogSection objects (with heterogeneous type handling for subtypes like ActivityLogUnitTestSection, ActivityLogCommandInvocationSection, etc.)
  3. Format the decoded log hierarchy as clean, indented text containing:
    • Section titles
    • Emitted test output (emittedOutput from ActivityLogUnitTestSection)
    • Command details and output (ActivityLogCommandInvocationSection)
    • Log messages
    • Properly indented subsection hierarchy
  4. All failure paths (Get command failure, non-zero exit, empty output, decode error, write error) fall back to raw export for compatibility

Reference: ChargePoint#61

Test Plan/Testing Performed:

  • Code review of changes against the ActivityLogSection model hierarchy
  • Verified all ActivityLogSection subtypes are handled in the type-discriminated decoder
  • All failure paths verified to fall back to raw export (no silent file omission)
  • CI passing

Link to Devin session: https://app.devin.ai/sessions/1392a855c7a64985a8f51ca8d4a59c08
Requested by: @davidbean-hash


Open in Devin Review

Instead of using xcresulttool export (which writes raw serialized
ActivityLogSection data with internal type metadata), use xcresulttool
get --format json to retrieve structured log data, decode it into
ActivityLogSection objects, and format them as clean human-readable text.

The formatted output includes section titles, emitted output from unit
test and command invocation sections, log messages, and properly
indented subsection hierarchy.

Falls back to raw export if JSON decoding fails.

Fixes ChargePoint#61

Co-Authored-By: david.bean <david.bean@cognition.ai>
@devin-ai-integration
Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration[bot]

This comment was marked as resolved.

Restructure exportFormattedLog so that if the JSON Get command fails,
returns non-zero exit status, or produces empty output, the function
always falls back to the raw XCResultToolCommand.Export. Previously
these early-return paths would silently skip log file creation.

Co-Authored-By: david.bean <david.bean@cognition.ai>
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.

1 participant