[PR #546] [MERGED] build: pin LF via .gitattributes and verify manifest bytes for every package #1020

Closed
opened 2026-10-20 17:33:16 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/546
Author: @kolacheee
Created: 8/24/2026
Status: ✅ Merged
Merged: 8/24/2026
Merged by: @kolacheee

Base: staging ← Head: fix/545-lf-pinning


📝 Commits (3)

  • d09babe build: pin text files to LF so clones stop corrupting artifacts
  • 9765ca1 fix(scripts): check manifest bytes for catalog-excluded packages too
  • 3c366f0 fix(scripts): reject symlinked package directories in the integrity sweep

📊 Changes

3 files changed (+243 additions, -44 deletions)

View changed files

➕ .gitattributes (+54 -0)
➕ scripts/package-manifest-integrity.mjs (+170 -0)
📝 scripts/validate-catalog.mjs (+19 -44)

📄 Description

Pull request

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #545

Why this change

  • Git for Windows writes core.autocrlf=true into the system gitconfig, so a fresh clone on Windows is CRLF-smudged before any repo-local setting can help. This repo's builds raw-concatenate src/*.js and its manifests record exact bytes/sha256, so the smudge has already caused a shipped defect: pixelforge 0.11.0's manifest, artifact zip, and source blob disagreed by 3,280 bytes because one source file sat CRLF at build time (caught in #544 review). The same smudge makes validate-catalog.mjs and validate-package-locales.mjs fail on packages a contributor never touched. And the byte-equality check that enforces exactly this invariant only walked catalog.packages — so INCOMPLETE_PACKAGE_IDS members (pixelforge) were never checked at all, which is how the broken commit shipped.

What changed

  • Root .gitattributes (new): * text=auto eol=lf as the base — eol travels with the tree and wins over any core.autocrlf — plus explicit binary pins for the 272 committed .zip artifacts, .png (the only image format in the tree today), the other image formats validate-catalog.mjs already accepts (pinned before one lands), and defensive audio/font/pdf rules. No eol=crlf rules: the repo contains no Windows-native scripts (documented in a comment). No renormalization was needed: all 1,282 text blobs at HEAD are already pure LF and all 323 binaries are -text, triple-verified (git ls-files --eol, a per-blob cat-file scan, and git add --renormalize . staging zero changes) — so this PR changes checkout behavior only, not one byte of content.
  • scripts/package-manifest-integrity.mjs (new) + validate-catalog.mjs rewired: the per-file bytes/sha256 assertions and readZip move into a shared module used by both the existing catalog loop and a new sweep over every packages/*/manifest.json the catalog misses — identical code on both paths, so they cannot drift. Catalog-excluded packages now get the same source-vs-manifest and artifact-vs-manifest verification as everything else. CI already runs validate-catalog.mjs, so no workflow change is needed.
  • Affected package IDs: none — no package source or artifact is modified.

Package and security impact

  • Affected package IDs: none (infrastructure only)
  • Engine compatibility impact: none
  • New or changed permissions/entrypoints: none
  • Restart, storage, update, or uninstall impact: none

Validation

  • node scripts/validate-catalog.mjs passes locally
  • git diff --check passes locally
  • Rebuilt every affected manifest, payload, artifact, and catalog entry
  • Installed or updated the affected package through Marinara Engine
  • Checked supported modes, restart behavior, and uninstall cleanup
  • Read and followed CONTRIBUTING.md

Manual verification notes

Boxes left for the human contributor per the template. What was agent-verified, exactly:

  • The smudged-clone before/after (the heart of it): a git clone --local -c core.autocrlf=true of the branch parent checks out 1,282 files as CRLF and fails validate-package-locales (stale-size error on background) and validate-catalog (byte mismatch on eightball) on the raw tree; the identical clone of this branch checks out everything LF (w/lf 1,284 / w/-text 323, zero CRLF), all validators exit 0, and all 323 binaries are byte-identical to their blobs (pixelforge-0.11.0.zip disk = blob).
  • Fail-first on the #544 bug shape: in a scratch clone, one source file inflated to CRLF (+3,280 bytes — the issue's exact figure) and rebuilt: the pre-change validator exits 0 on the defect; the new one exits 1 naming the file and both byte counts ("pixelforge client.js source size does not match its manifest (manifest 625663 bytes, source 622383 bytes)"). The artifact arm proven separately (swapped-in stale zip → "Archived manifest does not match").
  • Full gates on the committed tree: npm run check (pinned prettier 3.9.6 + eslint 10.8.1) 0 errors; validate-catalog / validate-package-locales / test-catalog-lanes / validate-pr-triage all exit 0; git diff --check clean.
  • Known pre-existing, untouched: npm run test:security fails on Windows only (catalog-path-safety.regression.mjs asserts a POSIX-shaped path); identical on the unmodified parent; CI runs ubuntu.
  • No package was rebuilt or reinstalled — nothing in this PR changes any package's bytes (verified: renormalize staged zero changes).

Documentation impact

  • No documentation changes needed — the .gitattributes carries its own rationale as comments where the next contributor will meet it
  • Updated this README catalog and package guidance
  • Updated linked Marinara Engine documentation

UI evidence (if applicable)

  • Not applicable — no UI.

Summary by CodeRabbit

  • Chores
    • Standardized text file line endings across supported environments.
    • Marked binary files to prevent unintended line-ending conversion.
    • Added comprehensive package integrity checks for manifests, files, archives, sizes, hashes, and content consistency.
    • Improved catalog validation by detecting uncatalogued or incomplete packages and clearly reporting source-only packages.
    • Consolidated validation behavior for more consistent and reliable results.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Agents/pull/546 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 8/24/2026 **Status:** ✅ Merged **Merged:** 8/24/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `fix/545-lf-pinning` --- ### 📝 Commits (3) - [`d09babe`](https://github.com/Pasta-Devs/Marinara-Agents/commit/d09babeb2242b7eb448a9f7b44a8068376c1aabe) build: pin text files to LF so clones stop corrupting artifacts - [`9765ca1`](https://github.com/Pasta-Devs/Marinara-Agents/commit/9765ca19a8e7e3f4f866d3e07be8d143f3350d80) fix(scripts): check manifest bytes for catalog-excluded packages too - [`3c366f0`](https://github.com/Pasta-Devs/Marinara-Agents/commit/3c366f0b287d830b450499e1a95ef9c320b98e32) fix(scripts): reject symlinked package directories in the integrity sweep ### 📊 Changes **3 files changed** (+243 additions, -44 deletions) <details> <summary>View changed files</summary> ➕ `.gitattributes` (+54 -0) ➕ `scripts/package-manifest-integrity.mjs` (+170 -0) 📝 `scripts/validate-catalog.mjs` (+19 -44) </details> ### 📄 Description # Pull request > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #545 ## Why this change - Git for Windows writes `core.autocrlf=true` into the **system** gitconfig, so a fresh clone on Windows is CRLF-smudged before any repo-local setting can help. This repo's builds raw-concatenate `src/*.js` and its manifests record exact bytes/sha256, so the smudge has already caused a shipped defect: pixelforge 0.11.0's manifest, artifact zip, and source blob disagreed by 3,280 bytes because one source file sat CRLF at build time (caught in #544 review). The same smudge makes `validate-catalog.mjs` and `validate-package-locales.mjs` fail on packages a contributor never touched. And the byte-equality check that enforces exactly this invariant only walked `catalog.packages` — so `INCOMPLETE_PACKAGE_IDS` members (pixelforge) were never checked at all, which is how the broken commit shipped. ## What changed - **Root `.gitattributes`** (new): `* text=auto eol=lf` as the base — `eol` travels with the tree and wins over any `core.autocrlf` — plus explicit `binary` pins for the 272 committed `.zip` artifacts, `.png` (the only image format in the tree today), the other image formats `validate-catalog.mjs` already accepts (pinned before one lands), and defensive audio/font/pdf rules. No `eol=crlf` rules: the repo contains no Windows-native scripts (documented in a comment). **No renormalization was needed**: all 1,282 text blobs at HEAD are already pure LF and all 323 binaries are `-text`, triple-verified (`git ls-files --eol`, a per-blob `cat-file` scan, and `git add --renormalize .` staging zero changes) — so this PR changes checkout behavior only, not one byte of content. - **`scripts/package-manifest-integrity.mjs`** (new) + **`validate-catalog.mjs`** rewired: the per-file bytes/sha256 assertions and `readZip` move into a shared module used by *both* the existing catalog loop and a new sweep over every `packages/*/manifest.json` the catalog misses — identical code on both paths, so they cannot drift. Catalog-excluded packages now get the same source-vs-manifest and artifact-vs-manifest verification as everything else. CI already runs `validate-catalog.mjs`, so no workflow change is needed. - Affected package IDs: none — no package source or artifact is modified. ## Package and security impact - Affected package IDs: none (infrastructure only) - Engine compatibility impact: none - New or changed permissions/entrypoints: none - Restart, storage, update, or uninstall impact: none ## Validation <!-- These are human tasks. Never tick a box for a check that was not actually performed. --> - [ ] `node scripts/validate-catalog.mjs` passes locally - [ ] `git diff --check` passes locally - [ ] Rebuilt every affected manifest, payload, artifact, and catalog entry - [ ] Installed or updated the affected package through Marinara Engine - [ ] Checked supported modes, restart behavior, and uninstall cleanup - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes Boxes left for the human contributor per the template. What was agent-verified, exactly: - **The smudged-clone before/after** (the heart of it): a `git clone --local -c core.autocrlf=true` of the branch **parent** checks out 1,282 files as CRLF and fails `validate-package-locales` (stale-size error on `background`) and `validate-catalog` (byte mismatch on `eightball`) on the raw tree; the identical clone of **this branch** checks out everything LF (`w/lf` 1,284 / `w/-text` 323, zero CRLF), all validators exit 0, and all 323 binaries are byte-identical to their blobs (`pixelforge-0.11.0.zip` disk = blob). - **Fail-first on the #544 bug shape**: in a scratch clone, one source file inflated to CRLF (+3,280 bytes — the issue's exact figure) and rebuilt: the **pre-change validator exits 0 on the defect**; the new one exits 1 naming the file and both byte counts ("pixelforge client.js source size does not match its manifest (manifest 625663 bytes, source 622383 bytes)"). The artifact arm proven separately (swapped-in stale zip → "Archived manifest does not match"). - Full gates on the committed tree: `npm run check` (pinned prettier 3.9.6 + eslint 10.8.1) 0 errors; `validate-catalog` / `validate-package-locales` / `test-catalog-lanes` / `validate-pr-triage` all exit 0; `git diff --check` clean. - Known pre-existing, untouched: `npm run test:security` fails on Windows only (`catalog-path-safety.regression.mjs` asserts a POSIX-shaped path); identical on the unmodified parent; CI runs ubuntu. - No package was rebuilt or reinstalled — nothing in this PR changes any package's bytes (verified: renormalize staged zero changes). ## Documentation impact - [x] No documentation changes needed — the `.gitattributes` carries its own rationale as comments where the next contributor will meet it - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation ## UI evidence (if applicable) - Not applicable — no UI. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Standardized text file line endings across supported environments. * Marked binary files to prevent unintended line-ending conversion. * Added comprehensive package integrity checks for manifests, files, archives, sizes, hashes, and content consistency. * Improved catalog validation by detecting uncatalogued or incomplete packages and clearly reporting source-only packages. * Consolidated validation behavior for more consistent and reliable results. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-20 17:33:16 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Agents#1020
No description provided.