Skip to content

refactor(extensions): use native owners in test fixtures - #178390

Merged
steipete merged 4 commits into
mainfrom
deslop/z19-95-extension-native-leaves-20261015
Oct 20, 2026
Merged

steipete merged 4 commits into
mainfrom
deslop/z19-95-extension-native-leaves-20261015

Conversation

@steipete

@steipete steipete commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Bundled extension tests still depend on production-only reset, forwarding, and clock-injection seams rather than the native module and database owners.

User Impact

No user-visible change or migration. Feishu proxy preparation and delivery authority, ordinary memory indexing and recovery, and IRC reconnect policy remain unchanged. Standalone session memory is untouched.

Why This Change Was Made

Remove the private Feishu proxy reset export and isolate client fixtures at the module boundary. Read ordinary memory's published database facts and metadata operations directly, retaining the existing async-context database selection; subscribe to transcript updates through the existing SDK owner. Fixtures now seed real metadata, observe native transcript subscriptions, and inject failures at the database method boundary. Use the native IRC clock rather than a callback supplied only by tests.

This is the extension area of a wider native-owner cleanup split: 17 paths, 34 net production lines and 10 net fixture lines removed (44 overall). The class hierarchy, database operations, proxy caches, and reconnect algorithm are not redesigned. No public SDK, protocol, config, CLI, dependency or persisted shape changes.

Best-effort tradeoffs accepted

No production guard or unlikely failure fallback is removed. Only private test plumbing and forwarding methods disappear. Keep Feishu proxy incident protections, current-authority effect checks, durable delivery settlement, database publication/recovery and cache bounds, independent transcript subscriptions, and the IRC stable-connection threshold. No timeout, retry, skip, assertion, baseline or suppression weakening.

Evidence

Targeted Feishu, ordinary-memory, and IRC graph typechecks passed. Formatting, official syntax-only lint, line caps, and runtime/static cycle checks passed (zero cycles). Fresh independent P0–P2 review of the complete current-base composition found no actionable issues. The smallest-cut review preserves the existing owners and introduces no replacement abstraction.

Initial-head focused serial proof passed all 128 selected behavior cases: 43 Feishu cases (client, read authority, and registered outbound delivery), 71 ordinary-memory cases (startup catch-up, scheduling, reindex recovery, FTS fallback, and cache eviction), and 14 IRC cases (three reconnect-clock and 11 full monitor cases). All 14 suppression checks also passed. Each group completed native teardown with zero exit status. No excluded cases are counted as passes.

Repair proof passed the extension-test import boundary (4,849 files), all five changed metadata-fault cases, and 21 scheduling/startup siblings. One scheduling retry case initially failed because its real SDK I/O had not settled before the fake-clock advance; after adding the existing manager-idle wait, that unchanged case passed in 7.348s. The final selected replay took 232.610s including cold preparation (91% of runner time was transformation); name-filter exclusions are not counted as passes or newly added skips. Fresh targeted memory types, formatting, five-file line caps, all 14 suppression checks, and static cycles (zero) passed. Fresh independent P0–P2 repair review found no actionable issues. This is not a claim to have rerun all 128 cases on the repair; exact-head CI supplies broad proof.

Ordinary extension typed lint has an explicit local gap: its broad artifact preparation exceeds this campaign's local proof budget. Syntax-only lint is not typed lint; exact-head hosted CI supplies that gate and broad proof. Real SDK/loopback tests are not live Feishu service proof; no live credentials were used.

CI repair

Initial hosted CI found two owned fixture problems. The extension-test boundary rejected direct core transcript-emitter imports; scheduling now awaits persisted identities and publication through the existing SDK. The one synthetic non-corpus artifact case captures the actual listener through a native pass-through SDK subscription and proves its path-filtering boundary; persisted append, sibling/restarted subscription, and archive cases retain native emission proof. No SDK export or checker exception is added.

Typed lint also found three unbound prototype-method captures in metadata fault fixtures. One-shot throwing spies now use their native call-through default. The cache-insertion spy restores the original method before calling it on the same database receiver. All original fault, call-count, persistence, cache, timing, and recovery assertions remain.

Focused repair execution caught one additional fixture-ordering error: advancing fake time did not settle the real SDK worker I/O performed inside the intentionally failing sync. The fixture now awaits its existing manager-idle boundary before advancing to the unchanged retry deadline. No retry, deadline, or expected result changes.

@clawsweeper

clawsweeper Bot commented Oct 20, 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.

