Skip to content

refactor(test): restore auth persistence integrity - #125699

Merged
steipete merged 2 commits into
mainfrom
steipete/w4-test-integrity
Aug 18, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/w4-test-integrity

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes a test-infrastructure integrity gap where onboarding auth tests passed by writing and reading an obsolete auth-profiles.json mock even though production persists auth profiles in SQLite. A regression in the real store owner could therefore ship while the tests remained green.

The same test area also carried seven copies of one message-action plugin fixture, two copies of the context registry setup, and several plugin-local temp-directory trackers that had drifted from the shared helper.

Why This Change Was Made

The auth wizard tests now call the production profile writer, read actual persisted SQLite rows, and use the tracked OpenClaw test-state lifecycle. This restores the real-store test shape previously present in 43ea501f38d, adapted to current OAuth ownership and cleanup contracts, and deletes the JSON mock plus the command-local re-export facade.

Repeated ActionHub/context fixtures now have canonical factories with explicit setup and cleanup. Plugin-local temp trackers reuse the public Plugin SDK test helper, matching temp-repo callers use the shared tracker, and the obsolete synchronous-loader string-grep test/guidance is removed.

User Impact

There is no runtime behavior change. Maintainers get regression coverage that can fail on real auth persistence defects, while shared test support is 676 lines smaller and less likely to drift under non-isolated Vitest execution.

Evidence

  • Adversarial old-mock proof: temporarily restoring the obsolete JSON writer made 7 of 13 onboarding auth tests fail with Expected SQLite auth profile store; removing it restores 13/13 passing tests.
  • All nine touched outbound suites passed together: 102 tests across two routed Vitest shards.
  • All remaining directly touched suites passed across seven routed Vitest shards.
  • Browser, Codex, Matrix, and Reef tracker consumers passed: 119 tests across four routed Vitest shards.
  • pnpm check:changed passed on the final diff, including core/extension/root typechecks, core/extension/script lint, dead exports, plugin boundaries, import cycles, database-first, and auth guards.
  • git diff --check passed.
  • Fresh Codex autoreview: clean, no accepted/actionable findings.
  • Judged LOC: production +0/-0; tests, test support, and guidance +320/-996 (net -676).

AI-assisted.

@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added channel: matrix Channel integration: matrix commands Command implementations extensions: codex channel: reef Channel integration: reef extensions: browser size: XL maintainer Maintainer-authored PR labels Aug 18, 2026
@steipete
steipete marked this pull request as ready for review August 18, 2026 07:41
@steipete steipete self-assigned this Aug 18, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 18, 2026
@clawsweeper

clawsweeper Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 5:35 AM ET / 09:35 UTC.

ClawSweeper review

What this changes

This PR replaces obsolete auth-profile test mocks with SQLite-backed test state, consolidates repeated fixtures and temp-directory helpers, and accepts npm 12 pack --json result shapes in package tests.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No discrete correctness defect was found in the current checkout: the SQLite-backed auth assertions and the importer-scoped Docker-pruning regression are present. Keep this active maintainer-owned PR open while its exact-head checks finish and the new npm 12 parsing path is exercised. Likely related people: steipete (current test-infrastructure contributor; medium confidence).

Priority: P2
Reviewed head: 49de10a679b2fa446ce013784769e1ca07468383

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The owner-boundary test refactor is coherent and addresses the earlier Docker regression, with npm 12 validation remaining the material confidence reducer.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-owned, behavior-neutral test refactor is outside the external-contributor real-behavior-proof gate.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-owned, behavior-neutral test refactor is outside the external-contributor real-behavior-proof gate.
Evidence reviewed 7 items SQLite-backed auth test lifecycle: The shared helper clears runtime snapshots, creates isolated state-only OpenClaw test state, and reads profiles through the persisted-store owner rather than a JSON fixture.
Writer-to-store regression path: The onboarding test invokes the production OAuth writer and asserts the resulting profile through the SQLite-backed reader; the writer persists through the locked auth-profile owner.
Earlier Docker-pruning blocker addressed: The retained regression creates a nested kept dependency that resolves a root-hoisted transitive package and verifies require still succeeds; the production pruner resolves packages from each importer directory.
Findings None None.
Security None None.

Live Verification

Command: pnpm test src/commands/onboard-auth.test.ts

Result: PASS (completed)

