Skip to content

refactor(tests): share API-key credential inputs - #142245

Merged
steipete merged 1 commit into
mainfrom
codex/test-api-key-input-fixtures
Sep 8, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-api-key-input-fixtures

Conversation

@steipete

@steipete steipete commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Auth-profile tests repeat the same three-field API-key credential input across ordering, persistence, selection, and mutation scenarios, obscuring the behavior each case exercises.

Why This Change Was Made

Replace 79 input literals with a small, data-only constructor requiring provider and key. It preserves the exact type, provider, key order, optional-field absence, string values, fresh allocation, and existing bindings. Independent expected objects stay literal. The helper has no runtime dependencies, defaults, normalization, or casts.

User Impact

No production behavior changes. This removes 288 net test/support lines across 16 suites plus the six-line helper, while retaining every scenario and assertion.

Evidence

  • All 16 complete suites passed 374 tests before and after, with no failures or skips and identical per-file ordered case/status lists.
  • All 79 replacements preserve complete expanded test code and argument expressions; fixture checks verify own keys, descriptors, values, prototypes, fresh repeated calls, and mutation independence.
  • Mapped changed checks, formatting, and complete 17-file P2 review passed.
  • No runtime-performance or aggregate coverage claim. Native Vitest aggregate file scheduling order differed and is not claimed identical.

@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.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: L maintainer Maintainer-authored PR labels Sep 8, 2026
@steipete
steipete marked this pull request as ready for review September 8, 2026 14:47
@steipete
steipete requested a review from a team as a code owner September 8, 2026 14:47
@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, 10:55 AM ET / 14:55 UTC.

ClawSweeper review

What this changes

Replaces repeated API-key credential inputs in auth-profile tests with a small shared constructor while preserving existing scenarios and expectations.

Merge readiness

✅ Ready for maintainer review

Keep open as a focused, behavior-preserving test cleanup. The complete introduced diff preserves inputs and assertions, and the consolidation is absent from reviewed main. No actionable correctness finding was identified.

Priority: P3
Reviewed head: 7283d510c9d2ab04102dc4bd96ed0c0e251acb1c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, readable consolidation with equivalent inputs, unchanged assertions, and useful reported validation.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied maintainer classification exempts this test-only cleanup from external-contributor runtime proof; the changed owner only constructs test data, with before/after suite results reported in the PR body.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied maintainer classification exempts this test-only cleanup from external-contributor runtime proof; the changed owner only constructs test data, with before/after suite results reported in the PR body.
Evidence reviewed 7 items Complete introduced changes inspected: Read the pinned merge-base-to-head diff in full across separate bounded inspections. Changes consist of helper imports and equivalent input-object replacements; assertions, scenario definitions, production code, dependencies, and workflows remain unchanged.
Fixture preserves credential semantics: The constructor returns a fresh object containing only type, provider, and key, in the original order. It performs no normalization, defaulting, caching, or imports. Its output satisfies the existing API-key credential contract.
Independent regression expectations retained: The locked-upsert test still passes the original whitespace and escaped-character input, then independently expects the normalized key. Provider-case and mismatched-provider inputs elsewhere are likewise preserved.
Findings None None.
Security None None.

How this fits together

Auth profiles supply credentials and account-selection state to OpenClaw providers and sessions. These tests exercise ordering, persistence, OAuth interactions, and session selection using synthetic credentials.

flowchart LR
  A[Synthetic provider and key] --> B[Shared test fixture]
  B --> C[Auth profile test inputs]
  C --> D[Ordering and persistence]
  C --> E[Session credential selection]
  D --> F[Independent assertions]
  E --> F
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests -288. Total -288 across 17 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 17 107 395 -288
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 107 395 -288

Review metrics

None.

Technical review

Best possible solution:

Keep the constructor data-only and preserve literal expected results so shared setup cannot conceal credential regressions.

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

Not applicable: this PR consolidates test inputs rather than repairing a reported runtime defect; source inspection confirms equivalent fixture construction.

Is this the best way to solve the issue?

Yes. A dependency-free constructor removes repeated setup while preserving explicit provider/key values, fresh allocation, and independent expectations.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is 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: The supplied maintainer classification exempts this test-only cleanup from external-contributor runtime proof; the changed owner only constructs test data, with before/after suite results reported in the PR body.

Label justifications:

  • P3: This is 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: The supplied maintainer classification exempts this test-only cleanup from external-contributor runtime proof; the changed owner only constructs test data, with before/after suite results reported in the PR body.

Evidence

What I checked:

  • Complete introduced changes inspected: Read the pinned merge-base-to-head diff in full across separate bounded inspections. Changes consist of helper imports and equivalent input-object replacements; assertions, scenario definitions, production code, dependencies, and workflows remain unchanged. (src/agents/auth-profiles/credential-fixtures.test-support.ts:1, 7283d510c9d2)
  • Fixture preserves credential semantics: The constructor returns a fresh object containing only type, provider, and key, in the original order. It performs no normalization, defaulting, caching, or imports. Its output satisfies the existing API-key credential contract. (src/agents/auth-profiles/credential-fixtures.test-support.ts:5, 7283d510c9d2)
  • Independent regression expectations retained: The locked-upsert test still passes the original whitespace and escaped-character input, then independently expects the normalized key. Provider-case and mismatched-provider inputs elsewhere are likewise preserved. (src/agents/auth-profiles/profiles.test.ts:1083, 7283d510c9d2)
  • Still distinct from main and release: The auth-profiles subtree has no changes between the pinned merge base and fetched main. The new helper is absent from both fetched main and the supplied latest release, v2026.9.3; this cleanup is not already incorporated. (src/agents/auth-profiles, 0f3db48abbf0)
  • Validation evidence and review limits: The captured PR body reports all 374 tests across the 16 suites passing before and after, with identical per-file case/status lists and fixture-equivalence checks. Supplied CI includes successful changed-test, test-type, and core-auth checks. These are reported results, not reviewer-executed tests; the read-only diff whitespace check passed. (7283d510c9d2)
  • Area-history routing: Current-main history includes recent account-selection lifecycle work by Peter Steinberger and earlier session-rotation work by Jason (Json). Deeper pickaxe/blame inspection encountered unavailable historical objects, so no source-line introduction attribution is claimed. (src/agents/auth-profiles/session-override.user-pin.test.ts, cb1b29d9a1e6)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • openclaw/openclaw-secops: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 225845a into main Sep 8, 2026
169 checks passed
@steipete
steipete deleted the codex/test-api-key-input-fixtures branch September 8, 2026 14:59
@steipete

steipete commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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: L 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