Skip to content

ci: keep generated HQ snapshot and ACTIVITY.md off branches - #370

Merged
mergify[bot] merged 5 commits into
mainfrom
claude/ci-conflict-hotspots
Oct 4, 2026
Merged

mergify[bot] merged 5 commits into
mainfrom
claude/ci-conflict-hotspots

Conversation

@Cuarroc

@Cuarroc Cuarroc commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Branches dürfen den HQ-Snapshot (docs/dev-hq/data.js|json) und .pa/ACTIVITY.md nicht mehr committen, weil genau diese drei Dateien fast alle Merge-Konflikte verursacht haben. Ein neues Gate (hotspot-guard) lehnt solche Änderungen ab und sagt, wie man sie entfernt. Journal-Notizen auf Branches landen in einer ungetrackten Datei, und den Snapshot aktualisiert nur noch der Koordinator auf main bzw. in einem eigenen hq-snapshot-PR.

Report

What changed (9 files, +223/-9)

  • Writers found: scripts/sync.sh note (appends .pa/ACTIVITY.md), scripts/session-end-hook.sh (calls it; debounce on the file), .githooks/post-merge (regenerates docs/dev-hq/data.* in the worktree after every merge), scripts/dev-hq.mjs (the generator, run by npm run hq and by scripts/hq-live.mjs at startup), scripts/dev/report-commit.mjs (only restores the snapshot, does not write it). Readers: HQ tests (scripts/lib/hq-*.test.mjs) read data.json; they need it present, not fresh. .pa/ACTIVITY.md is read by hq-live.mjs insights.
  • scripts/lib/hotspots.sh: shared rule. Only main/master, GitHub or Mergify queue branches, and hq-snapshot* / */hq-snapshot* branches may carry changes to the files.
  • scripts/ci/hotspot-guard.sh + gate hotspot-guard (prepush, branchpush, linux): fails if the diff vs merge-base touches a hotspot file; fails closed without a base; message names the files and the git checkout <base> -- ... fix.
  • sync.sh note on a branch writes .pa/ACTIVITY.local.md (ignored by .gitignore) and prints where; new sync.sh where; session-end hook debounces on that file.
  • .githooks/post-merge skips regeneration off main.
  • AGENTS.md "Checks": one paragraph (CLAUDE.md untouched).

Decision note: the task text named the package-branch regex, but most conflicting PRs (codex/state-7-…, codex/ci-…) do not match it. The rule is therefore an allow-list (main + hq-snapshot branches), not a deny-list of package branches. Open PRs that currently carry these files will go red until they drop them (message tells how).

Evidence

  • bash scripts/test-hotspot-guard.sh exit 0 (10 ok cases at f5ce8aa; Mergify queue case red before the review fix)
  • node --test scripts/lib/hq-post-merge.test.mjs exit 0 (7 pass)
  • bash scripts/test-gates.sh, test-ci-shape.sh, test-script-modes.sh exit 0
  • bash scripts/ci/red-first.sh --plan exit 0 at f5ce8aa (count=11)
  • CARGO_TARGET_DIR=<assigned-slot> CARGO_BUILD_JOBS=1 bash scripts/ci/gates.sh lane prepush exit 0 at f5ce8aa (1764 Rust tests passed; 7 platform-gated tests skipped)
  • gh pr checks 370 --watch --interval 10 exit 0 at f5ce8aa (gates (linux), gates (windows), red-first, CodeQL and GitGuardian green; expected reporting jobs skipped)

NICHT ABGEDECKT

  • Windows half (#[cfg(windows)], Git-Bash behaviour of the new scripts); runs in the merge queue.
  • hq-live.mjs startup regeneration on a branch is not changed; the guard catches it at commit/push time. A full red-first run against the merge base was not executed locally (plan only).
  • The first dedicated hq-snapshot refresh PR is a follow-up for the coordinator.

Architecture drift: no unapproved finding. The review fix adopts the repository's existing mergify/merge-queue/* branch convention from the CI workflow and lane planner.

Review: completed, tier B; no high finding remains open.

Review disposition

  • Reviewer: Codex (OpenAI); exact model identifier was not observable from the harness in this session.
  • Candidate reviewed: a3bc472; post-fix candidate rechecked: f5ce8aa.
  • F1 — medium — scripts/lib/hotspots.sh:29: the allowlist recognized gh-readonly-queue/* but omitted this repository's established mergify/merge-queue/* branch form. A queue batch carrying an allowed snapshot refresh would therefore fail hotspot-guard. Accepted: red test commit 4b626f3, fix commit f5ce8aa; scripts/test-hotspot-guard.sh:64 now proves the real queue form.
  • Countercheck: the branch form is used by .github/workflows/ci.yml and scripts/ci/lane-plan.sh; the failing regression test reproduced the rejection at a3bc472. No other finding survived countercheck, and no second architecture pattern was introduced.

🤖 Generated with Claude Code

CI-Fix (5491ddd): selftest-hotspot-guard failed in CI because GITHUB_HEAD_REF leaked into the sync note on main case (reproduced locally with GITHUB_ACTIONS=true GITHUB_HEAD_REF=claude/ci-conflict-hotspots); the test now unsets both. bash scripts/ci/red-first.sh exit 0, bash scripts/ci/gates.sh lane prepush exit 0 at 5491ddd.

  • CI-Fix a3bc472: scripts/lib/hq-post-merge.test.mjs erbte in CI GITHUB_HEAD_REF (Hook hielt die Fixture fuer den PR-Branch, 5 Tests rot). Rot lokal mit GITHUB_ACTIONS=true GITHUB_HEAD_REF=claude/x node --test scripts/lib/hq-post-merge.test.mjs (Exit 1, 5 failed), danach 7/7 gruen mit und ohne Variablen; gates.sh lane prepush Exit 0.

GitHub/Mergify merge without our local merge driver, so every PR that
committed docs/dev-hq/data.js|json or .pa/ACTIVITY.md re-conflicted with
all others. Only main and hq-snapshot branches may change them now.

- gate hotspot-guard rejects a branch diff (vs merge-base) touching them
- sync.sh note writes to untracked .pa/ACTIVITY.local.md on a branch
- post-merge regenerates the snapshot on main only
- session-end-hook debounces on the file sync.sh really writes

Test-First: scripts/test-hotspot-guard.sh::guard rejects package branch touching docs/dev-hq/data.js
Test-First: scripts/test-hotspot-guard.sh::guard rejects package branch touching docs/dev-hq/data.json
Test-First: scripts/test-hotspot-guard.sh::guard rejects package branch touching .pa/ACTIVITY.md
Test-First: scripts/test-hotspot-guard.sh::guard accepts branch touching other files only
Test-First: scripts/test-hotspot-guard.sh::guard accepts main touching the hotspot files
Test-First: scripts/test-hotspot-guard.sh::guard accepts a dedicated hq-snapshot branch
Test-First: scripts/test-hotspot-guard.sh::guard fails closed without a base
Test-First: scripts/test-hotspot-guard.sh::sync note on a package branch leaves the tracked ACTIVITY.md alone
Test-First: scripts/lib/hq-post-merge.test.mjs::post-merge leaves the snapshot alone on a non-main branch

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T20:40:13.312317Z c10cdf6 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c10cdf6e10

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/lib/hotspots.sh Outdated

hs_may_touch() { # branch
case "$1" in
main | master | gh-readonly-queue/* | hq-snapshot* | */hq-snapshot*) return 0 ;;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Erlaube den Mergify-Queue-Branch für Snapshot-PRs

Sobald ein erlaubter <vendor>/hq-snapshot-*-PR in die verpflichtende Mergify-Queue gelangt, lautet GITHUB_HEAD_REF laut .github/workflows/ci.yml:98-100 stattdessen mergify/merge-queue/*. Dieses Muster fehlt hier, sodass hotspot-guard den Snapshot im Queue-Diff findet und die Linux-Bahn ablehnt; der dokumentierte Weg zum Aktualisieren des Snapshots kann damit nicht gemergt werden. Die Allowlist muss den tatsächlich verwendeten Mergify-Namensraum berücksichtigen oder die ursprüngliche PR-Branch-Identität separat auswerten.

AGENTS.md reference: AGENTS.md:L148-L154

Useful? React with 👍 / 👎.

Comment thread scripts/lib/hotspots.sh Outdated

hs_may_touch() { # branch
case "$1" in
main | master | gh-readonly-queue/* | hq-snapshot* | */hq-snapshot*) return 0 ;;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Entferne master aus der Hotspot-Ausnahme

Bei einem PR mit dem Quellbranch master gibt hs_may_touch sofort Erfolg zurück, sodass das Gate Änderungen an allen drei Hotspot-Dateien ungeprüft akzeptiert. Dieses Repository verwendet main, und die neue Regel erlaubt außer dedizierten Snapshot-Branches ausdrücklich keinen anderen Branch; ein Branch namens master kann die Konfliktvermeidung daher vollständig umgehen.

AGENTS.md reference: AGENTS.md:L148-L154

Useful? React with 👍 / 👎.

Comment thread scripts/sync.sh
Comment on lines +32 to +34
if [ -f "$TRACKED" ]; then
echo "== .pa/ACTIVITY.md (letzte Einträge) =="
tail -n 40 "$ACTIVITY"
tail -n 40 "$TRACKED"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Zeige den lokalen Handover beim Start an

Auf jedem normalen Arbeitsbranch schreibt sync.sh note den Handover nun nach .pa/ACTIVITY.local.md, aber sync.sh start liest hier weiterhin ausschließlich $TRACKED. Damit sieht die nächste Sitzung beim vorgeschriebenen Start-Check nur das globale Journal und nicht die gerade für diesen Arbeitsbaum hinterlassene Zusammenfassung; die neue lokale Notiz hat im Repository keinen anderen Leser. Gib beim Start zusätzlich den Tail von $ACTIVITY aus, wenn dieser von $TRACKED abweicht.

AGENTS.md reference: AGENTS.md:L294-L297

Useful? React with 👍 / 👎.

Comment thread scripts/sync.sh
Comment on lines +27 to +29
ACTIVITY="$TRACKED"
branch="$(hs_branch "$ROOT")"
hs_may_touch "$branch" || ACTIVITY="$ROOT/.pa/ACTIVITY.local.md"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Schreibe ACTIVITY auch auf Snapshot-Branches nur lokal

Auf einem <vendor>/hq-snapshot-*-Branch liefert hs_may_touch Erfolg, weshalb diese Zuweisung .pa/ACTIVITY.md als Ziel behält; zugleich beendet hotspot-guard für denselben Branch seine Prüfung vorzeitig. Ein vorgeschriebener sync.sh note verändert dadurch das getrackte Journal, obwohl der dedizierte Snapshot-PR laut Regel nur die beiden docs/dev-hq/data.*-Dateien enthalten soll. Die Snapshot-Ausnahme muss für das Journal getrennt von der Berechtigung zur Snapshot-Regeneration behandelt werden.

AGENTS.md reference: AGENTS.md:L148-L154

Useful? React with 👍 / 👎.

Cuarroc and others added 2 commits October 4, 2026 22:45
The sync note cases inherited GITHUB_HEAD_REF in CI, so the main case saw the PR branch.

No-Test: fixes the self-test itself; verified with GITHUB_ACTIONS and GITHUB_HEAD_REF set

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The hook reads GITHUB_HEAD_REF first, so in CI the fixture repos were judged as the PR branch and the hook skipped regeneration.

No-Test: fixes the test harness itself; red with GITHUB_ACTIONS=true GITHUB_HEAD_REF=claude/x (5 failed), green with and without (7 passed)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Cuarroc Cuarroc added the priority Mergify: zuerst in die Queue (nur Koordinator) label Oct 4, 2026
@mergify

mergify Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

Test-First: scripts/test-hotspot-guard.sh::guard accepts a Mergify merge queue branch
Test-First: scripts/test-hotspot-guard.sh::guard accepts a Mergify merge queue branch
@Cuarroc

Cuarroc commented Oct 4, 2026

Copy link
Copy Markdown
Owner Author

@Mergifyio queue

@mergify mergify Bot added the queued label Oct 4, 2026
@mergify
mergify Bot merged commit 5a7d4b7 into main Oct 4, 2026
11 checks passed
@mergify

mergify Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 14 minutes 38 seconds in the queue, including 14 minutes 16 seconds running CI.

Required conditions to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority Mergify: zuerst in die Queue (nur Koordinator)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant