Skip to content

refactor: remove source revision and close policy factories - #1894

Merged
obviyus merged 1 commit into
mainfrom
cleanup/row3-policy-leaves
Oct 10, 2026
Merged

obviyus merged 1 commit into
mainfrom
cleanup/row3-policy-leaves

Conversation

@obviyus

@obviyus obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Remove createSourceRevisionTools and createCloseDecisionWorkflow; import their production operations directly instead of constructing policy dependency bags.
  • Require the reviewed item's repository for close validation. Share the real bot-author vocabulary, number parser, and head extraction; remove three source-revision ForTest wrappers and migrate all test/proof-script callers.
  • Keep digest bytes, report/storage schemas, parser vocabulary, and public close behavior unchanged. No repository paths/links/context changes; no decision-packet or repair/dashboard reader changes. The apply close reader has only a coordinated item-input type tightening.

Row 3 slice 3a (source revisions + close policy), independently based on origin/main. Slice 3b removes PR-reference and comment identity/automation factories in a separate PR. Net 111 lines removed (756 added / 867 removed); 1,623 changed lines, retaining the coherent source/close cutover under the campaign's approximately-1.5k guidance.

pr-behavior-proof

Claim: source-bound apply still accepts an owned completed review lease, rejects changed issue source, and rechecks exact-publication state after batched labels and immediately before closure; rendered close decisions retain repository-specific and protected-label safety.

Surface and fixtures: built apply-decisions entry point, temporary report trees, executable mock gh transport, and real report/marker rendering and parsing. No production GitHub writes.

Commands/environment: Node 24.21.0; pnpm; checks queued through pueue. build:all; 128 focused tests across review-close-policy, close-reasons, review-content-cache, review-comment-noise, scheduled-review-noop, and apply-close-decision; three selected apply-label-sync scenarios (exact issue apply accepts, exact publication rechecks after batched labels, issue apply rejects a stable live source revision).

Observed: 128/128 focused tests and 3/3 entry-point scenarios passed. The compiled apply scenario synced the durable review and completed the permitted close; the changed-source scenario remained open without closing. Source/cache tests retain full-body sensitivity, bot-only stability, human-activity sensitivity, and canonical revision parity. Close-policy rendering retains ClawHub/ClawSweeper provenance checks, protected labels, and deterministic close comments.

Supporting checks: build:all, lint, and format:check passed. Codex review against origin/main reported no actionable defects on committed head b59da07828c7e14ed976d8b87153a924d5883d39. Its earlier findings (read-only bot-set contracts, moved githubCount type reference, and two proof-script imports) are all fixed. Logs: pueue 1466 (build + focused/entry-point proof), 1479 (lint passed; formatting-only issue then fixed), 1480 (format passed), 1467 (repaired review), 1481 (committed-head review, no actionable defects).

Limits: controlled local CLI/transport and rendered/parsed behavior, not deployed Worker auth, production GitHub mutation, or a live review. No full suite. OpenClaw Bay is unaffected: no published status shape, telemetry, dashboard reader, stored schema, or UI change. docs/proof remains untouched.

Do not merge as part of this cleanup task.

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR replaces source-revision and close-policy factories with direct imports and requires an explicit repository for close validation.

Example: Validate an implemented-on-main close for a PR in openclaw/clawsweeper.

  • Before: Validation could obtain the repository from the item or the runtime target.
  • After: Validation requires the item's repository and retains the existing provenance checks.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is coherent and source review found no actionable defect, but supplied mock-backed validation does not satisfy the repository's runtime-proof requirement.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: No user-visible malfunction is claimed; redundant factory wiring makes review identity and close-policy maintenance harder.
Reason: The maintainer-authored direction continues established consolidation work, removes machinery, and preserves the existing policy contract.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it provides a coherent refactor absent from current main, and inspection found no actionable correctness defect.

Priority: P3
Reviewed head: b59da07828c7e14ed976d8b87153a924d5883d39

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied CLI scenarios use mocked GitHub transport and provide no inspectable runtime trace establishing the preserved source-drift and final-close behavior.
Agent review details

How this fits together

GitHub item context enters source-identity hashing and close-policy validation; their digests and eligibility results feed review publication and guarded apply operations.

flowchart TD
  A[GitHub item context] --> B[Source revision functions]
  B --> C[Review report]
  C --> D[Close policy validation]
  D --> E[Apply freshness and lease guards]
  E --> F[GitHub publication and closure]
Loading

Technical review

Best possible solution:

Retain the direct-import cutover with explicit repository identity and unchanged digest, provenance, and protected-label behavior.

Do we have a high-confidence way to reproduce the issue?

This is a refactor rather than a bug report; source inspection confirms the factories remain on current main, and no target code was executed.

Is this the best way to solve the issue?

Direct imports are appropriate for these fixed production helpers, and inspected callers already supply repository identity without needing the removed fallback.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9dc7f06f6fa5.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Review metrics

Metric Value Why it matters
Patch size Production +645/-717; tests +103/-132; proof scripts +7/-18; changelog +1 Most production churn de-indents existing function bodies; the coordinated cutover removes 111 lines overall.

Labels

Label changes:

  • add P3: Internal maintenance refactor with no demonstrated user-facing bug or intended behavior change.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: Internal maintenance refactor with no demonstrated user-facing bug or intended behavior change.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Supply inspectable current-head runtime evidence for the preserved source-bound apply behavior.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

Reviewed October 10, 2026, 9:21 AM ET / 13:21 UTC.

@obviyus
obviyus merged commit a46cadd into main Oct 10, 2026
28 checks passed
@obviyus
obviyus deleted the cleanup/row3-policy-leaves branch October 10, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant