Skip to content

test(e2e): backfill coverage for the memory module-dispatch and maintenance-contract hops - #5973

Merged
M3gA-Mind merged 1 commit into
tinyhumansai:mainfrom
M3gA-Mind:test/e2e-backfill-w3
Sep 2, 2026
Merged

M3gA-Mind merged 1 commit into
tinyhumansai:mainfrom
M3gA-Mind:test/e2e-backfill-w3

Conversation

@M3gA-Mind

@M3gA-Mind M3gA-Mind commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Problem

Both paths could break completely today and no lane would go red.

#5808 / #5801. MemorySourceSync::run_source_sync is a defaulted contract member. ModuleMemoryProvider inherited its Unsupported body instead of bridging it, so "Sync now" answered unsupported capability: source_sync while the module's own scheduler kept syncing fine. A defaulted member that was never bridged is indistinguishable from a bridged one at compile time — which is exactly why the bug shipped.

#5725. reset_tree and flush_now were routed through Maintenance::reset_derived_index / flush_pending. Nothing exercised either afterwards. In the raw-coverage lane both names appear only as string literals fed to memory::schema::schemas(...) — a schema lookup, not an invocation (memory_threads_raw_coverage_e2e.rs:1153-1158). In worker_c_modules_e2e.rs they sit in a 68-method loop whose helper assert_rpc_completed passes if the response contains either result or error. Both satisfy a grep and the domain e2e gate while asserting nothing.

Solution

Because the compile-time signal is exactly what is missing in both cases, both tests assert the runtime answer, and each keys on a message produced on a specific side of the seam.

sources_sync_dispatches_to_the_module_rather_than_refusing_the_capabilitybinding::build binds module_provider whenever the modules feature is on, so openhuman.memory_sources_sync really does reach the bridged member. An unbridged member refuses the capability before any transport is attempted; a bridged one gets as far as the module. Those two failures differ in the message. The test adds an enabled folder source (asserting enabled first, since the enabled gate in sync_rpc returns before the driver is ever asked) and requires that the answer is not an unsupported capability refusal.

tree_reset_and_flush_route_through_the_maintenance_contract — both RPCs resolve binding.provider().as_maintenance() and bail with "driver '<id>' does not serve Maintenance" before any driver call. That message is therefore the one failure that proves the contract hop did not happen, and it is what the test forbids.

Neither test asserts success, deliberately. Success needs a live module artifact fetched over the network, and this lane must not depend on that. The bugs being pinned were never "wrong data" — they were "the call is refused before it is attempted", and that is what these assert.

Submission Checklist

  • Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy — this PR is the tests; each pins the failure path it was written for, and both are revert-checked.
  • Diff coverage ≥ 80% — N/A: the diff is test code only; no production line is added or changed, so there are no changed lines for diff-cover to score.
  • Coverage matrix updated — N/A: no feature row added, removed or renamed; this adds coverage for existing behaviour.
  • All affected feature IDs from the matrix are listed in the PR description under ## Related — N/A: no matrix feature row applies.
  • No new external network dependencies introduced (mock backend used per Testing Strategy) — neither new test requires the network. Note that the existing lane does; that is reported, not introduced, in ## Related.
  • Manual smoke checklist updated if this touches release-cut surfaces — N/A: test-only change, no user-facing surface.
  • Linked issue closed via Closes #NNN in the ## Related section — N/A: backfills coverage for already-merged PRs; there is no open issue to close.

Impact

  • Test-only. No runtime, platform, performance, security, migration or compatibility impact.
  • Both tests live in the existing memory_sources_e2e target, so no new link step.

Related


AI Authored PR Metadata (required for Codex/Linear PRs)

Linear Issue

  • Key: N/A — no Linear issue; this is a coverage backfill from an internal audit.
  • URL: N/A

Commit & Branch

  • Branch: test/e2e-backfill-w3
  • Commit SHA: 4490739d2

