[GH-ISSUE #381] Catalog regeneration forces every concurrent PR to rebase (catalog/*.json conflicts) #191

Closed
opened 2026-10-20 17:25:14 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @kolacheee on GitHub (Aug 16, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/381

Originally assigned to: @kolacheee on GitHub.

Problem

Every package release regenerates catalog/catalog.json, catalog/v2/catalog.json, and catalog/v3/catalog.json. Because every package PR commits its regenerated catalog, any two PRs open at the same time touch the same three files. When one merges, the others conflict and must rebase — which also re-runs the full CI suite on each. With several devs working concurrently this happens constantly.

Why the conflicts fire

The catalogs are pure derived data — scripts/build-agent-catalog.mjs (+ build-feature-packages.mjs, build-pixelforge-package.mjs) aggregate every packages/<id>/manifest.json into one packages[] array via the shared writeCatalogFamily() in scripts/catalog-lanes.mjs. Two independent conflict sources:

  1. generatedAt — each builder stamped catalog.generatedAt = new Date().toISOString() right before writing. That single line differs between any two regenerations, so it conflicts even when the two PRs touched completely different packages. (This is the one that fires every time. A merge only stays clean when one side regenerated — as soon as both do, the timestamp collides.)
  2. Adjacent packages[] entries — when two PRs insert/bump entries near each other in the sorted array.

Constraint that shapes the fix

  • The Engine fetches the catalog from raw.githubusercontent.com/Pasta-Devs/Marinara-Agents/<channel>/catalog/... (staging Engine ← this repo's staging; stable Engine ← main). So the catalogs must stay committed on those branches — deleting them isn't an option.
  • Per CONTRIBUTING.md, catalog/ + artifacts/ are a deliberate security-review surface: "A contributor who can change both an artifact and its catalog entry can also change the recorded hash... paths map to SpicyMarinara in .github/CODEOWNERS. main must remain owner-only." Any change to who/what commits catalog + artifact hashes intersects that integrity control.

Options

B — Make generatedAt deterministic (implemented; security-neutral)

Preserve the committed generatedAt across rebuilds; refresh it only on an explicit MARINARA_CATALOG_STAMP_GENERATED_AT=1 opt-in (e.g. at release). A no-op rebuild becomes byte-identical, and the always-conflicting timestamp line disappears — so two PRs that touch different packages typically auto-merge (non-adjacent array inserts). The Engine catalog schema only needs a valid ISO datetime, which a preserved value satisfies. This removes the conflict that actually fires on every concurrent PR and is the low-risk majority of the fix.

→ Draft PR: (link to follow)

A — CI owns the catalog: PRs stop committing it, automation regenerates on merge

The "elegant end state": feature PRs commit only their own packages/<id>/ sources + artifact; CI regenerates + validates the catalog in-job, and a post-merge job regenerates + commits the published catalog. PRs would then share no files and never force a rebase.

But this needs an owner (SpicyMarinara) decision, because it changes the integrity-review model above:

  • A CI bot committing regenerated catalog/artifact hashes to staging/main bypasses the CODEOWNERS gate and the owner-only-main promotion that currently vet those hashes.
  • It also shifts validate-catalog.mjs from validating the committed catalog to validating a freshly generated one, and adds a full catalog rebuild to the PR check (CI cost).

Because that touches the security posture of a repo I don't own, I'm not implementing the auto-commit unilaterally — flagging it here for the owner to decide whether the bot-commit path is acceptable (it is arguably more consistent than hand-committed hashes, since CI always recomputes them, but it's the owner's call).

C — Regenerate-on-conflict git merge driver (security-neutral middle ground)

A .gitattributes merge= driver for catalog/**/*.json that re-runs the deterministic generator instead of a textual 3-way merge, registered via an npm setup step. The human still commits and the owner still reviews the result, so the integrity model is unchanged — but local rebases auto-resolve. Weaker than A (GitHub's own mergeability still flags the PR; only local rebases auto-fix), and largely unnecessary once B lands, but it's compatible if more is wanted later.

Recommendation

Ship B now (done — draft PR incoming). It's safe, needs no infra/permission changes, and eliminates the conflict that fires every time. Treat A as an owner-gated follow-up (it's the ideal but it's a security-model decision), and keep C in reserve if entry-adjacency conflicts still bite after B.

Filed after CI work on #375 surfaced how often these catalog rebases block concurrent PRs.

Originally created by @kolacheee on GitHub (Aug 16, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/381 Originally assigned to: @kolacheee on GitHub. ## Problem Every package release regenerates `catalog/catalog.json`, `catalog/v2/catalog.json`, and `catalog/v3/catalog.json`. Because every package PR commits its regenerated catalog, any two PRs open at the same time touch the same three files. When one merges, the others conflict and must rebase — which also re-runs the full CI suite on each. With several devs working concurrently this happens constantly. ## Why the conflicts fire The catalogs are **pure derived data** — `scripts/build-agent-catalog.mjs` (+ `build-feature-packages.mjs`, `build-pixelforge-package.mjs`) aggregate every `packages/<id>/manifest.json` into one `packages[]` array via the shared `writeCatalogFamily()` in `scripts/catalog-lanes.mjs`. Two independent conflict sources: 1. **`generatedAt`** — each builder stamped `catalog.generatedAt = new Date().toISOString()` right before writing. That single line differs between *any* two regenerations, so it conflicts even when the two PRs touched completely different packages. (This is the one that fires every time. A merge only stays clean when *one* side regenerated — as soon as *both* do, the timestamp collides.) 2. **Adjacent `packages[]` entries** — when two PRs insert/bump entries near each other in the sorted array. ## Constraint that shapes the fix - The Engine fetches the catalog from `raw.githubusercontent.com/Pasta-Devs/Marinara-Agents/<channel>/catalog/...` (staging Engine ← this repo's `staging`; stable Engine ← `main`). So the catalogs **must stay committed** on those branches — deleting them isn't an option. - Per `CONTRIBUTING.md`, `catalog/` + `artifacts/` are a **deliberate security-review surface**: *"A contributor who can change both an artifact and its catalog entry can also change the recorded hash... paths map to `SpicyMarinara` in `.github/CODEOWNERS`. `main` must remain owner-only."* Any change to *who/what* commits catalog + artifact hashes intersects that integrity control. ## Options ### B — Make `generatedAt` deterministic (implemented; security-neutral) Preserve the committed `generatedAt` across rebuilds; refresh it only on an explicit `MARINARA_CATALOG_STAMP_GENERATED_AT=1` opt-in (e.g. at release). A no-op rebuild becomes byte-identical, and the always-conflicting timestamp line disappears — so two PRs that touch *different* packages typically auto-merge (non-adjacent array inserts). The Engine catalog schema only needs a valid ISO datetime, which a preserved value satisfies. **This removes the conflict that actually fires on every concurrent PR** and is the low-risk majority of the fix. → Draft PR: (link to follow) ### A — CI owns the catalog: PRs stop committing it, automation regenerates on merge The "elegant end state": feature PRs commit only their own `packages/<id>/` sources + artifact; CI regenerates + validates the catalog in-job, and a post-merge job regenerates + commits the published catalog. PRs would then share **no** files and never force a rebase. **But this needs an owner (SpicyMarinara) decision**, because it changes the integrity-review model above: - A CI bot committing regenerated catalog/artifact hashes to `staging`/`main` bypasses the CODEOWNERS gate and the owner-only-`main` promotion that currently vet those hashes. - It also shifts `validate-catalog.mjs` from validating the *committed* catalog to validating a *freshly generated* one, and adds a full catalog rebuild to the PR check (CI cost). Because that touches the security posture of a repo I don't own, I'm **not** implementing the auto-commit unilaterally — flagging it here for the owner to decide whether the bot-commit path is acceptable (it is arguably *more* consistent than hand-committed hashes, since CI always recomputes them, but it's the owner's call). ### C — Regenerate-on-conflict git merge driver (security-neutral middle ground) A `.gitattributes` `merge=` driver for `catalog/**/*.json` that re-runs the deterministic generator instead of a textual 3-way merge, registered via an `npm` setup step. The human still commits and the owner still reviews the result, so the integrity model is unchanged — but local rebases auto-resolve. Weaker than A (GitHub's own mergeability still flags the PR; only local rebases auto-fix), and largely unnecessary once B lands, but it's compatible if more is wanted later. ## Recommendation Ship **B** now (done — draft PR incoming). It's safe, needs no infra/permission changes, and eliminates the conflict that fires every time. Treat **A** as an owner-gated follow-up (it's the ideal but it's a security-model decision), and keep **C** in reserve if entry-adjacency conflicts still bite after B. *Filed after CI work on #375 surfaced how often these catalog rebases block concurrent PRs.*
bsakaguchi 2026-10-20 17:25:14 +07:00
  • closed this issue
  • added the
    ci
    label
Author
Owner

@kolacheee commented on GitHub (Aug 16, 2026):

Option B implemented in draft PR #382 (branch fix/catalog-generatedat-churn): generatedAt is now preserved across rebuilds (fresh stamp only on MARINARA_CATALOG_STAMP_GENERATED_AT=1), with a determinism regression wired into the catalog check. Options A and C remain as described above — A is left for the owner because it changes the CODEOWNERS/owner-only-main integrity model.

<!-- gh-comment-id:5308200581 --> @kolacheee commented on GitHub (Aug 16, 2026): Option B implemented in draft PR #382 (branch `fix/catalog-generatedat-churn`): `generatedAt` is now preserved across rebuilds (fresh stamp only on `MARINARA_CATALOG_STAMP_GENERATED_AT=1`), with a determinism regression wired into the catalog check. Options A and C remain as described above — A is left for the owner because it changes the CODEOWNERS/owner-only-`main` integrity model.
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#191
No description provided.