@steipete
steipete marked this pull request as ready for review October 20, 2026 11:56
@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-core Extension: memory-core channel: feishu Channel integration: feishu channel: irc size: M labels Oct 20, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T12:30:36.689381Z 6aa7970 New commits
ℹ️ 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.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR removes private test hooks and forwarding methods across Feishu, memory indexing, and IRC reconnect fixtures.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful simplification with reported focused harness coverage, but source-confirmed import and typed-lint defects prevent a clean validation result.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; its body reports focused native-owner and loopback coverage, which supports preservation but does not claim live Feishu service verification.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Tests depend on private production seams that increase maintenance cost.
Reason: The maintainer-authored direction removes redundant machinery while preserving runtime contracts; the remaining defects are narrow fixture repairs.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep this maintainer-authored PR open: the native-owner cleanup is useful, but two fixture defects block validation.

Priority: P3
Reviewed head: 6984fb91a229d91d2f7d4ae3d0b481bca391d625

Before merge

  • Keep transcript-event fixtures on supported SDK test surfaces (P2) - This new import reaches directly into private core source, as does manager-sync-ops.startup-catchup.test.ts:24. scripts/check-no-extension-test-core-imports.ts rejects relative imports resolving into repository src, and the exact-head check-additional-boundaries annotations confirm this check fails. Route event generation through a focused SDK test/runtime surface while retaining the native listener and artifact-rejection coverage.
  • Handle receiver-dependent method references under typed lint (P2) - The new saved writeMetadata reference extracts an instance method that reads this.facts and calls other instance operations. The same extraction appears in manager.fts-only-reindex.test.ts:30 and manager.reindex-recovery.test.ts:45. The enabled typescript/unbound-method rule rejects these references even though subsequent mocks preserve the receiver. Avoid unnecessary extraction where spies already call through, and handle any required capture using the existing documented receiver-preserving pattern in manager-memory-source-race.test.ts:165.

Findings

  • [P2] Keep transcript-event fixtures on supported SDK test surfaces — extensions/memory-core/src/memory/manager-session-scheduling.test.ts:9
  • [P2] Handle receiver-dependent method references under typed lint — extensions/memory-core/src/memory/manager.cache-unreferenced-eviction.test.ts:23
Agent review details

How this fits together

Bundled extension tests exercise Feishu transport, memory database and transcript owners, and IRC reconnect scheduling; the refactor replaces test-specific seams with those existing owners.

flowchart TD
  A[Extension fixtures] --> B[Feishu client module]
  A --> C[Memory database owner]
  A --> D[Transcript event owner]
  A --> E[IRC reconnect owner]
  B --> F[SDK transport]
  C --> G[Database workers]
  D --> G
  E --> H[Native clock]
Loading

Technical review

Best possible solution:

Complete the native-owner cleanup using supported test surfaces and receiver-safe database interception.

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

Source inspection establishes both fixture violations, and exact-head annotations confirm the extension-import failure; no target code or tests were run during this review.

Is this the best way to solve the issue?

Removing forwarding methods and test-only hooks follows existing ownership boundaries, provided the replacement fixtures also respect SDK imports and typed lint.

Full review comments:

  • [P2] Keep transcript-event fixtures on supported SDK test surfaces — extensions/memory-core/src/memory/manager-session-scheduling.test.ts:9
    This new import reaches directly into private core source, as does manager-sync-ops.startup-catchup.test.ts:24. scripts/check-no-extension-test-core-imports.ts rejects relative imports resolving into repository src, and the exact-head check-additional-boundaries annotations confirm this check fails. Route event generation through a focused SDK test/runtime surface while retaining the native listener and artifact-rejection coverage.
    Confidence: 1
  • [P2] Handle receiver-dependent method references under typed lint — extensions/memory-core/src/memory/manager.cache-unreferenced-eviction.test.ts:23
    The new saved writeMetadata reference extracts an instance method that reads this.facts and calls other instance operations. The same extraction appears in manager.fts-only-reindex.test.ts:30 and manager.reindex-recovery.test.ts:45. The enabled typescript/unbound-method rule rejects these references even though subsequent mocks preserve the receiver. Avoid unnecessary extraction where spies already call through, and handle any required capture using the existing documented receiver-preserving pattern in manager-memory-source-race.test.ts:165.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0784da52a55c.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm lint:plugins:no-extension-test-core-imports
  • pnpm exec oxlint --type-aware -c .oxlintrc.json extensions/memory-core/src/memory/manager-session-scheduling.test.ts extensions/memory-core/src/memory/manager-sync-ops.startup-catchup.test.ts extensions/memory-core/src/memory/manager.cache-unreferenced-eviction.test.ts extensions/memory-core/src/memory/manager.fts-only-reindex.test.ts extensions/memory-core/src/memory/manager.reindex-recovery.test.ts
  • pnpm test extensions/memory-core/src/memory/manager-session-scheduling.test.ts extensions/memory-core/src/memory/manager-sync-ops.startup-catchup.test.ts extensions/memory-core/src/memory/manager.cache-unreferenced-eviction.test.ts extensions/memory-core/src/memory/manager.fts-only-reindex.test.ts extensions/memory-core/src/memory/manager.reindex-recovery.test.ts --maxWorkers=1
  • git diff --check

