Skip to content

refactor(doctor): continue provider and shared extractions - #51905

Merged
vincentkoc merged 5 commits into
mainfrom
vincentkoc-code/doctor-refactor-phase4
Mar 21, 2026
Merged

vincentkoc merged 5 commits into
mainfrom
vincentkoc-code/doctor-refactor-phase4

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Summary

  • extract empty-allowlist scanning into a shared doctor module
  • extract Matrix doctor preview and repair orchestration into provider helpers
  • extract Telegram empty-allowlist callback wiring into the Telegram provider

Testing

  • pnpm exec vitest run src/commands/doctor/shared/empty-allowlist-policy.test.ts src/commands/doctor/shared/empty-allowlist-scan.test.ts src/commands/doctor/providers/telegram.test.ts src/commands/doctor/providers/matrix.test.ts src/commands/doctor-config-flow.test.ts
  • pnpm build
  • pnpm check

Notes

  • AI-assisted
  • requested maintainer-driven refactor, no changelog entry

Thanks @vincentkoc

@vincentkoc vincentkoc self-assigned this Mar 21, 2026
@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: L maintainer Maintainer-authored PR labels Mar 21, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review March 21, 2026 22:50
@greptile-apps

greptile-apps Bot commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR is a clean refactoring of doctor-config-flow.ts, extracting ~150 lines of inline logic into well-scoped modules: Matrix doctor helpers (providers/matrix.ts), a generic empty-allowlist scanner (shared/empty-allowlist-scan.ts), and a Telegram-specific extra-warnings callback (providers/telegram.ts). All extracted behaviour is covered by new unit tests and the overall logic is preserved faithfully.

  • applyMatrixDoctorRepair consolidates the matrix snapshot + state + crypto repair sequence that was previously inline in doctor-config-flow.ts; return-value semantics ({ changes, warnings }) replace direct note() calls, making the helper independently testable.
  • scanEmptyAllowlistPolicyWarnings replaces the inline detectEmptyAllowlistPolicy function, introducing an extraWarningsForAccount callback so provider-specific warnings (e.g. Telegram groupPolicy) can be injected without coupling the shared module to provider code.
  • collectTelegramEmptyAllowlistExtraWarnings wraps the existing collectTelegramGroupPolicyWarnings logic behind the EmptyAllowlistAccountScanParams interface, allowing it to be passed directly as the extraWarningsForAccount callback.
  • asObjectRecord is now used consistently for the accounts sub-object traversal in the new shared scanner, replacing a raw typeof accounts === "object" cast from the old code — a minor safety improvement.

Confidence Score: 5/5

  • This PR is a pure mechanical refactoring with no observable behaviour changes; it is safe to merge.
  • All extracted helpers faithfully reproduce the original inline logic (verified line-by-line), new unit tests cover every extracted function, and the applyMatrixDoctorRepair warning/change emission preserves the exact sequence of note() calls. No regressions were identified.
  • No files require special attention.

Last reviewed commit: "Merge branch 'main' ..."

@vincentkoc
vincentkoc merged commit 5b31b34 into main Mar 21, 2026
8 checks passed
@vincentkoc
vincentkoc deleted the vincentkoc-code/doctor-refactor-phase4 branch March 21, 2026 22:57
MaheshBhushan pushed a commit to MaheshBhushan/openclaw that referenced this pull request Mar 22, 2026
…51905)

* refactor(doctor): extract empty allowlist scanning

* refactor(doctor): extract matrix provider helpers

* refactor(doctor): extract matrix repair orchestration
frankekn pushed a commit to artwalker/openclaw that referenced this pull request Mar 23, 2026
…51905)

* refactor(doctor): extract empty allowlist scanning

* refactor(doctor): extract matrix provider helpers

* refactor(doctor): extract matrix repair orchestration
furaul pushed a commit to furaul/openclaw that referenced this pull request Mar 24, 2026
…51905)

* refactor(doctor): extract empty allowlist scanning

* refactor(doctor): extract matrix provider helpers

* refactor(doctor): extract matrix repair orchestration
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
…51905)

* refactor(doctor): extract empty allowlist scanning

* refactor(doctor): extract matrix provider helpers

* refactor(doctor): extract matrix repair orchestration
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
…51905)

* refactor(doctor): extract empty allowlist scanning

* refactor(doctor): extract matrix provider helpers

* refactor(doctor): extract matrix repair orchestration
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
…51905)

* refactor(doctor): extract empty allowlist scanning

* refactor(doctor): extract matrix provider helpers

* refactor(doctor): extract matrix repair orchestration
Nachx639 pushed a commit to Nachx639/clawdbot that referenced this pull request Jun 17, 2026
…51905)

* refactor(doctor): extract empty allowlist scanning

* refactor(doctor): extract matrix provider helpers

* refactor(doctor): extract matrix repair orchestration
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
…51905)

* refactor(doctor): extract empty allowlist scanning

* refactor(doctor): extract matrix provider helpers

* refactor(doctor): extract matrix repair orchestration
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request Sep 29, 2026
…51905)

* refactor(doctor): extract empty allowlist scanning

* refactor(doctor): extract matrix provider helpers

* refactor(doctor): extract matrix repair orchestration
lhfer pushed a commit to lhfer/openclaw that referenced this pull request Oct 11, 2026
…51905)

* refactor(doctor): extract empty allowlist scanning

* refactor(doctor): extract matrix provider helpers

* refactor(doctor): extract matrix repair orchestration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations maintainer Maintainer-authored PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant