Repository navigation
Conversation
…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]>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
There was a problem hiding this comment.
🟢 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/.editorconfigwith one[*.sh]section pinning the indent and the formatting switches to the valuessecrets.shuses. It sets noroot = 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 Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Promotes the #3576
lib/shEditorConfig fromdeveloptomain.lib/shthat pins everyshfmtsetting, so a carrier's own[*.sh]cannot reach the byte-locked copy.Closes #3576
🤖 Generated with Claude Code