Skip to content

fix: activate defaulted to a build target platform, and errors printed as {} - #79

Merged
frostebite merged 1 commit into
mainfrom
fix/activate-target-platform-and-error-logging
Aug 14, 2026
Merged

fix: activate defaulted to a build target platform, and errors printed as {}#79
frostebite merged 1 commit into
mainfrom
fix/activate-target-platform-and-error-logging

Conversation

@frostebite

Copy link
Copy Markdown
Member

Found and fixed while investigating why unity-activate#111's thin-wrapper CI was failing on every job.

Two real bugs

1. activate inherited a build-oriented targetPlatform default.

ActivateCommand.configureOptions() calls UnityOptions.configure(), which defaults targetPlatform to StandaloneWindows64 — a sensible default for build, meaningless for activate (which doesn't build anything, just needs an editor image to run activation inside). A bare game-ci activate <path> — exactly what unity-activate's thin wrapper calls, with no --target-platform flag — hit RunnerImageTag's Windows/il2cpp version gate and threw:

Windows-based builds are only supported on 2019.3.X+ versions of Unity.

...for any older Unity version, on every host. NoTarget already exists and maps to the generic image, skipping that check entirely — it's what unity-engine-core's extracted activate logic uses for exactly this case. activate now defaults to it; an explicit --target-platform still overrides.

2. log.error() printed [ERROR] {} for any bare Error.

This is what made bug #1 nearly impossible to see from CI logs. inspect()'s fallback for non-string values is JSON.stringify(value) — but Error's message/stack/name are non-enumerable own properties, so JSON.stringify(new Error('anything')) is always '{}'. Every uncaught error in the CLI — not just this one — was printing as a useless empty object. Error instances are now special-cased to print their stack.

How I found it

Reproduced locally: bun run src/index.ts activate <path-to-a-fake-2019.2.14f1-project> on a fresh git repo reproduced the exact [ERROR] {} from CI. Fixing bug #2 first turned that into the real message (bug #1), which then explained every failing job in unity-activate#111 (all older Unity versions — the "Tests" job, which doesn't shell out to a real Unity version, was the only one that passed).

Testing

  • New test: activate-command.test.tsconfigureOptions() defaults targetPlatform to NoTarget, and still honors an explicit --target-platform.
  • New test: logger/index.test.tslog.error(new Error(...)) prints the message, not {}.
  • bun run test — 147 pass, 3 skip, 0 fail (144 pass, 3 skip before this PR — 3 new tests, no regressions).
  • Manually verified locally past both bugs: activate now reaches the real docker run invocation (fails only because Docker isn't installed in my sandbox, which is expected).

🤖 Generated with Claude Code

…d as {}

Two real bugs surfaced by testing unity-activate's thin-wrapper PR against
this repo's freshly-merged activate command:

- ActivateCommand inherited UnityOptions' build-oriented targetPlatform
  default (StandaloneWindows64), so a bare `game-ci activate <path>` -
  exactly what the thin wrapper calls - threw "Windows-based builds are
  only supported on 2019.3.X+" for any older Unity version, even though
  activation doesn't build anything. Defaults to NoTarget instead, which
  RunnerImageTag already maps to the generic image and skips build-target
  validation entirely. Explicit --target-platform still works.
- log.error()'s JSON.stringify fallback silently produces '{}' for any
  bare Error, since message/stack/name are non-enumerable own properties.
  This was masking the actual error above and likely every other uncaught
  failure in the CLI. Error objects are now special-cased to print their
  stack.
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Important

Review available on request

  • 🔍 Trigger review

Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment @coderabbitai review to review the latest changes. For a full review, comment @coderabbitai full review.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 564a4e7c-3da9-4c18-a206-edc5026405dd


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@frostebite
frostebite merged commit 86176b1 into main Aug 14, 2026
15 checks passed
@frostebite
frostebite deleted the fix/activate-target-platform-and-error-logging branch August 14, 2026 19:18
frostebite added a commit that referenced this pull request Aug 14, 2026
…or-logging fixes (#80)

* fix: activate defaulted to a build target platform, and errors printed as {}

Two real bugs surfaced by testing unity-activate's thin-wrapper PR against
this repo's freshly-merged activate command:

- ActivateCommand inherited UnityOptions' build-oriented targetPlatform
  default (StandaloneWindows64), so a bare `game-ci activate <path>` -
  exactly what the thin wrapper calls - threw "Windows-based builds are
  only supported on 2019.3.X+" for any older Unity version, even though
  activation doesn't build anything. Defaults to NoTarget instead, which
  RunnerImageTag already maps to the generic image and skips build-target
  validation entirely. Explicit --target-platform still works.
- log.error()'s JSON.stringify fallback silently produces '{}' for any
  bare Error, since message/stack/name are non-enumerable own properties.
  This was masking the actual error above and likely every other uncaught
  failure in the CLI. Error objects are now special-cased to print their
  stack.

* chore: bump version to 0.1.4 for the activate target-platform and error-logging fixes (#79)
frostebite added a commit that referenced this pull request Aug 14, 2026
…#82)

RunnerImageTag mapped both NoTarget and the internal 'Test' targetPlatform
to the same empty suffix, producing tags like "ubuntu-2019.2.17f1-3" -
unityci/editor always has a module suffix (base/webgl/android/etc.), so
this is never a real image. `docker pull` failed with "manifest unknown"
on every version.

Surfaced by unity-activate#111's thin-wrapper CI: `game-ci activate`
defaults targetPlatform to NoTarget (#79) and hit this on every job.

'base' is the same image StandaloneLinux64 (pre-il2cpp) already resolves
to - the right choice for "just an editor, no specific build target".
Split into its own noTarget suffix rather than reusing generic, since
'Test' also used generic and doesn't pull real images - no reason to
touch its behavior.
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