Skip to content

Make the Compile Recipe and the Clone Instruction Portable - #166

Merged
ptr727 merged 3 commits into
developfrom
promo-portability
Sep 21, 2026
Merged

ptr727 merged 3 commits into
developfrom
promo-portability

Conversation

@ptr727

@ptr727 ptr727 commented Sep 21, 2026

Copy link
Copy Markdown
Owner

What

Answers the two findings Copilot raised against the promotion pull request #164.

  • The OPERATIONS.md compile recipe generated secrets.yaml with sed -i, which GNU and BSD sed read differently. BSD sed takes the argument after a bare -i as a backup suffix, so the step failed on macOS, a supported platform. It now writes sed's output to a mktemp file and moves it into place, with no -i form at all.
  • The README.md adopter clone instruction named develop while every other consumption instruction, in the README and in each template's External usage: header, names main. It now defaults to main and keeps develop as the route for tracking changes before they are promoted.

Why the step changed more than the finding asked

The review passes on this branch found that each obvious fix failed a different way, and each is closed here:

  • sed -i.bak plus rm of the backup is portable, but deletes a real secrets.yaml.bak someone moved aside.
  • An unchained mv installs an empty secrets.yaml when sed fails, and one with an empty key when openssl fails. The existing guard then keeps that broken file on every later run, so the compile fails on missing secrets a long way from the cause.

The key, the template's placeholder, the substitution, and the move are now one condition. Any failure leaves no secrets.yaml and removes the temp file.

Verification

The block was extracted from the file as written and run under both bash and dash, with an isolated TMPDIR so a leaked temp file counts exactly:

Case Result
Success secrets.yaml written with the placeholder replaced
Template missing Nothing written, no temp file left, failure message
Template empty Nothing written, no temp file left, failure message
openssl fails Nothing written, no temp file left, failure message
mv fails into a read-only directory Nothing written, no temp file left, failure message
mktemp fails Nothing written, no temp file left, failure message

The mktemp and redirect form also ran under busybox. BSD sed itself was not available to execute here, and the step no longer relies on any -i behavior, which is what differed.

Notes

The generated file now takes mktemp's mode 0600 rather than the 0644 cp gave, which suits a secrets file and is readable by the container, since the recipe runs it as the invoking user.

The comments label is not needed here, since this change adds no comment line in code or config.

🤖 Generated with Claude Code

GNU and BSD sed disagree on a bare -i, which BSD reads as taking the next
argument as a backup suffix, so the recipe's placeholder substitution
failed on macOS, a supported platform. The step now writes sed's output to
a mktemp file and moves it into place, so it uses no -i form and never
touches a sibling path such as a secrets.yaml.bak someone moved aside.

It also fails closed. The key, the template's placeholder, the
substitution, and the move are one condition, so an empty key, a missing
or placeholder-free template, or a failed mv leaves no secrets.yaml for
the guard to keep on every later run, and the temp file is removed on any
failure.

The adopter clone instruction named develop while every other consumption
instruction in the README and the template headers names main. It now
defaults to main, and keeps develop as the route for tracking changes
before they are promoted.
Copilot AI lite review requested due to automatic review settings September 21, 2026 03:53
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: e2ce1045-1c62-481b-842c-0fc5dd6bdc47

📥 Commits

Reviewing files that changed from the base of the PR and between 84611aa and ad64037.

📒 Files selected for processing (2)
  • OPERATIONS.md
  • README.md

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The new secrets generation recipe should use mktemp with an explicit template (ideally under $config_dir) to remain portable across mktemp implementations.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

This PR improves cross-platform portability of the operational compile recipe and aligns adoption instructions with the repository’s default branch conventions.

Changes:

  • Update the README clone instruction to default to main, with develop noted as the pre-promotion tracking option.
  • Replace the sed -i-based secrets.yaml generation step with a temp-file + move workflow that avoids GNU/BSD sed incompatibilities.
File Description
README.md Defaults the adopter clone command to main and documents develop as an opt-in tracking branch.
OPERATIONS.md Reworks secrets.yaml generation to avoid sed -i and to clean up temp files on failure.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread OPERATIONS.md Resolved
A bare mktemp fails on implementations that require a template, and the
file's own lint recipe already names one under /tmp, so this matches it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The updated secrets-generation snippet can still behave incorrectly when mktemp fails because $tmp is used without verifying that it was created successfully.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
Resolved since last review (1)

Comment thread OPERATIONS.md Resolved
A failed mktemp left tmp empty, so the redirect failed with an unrelated
error before the step's own message. mktemp now runs inside the condition,
only after the key and the template check pass, and the cleanup runs only
when a temp file exists.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The updates cleanly address the portability issues described without introducing new behavioral risks in the documented workflows.

Review effort: Lite
Findings: None

Resolved since last review (1)

@ptr727
ptr727 merged commit 3415c8c into develop Sep 21, 2026
11 checks passed
@ptr727
ptr727 deleted the promo-portability branch September 21, 2026 04:08
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