Validation Run

  • pnpm --filter openhuman-app format:check — N/A: no frontend file is touched.
  • pnpm typecheck — N/A: no TypeScript is touched.
  • Focused tests: cargo test --test memory_sources_e2e sources_sync_dispatches_to_the_module and ... tree_reset_and_flush_route_through — both pass; both revert-checked (table below).
  • Rust fmt/check (if changed): cargo fmt -- --check — clean.
  • Tauri fmt/check (if changed): N/A: the Tauri shell is not touched.

Validation Blocked

Behavior Changes

  • Intended behavior change: none — test-only.
  • User-visible effect: none.

Parity Contract

  • Legacy behavior preserved: N/A — no production code changed.
  • Guard/fallback/dispatch parity checks: both tests assert the dispatch seam itself; the revert-checks below show each failing when its seam is removed.

Duplicate / Superseded PR Handling

  • Duplicate PR(s): none
  • Canonical PR: this one
  • Resolution: N/A

Revert-check evidence

Test Fix reverted Result
sources_sync_dispatches_to_the_module_rather_than_refusing_the_capability run_source_sync bridge removed from modules/memory_part_02.rs so the trait default applies FAILED at memory_sources_e2e.rs:952Got: unsupported capability: source_sync (the #5801 string verbatim)
tree_reset_and_flush_route_through_the_maintenance_contract as_maintenance() returns None in modules/memory_part_01.rs FAILED at memory_sources_e2e.rs:1029Got: flush_now: driver 'tinymemory' does not serve Maintenance

Both fixes restored afterwards; git diff against main for both files is empty.

main is currently red on the Rust Quality layout gate (git_operations.rs at 949 lines against a 750 limit, from #5672). That is pre-existing and unrelated to this PR.

Summary by CodeRabbit

  • Tests
    • Added end-to-end regression coverage for resolving relative folder-source paths against the workspace location.
    • Added validation that missing-folder diagnostics include the resolved workspace path.
    • Added coverage confirming memory source synchronization requests are dispatched successfully without unsupported-capability or host-side refusal errors.
    • Added validation for memory tree flush and reset operations, ensuring requests route through maintenance handling without unknown-method failures.

@M3gA-Mind
M3gA-Mind requested a review from a team September 2, 2026 12:51
@tinysweeper

tinysweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown

How this change flows

0 changed behaviours across 12 relationships. 6 surrounding behaviours are shown (34 graph nodes walked). 23 further behaviours left out to keep the diagram readable.

flowchart LR
  n0["join"]:::impacted
  n1["memory_sources_github_repo_activity_flow"]:::impacted
  n2["memory_sources_composio_registry_flow"]:::impacted
  n3["memory_sources_crud_and_folder_read_flow"]:::impacted
  n4["serve"]:::impacted
  n5["memory_sources_validation_rejects_bad_input"]:::impacted
  n1 -->|calls| n0
  n1 -->|tests| n0
  n1 -->|calls| n4
  n2 -->|calls| n0
  n2 -->|tests| n0
  n2 -->|calls| n4
  n3 -->|calls| n0
  n3 -->|tests| n0
  n3 -->|calls| n4
  n5 -->|calls| n0
  n5 -->|tests| n0
  n5 -->|calls| n4
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading

Green: changed behaviour. Grey: surrounding behaviour. Arrows name the call, use, implementation, or test relationship. Orange: has findings. Red: has a finding that blocks the merge.

tinysweeper 0.1.0

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tinysweeper found nothing blocking. Approving.

$0.0000 · 0 in / 0 out

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Sep 2, 2026
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 0c9ab195-d0ec-4ad0-a004-b8d1f6b2c93b

📥 Commits

Reviewing files that changed from the base of the PR and between 2734163 and 5c1bc7e.

📒 Files selected for processing (1)
  • tests/memory_sources_e2e.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The change adds end-to-end regression tests for folder-source path resolution, source synchronization dispatch, and tree maintenance RPC routing.

Changes

Memory dispatch contracts

Layer / File(s) Summary
Folder source resolution tests
tests/memory_sources_e2e.rs
Verifies relative folder paths resolve against OPENHUMAN_WORKSPACE. Missing-folder errors must include the resolved path.
Memory dispatch regression tests
tests/memory_sources_e2e.rs
Verifies memory_sources_sync reaches the bridged module and tree flush/reset RPCs reach the Maintenance contract.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 5c1bc

This test-only change adds focused coverage without altering runtime behavior, and no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: senamakel

Poem

A rabbit checks the workspace trail
The source-sync message clears the rail
Flush and reset take the proper way
Maintenance answers without delay
Regression tests keep errors at bay

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding E2E coverage for memory module dispatch and maintenance-contract routing.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Warning

Your free Security trial is over. An organization admin can upgrade to Advanced for continuous pull request security review or dismiss this notice.


Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Sep 2, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4490739d25

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread tests/memory_sources_e2e.rs
Comment on lines +1029 to +1030
assert!(
!message.contains("does not serve Maintenance"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Prove the maintenance methods were actually invoked

This only excludes one early error string and does not observe either maintenance call. If either RPC is reverted to the old host-side implementation, replaced with a successful no-op, or becomes an unknown method, message is empty or different and the test still passes without calling flush_pending or reset_derived_index. Use an instrumented provider or assert a specific post-dispatch result so the claimed contract-hop regression is detectable.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed on the substance. Partly fixed in 27341632a, and I am leaving this OPEN because one of your three cases is not closed and I do not want to resolve on a partial answer.

Closed — renamed or removed RPC. unknown method: <name> contains no does not serve Maintenance, so it satisfied the old assertion while nothing dispatched. Now rejected explicitly. Also added a check that the response carries a result or an error rather than neither.

NOT closed — a successful no-op. From the RPC boundary a no-op is indistinguishable from a real call: reset_tree answers tree_rows_deleted / chunks_requeued / jobs_enqueued, and a genuine call against an empty store returns the same zeros. Your suggestion of an instrumented provider is the right shape, but memory/binding.rs exposes no driver-registration seam — I grepped for set_test_provider / register_driver / test_provider and there is none. Adding one is a change to production wiring, which does not belong in a test-backfill PR. If you want that seam, it should be its own change and I am happy to say so on an issue.

Being precise about what I demonstrated, because the revert I ran does not prove my additions. I revert-checked by forcing ModuleMemoryProvider::as_maintenance() to None. It failed at memory_sources_e2e.rs:1047

openhuman.memory_tree_flush_now never reached a driver: the bound provider does not serve
the Maintenance capability... Got: flush_now: driver 'tinymemory' does not serve Maintenance

— but line 1047 is the pre-existing assertion, not the ones I added. That revert was already covered. My unknown method assertion is justified by inspection of the error text rather than by that run, and I did not spend a second build under the current memory/disk throttle to exercise it on a thread that stays open regardless. Flagging that rather than letting the green revert-check read as proof of the new lines.

Over to a human on the no-op case.

@M3gA-Mind
M3gA-Mind force-pushed the test/e2e-backfill-w3 branch 2 times, most recently from bfa1e16 to 1b84322 Compare September 2, 2026 13:13
M3gA-Mind added a commit to M3gA-Mind/openhuman that referenced this pull request Sep 2, 2026
Both review findings on tinyhumansai#5973 were correct.

`sources_sync_...` asserted `!contains("unsupported capability")` and
`!contains("source_sync")`. The other way the call is refused before dispatch is
`sync_rpc` bailing on an absent capability with

    the bound memory driver '<id>' does not serve source sync

(`memory/sources/rpc_part_01.rs:560-564`). That carries "source sync" with a
SPACE, so it contains neither string and both assertions passed while
`run_source_sync` was never reached — green for the exact regression the test
exists to catch, one layer up from the defaulted body. Now rejected.

Proven: forcing `ModuleMemoryProvider::as_source_sync()` to `None` fails the new
assertion at memory_sources_e2e.rs:977 with the real message
("...driver 'tinymemory' does not serve source sync"); before the change that
revert passed.

`tree_reset_and_flush_...` excluded one string, so an RPC that was renamed or
removed answered `unknown method: <name>`, contained no "does not serve
Maintenance", and passed without dispatching. Now rejected, plus a check that
the response is a result or an error rather than neither.

Not closed, and said so on the thread: a successful no-op is indistinguishable
from a real call at the RPC boundary. Detecting it needs an instrumented
provider, and `memory/binding.rs` exposes no driver-registration seam; adding
one is a production change that does not belong in a test backfill.
coderabbitai[bot]
coderabbitai Bot previously approved these changes Sep 2, 2026
…memory sources

Two e2e gaps found in the coverage audit of recently merged PRs. Both paths
could break completely today without a single lane going red.

tinyhumansai#5808 / tinyhumansai#5801 — `MemorySourceSync::run_source_sync` is a DEFAULTED contract
member. `ModuleMemoryProvider` inherited its `Unsupported` body instead of
bridging, so "Sync now" answered `unsupported capability: source_sync` on a
build whose module could sync fine. A defaulted member that was never bridged
is indistinguishable from a bridged one at compile time, which is why it
shipped — so this asserts the RUNTIME answer.

The discriminator: `binding::build` binds `module_provider` whenever the
`modules` feature is on, so this RPC really does reach the bridged member. An
unbridged member refuses the capability BEFORE any transport is attempted; a
bridged one gets as far as the module.

tinyhumansai#5725 — `reset_tree` and `flush_now` were routed through
`Maintenance::reset_derived_index` / `flush_pending`. Nothing exercised either
afterwards: in the raw-coverage lane both names appear only as string literals
fed to `memory::schema::schemas(...)`, and in `worker_c_modules_e2e.rs` they
sit in a 68-method loop whose helper passes on an error response.

This commit also carries the two review findings raised on the PR, which were
both correct and were fixed in a follow-up now folded in by the rebase:

  - `sources_sync_...` excluded only "unsupported capability" and
    "source_sync". The other pre-dispatch refusal — `sync_rpc` bailing with
    "the bound memory driver '<id>' does not serve source sync"
    (`memory/sources/rpc_part_01.rs:560-564`) — spells it with a SPACE, so it
    matched neither string and the test passed green while `run_source_sync`
    was never reached. Now rejected. Proven: forcing
    `ModuleMemoryProvider::as_source_sync()` to `None` fails the new assertion
    with the real message; before the change that same revert passed.
  - `tree_reset_and_flush_...` excluded one string, so a renamed or removed RPC
    answered `unknown method: <name>`, contained no "does not serve
    Maintenance", and passed without dispatching. Now rejected, plus a check
    that the response is a result or an error rather than neither.

Neither test asserts success. That would need a live module artifact fetched
over the network, which this lane must not depend on; the bugs these pin were
never "wrong data" but "the call is refused before it is attempted".

Rebased onto edee560. The conflict with the merged relative-folder-path
tests (tinyhumansai#5959) was textual, not semantic: both sides append independent tests to
the tail of this file and share the same setup boilerplate, which is what git
interleaved. Resolved by taking main's file whole and appending these two
tests, so both sets survive intact.
@M3gA-Mind
M3gA-Mind merged commit 1bbce8e into tinyhumansai:main Sep 2, 2026
31 checks passed
senamakel pushed a commit to HDZTony/openhuman that referenced this pull request Sep 11, 2026
…-w3\n\ntest(e2e): backfill coverage for the memory module-dispatch and maintenance-contract hops\n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant