Skip to content

test(core): remove orphan test exports - #122500

Merged
steipete merged 1 commit into
mainfrom
test/audit-orphan-core-test-exports
Aug 12, 2026
Merged

steipete merged 1 commit into
mainfrom
test/audit-orphan-core-test-exports

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Three core test-only surfaces retained eight unused exports after their original direct tests were removed or moved to owner boundaries. While validating their removal, the current main Gateway usage suite also exposed a stale file-era mock: it passed a retired JSON store path into the real canonical SQLite resolver, causing seven tests to fail before usage loading.

Why This Change Was Made

Remove only the zero-caller aliases/properties while retaining every live production function and public compatibility export. Update the Gateway composition fixture to return a canonical SQLite marker explicitly; the dedicated infra resolver suite continues to own real SQLite identity and stale-target behavior.

User Impact

No intended user-visible change. Gateway usage, OpenAI HTTP image limits, SQLite transcripts, and Plugin SDK runtime behavior are unchanged. Test-support surface is smaller, and the previously red sessions.usage suite passes again against canonical storage semantics.

Evidence

  • Reproduced the same seven sessions.usage failures on clean main; all returned INVALID_REQUEST before the export cleanup was involved.
  • Focused owner/consumer proof: 253 tests passed across Gateway, infra, E2E, memory-core, and QA Lab projects. The E2E lane rebuilt TypeScript and bundled plugin assets successfully.
  • pnpm plugin-sdk:surface:check passed with no package-exported forbidden subpaths.
  • Full changed-file gate passed core/extension typechecks and lint, Plugin SDK API/export/surface checks, database-first and schema guards, import cycles, dead exports, boundaries, and dependency guards. Blacksmith/Testbox was unavailable on this host, so trusted heavy proof used the documented local fallback.
  • Structured autoreview and deleted-content secret scan: clean.
  • git diff --check: clean.
  • Delta: nine test-support export lines removed from production-owned modules; test fixture +7 net lines; overall -2 lines.

AI-assisted maintenance cleanup; callers, public compatibility boundaries, storage ownership, retained resolver proof, and current-main failure behavior were reviewed directly.

@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 12, 2026 06:48
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS maintainer Maintainer-authored PR labels Aug 12, 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 Aug 12, 2026
@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 12, 2026, 2:56 AM ET / 06:56 UTC.

ClawSweeper review

What this changes

Removes zero-caller test-only exports and makes the Gateway usage fixture return the canonical SQLite session marker expected by detail handlers.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open: this maintainer-authored cleanup has a coherent, narrow test-boundary fix and no correctness finding; wait for exact-head CI before merge.

Priority: P3
Reviewed head: cb73348f38fdf76bf4f9d786d93e912f7e651f9c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-consistent cleanup with no actionable defect found; normal exact-head CI remains the merge gate.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored, behavior-neutral test-support cleanup 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-authored, behavior-neutral test-support cleanup is outside the external-contributor real-behavior-proof gate.
Evidence reviewed 7 items Gateway owner boundary: Stored-session usage requests pass the session-store path to the resolver, and only proceed when it returns a canonical target.
Resolver contract: A complete stored target is converted to a canonical SQLite marker; a stale identity returns undefined and fails closed.
Sibling real-boundary coverage: The Gateway usage E2E test verifies the persisted SQLite marker and the corresponding legacy store path separately, supporting the fixture's explicit marker result.
Findings None None.
Security None None.

How this fits together

Gateway usage detail requests resolve a stored session into a canonical SQLite transcript marker before loading time-series or log data. The changed fixture represents that resolution boundary, while the other edits narrow internal test-only interfaces.

flowchart LR
  A[Gateway usage request] --> B[Stored session lookup]
  B --> C[Canonical SQLite target]
  C --> D[Usage detail loader]
  E[Test-only exports] --> F[Current test consumers]
  F --> G[Focused regression coverage]
Loading

Before merge

  • Complete next step (P2) - No mechanical repair is identified; this protected maintainer PR needs normal exact-head CI completion.
