Skip to content

Add the SQ-LOCK-01 executor: squabble relock - #164

Merged
hyperpolymath merged 2 commits into
mainfrom
claude/sq-lock-01-executor
Nov 14, 2026
Merged

hyperpolymath merged 2 commits into
mainfrom
claude/sq-lock-01-executor

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

The owner said to build the SQ-LOCK-01 executor (2026-11-14). Until now only the detector existed (self_sha_lock_records); nothing repaired a lock. squabble relock repairs the records whose ref: repeats their own SHA, using the order the catalogue row already gives.

First proof: on ZeroInflatedCounts.jl's lock, hyperpolymath/cicd-suite@0da816c0… (cicd-suite has no tags and holds the commit on its main), the executor's output is byte-identical to the hand repair in ZeroInflatedCounts.jl#22.

Changes

  • crates/squabble-core/src/lockfix.rs (new, pure, no network): choose_ref (highest full-semver tag, else highest semver tag, else first tag, else the default or only branch that holds the commit; ties and no ref are Refusals), rewrite_refs (only the direct ref: line of a named record; line endings kept; an unwritable ref is refused), plan_lock_fix, and reusable_callers (job-level reusable callers from a workflow). Its own check, check_rewrite, fails closed: same line count, only the edited ref: lines differ, edited records no longer flagged, refused ones still flagged.
  • crates/squabble-cli/src/relock.rs (new): squabble relock --lock <file> --evidence <tsv> (--workflows <dir> | --callers <file>) [--attempts n] [--open-fix-pr] [--write]. A dry run unless --write is given and decide (the ESTATE_AUTOFIX kill switch, two attempts per head, one open fix PR per rule) returns Apply. It writes through a temp file and a rename. Exit 0 all repaired, 4 some are referrals, 2 error.
  • crates/squabble-core/src/rules.rs: four private helpers made pub(crate) for reuse, nothing else.
  • docs/decisions/0004-first-line-rule-catalogue.adoc: a section on the executor.

Two things worth a reviewer's eye

  • Callers are never guessed. My first test run hand-listed one caller and the executor flagged metadatastician/standards@6038…, a valid reusable-caller record whose ref: repeats its SHA by design. Had evidence existed for it, it would have been rewritten and broken the lock's closure. So callers now come from the repository's own workflows, and a run with neither --workflows nor --callers is an error.
  • It does not claim the rule's check. It prints check: not run here; the lock gate on the PR is the check. The rule's check is the repository's lock gate, run on the PR.

Not in this PR

  • Gathering the evidence from git (tags at a SHA, branches that contain it) is still a TSV the caller supplies. That, and opening the PR, are the next steps.
  • It has not been run on any repository other than as a dry comparison on one lock copy; no applier wave is widened by this.

RSR Quality Checklist

Required

  • Tests pass (cargo test: 215 in squabble-core, 100 + 58 in the CLI crates)
  • Code is formatted (cargo fmt --check)
  • Linter is clean (cargo clippy --all-targets -- -D warnings)
  • No banned language patterns
  • No unsafe blocks
  • No secrets, credentials, or .env files included
  • SPDX headers present on both new files; no licence edits

As Applicable

  • Documentation updated (ADR 0004)

Generated by Claude Code

Repairs actions.lock records whose ref: repeats their own SHA, in the row's
order (highest full-semver tag, else highest semver, else first tag, else the
default or only branch that holds the commit); ties and no ref are referrals.
Pure core in squabble-core (lockfix), thin CLI in squabble-cli (relock).
Changes only the flagged ref: lines and re-checks its own result; a dry run
unless --write and the guards say Apply (ESTATE_AUTOFIX); reusable callers are
read from the repo's workflows and never rewritten; never claims the rule's
check passed (the repo's lock gate on the PR is the check).

First proof: its output for ZeroInflatedCounts.jl cicd-suite@0da816c0 is
byte-identical to the hand repair in ZeroInflatedCounts.jl#22.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0136P7Zmiut2nCcbtEx25HAU
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 39 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: ea672fc7-3a7c-4bd7-b152-ee030f24075f
Commits

Reviewing files that changed from the base of the PR and between 7607660 and 6e81111.

Files selected for processing: 6

  • crates/squabble-cli/src/main.rs
  • crates/squabble-cli/src/relock.rs
  • crates/squabble-core/src/lib.rs
  • crates/squabble-core/src/lockfix.rs
  • crates/squabble-core/src/rules.rs
  • docs/decisions/0004-first-line-rule-catalogue.adoc
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-14T09:11:40.011133Z
We couldn’t complete this review. Comment @codex review to try again.
12f7fa3 PR opened
ℹ️ 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

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath merged commit 199d1be into main Nov 14, 2026
51 of 52 checks passed
@hyperpolymath
hyperpolymath deleted the claude/sq-lock-01-executor branch November 14, 2026 09:28
hyperpolymath added a commit that referenced this pull request Nov 14, 2026
…pository (#166)

## Summary

The second step of the SQ-LOCK-01 executor (#164). `squabble relock`
could repair a lock only from an evidence TSV that a person gathered by
hand. `--gather` asks each flagged record's own repository instead, so
the executor can run from a lock and its workflows alone. Still
read-only on every repository, and still a dry run unless `--write` is
given and the guards say Apply.

Live check, no hand-made evidence:

- ZeroInflatedCounts.jl's `hyperpolymath/cicd-suite@0da816c0…` (no tags;
the commit is on `main`) gives `main`, byte-identical to the hand repair
in ZeroInflatedCounts.jl#22.
- ResidualEvidenceTypes.jl's `actions/upload-artifact@bbbca2dd…` (one
tag at that SHA) gives `v7.0.0`.

## Changes

- `crates/squabble-cli/src/relock_gather.rs` (new): `git ls-remote
--tags` for the tags whose commit is the SHA (an annotated tag by its
peeled `^{}` commit). Only when there is no tag: a blob-less fetch of
all branch heads into a private temporary directory (removed on drop)
and `for-each-ref --contains`. Also the default branch from `ls-remote
--symref`. It never writes to the repository it asks and never to the
lock. Tests run real git against a local fixture repository (annotated
tag found by its peeled commit; branches named when there is no tag; a
commit no branch holds is no evidence, not an error; an unreachable
remote is an error).
- `crates/squabble-cli/src/relock.rs`: `--gather` and `--remote-base`,
exactly one of `--evidence` or `--gather`. A failed lookup prints
`gather-failed` and leaves the record without evidence, so it is a
referral, never a guess.
- `docs/decisions/0004-first-line-rule-catalogue.adoc`: the executor
section's evidence bullet, and the proof.

## Not in this PR

Opening the fix PR is still a separate step that is not built. Nothing
has been run on any repository other than as the read-only comparisons
above, and no applier wave is widened by this.

## RSR Quality Checklist

### Required

- [x] Tests pass (`cargo test`: 106 in the CLI crate, 215 in
squabble-core)
- [x] Code is formatted (`cargo fmt --check`)
- [x] Linter is clean (`cargo clippy --all-targets -- -D warnings`)
- [x] No banned language patterns
- [x] No `unsafe` blocks
- [x] No secrets, credentials, or `.env` files included
- [x] SPDX headers present on the new file; no licence edits

### As Applicable

- [x] Documentation updated (ADR 0004)

---
_Generated by [Claude
Code](https://claude.ai/code/session_0136P7Zmiut2nCcbtEx25HAU)_
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.

3 participants