Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ptr727/ProjectTemplate
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.0.440
Choose a base ref
...
head repository: ptr727/ProjectTemplate
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.0.445
Choose a head ref
  • 6 commits
  • 24 files changed
  • 1 contributor

Commits on Aug 23, 2026

  1. Drop the Invalid environment: Key From the Deploy-Site Caller Stub (#948

    )
    
    Fixes #942.
    
    ## The bug
    
    A job calling a reusable workflow cannot itself carry an `environment:`
    key ([GitHub's supported-keywords
    list](https://docs.github.com/en/actions/reference/workflows-and-actions/reusing-workflow-configurations)
    omits it, and the combination is a hard workflow-syntax error), but the
    documented `deploy-site.yml` caller stub bound one on the same job as
    `uses:` anyway. As documented, the stub would fail to even parse.
    
    ## No redesign needed
    
    `deploy-site-task.yml`'s own `deploy` job already binds `environment:
    ${{ inputs.environment }}` on itself, an ordinary job (not a `uses:`
    job). Per GitHub's documented cross-repository behavior (the `github`
    context, and an OIDC token's `sub` claim, always attribute the
    environment to the *caller*), that already resolves against the caller's
    own GitHub Environment store. The caller's `secrets:
    DEPLOY_SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}` mapping
    exists only to put the name in the task's reach and evaluates empty at
    the caller; the task's own environment binding overrides that empty
    value with the real one.
    
    ## Confirmed with a live run
    
    Dispatched `deploy-site-task.yml` cross-repository from `ptr727/Blog`,
    caller job carrying no `environment:` key, targeting Blog's real
    `staging` environment: `DEPLOY_SSH_PRIVATE_KEY` resolved (masked,
    non-empty), and only the separately-tracked `SITE_BASE_URL` naming
    mismatch was reported missing.
    
    Run: https://github.com/ptr727/Blog/actions/runs/32618245296
    
    ## What changed
    
    - `docs/reusable-workflows.md`: drop the job-level `environment:` line
    from the caller-stub example, correct the surrounding prose's false
    premise, tick the Stage 5 rollout checklist item with the run URL as
    evidence.
    - `.github/workflows/deploy-site-task.yml`: correct the same false
    premise in the job's own comment (no functional change - the job's
    `environment:` binding was already right).
    - `spec/files.json`: drop the `"\n environment:"` token from
    `deploy-site.yml`'s interface contract, which mechanically required the
    now-known-invalid shape.
    - `spec/audit.py`: fix the `deploy_stub`/`deploy_contract` self-test
    fixture to match, drop the case whose premise the fix inverts. `python3
    spec/audit.py --selftest` passes.
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    <!-- This is an auto-generated comment: release notes by coderabbit.ai
    -->
    ## Summary by CodeRabbit
    
    * **Documentation**
    * Clarified deployment environment and secret handling in reusable
    workflows.
    * Added guidance for cross-repository deployments, required
    configuration, hooks, environment variables, verification tokens, and
    references.
    * **Bug Fixes**
      * Corrected environment settings for reusable deployment tasks.
      * Removed unsupported caller-level environment configuration.
      * Preserved validation for secret mapping and required permissions.
      * Improved audit feedback for invalid deployment configuration.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->
    ptr727 authored Aug 23, 2026
    Configuration menu
    Copy the full SHA
    f47609b View commit details
    Browse the repository at this point in the history
  2. Enforce shfmt and Broaden Shell-Script Discovery in the Lint Gate (#951)

    Enforce shfmt and Broaden Shell-Script Discovery in the Lint Gate
    
    Fixes #950.
    
    ## The gap
    
    `validate-task.yml`'s shell step ran shellcheck only, and both it and
    `docker_lint.py`'s `shellcheck` linter discovered targets from a bare
    `*.sh` glob. CODESTYLE.md's Shell section and the `shell-codestyle`
    Skill never named shfmt at all, so nothing documented or enforced the
    formatter half of the shell clean-compile, and a tracked script meant
    to run as a bare command (no extension, shebang only) was invisible to
    both the glob and, before this change, to shfmt.
    
    ## The fix
    
    - `.github/workflows/validate-task.yml`: the shell step now also runs
      `mvdan/shfmt:latest -d`, and its target list is the `*.sh` glob plus
      every tracked, extensionless file whose shebang names bash or sh.
    - `scripts/docker_lint.py`: added a `shfmt` linter entry (shares the
      shellcheck image's target-discovery shape) and a `discover_shebang`
      field on `Linter` that both shellcheck and shfmt set, backed by a new
      `extensionless_shell_scripts()`/`has_shell_shebang()` pair so the
      local wrapper matches CI exactly. Tests added in
      `scripts/tests/test_docker_lint.py`.
    - `.agents/skills/shell-codestyle/SKILL.md` (regenerated into
      `.github/skills/` and `.claude-plugin/` via `build_dist.py`),
      `CODESTYLE.md`, `GOVERNANCE.md`, and the two `host-setup/*/README.md`
      files: document the shellcheck-plus-shfmt clean-compile and the
      broadened discovery.
    
    ## Verified
    
    Full doc-lint set (`markdownlint`, `cspell`, `actionlint`,
    `editorconfig-checker`), `shellcheck`, `shfmt`, and `PSScriptAnalyzer`
    all pass clean via `scripts/docker_lint.py` with no `--linter` filter.
    `scripts/repo_gate.py`, `scripts/prose_lint.py --diff origin/develop`,
    and the full `scripts/tests/` suite (790 tests) all pass. Confirmed the
    extensionless-script gap directly: reproduced Blog's
    `ops/vps-backup-pull` shape in a scratch repo, showed `docker_lint.py`
    missed a real shfmt formatting violation in it before this change and
    catches it after.
    
    
    <!-- This is an auto-generated comment: release notes by coderabbit.ai
    -->
    ## Summary by CodeRabbit
    
    * **New Features**
    * Shell validation now includes `.sh` files and extensionless Bash/sh
    scripts identified by their shebang.
      * Validation runs both ShellCheck and shfmt in CI and local tooling.
    
    * **Documentation**
    * Updated shell coding, governance, and setup guidance for the expanded
    validation workflow.
    
    * **Refactor**
    * Standardized shell formatting across setup and configuration scripts
    without changing behavior.
    
    * **Tests**
    * Added coverage for script discovery, formatting arguments, and
    non-shell file exclusion.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->
    ptr727 authored Aug 23, 2026
    Configuration menu
    Copy the full SHA
    1bf5953 View commit details
    Browse the repository at this point in the history
  3. Walk env's Full Argument Grammar, Fix read's EOF Quirk (#953)

    Walk env's Full Argument Grammar, Fix read's EOF Quirk
    
    Fixes 2 real findings from qodo-code-review on PR #952 (the develop ->
    main promotion PR carrying #951's shell-lint-gate work), both
    reproduced before the fix.
    
    ## env NAME=VALUE and operand-taking flags
    
    Both shebang parsers only walked past simple boolean flags before
    `env`'s command, so `#!/usr/bin/env FOO=1 bash` (a real pattern:
    environment assignments before the command) fell through as
    unclassified, while `#!/usr/bin/env -u bash python` (a real pattern:
    `-u NAME` unsets an env var, taking `bash` as -u's operand rather than
    naming the interpreter) was misclassified as a bash script.
    
    - `scripts/docker_lint.py`: `shell_shebang_interpreter` now walks past
      `NAME=VALUE` assignments (`_is_env_assignment`) and past `env`
      options that consume a separate operand token (`-u`/`--unset`,
      `-C`/`--chdir`), in addition to `-S`/`--split-string` and plain
      boolean flags.
    - `.github/workflows/validate-task.yml`: `is_shell_shebang` gained the
      same walk.
    
    ## A no-trailing-newline shebang silently skipped in CI
    
    `IFS= read -r first_line < "$file"` returns non-zero at EOF even after
    correctly filling `first_line`, so the CI step's
    `... && IFS= read -r first_line < "$file" && is_shell_shebang ...`
    chain short-circuited before the shebang check ever ran, for a tracked
    extensionless script whose shebang line is also its last line with no
    trailing newline. `docker_lint.py`'s `readline()` has no such quirk,
    so this was a real CI/local divergence, not a difference in what was
    being checked.
    
    - `.github/workflows/validate-task.yml`: reads into `first_line`
      first, tolerates `read`'s own EOF exit code with `|| true`, then
      checks the content regardless.
    
    ## Verified
    
    Reproduced both false-positive/false-negative shebang cases and the
    no-trailing-newline case end to end, in a scratch repo, through the CI
    step's exact commands and through `docker_lint.py`. Added
    `test_shell_shebang_interpreter_walks_past_env_grammar` and
    
    `test_extensionless_shebang_script_with_no_trailing_newline_is_picked_up`
    to `scripts/tests/test_docker_lint.py`. Full test suite (795 tests),
    ruff, mypy, actionlint, `repo_gate.py`, `prose_lint.py --diff
    origin/develop`, and the complete `docker_lint.py` run (all 7 linters)
    all pass clean.
    
    
    <!-- This is an auto-generated comment: release notes by coderabbit.ai
    -->
    
    ## Summary by CodeRabbit
    
    * **Bug Fixes**
    * Improved detection of extensionless shell scripts, including files
    without a final newline.
    * More accurately recognizes shell interpreters in complex shebang
    commands using environment assignments, options, argument separators,
    and split-string syntax.
    * Validation now more reliably identifies Bash and sh scripts, reducing
    incorrect linting results.
    
    * **Tests**
    * Added coverage for trailing-newline omissions and expanded shebang
    parsing scenarios.
    
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->
    ptr727 authored Aug 23, 2026
    Configuration menu
    Copy the full SHA
    24d24bd View commit details
    Browse the repository at this point in the history
  4. Reject Symlinks From Shebang Discovery, Propagate read Failures (#955)

    Reject Symlinks From Shebang Discovery, Propagate read Failures
    
    Fixes 2 findings from coderabbitai on PR #952 (the develop -> main
    promotion PR carrying #951's shell-lint-gate work), both reproduced
    before the fix.
    
    ## A tracked symlink could read an arbitrary host file
    
    The extensionless-shebang scan opens each candidate file to check its
    first line, host-side, before Docker ever starts. `[ -f "$file" ]` and
    Python's `Path.open()` both follow a symlink, so a tracked symlink
    pointing outside the checkout (`ops/evil -> /etc/shadow`, or anywhere
    else the CI runner or a dev's own machine can read) had its target's
    first line read on the host as part of merely checking whether it
    looks like a shell script. Reproduced: a symlink to a file containing
    `TOP SECRET` content was read through `read <` on the CI side and
    `Path.open()` on the Python side.
    
    - `.github/workflows/validate-task.yml`: added `[ ! -h "$file" ]`
      (checks the tracked path itself via `lstat`, never follows it)
      alongside the existing `-f` check, before any read.
    - `scripts/docker_lint.py`: `has_shell_shebang` now checks
      `is_symlink()` first and returns `False` without ever opening the
      path.
    - `scripts/tests/test_docker_lint.py`: added `track_symlink()` and two
      regression tests proving a symlinked extensionless script is
      excluded from discovery and never opened.
    
    This matches established fleet precedent: `build_dist.py`,
    `skills_install.py`, and `carry.py` (`spec/`) already reject symlinks
    for the same reason, confirmed by their own existing test suites
    passing unaffected.
    
    ## `read`'s `|| true` masked a genuine read failure too
    
    `IFS= read -r first_line < "$file" || true` (landed in #953) tolerated
    the harmless no-trailing-newline EOF case, but the same `|| true` also
    swallowed a genuine read failure (permission denied, file removed
    mid-run), silently skipping a tracked script CI should have linted.
    
    - `.github/workflows/validate-task.yml`: replaced the `read`/`|| true`
      pair with `first_line="$(head -n 1 -- "$file")"`, which reads a
      no-trailing-newline file cleanly (exit 0) while still failing loudly
      on a genuine read error, per CodeRabbit's own verified reproduction.
    
    ## Verified
    
    Reproduced all three cases end to end in a scratch repo: a tracked
    symlink to a file containing secret content is excluded from
    discovery on both the CI step's exact commands and `docker_lint.py`
    (and never opened, confirmed via the new Python test), a
    no-trailing-newline script is still discovered and read correctly,
    and a genuine permission-denied read aborts the script instead of
    being silently skipped. Full test suite (797 tests), ruff, mypy,
    actionlint, `repo_gate.py`, `prose_lint.py --diff origin/develop`, and
    the complete `docker_lint.py` run (all 7 linters) all pass clean.
    
    
    <!-- This is an auto-generated comment: release notes by coderabbit.ai
    -->
    ## Summary by CodeRabbit
    
    * **Bug Fixes**
      * Shell linting now excludes symbolic links from shell-script checks.
    * Symlink targets are no longer inspected when detecting shell scripts.
      * Shell-script discovery now handles candidate shebangs more reliably.
    
    * **Tests**
    * Added coverage for extensionless symlinks and symlink shebang
    detection.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->
    ptr727 authored Aug 23, 2026
    Configuration menu
    Copy the full SHA
    9067017 View commit details
    Browse the repository at this point in the history
  5. Propagate has_shell_shebang's Read Failures Instead of Swallowing Them (

    #956)
    
    Propagate has_shell_shebang's Read Failures Instead of Swallowing Them
    
    Fixes one real finding from coderabbitai on PR #952 (declines the
    other; see below).
    
    ## Propagate shell-file read failures
    
    `has_shell_shebang` caught every `OSError` from `path.open()`/
    `readline()` and returned `False`, the same value it returns for a
    file that legitimately isn't a shell script. Unlike the CI bash side
    (where `read` fails at true EOF even after filling the variable),
    Python's `readline()` never raises for EOF, an empty read is just
    `b''` with no exception, so every `OSError` this caught was a genuine
    failure (permission denied, the file vanishing between `git ls-files`
    and the read, disk I/O). Swallowing it meant a tracked file this
    couldn't open silently dropped out of the lint target list, and
    `lint()` could report success having never actually checked it.
    
    - `scripts/docker_lint.py`: `has_shell_shebang` now raises
      `CommandFailed` on a genuine read `OSError`, matching the pattern
      `ls_files` already uses for its own I/O failures. The deliberate
      `False` cases (a symlink, invalid UTF-8) are unchanged.
    - `scripts/tests/test_docker_lint.py`: added
      `test_has_shell_shebang_raises_rather_than_swallowing_a_read_failure`,
      confirming a mocked `PermissionError` surfaces as `CommandFailed`
      instead of a silent `False`.
    
    ## Declined: reject symlinks in every shell-discovery path
    
    The `*.sh`-glob-matched branch (`ls_files(root, linter.patterns)`)
    never reads file content on the host at all, before or after this
    chain's own symlink fix (#955): it only builds a path list and passes
    it to `docker run ... -- files`. Confirmed empirically that a symlink
    processed *inside* the container cannot escape to the host filesystem
    regardless of target: `docker run -v "$PWD":/mnt alpine sh -c 'cat
    /mnt/link-to-etc-shadow'` reads the container's own `/etc/shadow`
    (byte-identical to reading it directly), and a symlink to a real host
    tmp file that exists on the host but not in the container's own
    filesystem tree fails with "No such file or directory" (i.e., the
    container's own root, not the host's, is what a bind-mounted symlink
    resolves against). The host-side read this chain actually guards
    against is specific to `extensionless_shell_scripts`' shebang peek,
    which already rejects symlinks (#955); the glob-matched branch has no
    equivalent host-side read to guard.
    
    ## Verified
    
    Full test suite (798 tests), ruff, mypy, `repo_gate.py`,
    `prose_lint.py --diff origin/develop`, and the complete
    `docker_lint.py` run (all 7 linters) all pass clean.
    
    
    <!-- This is an auto-generated comment: release notes by coderabbit.ai
    -->
    ## Summary by CodeRabbit
    
    * **Bug Fixes**
      * Improved handling of symbolic links during shell-file detection.
    * File read failures now report a clear error with the affected path
    instead of being silently ignored.
    
    * **Tests**
    * Added coverage to verify that permission-related read failures are
    surfaced correctly.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->
    ptr727 authored Aug 23, 2026
    Configuration menu
    Copy the full SHA
    031d8a2 View commit details
    Browse the repository at this point in the history
  6. Promote Develop to Main (#952)

    Routine promotion.
    
    <!-- This is an auto-generated comment: release notes by coderabbit.ai
    -->
    ## Summary by CodeRabbit
    
    - **New Features**
    - Shell validation now covers extensionless Bash and sh scripts
    identified by their shebang.
      - CI checks shell scripts with both ShellCheck and shfmt.
    
    - **Documentation**
      - Clarified shell-formatting requirements and verification tools.
    - Updated reusable deployment workflow guidance, including environment
    and secret handling.
    
    - **Bug Fixes**
    - Improved deployment workflow validation and environment configuration
    checks.
      - Strengthened shell-script discovery and linting coverage.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->
    ptr727 authored Aug 23, 2026
    Configuration menu
    Copy the full SHA
    3927fec View commit details
    Browse the repository at this point in the history
Loading