Skip to content

Fix base64 encoding for ocm-container CLI compatibility#139

Merged
clcollins merged 3 commits intomainfrom
fix/base64-std-encoding
Apr 4, 2026
Merged

Fix base64 encoding for ocm-container CLI compatibility#139
clcollins merged 3 commits intomainfrom
fix/base64-std-encoding

Conversation

@clcollins
Copy link
Copy Markdown
Owner

@clcollins clcollins commented Apr 4, 2026

Summary

  • Switch ALERT_DETAILS encoding from base64.RawURLEncoding to base64.RawStdEncoding
  • RawURLEncoding uses URL-safe alphabet (-_) incompatible with base64 -d in ocm-container
  • RawStdEncoding uses standard alphabet (+/) that base64 -d understands, while still omitting = padding that breaks ocm-container's env var parsing
  • Fix pre-existing lint issues uncovered by CI: suppress errcheck on deferred asyncWriter.Close(), remove unused renderActionLogHeader() function, and remove empty test branch

Test plan

  • Verify echo $ALERT_DETAILS | base64 -d | jq . works inside ocm-container after login
  • Verify no = padding characters appear in the encoded value
  • Run existing unit tests (go test ./pkg/tui/...)

🤖 Generated with Claude Code

clcollins and others added 2 commits April 4, 2026 10:00
Switch ALERT_DETAILS encoding from RawURLEncoding to RawStdEncoding.
RawURLEncoding uses a URL-safe alphabet (-_) that the `base64 -d`
CLI tool inside ocm-container doesn't understand. RawStdEncoding uses
the standard alphabet (+/) which is compatible with `base64 -d`, while
still avoiding = padding that breaks ocm-container's env var parsing.

Created with assistance from Claude 🤖 <claude@anthropic.com>

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Christopher Collins <collins.christopher@gmail.com>
- main.go: suppress errcheck for deferred asyncWriter.Close()
- model_test.go: suppress staticcheck SA9003 for placeholder empty branch
- views.go: remove unused renderActionLogHeader function

Created with assistance from Claude 🤖 <claude@anthropic.com>

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Christopher Collins <collins.christopher@gmail.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates how the TUI passes PagerDuty alert details into ocm-container by changing the base64 encoding variant to improve CLI decode compatibility, and aligns related tests/docs cleanup.

Changes:

  • Switch ALERT_DETAILS encoding from base64.RawURLEncoding to base64.RawStdEncoding (still unpadded).
  • Update unit test expectations to match the new encoding/decoding behavior.
  • Remove an unused view helper and adjust a couple of lint-related comments.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
README.md Updates the ALERT_DETAILS encoding note (but leaves some surrounding wording inconsistent).
pkg/tui/commands.go Changes ALERT_DETAILS encoding to RawStdEncoding for better base64 -d compatibility.
pkg/tui/commands_test.go Updates base64 encoding/decoding in tests to RawStdEncoding.
pkg/tui/views.go Removes unused renderActionLogHeader() helper.
pkg/tui/model_test.go Replaces a comment block with an empty if plus nolint.
main.go Adds //nolint:errcheck to deferred asyncWriter.Close().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment thread pkg/tui/model_test.go Outdated
- Fix inconsistent base64 encoding references in README
- Remove empty if block in model_test.go

Created with assistance from Claude 🤖 <claude@anthropic.com>

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Christopher Collins <collins.christopher@gmail.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread main.go
@clcollins
Copy link
Copy Markdown
Owner Author

@clcollins PR #139 has been fully qualified.

Qualification Summary:

  • Loops: 2 iteration(s) of Phases 1–4
  • New commits: 2 commit(s) added during qualification
  • Merge: No conflicts
  • CI: All 2 checks passing (Lint Code, Run Unit Tests)
  • Copilot: 3 comments addressed across 2 review rounds
  • CodeRabbit: N/A (not enabled)
  • Codecov: N/A (not enabled)

Intent validation: The PR still fulfills its original intent — switching ALERT_DETAILS encoding from RawURLEncoding to RawStdEncoding for base64 -d CLI compatibility. All changes made during qualification (lint fixes, README consistency, empty test branch removal) are consistent with the PR's purpose.

This PR is ready to merge.


Qualified by Claude on behalf of @clcollins

@clcollins clcollins merged commit cd20ea6 into main Apr 4, 2026
6 checks passed
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