pnpm test src/commands/onboard-auth.test.ts
runner@runnervmzvulz:/tmp/clawsweeper-live-proof-125699-tGFvXt/target$ pnpm test src/commands/onboard-auth.test.ts
$ node --import tsx scripts/test-projects.mts src/commands/onboard-auth.test.ts
pnpm test src/commands/onboard-auth.test.ts
[test] starting test/vitest/vitest.commands.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-125699-tGFvXt/target

 ✓  commands  src/commands/onboard-auth.test.ts (13 tests) 1558ms
     ✓ persists OAuth credentials under the default agent SQLite store  342ms

 Test Files  1 passed (1)
      Tests  13 passed (13)
   Start at  09:36:00
   Duration  10.61s (transform 7.14s, setup 1.02s, import 7.71s, tests 1.56s, environment 0ms)

[test] passed 1 Vitest shard in 16.26s
runner@runnervmzvulz:/tmp/clawsweeper-live-proof-125699-tGFvXt/target$ pnpm test src/commands/onboard-auth.test.ts

































Assertions:

  • PASS expect_output: src/commands/onboard-auth.test.ts

How this fits together

Onboarding auth tests call provider-auth helpers that persist credentials to an agent-scoped SQLite store. Shared test fixtures also underpin outbound-channel, plugin-packaging, and Docker dependency-pruning regression tests.

flowchart LR
  A[Onboarding auth test] --> B[Auth test lifecycle]
  B --> C[SQLite auth profile store]
  C --> D[Persisted-profile assertions]
  E[Shared test fixtures] --> F[Outbound and plugin tests]
  F --> G[Packaging and Docker regressions]
Loading

Before merge

  • Resolve merge risk (P1) - The npm 12-specific pack --json parser branch has no direct npm 12 contract proof in the available review environment, so a malformed accepted shape could weaken package-test automation.
  • Complete next step (P2) - No discrete repair is indicated; complete npm 12 and exact-head CI validation rather than opening an automated fix lane.
Agent review details

Security

None.

PR surface

Source +63, Tests -713, Docs -2. Total -652 across 43 files.

View PR surface stats
Area Files Added Removed Net
Source 7 162 99 +63
Tests 35 199 912 -713
Docs 1 0 2 -2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 43 361 1013 -652

Review metrics

Metric Value Why it matters
Production versus test LOC production +0/-0; tests, test support, and guidance +320/-996 (net -676) The refactor adds no runtime behavior and materially reduces duplicated test-support maintenance surface.

Stored data model

Persistent data-model change detected: serialized state: src/commands/onboard-auth.test.ts, serialized state: test/helpers/auth-wizard.ts, serialized state: test/plugin-npm-package-manifest.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify npm 12 pack output (recommended)
    Run the package-manifest test under npm 12 and confirm the parser reads the real npm pack --json output before merge.
  2. Accept the test-only uncertainty
    Merge with the npm 12 parser unverified locally, accepting risk that package-test automation may misread an unexpected object shape.

Technical review

Best possible solution:

Retain the SQLite owner-boundary regressions and shared fixtures, then validate the package-manifest suite under npm 12 before merging.

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

Not applicable: this PR changes test infrastructure rather than reporting a user-facing failure; its main regression path is source-visible in the onboarding auth tests.

Is this the best way to solve the issue?

Yes for auth persistence: using the production writer and persisted SQLite reader is a stronger owner-boundary regression than the removed JSON mock. The separate npm 12 parser addition still needs execution against its stated runtime contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b8ff4fe3d7d6.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-owned, behavior-neutral test refactor is outside the external-contributor real-behavior-proof gate.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a bounded test-integrity and automation improvement without evidence of an urgent user-facing runtime regression.
  • merge-risk: 🚨 automation: The npm 12 parser changes how package-test automation interprets npm pack --json output.
  • 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: This maintainer-owned, behavior-neutral test refactor is outside the external-contributor real-behavior-proof gate.

Evidence

What I checked:

  • SQLite-backed auth test lifecycle: The shared helper clears runtime snapshots, creates isolated state-only OpenClaw test state, and reads profiles through the persisted-store owner rather than a JSON fixture. (test/helpers/auth-wizard.ts:45, 49de10a679b2)
  • Writer-to-store regression path: The onboarding test invokes the production OAuth writer and asserts the resulting profile through the SQLite-backed reader; the writer persists through the locked auth-profile owner. (src/commands/onboard-auth.test.ts:87, 49de10a679b2)
  • Earlier Docker-pruning blocker addressed: The retained regression creates a nested kept dependency that resolves a root-hoisted transitive package and verifies require still succeeds; the production pruner resolves packages from each importer directory. (src/plugins/prune-docker-plugin-dist.test.ts:223, 49de10a679b2)
  • Test-fixture consolidation follows the shared owner: The common temp-directory helper handles canonical temporary roots, tracking, and cleanup; extension test-support files now re-export the public SDK tracker instead of maintaining local copies. (test/helpers/temp-dir.ts:36, 49de10a679b2)
  • npm contract remains to be exercised: The changed package test directly parses npm pack --json output, but this review host has npm 11.17.0 and no locally inspectable npm 12 implementation; the parser’s npm 12 object-result branch therefore needs an npm 12 run. (test/plugin-npm-package-manifest.test.ts:61, 49de10a679b2)
  • Current-head provenance: Available blame attributes the reviewed current-head lines to the current commit by Peter Steinberger; the checkout has no reachable parent history for broader area provenance. (test/helpers/auth-wizard.ts:45, 49de10a679b2)

Likely related people:

  • steipete: The available blame and current commit metadata attribute the reviewed helper and Docker regression lines to this contributor; the supplied timeline also shows current assignment. (role: current test-infrastructure contributor; confidence: medium; commits: 77a01e667fe3, 49de10a679b2; files: test/helpers/auth-wizard.ts, src/commands/onboard-auth.test.ts, src/plugins/prune-docker-plugin-dist.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Run pnpm test test/plugin-npm-package-manifest.test.ts under npm 12 and retain the exact-head CI result.

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-08-18T07:51:52.851Z sha 9441e88 :: found issues before merge. :: [P1] Restore importer-scoped Docker pruning regressions

Restore the SQLite-backed auth wizard assertions traced to 43ea501 and consolidate duplicated message-action and temp-directory fixtures.
@steipete
steipete force-pushed the steipete/w4-test-integrity branch from 9441e88 to 49de10a Compare August 18, 2026 09:28
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 18, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Accepted P1 addressed on 49de10a679b2fa446ce013784769e1ca07468383.

Restoration: rebased onto current main, retaining the consolidated test/helpers/temp-dir.ts lifecycle while preserving the test-local importerDir package fixture, createRequire runtime assertions, and both importer-relative Docker-pruning regressions from #125580. No verbatim fallback or duplicate helper was needed.

Additional bounded repair: the touched plugin npm-manifest suite exposed npm 12's object-form npm pack --json result. Its three consumers now share the existing array/object parser contract; production code is unchanged.

Evidence:

  • node scripts/run-vitest.mjs src/plugins/prune-docker-plugin-dist.test.ts — 6/6 passed.
  • node scripts/run-vitest.mjs src/commands/auth-choice.test.ts — 11/11 passed.
  • Explicit directly touched suites — unit-fast-isolated 33/33, tooling 323/323, infra 69/69, commands 38/38, plugins 23/23.
  • QA release-policy E2E — 5/5 passed.
  • Browser/Codex/Matrix/Reef tracker consumers — 119 passed, 1 expected skip across four shards.
  • pnpm check:changed — passed, including formatting, all typechecks, core/extension/script lint, dead exports, plugin boundaries, database-first, and import cycles.
  • Fresh branch autoreview — clean, no accepted/actionable findings.
  • Exact-head CI — green after rerunning one unrelated UI timing flake: https://github.com/openclaw/openclaw/actions/runs/32121803597

Known local proof gap: broad pnpm test:changed reached 4,150 passed / 3 skipped across 309 files before the single non-isolated command worker exhausted its 4 GiB heap on Node 26. The bounded touched-suite commands above and exact-head hosted CI completed terminal green.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete merged commit f72782d into main Aug 18, 2026
301 of 303 checks passed
@steipete
steipete deleted the steipete/w4-test-integrity branch August 18, 2026 09:58
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 20, 2026
* test: restore auth persistence integrity

Restore the SQLite-backed auth wizard assertions traced to 43ea501 and consolidate duplicated message-action and temp-directory fixtures.

* test: support npm 12 pack results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: matrix Channel integration: matrix channel: reef Channel integration: reef commands Command implementations extensions: browser extensions: codex maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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