Skip to content

chore: harden Beads synchronization and corrective state - #2834

Merged
Sinity merged 3 commits into
masterfrom
feature/chore/corrective-beads-safety
Jul 13, 2026
Merged

Sinity merged 3 commits into
masterfrom
feature/chore/corrective-beads-safety

Conversation

@Sinity

@Sinity Sinity commented Jul 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

Makes the July corrective design synthesis durable and independently auditable in Beads, repairs backlog hygiene across the full export, and prevents Beads-only pushes from paying the full Polylogue quick-gate cost.

Problem

The Beads 1.0.4 server fallback auto-imported the checked-out JSONL before every mutation without checking whether the database was empty. In a branch-heavy shared checkout this could replay stale rows over newer live state. The corrective synthesis also left 24 open records without executable acceptance criteria and several label, priority, dependency, and design-hygiene defects. Finally, Beads-only pushes were running the same mypy/render gate as product-code pushes.

Ref polylogue-gxjh and polylogue-gxjh.1.

Solution

  • Reconciles 50 Beads records into a compact JSONL delta, including standalone corrective contracts, 24 substantive AC sets, hygiene repairs, closure evidence for the server replay incident, and a follow-up for monotonic/receipted synchronization.
  • Keeps declaration markers optional and advisory; polylogue-stc measures declaration recall before any future mandate.
  • Adds a typed pre-push classifier that evaluates every pushed ref. Beads-only changes run backlog-hygiene checks D1/D2; mixed or product-code changes retain devtools verify --quick.
  • Preserves the active Beads hook by replaying the captured pre-push ref stream after classification.
  • Teaches backlog-hygiene verification to run selected checks without weakening the default full scan.

The upstream Beads server-empty guard itself is deployed from Sinnix commit fd47118; this repository records the incident and proof rather than vendoring the binary patch.

Verification

  • devtools test tests/unit/devtools/test_pre_push_hook.py tests/unit/devtools/test_verify_backlog_hygiene.py — 14 passed.
  • devtools verify --quick — 15/15 steps passed; 36.06s; run 20260713T074947Z-quick-3660747-df0fafca.
  • .agent/scripts/bd-graph-lint — no dependency cycles; duplicate labels=0, inversions=0, missing AC=0.
  • python3 devtools/verify_backlog_hygiene.py — zero unhandled findings across 777 issues.
  • Structured retention audit — all 29 earlier corrective records retain their non-empty description/design/AC/notes text; all 50 intended live records match the committed core fields after explicit restoration with the patched binary.

GitHub-hosted workflows are disabled while the account is billing-locked, so local gates above are the publication evidence for this PR.

Summary by CodeRabbit

  • New Features

    • Added targeted pre-push verification that selects checks based on the files being pushed.
    • Added specialized validation for backlog-only updates.
    • Added selective backlog-hygiene check execution.
  • Bug Fixes

    • Improved recognition of bead references to avoid false positives.
    • Improved pre-push error handling and temporary-file cleanup.
  • Tests

    • Expanded coverage for hook behavior, push classification, malformed input, and backlog validation.

Sinity and others added 3 commits July 13, 2026 09:43
The active pre-push hook ran mypy and every generated-surface check even when the complete pushed diff only changed .beads/. A typical bookkeeping push spent 71 seconds proving product code that had not changed.

Parse Git pre-push update lines once, classify the complete published diff, and run only JSONL dependency-integrity checks D1/D2 for Beads-only pushes. Mixed or code pushes retain the full quick gate, and the update stream is replayed to the Beads hook. Both active and template hooks share the selector. Behavioral tests cover existing/new/mixed refs and malformed input.

Co-Authored-By: Codex <[email protected]>
The corrective design state had two independent deficits: 24 execution records lacked standalone acceptance criteria, and Beads 1.0.4 server-mode auto-import could replay stale branch JSONL over newer live rows.

Add behavior-level AC to all 24 records, reconcile area/horizon/dependency/ref hygiene, preserve optional marker adoption pending declaration-recall evidence, record the disabled billing-locked workflows, and close the completed server migration/root incident. Keep generalized monotonic import receipts and concurrent bootstrap hardening on gxjh.1.

The current 777-record export has zero backlog-hygiene findings, no graph cycles, no inversions, no duplicate labels, and no missing AC. All 29 fields from the earlier corrective reconciliation remain exact substrings of their current records.

Co-Authored-By: Codex <[email protected]>
Normalize the corrective JSONL against the current master ordering after
conflict resolution. This removes serialization-only churn while retaining
all 50 semantic record changes and the new monotonic-sync follow-up.

Co-Authored-By: Claude <[email protected]>
@Sinity
Sinity merged commit 4e787df into master Jul 13, 2026
1 of 2 checks passed
@Sinity
Sinity deleted the feature/chore/corrective-beads-safety branch July 13, 2026 07:51
@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1d068085-aa8b-4f9c-84d6-469174f64e97

📥 Commits

Reviewing files that changed from the base of the PR and between e8c9485 and 5b498df.

📒 Files selected for processing (7)
  • .beads-hooks/pre-push
  • .beads/issues.jsonl
  • .githooks/pre-push
  • devtools/pre_push_gate.py
  • devtools/verify_backlog_hygiene.py
  • tests/unit/devtools/test_pre_push_hook.py
  • tests/unit/devtools/test_verify_backlog_hygiene.py
🔥 Files not summarized due to errors (1)
  • .beads/issues.jsonl: Server error: no LLM provider could handle the message

📝 Walkthrough

Walkthrough

Pre-push hooks now pass push updates to a Python gate. The gate computes changed paths, runs D1/D2 hygiene checks for Beads-only pushes, and runs stamped quick verification for other pushes. Hygiene checks support filtering and stricter Bead-reference matching.

Changes

Pre-push verification gate

Layer / File(s) Summary
Hook update handoff
.beads-hooks/pre-push, .githooks/pre-push
Both hooks create and clean up temporary update files before invoking devtools.pre_push_gate; the Beads hook forwards the updates to its pre-push command.
Update classification and gate execution
devtools/pre_push_gate.py
The new module parses pre-push updates, computes changed paths including new branches and deleted refs, classifies Beads-only pushes, and selects either D1/D2 hygiene checks or stamped quick verification.
Selective backlog hygiene checks
devtools/verify_backlog_hygiene.py
Hygiene findings can be restricted with --checks, and longer external identifiers are excluded from truncated Bead-reference matching.
Behavioral validation
tests/unit/devtools/test_pre_push_hook.py, tests/unit/devtools/test_verify_backlog_hygiene.py
Tests cover hook behavior, update classification, merge-base handling, malformed input, filtered findings, and external request identifiers.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related issues

  • Sinity/polylogue#1881 — Adds Beads integration to the pre-push gate, including Beads-only classification and backlog-hygiene checks.

Possibly related PRs

Sequence Diagram(s)

sequenceDiagram
  participant Git
  participant PrePushHook
  participant PrePushGate
  participant GitDiff
  participant VerifyBacklogHygiene
  participant DevtoolsVerify

  Git->>PrePushHook: provide update lines
  PrePushHook->>PrePushGate: pass temporary updates file
  PrePushGate->>GitDiff: compute changed paths
  GitDiff-->>PrePushGate: return changed paths
  alt Beads-only changes
    PrePushGate->>VerifyBacklogHygiene: run checks D1,D2
  else Other changes
    PrePushGate->>DevtoolsVerify: run verify --quick when needed
  end
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/chore/corrective-beads-safety

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@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: 5b498df8d1

ℹ️ 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 devtools/pre_push_gate.py Resolved
@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant