Skip to content

refactor: replace PR reference and comment policy factories - #1895

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

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

Conversation

@obviyus

@obviyus obviyus commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Remove createPullRequestReferenceParser, createReviewCommentIdentity, and createReviewCommentAutomation; use ordinary imports for the existing production policy/parsing/rendering operations.
  • Pass repository identity explicitly through PR reference parsing. Promotion and coverage consumers import the parser directly instead of returning and re-injecting a parser bag. Preserve the existing reference vocabulary and Markdown trust rules.
  • State/publication/lease modules import comment identity directly. Keep label mutation as an explicit real-I/O callback, and remove test substitutions for marker escaping and identity policy. Retain only production-needed exports.

This completes Row 3 slice 3b (PR references + comment identity/automation), rebased onto a46cadd7e21d25afa6ad8e6d006cceb853575e46 after #1894 merged. Conflict resolution preserves the direct githubCount export, preserves the removal of the githubContext.githubCount return property, and completes the identity-factory removal without adapters or duplicate helpers.

Net 48 lines removed (563 added / 611 removed across 17 files). Head: 5a28605337e710c11a578fa05b7d899134a90e9f.

No repository paths/links/context implementation, decision-packet reader, repair/dashboard report reader, stored schema, or frozen docs/proof change. The two promotion/coverage files receive only direct-import/callsite changes, coordinated with the reader owner.

pr-behavior-proof

Claim: rendered automation/version markers still round-trip through the durable parser with identical trust/identity rules; stale-head publication still removes only owned stale labels and preserves the durable review flow; duplicate-close reference handling never promotes foreign Markdown link labels to same-repository PR authority.

Surface and fixture: production report/comment renderers and durable parsers, plus built apply-decisions using temporary report trees and executable mock-GitHub transport. Existing publication tests exercise real filesystem payloads and observable publication receipts. New repository-order regression parses the same input for OpenClaw, ClawHub, then OpenClaw and verifies there is no retained selection.

Environment and commands: Node 24.21.0, pnpm; all checks through pueue task 1522 on the rebased head. pnpm run build:all; node --test test/review-comment-publication.test.ts test/review-comment-rendering.test.ts test/pr-proof-automation.test.ts test/apply-pr-duplicate-ref-proof.test.ts; selected apply-label-sync.test.ts scenarios closeout receipts ignore spoofed markers after posting the owned receipt and apply-decisions clears stale PR review labels when live head changed; pnpm run lint; pnpm run format:check.

Observed on the rebased head: build:all passed; all 105 focused tests and both selected receipt/stale-head apply scenarios passed; lint and format:check passed. The real compiled apply path synchronized the stale review without closing the item; the foreign-reference scenario remained open and did not request coverage proof. The stale-head fixture reports unavailable check-runs from its intentionally limited mock transport while still completing its expected comment-only synchronization.

Artifacts: pueue log 1522 --full contains the complete successful rebased-head run (exit 0). Historical pre-rebase evidence: pueue 1482, 1484, 1486; Codex reviews 1487 and 1495 found no actionable defects on the previous head. The prior unused repoUrlFor finding is fixed; those historical reviews are not asserted as reviews of the rebased head.

Limits: local controlled transport and public rendered/parsed behavior, not a deployed Worker or production GitHub mutation. No full suite. OpenClaw Bay is unaffected: no telemetry shape, status feed, record format, dashboard reader, or UI changes.

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 PR-reference and comment-policy factories with direct imports and explicit repository arguments.

Example: Parse openclaw/clawhub#400 while reviewing openclaw/openclaw.

  • Before: The factory-bound parser rejects the foreign repository reference.
  • After: The directly imported parser receives openclaw/openclaw explicitly and preserves that rejection.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused patch has no identified defect, but mocked validation and inaccessible local artifacts do 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: Repeated dependency wiring makes reference and comment-policy ownership harder to audit.
Reason: The authorized cleanup removes three factories and preserves existing outputs, consistent with the preceding merged slices.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR provides a focused factory-removal refactor absent from current main, with no actionable correctness or security findings.

Priority: P3
Reviewed head: 5a28605337e710c11a578fa05b7d899134a90e9f

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Supply viewable current-head runtime evidence for stale-head publication and foreign-reference rejection through the real transport boundary.
Agent review details

How this fits together

Repository-scoped references and saved review records enter these modules, which produce coverage inputs, durable comment markers, and stale-review label updates for the publication workflow.

flowchart LR
  A[Saved review and GitHub context] --> B[Reference and identity functions]
  B --> C[Coverage and promotion]
  B --> D[Comment rendering and state]
  D --> E[Publication workflow]
  E --> F[GitHub comments and labels]
Loading

Technical review

Best possible solution:

Retain the direct-import refactor while preserving the existing repository, identity, publication, and label-mutation contracts.

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

This PR claims behavior preservation rather than fixing a reported runtime bug; no target code was executed during this read-only review.

Is this the best way to solve the issue?

Direct imports provide a narrower ownership structure, and inspected consumers supply the former production dependency or explicit repository argument.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 62a58f973bae.

Provenance checked

  • PR-reference parsing keeps the original intent (05c662b: Earlier modularization extracted same-repository reference parsing while preserving close-safety gates; this is extraction provenance rather than first introduction.)
  • Comment identity and automation keeps the original intent (6e7ed03: Publication was split into cohesive identity, automation, state, publication, and lease modules; subsequent readiness changes retained exact identity and receipt safeguards.)
  • Typed readiness and routing keeps the original intent (8c2f602: Recent merged work made saved typed decisions authoritative for labels, readiness, comments, and automation markers.)
  • Count coercion and owned-label selection keeps the original intent (unknown: Base blobs show unchanged production helpers being imported or moved to exports; earlier-name git log -S searches failed on an unavailable historical blob.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Review metrics

Metric Value Why it matters
Production and test churn Production +544/-594; tests +18/-17; changelog +1 Most churn unwraps factory bodies; production code shrinks by 50 lines without introducing a competing policy owner.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: Internal wiring cleanup preserves existing user-visible behavior.
  • 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.

  • Attach viewable current-head runtime evidence for the changed publication and reference paths using the production transport.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-10T13:31:43.379Z sha 3b385b7 :: needs maintainer review before merge. :: none

Reviewed October 10, 2026, 9:42 AM ET / 13:42 UTC (Revision 2).

@obviyus
obviyus force-pushed the cleanup/row3-comment-policy-leaves branch from 3b385b7 to 5a28605 Compare October 10, 2026 13:39
@obviyus

obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus
obviyus merged commit 43288b0 into main Oct 10, 2026
22 of 24 checks passed
@obviyus
obviyus deleted the cleanup/row3-comment-policy-leaves branch October 10, 2026 13:46
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