Skip to content

Seed pipeline strips trailing newline from every baseline file — repo-template not byte-identical to standards/ #597

Description

@don-petry

Problem

seed-repo-template.sh ships every baseline file without its trailing newline:

  • _put_file writes printf '%s' "$content" where content="$(_emit_baseline …)" — command substitution strips the trailing \n.
  • template_stub_drift.sh _template_drift_expected_sha does the same ($(...) + printf '%s'), so the drift check expects the newline-stripped blob.

Net effect: repo-template's files (and every seeded repo's files) are not byte-identical to their standards/ source — each is off by a final \n, and ships slightly non-idiomatic (no terminating newline).

Symptom already seen

The .gitleaks.toml template-drift incident (2026-07-03): repo-template shipped .gitleaks.toml with its newline (blob 6548cdb, = canonical standards/gitleaks.toml), but the drift check expected the newline-stripped 92d4d15 → red repo-wide, admin-bypassed by #1032. Resolved by re-seeding .gitleaks.toml to the no-newline form (4ffad44c) to match the seed convention — i.e. papered over the root cause.

Proper fix

Preserve the trailing newline end-to-end:

  • _put_file and _template_drift_expected_sha: emit/hash printf '%s\n' "$content" (re-add the single newline the emission intends), or avoid the $() strip entirely.
  • Re-seed repo-template so every baseline file becomes byte-identical to standards/ (with the terminating \n).

Affects all baseline files, not just .gitleaks.toml. Non-blocking (drift is currently green), but worth fixing for byte-parity + POSIX text hygiene.

Refs: petry-projects/.github-private scripts/seed-repo-template.sh, scripts/template_stub_drift.sh; the #1032 / 4ffad44c incident.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions