Skip to content

chore(mister): add AmigaVision launch diagnostics#869

Merged
wizzomafizzo merged 4 commits into
mainfrom
debug/amigavision-launch-logging
May 30, 2026
Merged

chore(mister): add AmigaVision launch diagnostics#869
wizzomafizzo merged 4 commits into
mainfrom
debug/amigavision-launch-logging

Conversation

@wizzomafizzo
Copy link
Copy Markdown
Member

@wizzomafizzo wizzomafizzo commented May 30, 2026

Summary

  • log AmigaVision listing launches, boot image discovery, and install path selection
  • log ags_boot write path and failures
  • log the exact MiSTer command-interface launch command

Verification

  • go test ./pkg/platforms/mister/cores ./pkg/platforms/mister/mgls
  • golangci-lint run ./pkg/platforms/mister/cores ./pkg/platforms/mister/mgls

Summary by CodeRabbit

  • Bug Fixes

    • More reliable AmigaVision boot-image detection with clearer fallback selection and improved handling when images are missing.
    • Improved detection and reporting for installation/config scanning failures and write errors.
  • Chores

    • Expanded structured logging and diagnostics around boot discovery, fallback choice, and boot-file writes.
    • Safer command-write flow with explicit command logging and stricter path validation to reject control characters.
  • Tests

    • Added unit tests covering path validation and rejecting control characters in launch paths.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 02b66f4f-7f8e-48a8-8490-a91e8ccbe831

📥 Commits

Reviewing files that changed from the base of the PR and between 149d62d and 9938b98.

📒 Files selected for processing (1)
  • pkg/platforms/mister/mgls/mgls_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/platforms/mister/mgls/mgls_test.go

📝 Walkthrough

Walkthrough

Adds AmigaVision boot-image discovery with fallback install-path selection and structured logging; adds load_core path validation and command logging in the MiSTer interface, plus unit tests for the new validation.

Changes

AmigaVision boot and launch improvements

Layer / File(s) Summary
Boot-image discovery and install path fallback with logging
pkg/platforms/mister/cores/hooks.go
Adds amigaVisionBootImagePath; updates hookAmiga to detect boot images, fall back to an alternate install path when missing, and emit debug/info/warn/error logs; updates findAmigaVisionInstallPath and amigaListingContains with additional logging.
Load-core validation helper and import
pkg/platforms/mister/mgls/mgls.go
Adds validateLoadCorePath and imports unicode to reject control characters in load_core paths.
Launch command interface validation and logging
pkg/platforms/mister/mgls/mgls.go
launchFile and LaunchCore validate load_core paths before writing; launchFile builds load_core <path>, writes it with fmt.Fprintln, and logs the exact command on success; CmdInterface accessibility check moved after validation.
Validation tests
pkg/platforms/mister/mgls/mgls_test.go
Adds TestValidateLoadCorePath, TestLaunchFileRejectsControlCharacters, and TestLaunchCoreRejectsControlCharacters ensuring control characters are rejected and restoring GlobalRBFCache after tests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • ZaparooProject/zaparoo-core#847: Direct code-level alignment with hookAmiga and findAmigaVisionInstallPath changes for boot-image detection and active install selection.
  • ZaparooProject/zaparoo-core#709: Overlapping changes in LaunchCore and core-to-RBF resolution logic; related to MiSTer launch path handling.

Poem