What I checked:

  • Pinned PR scope: The introduced merge-base-to-head diff removes private seams without changing public configuration, persisted formats, transport authority checks, or reconnect policy; current main still retains the removed seams. (6984fb91a229)
  • Confirmed extension boundary failure: The exact-head check-additional-boundaries annotations identify lint:plugins:no-extension-test-core-imports as failing. Both newly added relative transcript-event imports match the checker's forbidden core-import rule. (extensions/memory-core/src/memory/manager-session-scheduling.test.ts:9, 6984fb91a229)
  • Typed lint defect: typescript/unbound-method is enabled for these fixtures. Three added writeMetadata references extract a receiver-dependent method; existing main tests document narrowly scoped receiver-preserving exceptions for equivalent database interception. (extensions/memory-core/src/memory/manager.cache-unreferenced-eviction.test.ts:23, 6984fb91a229)
  • CI attribution limit: check-lint-extensions-1 failed during changed lint, and the aggregate gate remains pending. Raw job logs redirect to a host blocked by this review environment, so their precise diagnostics were unavailable; the method-reference violation is independently established from source. (6984fb91a229)
  • Preserved database ownership: Removed metadata and presence methods forward directly to the existing database owner; the async-context database getter and worker-backed metadata operation remain intact, with no runtime migration or storage-format change. (extensions/memory-core/src/memory/manager-sync-base.ts:109, 1598547552d6)
  • Policy and checkout: Root and applicable ancestor guidance were read and applied, including the test boundary and smallest-complete-fix rules. No maintainer-notes directory exists in this checkout, and the checkout remained clean. (extensions/AGENTS.md, 6984fb91a229)

PR surface

Source -34, Tests -16. Total -50 across 17 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 7 15 49 -34
Tests 10 121 137 -16
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 136 186 -50

Review metrics

Metric Value Why it matters
Production versus fixture LOC Production +15/-49; tests and test support +121/-137 The reduction removes forwarding and test-only seams; fixture additions seed real metadata and preserve independent subscription coverage.

Labels

Label changes:

  • add P3: This is behavior-preserving internal cleanup with focused validation defects and no demonstrated user-facing regression.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P3: This is behavior-preserving internal cleanup with focused validation defects and no demonstrated user-facing regression.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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 execution lanes are retired.

Reviewed October 20, 2026, 8:13 AM ET / 12:13 UTC.

@steipete
steipete merged commit 3ecfdb7 into main Oct 20, 2026
117 of 119 checks passed
@steipete
steipete deleted the deslop/z19-95-extension-native-leaves-20261015 branch October 20, 2026 12:52
@steipete

Copy link
Copy Markdown
Contributor Author

Both findings on the original head are resolved in6aa797053123cc7fd1fad339a7795709c7441ffd.

  • Transcript fixtures now use the existing SDK publication/subscription boundaries, retaining the native persisted-listener cases and the artifact path-filtering assertion.
  • Metadata fault spies retain native receiver-preserving call-through without extracting unbound prototype methods.

The corresponding boundary and typed-lint jobs118627315920 and118628718461 passed. Full exact-head CI39422453988 succeeded, and the PR landed as3ecfdb717de626397c46e9f3567b45b05b9ac055.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
Use native Feishu module isolation, ordinary-memory database facts and transcript subscriptions, and the IRC reconnect clock instead of private test-only seams and forwarding methods.

Keep proxy protections, database publication/recovery, independent subscribers and reconnect policy. Exercise faults at the native database boundary and settle actual SDK writes before retry-clock assertions. Standalone session memory is unchanged.

Focused proof and fresh review passed; final exact-head CI39422453988 succeeded. All116 check runs were enumerated; the only cancellations were superseded metadata jobs with successful same-head replacements. Earlier owned boundary and typed-lint failures are repaired.

PR openclaw#178390; 34 net production and10 fixture lines removed. No production guard or public contract change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu channel: irc extensions: memory-core Extension: memory-core P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant