Skip to content

refactor(config): reuse unset pruning branches - #148216

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/config-unset-pruning-20260914
Sep 15, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor/config-unset-pruning-20260914

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

This consolidation of config unset removal and pruning is part of the maintainer-requested maintainability and duplication-reduction deliverable. Config traversal duplicated the leaf splice/delete behavior already owned by recursive pruning.

User Impact

No intended behavior change. Explicit unsets remain immutable, prune empty objects, retain empty arrays, reject the same invalid or blocked path segments, and interpret successive indexes against the updated candidate.

Why This Change Was Made

Represent a leaf removal with the existing prune marker, then use the existing array/object removal branches. The leaf condition remains before child access; cloning happens only after a change is known. Public signatures, write and validation callers, config formats, defaults and managed unset paths are unchanged.

Production: -10 lines. Tests: +36 lines. This mechanical refactor needs no changelog entry.

Evidence

  • Normal CI attempt 1 completed successfully on 77a494970f0fa56a807ac2171aeb44debc7379ed: 120 successful jobs and 17 planned skips. Selected type, lint, format, dependency and build gates passed. Workflow Sanity also passed.
  • The actual config test job passed all 140 write-preparation cases, including the three additions; its config group passed 179 files and 2,638 cases. The tested merge 2621f97605fc83efd7226725cc4ee598ef3c9c08 contains the exact reviewed owner and test bytes. The successive-index reporter title was shortened; source order and the complete target result bind that case.
  • Added cases cover object pruning inside an array, retaining an emptied array and cumulative index interpretation. The existing immutability case also checks changed ancestor and unchanged sibling references; invalid-index and blocked-key coverage remains.
  • One exact-head P2 review completed scoped-clean. It covered the supplied diff and complete owner; broader executor and independent reviews covered callers, canonical index/record/key guards, persistence siblings, current-main changes and extraction history.
  • The latest exact-head ClawSweeper review has no actionable finding, Before merge item or Rank-up move. Its static-review limitation remains separate from the hosted execution above.

The evidence covers the immutable config-write boundary. No live operator session or migration execution is claimed; this change adds no persisted shape, migration, SDK, dependency or operator contract.

@vincentkoc vincentkoc self-assigned this Sep 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 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.

@vincentkoc
vincentkoc marked this pull request as ready for review September 14, 2026 11:35
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Sep 14, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 14, 2026, 8:27 PM ET / September 15, 2026, 00:27 UTC (Revision 2).

ClawSweeper review

What this changes

The PR shares configuration removal logic between leaf deletions and recursive pruning, with added coverage for immutability and array removals.

Merge readiness

✅ Ready for maintainer review

Keep open: the focused cleanup remains useful, preserves existing behavior, and has no actionable correctness findings. Neither current main nor the latest release contains the consolidation.

Priority: P3
Reviewed head: 77a494970f0fa56a807ac2171aeb44debc7379ed

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving simplification with useful boundary coverage and no identified correctness defects.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored internal refactor is exempt from the external-contributor proof gate and does not change authority. Its configuration removal path was reviewed statically; no after-change runtime execution is claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored internal refactor is exempt from the external-contributor proof gate and does not change authority. Its configuration removal path was reviewed statically; no after-change runtime execution is claimed.
Evidence reviewed 8 items Introduced production change: The pinned merge-base-to-head diff replaces separate leaf deletion branches with the existing prune marker. Array slicing and splicing, object copying and deletion, empty-object pruning, and empty-array retention retain their original ordering and results.
Behavioral coverage: The changed tests check unchanged sibling identity, changed ancestor identity, input preservation, empty-object removal inside arrays, retained empty arrays, and sequential indexes against the updated array. Existing invalid-index and blocked-key cases remain. Tests were inspected, not executed.
Production callers and security boundary: The writer uses the helper for validation candidates and final authored output; include-owned mutation also consumes it. The patch changes neither these callers nor authority checks, storage formats, managed unset paths, index parsing, or blocked prototype keys.
Findings None None.
Security None None.

How this fits together

OpenClaw’s configuration writer applies requested path removals before validation and persistence. This helper produces an updated configuration without modifying the caller’s input.

flowchart TD
  A[Configuration and removal paths] --> B[Validate path segments]
  B --> C[Traverse objects and arrays]
  C --> D[Shared removal and pruning]
  D --> E[Updated configuration]
  E --> F[Validation and persistence]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -10, Tests +36. Total +26 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 6 16 -10
Tests 1 41 5 +36
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 47 21 +26

Review metrics

None.

Technical review

Best possible solution:

Keep one removal branch per container type while preserving immutable updates, pruning rules, and sequential path semantics.

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

Not applicable: this PR claims a behavior-preserving refactor, not a defect fix; static comparison supports equivalent removal behavior.

Is this the best way to solve the issue?

Yes: reusing the existing pruning branches removes duplication within the established owner without adding APIs or changing persistence contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 46d1bc761641.

Labels

Label justifications:

  • P3: This is a bounded internal cleanup with no intended user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored internal refactor is exempt from the external-contributor proof gate and does not change authority. Its configuration removal path was reviewed statically; no after-change runtime execution is claimed.

Evidence

What I checked:

  • Introduced production change: The pinned merge-base-to-head diff replaces separate leaf deletion branches with the existing prune marker. Array slicing and splicing, object copying and deletion, empty-object pruning, and empty-array retention retain their original ordering and results. (src/config/config-path-mutation.ts:28, 77a494970f0f)
  • Behavioral coverage: The changed tests check unchanged sibling identity, changed ancestor identity, input preservation, empty-object removal inside arrays, retained empty arrays, and sequential indexes against the updated array. Existing invalid-index and blocked-key cases remain. Tests were inspected, not executed. (src/config/io.write-prepare.test.ts:1584, 77a494970f0f)
  • Production callers and security boundary: The writer uses the helper for validation candidates and final authored output; include-owned mutation also consumes it. The patch changes neither these callers nor authority checks, storage formats, managed unset paths, index parsing, or blocked prototype keys. (src/config/io.write.ts:239, 77a494970f0f)
  • Current-main necessity: Fetched main still has separate leaf-removal branches for arrays and objects, so the proposed consolidation is not already present. (src/config/config-path-mutation.ts:28, 46d1bc761641)
  • Latest release comparison: The v2026.9.4 implementation also retains the separate leaf branches. The existing removal behavior is shipped; this PR simplifies its implementation. (src/config/config-path-mutation.ts:28, 3a9d69db306c)
  • Related extraction and routing history: The supplied GitHub context identifies refactor(config): split write preparation primitives #114228 as the merged write-primitives extraction; local commit metadata agrees. That work established the owner rather than superseding this consolidation. Further follow-history and blame inspection encountered an unavailable historical object, so no source-line introduction attribution is claimed. (src/config/config-path-mutation.ts, e9ef30e739e3)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-14T11:58:56.679Z sha 77a4949 :: needs maintainer review before merge. :: none

@vincentkoc vincentkoc closed this Sep 15, 2026
@vincentkoc vincentkoc reopened this Sep 15, 2026
@vincentkoc
vincentkoc merged commit d686b93 into main Sep 15, 2026
384 of 387 checks passed
@vincentkoc
vincentkoc deleted the refactor/config-unset-pruning-20260914 branch September 15, 2026 07:20
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 15, 2026
* commit '0945dabbe487213e95e84a72ad1aae3659e0e000': (115 commits)
  fix: omit automation service aliases from squash coauthors (#148883)
  test: restore services typecheck shard headroom (#148885)
  perf(trajectory): avoid native probes for truncation records (#148870)
  improve(gateway): load cron only when reload requests it (#143500)
  fix: resolve issue #146088 — [Bug]: The most recent Linux AppImage does not ship with the correct versions of libs needed to run (#148174)
  refactor(theme): share nonvirtual ANSI color lookup (#148717)
  perf(gateway): scope exact session row topology reads (#148836)
  improve(memory): reduce vector replacement overhead (#148201)
  fix(i18n): keep HTTP headers out of native translations (#147119)
  refactor(plugins): share source-root display formatting (#148646)
  fix(cron): reject blank script paths before mutations (#148787)
  refactor(config): share audit positional scanning (#148643)
  fix(test): restore infrastructure typecheck shard headroom (#148861)
  fix(release): harden package validation fallbacks (#148729)
  refactor(config): share leaf and descendant unset pruning (#148216)
  test: reuse prepared runtime for pristine preflight (#148858)
  fix(ui): settle global model drafts across agent switches (#148843)
  fix(queue): avoid repeated scans when cancelling backlogs (#148754)
  fix(logging): orphaned \\\\?\\ path markers corrupt redacted Windows diagnostics (#147542)
  refactor(hooks): share optional reply metadata projection (#148641)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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