🐰 I sniff the boot image, hop left if it's gone,
I log my footprints while I troubleshoot on.
I guard the load_core from sneaky control chars,
and sing the exact command before it departs—
a rabbit's chuckle for safer starts.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title mentions AmigaVision diagnostics, but the PR also adds control-character validation to load_core paths—a security-critical feature not mentioned in the title. Consider updating the title to reflect both the AmigaVision logging improvements and the control-character path validation, or clarify if the validation is a separate concern.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 debug/amigavision-launch-logging

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 `@pkg/platforms/mister/mgls/mgls.go`:
- Around line 169-170: The code builds a line-delimited command ("load_core
"+path) and writes it with fmt.Fprintln(cmd, command) without sanitizing path;
update the function that sends the load_core command to validate/reject any path
containing newline or other control characters (e.g., '\n', '\r', or
unicode.IsControl) before constructing command, returning an error if invalid,
so injection via path is prevented; ensure validation is performed on the path
variable referenced where command is built and before the fmt.Fprintln call.
🪄 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: 6031d1b5-db6d-4888-ab13-9edc8e54dbdf

📥 Commits

Reviewing files that changed from the base of the PR and between d07efe9 and 339c4d7.

📒 Files selected for processing (2)
  • pkg/platforms/mister/cores/hooks.go
  • pkg/platforms/mister/mgls/mgls.go

Comment thread pkg/platforms/mister/mgls/mgls.go
@sentry
Copy link
Copy Markdown

sentry Bot commented May 30, 2026

Codecov Report

❌ Patch coverage is 68.60465% with 27 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/platforms/mister/cores/hooks.go 69.56% 20 Missing and 1 partial ⚠️
pkg/platforms/mister/mgls/mgls.go 64.70% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

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: 2

🤖 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 `@pkg/platforms/mister/mgls/mgls_test.go`:
- Around line 161-164: The test cases in mgls_test.go currently use hardcoded
POSIX-style path literals; replace those with filepath.Join-based construction:
create a base path using filepath.Join with components ("media", "fat",
".LASTLAUNCH.mgl") and use that base for the "valid path" case, and for the
negative cases ("newline rejected", "carriage return rejected", "tab rejected")
append the respective control character to the base string rather than embedding
a POSIX path literal; update the table entries (the rows with name: "valid
path", "newline rejected", etc.) to use the filepath.Join-built base and
concatenated control characters.
- Around line 153-179: Add tests that exercise the actual call sites launchFile
and LaunchCore (not just validateLoadCorePath) by invoking them with paths
containing control characters (e.g., newline, CR, tab) and asserting they return
an error and do not proceed to write the launch file; specifically, add subtests
that call launchFile(...) and LaunchCore(...) with the malicious paths used in
TestValidateLoadCorePath and use require.Error to ensure validation is enforced
at the call sites (and optionally check no file was created) so future refactors
can't bypass the guards in launchFile and LaunchCore.
🪄 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: e55def2f-48f4-490d-8f36-33bd0e881b1a

📥 Commits

Reviewing files that changed from the base of the PR and between 339c4d7 and 9c36efc.

📒 Files selected for processing (2)
  • pkg/platforms/mister/mgls/mgls.go
  • pkg/platforms/mister/mgls/mgls_test.go

Comment thread pkg/platforms/mister/mgls/mgls_test.go
Comment thread pkg/platforms/mister/mgls/mgls_test.go Outdated
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 `@pkg/platforms/mister/mgls/mgls_test.go`:
- Around line 195-217: The test TestLaunchCoreRejectsControlCharacters currently
only checks for any error but can get unrelated errors because LaunchCore calls
cores.GlobalRBFCache.Resolve before validateLoadCorePath; change the assertion
to require the specific validation error from validateLoadCorePath by asserting
that err.Error() equals fmt.Sprintf("load_core path contains control character:
%q", path) (use the loop variable path) so the test fails only when the
control-character check does not trigger; apply the same exact-message assertion
to TestLaunchFileRejectsControlCharacters as well.
🪄 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: 01bd2be3-e16d-4b45-a4ee-e471c41b39ac

📥 Commits

Reviewing files that changed from the base of the PR and between 9c36efc and 149d62d.

📒 Files selected for processing (2)
  • pkg/platforms/mister/mgls/mgls.go
  • pkg/platforms/mister/mgls/mgls_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/platforms/mister/mgls/mgls.go

Comment thread pkg/platforms/mister/mgls/mgls_test.go
@wizzomafizzo wizzomafizzo merged commit 0316142 into main May 30, 2026
12 checks passed
@wizzomafizzo wizzomafizzo deleted the debug/amigavision-launch-logging branch May 30, 2026 23:50
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