Agent review details

Security

None.

PR surface

Source -9, Tests +7. Total -2 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 3 0 9 -9
Tests 1 11 4 +7
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 11 13 -2

Review metrics

Metric Value Why it matters
Production vs test delta test-support production -9 lines; focused test fixture +7 net lines The change reduces internal export surface while adding only the explicit canonical-resolution setup needed by the existing boundary test.

Technical review

Best possible solution:

Retain only the current test-facing interfaces and land the fixture update after exact-head CI confirms the cleanup against the current base.

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

Yes, source identifies a deterministic focused path: run the sessions-usage suite against the base and PR head; this read-only review did not execute it.

Is this the best way to solve the issue?

Yes. Deleting zero-caller test interfaces and injecting the resolver's canonical marker is narrower and more maintainable than preserving aliases or relying on a retired store-path shape.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a small internal test-support cleanup with no intended user-visible behavior change.
  • 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-authored, behavior-neutral test-support cleanup is outside the external-contributor real-behavior-proof gate.

Label justifications:

  • P3: This is a small internal test-support 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: This maintainer-authored, behavior-neutral test-support cleanup is outside the external-contributor real-behavior-proof gate.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Authored the recent canonical test-surface refactor and has substantial recent history in Gateway usage and OpenAI HTTP paths. (role: recent area contributor; confidence: high; commits: f6fff4f7fdb6, cb73348f38fd; files: src/gateway/server-methods/usage.sessions-usage.test.ts, src/gateway/server-methods/usage.ts, src/gateway/openai-http.ts)
  • Vincent Koc: The usage-resolution history identifies this contributor on the canonical SQLite detail-target repair that the adjusted fixture models. (role: SQLite usage-resolution contributor; confidence: medium; commits: d3ea24c669da; files: src/gateway/server-methods/usage.ts, src/infra/session-cost-usage-collection.ts)

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.

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for cb73348f38fdf76bf4f9d786d93e912f7e651f9c:

  • Red-main reproduction: the unchanged sessions.usage suite failed seven stored-session cases on clean main, all with INVALID_REQUEST because the fixture passed a retired JSON store path into the real canonical SQLite resolver.
  • After the fixture repair, 253 focused tests passed across Gateway, infra, E2E, memory-core, and QA Lab projects with:
OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=/tmp/openclaw-vitest-orphan-core-final node scripts/run-vitest.mjs src/gateway/server-methods/usage.test.ts src/gateway/server-methods/usage.sessions-usage.test.ts src/gateway/server-methods/usage.sessions-usage-cache.test.ts src/gateway/openai-http.test.ts src/gateway/openai-http.usage.test.ts src/infra/session-cost-usage.test.ts extensions/memory-core/src/dreaming-startup-cleanup.test.ts extensions/memory-core/src/dreaming-narrative.test.ts extensions/qa-lab/src/suite-runtime-agent-session.test.ts test/dreaming-startup-cleanup.e2e.test.ts

The E2E project rebuilt TypeScript and bundled plugin assets successfully.

  • Plugin SDK surface check passed:
pnpm plugin-sdk:surface:check
OPENCLAW_TESTBOX=1 scripts/pr prepare-run 122500

It accepted the hosted exact-head gates with gates_mode=hosted_exact_or_recent_parent and revalidated the behavioral review artifacts/head SHA. The cancelled macOS Periphery jobs were non-required/superseded for this non-macOS diff.

Blacksmith/Testbox was unavailable as a standalone local executable on this host, so pre-push trusted heavy proof used the documented local fallback; native prepare subsequently verified hosted exact-head CI. Delta: test-support production -9 lines, focused test fixture +7 net lines, overall -2.

@steipete
steipete merged commit d3696f8 into main Aug 12, 2026
189 of 191 checks passed
@steipete
steipete deleted the test/audit-orphan-core-test-exports branch August 12, 2026 07:04
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime 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: XS 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.

2 participants