Skip to content

refactor(tests): reuse named OAuth credential fixtures - #142272

Merged
steipete merged 1 commit into
mainfrom
codex/test-oauth-credential-fixture
Sep 8, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-oauth-credential-fixture

Conversation

@steipete

@steipete steipete commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Related: #139428

What Problem This Solves

Auth-profile tests repeat the same five-field OAuth credential setup, while the existing named-parameter constructor lives in a broader utility module with filesystem and auth-store dependencies.

Why This Change Was Made

Moves the existing oauthCred implementation unchanged into the lightweight credential-fixture owner and migrates its two existing callers. Fifty additional input fixtures reuse it while keeping provider, access, refresh, and expiry labels visible. The old export is removed without a compatibility alias or competing constructor.

User Impact

No production behavior changes or test cases removed. Explicit expiry expressions, field absence and order, fresh objects, optional account/email semantics, and independent expected values remain intact. The change removes 51 net test/support lines, including three consequential formatter lines from the real import migration.

Evidence

  • All five complete affected suites passed 83 cases before and after, with identical per-file ordered case names.
  • Full AST expansion checked all 50 converted inputs, 39 retained clock-expression sites, eight existing calls, and the unchanged helper declaration.
  • Runtime controls verified freshness, ordered keys/values, absent versus explicitly undefined optional fields, and erased type-only dependency.
  • Full mapped checks, diff-scoped cleanup, and fresh full-scope P2 review passed without findings.

No runtime speedup or aggregate coverage percentage is claimed.

@clawsweeper

clawsweeper Bot commented Sep 8, 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 September 8, 2026 15:23
@steipete
steipete requested a review from a team as a code owner September 8, 2026 15:23
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Sep 8, 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 Sep 8, 2026
@clawsweeper

clawsweeper Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 8, 2026, 11:29 AM ET / 15:29 UTC.

ClawSweeper review

What this changes

Moves the existing OAuth test-credential constructor into a lightweight shared fixture module and replaces repeated credential inputs while preserving test scenarios and expectations.

Merge readiness

✅ Ready for maintainer review

Keep open as a useful, focused contribution to the maintainer-requested test-audit campaign. The consolidation is absent from fetched main, and the complete introduced diff shows no actionable correctness defect.

Priority: P3
Reviewed head: ca2384a3ece729755b63a1418d72cc4ccc9eb5d6

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving cleanup with complete caller migration and useful reported validation; no actionable defect was found.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored test-only cleanup changes no production owner or runtime behavior; the reported before/after suite and fixture-equivalence checks are supplemental validation.
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 test-only cleanup changes no production owner or runtime behavior; the reported before/after suite and fixture-equivalence checks are supplemental validation.
Evidence reviewed 7 items Unchanged constructor and complete caller migration: The constructor retains its named parameters and returns a fresh object with the OAuth discriminator followed by the supplied fields. Repository-wide symbol inspection finds only the shared constructor and five test consumers; both former consumers import the new location.
Introduced changes preserve test behavior: Read the complete introduced patches, including portions truncated in the supplied context, and the affected suites. Changes preserve credential values, expiry expressions, independent expected values, identity-mismatch assertions, and scenario bodies. The diff whitespace check passed; no tests were executed during this read-only review.
Still distinct from current main: Fetched main still defines oauthCred in the filesystem-dependent OAuth utility module; its lightweight credential module contains only the API-key constructor. The lightweight module is absent from the supplied latest release tag, v2026.9.3. This consolidation is therefore not established as already implemented or released.
Findings None None.
Security None None.

How this fits together

Auth-profile tests exercise how OpenClaw selects, refreshes, and stores provider credentials. The shared fixture constructor turns explicit synthetic credential fields into fresh test inputs for those existing checks.

flowchart LR
  A[Explicit synthetic credential fields] --> B[Shared fixture constructor]
  B --> C[Fresh OAuth test credentials]
  C --> D[Auth profile operations]
  D --> E[Selection and stored state]
  E --> F[Independent test assertions]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests -51. Total -51 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 7 120 171 -51
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 120 171 -51

Review metrics

None.

Technical review

Best possible solution:

Keep one lightweight credential-fixture owner with explicit call-site values and independent assertions, preserving existing coverage without claiming a runtime speedup.

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

Not applicable: this PR consolidates test inputs and does not report a runtime defect.

Is this the best way to solve the issue?

Yes: moving the existing constructor unchanged avoids a competing helper, preserves explicit input semantics, and removes unnecessary utility-module coupling.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a bounded test-maintenance cleanup with no production 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 test-only cleanup changes no production owner or runtime behavior; the reported before/after suite and fixture-equivalence checks are supplemental validation.

Label justifications:

  • P3: This is a bounded test-maintenance cleanup with no production 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 test-only cleanup changes no production owner or runtime behavior; the reported before/after suite and fixture-equivalence checks are supplemental validation.

Evidence

What I checked:

  • Unchanged constructor and complete caller migration: The constructor retains its named parameters and returns a fresh object with the OAuth discriminator followed by the supplied fields. Repository-wide symbol inspection finds only the shared constructor and five test consumers; both former consumers import the new location. (src/agents/auth-profiles/credential-fixtures.test-support.ts:11, ca2384a3ece7)
  • Introduced changes preserve test behavior: Read the complete introduced patches, including portions truncated in the supplied context, and the affected suites. Changes preserve credential values, expiry expressions, independent expected values, identity-mismatch assertions, and scenario bodies. The diff whitespace check passed; no tests were executed during this read-only review. (src/agents/auth-profiles/profiles.test.ts:240, ca2384a3ece7)
  • Still distinct from current main: Fetched main still defines oauthCred in the filesystem-dependent OAuth utility module; its lightweight credential module contains only the API-key constructor. The lightweight module is absent from the supplied latest release tag, v2026.9.3. This consolidation is therefore not established as already implemented or released. (src/agents/auth-profiles/oauth-test-utils.ts:27, a8ac0975148f)
  • Prior merged fixture work: Recent main history includes the API-key fixture consolidation at refactor(tests): share API-key credential inputs #142245. Comparing commit 225845a against its raw recorded parent confirms creation of the lightweight fixture module, providing a concrete routing connection independent of this proposed branch. (src/agents/auth-profiles/credential-fixtures.test-support.ts:3, 225845acbfe8)
  • Campaign context and reported validation: The captured PR body links Test audit: reduce redundant test code and full-suite runtime #139428, an open maintainer-requested campaign permitting coherent fixture consolidation while preserving meaningful coverage. It reports 83 cases passing before and after, equivalence checks for 50 converted inputs, and runtime fixture controls; these are contributor-reported results, not reviewer-executed proof. (ca2384a3ece7)
  • Implementation and security boundary: The moved helper imports only the local OAuthCredential type. No production authorization, persistence, provider protocol, dependency, or workflow implementation changes. Provider names in synthetic inputs do not establish a dependency on the Codex runtime contract. (src/agents/auth-profiles/credential-fixtures.test-support.ts:1, ca2384a3ece7)

Likely related people:

  • Peter Steinberger: Raw commit 225845a adds src/agents/auth-profiles/credential-fixtures.test-support.ts:1 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 225845acbfe8; files: src/agents/auth-profiles/credential-fixtures.test-support.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
steipete merged commit 8a19cc2 into main Sep 8, 2026
308 of 310 checks passed
@steipete
steipete deleted the codex/test-oauth-credential-fixture branch September 8, 2026 16:08
@steipete

steipete commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 8, 2026
* commit '04869ae4899ad0524c3287759798362b0d62fef8': (677 commits)
  fix(release): pin Kova census refresh (#142104)
  fix: doctor read-only database inspections time out on large agent databases (#142179)
  docs: align v2026.9.3 framing with release announcement (#142307)
  fix(ui): discover models when default-model pickers open (#142105)
  fix(ci): keep Docker upgrade seed baseline older than target (#142273)
  refactor(tests): reuse named OAuth credential fixtures (#142272)
  fix(ci): keep mobile release helpers out of source checks (#142115)
  chore(ui): refresh control ui locales (#142147)
  fix(active-memory): explain why recall was skipped (#138658)
  fix(media): preserve converted images with HEIC filenames (#142263)
  docs: add v2026.9.3 release notes (#142277)
  fix(ui): retire picker focus listeners together (#142258)
  fix(ui): keep menu hover colors consistent across themes (#142243)
  fix(release): keep changelog credits within verified history (#142261)
  fix: keep tool-finalizer placeholders private in message-only groups (#138645)
  perf(tui): carry prepared URL membership through rendering (#142262)
  test(ui): await activity cache imports before teardown (#142282)
  fix(qa): align auth and Workshop proofs with runtime contracts (#142280)
  feat(xai): use one curated catalog and concrete setup default (#142136)
  refactor(outbound): reuse prepared sendability facts (#142252)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling 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: M 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