Skip to content

Promote Develop: Carry an EditorConfig With lib/sh So Carriers' shfmt Settings Cannot Reach the Locked Copy - #3629

Merged
ptr727 merged 1 commit into
mainfrom
develop
Oct 29, 2026
Merged

ptr727 merged 1 commit into
mainfrom
develop

Conversation

@ptr727

@ptr727 ptr727 commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Promotes the #3576 lib/sh EditorConfig from develop to main.

  • #3628 Carries an EditorConfig with lib/sh that pins every shfmt setting, so a carrier's own [*.sh] cannot reach the byte-locked copy.

Closes #3576

🤖 Generated with Claude Code

…Reach the Locked Copy (#3628)

## Summary

The `host-secrets` type carries `lib/sh` byte-for-byte to
`lib/fleet/sh`. A carrier whose `.editorconfig` sets `[*.sh]
indent_style = tab` then fails `shfmt -d` on the carried copy, and
cannot reformat it.

This adds `lib/sh/.editorconfig`, which the tree's `**/*` include
carries beside `secrets.sh`. It holds one `[*.sh]` section that pins
every key `shfmt` reads at the value `secrets.sh` is formatted with, the
indent and the eight formatting switches and `shell_variant = bash`. It
sets no `root = true`, so every other setting still comes from the
carrier's own files. A carrier's root-level workaround section then
becomes redundant at its next resync.

The issue proposed pinning only the indent. The local review found that
a carrier's `switch_case_indent`, `function_next_line`, `shell_variant`,
or `minify` reaches the copy the same way, so the file pins them all.

A test in `tests/test_secrets_sh.py` reads the file and asserts the one
section and its full key set, so a deletion or a drifted value fails CI,
whose unit-test job has no `shfmt`.

Refs #3576

## Verification

- A scratch carrier whose root `.editorconfig` sets `[*.sh] indent_style
= tab` fails `shfmt -d lib/fleet/sh/secrets.sh` (exit 1) without the new
file and passes (exit 0) with it.
- A scratch carrier whose root `[*.sh]` flips every pinned key (tab,
size 2, `posix`, and every boolean `true`) passes with the new file, on
local `shfmt` 3.8.0 and on the `mirror.gcr.io/mvdan/shfmt:latest` image
CI runs (v3.14.1). Flipped one at a time without the file,
`shell_variant`, `switch_case_indent`, `function_next_line`, the indent,
and (on 3.14 only) `minify` each fail.
- The hub's own `*.sh` files pass `shfmt -d` on both versions.
- `carry.py`'s `inventory()` lists `lib/sh` as `.editorconfig` and
`secrets.sh`, so the carry includes the dotfile.
- The new test fails when the file gains a top-level `root = true`.
- The full suite ran 3085 tests, OK (skipped=7).
- The local strict review ran three rounds at the `frontier` tier. Round
one raised the unpinned keys (fixed), round two the class name (fixed),
and round three found nothing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings October 29, 2026 22:18
@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The review evidence reports no remaining active issues, and the described change pins the shfmt settings that secrets.sh depends on so a carrier's [*.sh] editorconfig cannot change the carried copy's formatting.

No open issues 🎉

What changed in this PR

This PR promotes develop to main and closes #3576. The host-secrets type carries lib/sh byte-for-byte to lib/fleet/sh. A carrier whose .editorconfig sets [*.sh] indent_style = tab would fail shfmt -d on the carried copy, and it cannot reformat that copy. The fix adds an .editorconfig inside lib/sh that pins every shfmt setting secrets.sh depends on. The **/* include carries the file with the script, so carriers need no workaround section of their own.

Changes:

  • Adds lib/sh/.editorconfig with one [*.sh] section pinning the indent and the formatting switches to the values secrets.sh uses. It sets no root = true, so every other carrier setting still applies.
  • Adds a unit test that reads the file and checks that the section and its full key set are exactly as expected, so a deletion or a changed value fails CI.
File Description
tests/​test_secrets_sh.py Adds a unit test that asserts the pinned shfmt section, its full key set, and the absence of root = true.
lib/​sh/​.editorconfig Pins every shfmt key the carried secrets.sh depends on, so a carrier's [*.sh] cannot change its formatting.

Review effort: Lite

@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.62%. Comparing base (3172314) to head (c4add87).
⚠️ Report is 444 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3629   +/-   ##
=======================================
  Coverage   81.62%   81.62%           
=======================================
  Files          26       26           
  Lines        9077     9077           
=======================================
  Hits         7409     7409           
  Misses       1668     1668           
Flag Coverage Δ
python-3.13 81.62% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ptr727
ptr727 merged commit c2be4da into main Oct 29, 2026
14 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.

Carry an Indent Setting With lib/sh So Tab-Indented Carriers Pass shfmt

2 participants