Skip to content

refactor(auth): isolate provider auth data contracts - #190544

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/provider-auth-data-contracts
Nov 9, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor/provider-auth-data-contracts

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Related: #188252

What Problem This Solves

Provider authentication data declarations live alongside host configuration and credential orchestration contracts, giving data-only consumers those type dependencies.

User Impact

No intended behavior or public API change. Credential provenance, optional fields, mutable metadata, live authentication contexts, callbacks and permissions remain unchanged. No runtime, CPU or code-size improvement is claimed.

Why This Change Was Made

Move the four existing declarations verbatim into the existing import-free provider-auth-types owner and retarget their internal production and parity-support consumers. Keep the four explicit exports through the established plugin facade and the existing SecretInputMode SDK export. No private compatibility forwarder or new facade export is added.

The patch remains ten files, production +49/-49 LF and one test-support import replacement. No test cases, assertions, allocations, API baselines or dependency changes are added. Runtime and support bodies are byte-identical after removing type-only imports; the two live auth-context declarations are also byte-identical. The newer mainline self-hosted token-limit calculation is outside this import-only patch.

Evidence

  • Complete tracked-repository retired-symbol/export census: four declaration bodies unchanged, destination import-free, exactly four facade exports, no new SecretInputMode facade export and no remaining retired private declaration/forwarder.

  • Normal native review passed 165 tests across 12 owning auth, API-key, noninteractive onboarding, provider, self-hosted and parity files, including all three parity-support consumers.

  • Single-worker parity measurements: 9/15/15 tests passed, command wall 28.082s/7.836s/7.334s and Vitest duration 24.81s/5.63s/5.33s. The first run is dominated by transformation. Hosted CI wall interval was 721s; these are not runtime-performance measurements.

  • Targeted ten-file lint/format, core types, whitespace and test-line ratchet passed with zero test-line growth.

  • Normal full build passed in 199s, including SDK export/declaration and built public-consumer checks. SDK export registration and canonical API comparison are recorded separately below.

  • An actual public auth-context consumer compiled with strict: true, skipLibCheck: false, NodeNext and no source-path aliases. Its file list resolves dist/plugin-sdk/provider-auth.d.ts; it consumes option bags, key provenance, resolver parameters, mutable credential metadata and existing callbacks through public types.

  • Fresh independent full-range review covered all ten files and the complete commit through 853f131be5e663f7e6e2dbc8028f930c981cbfa0, with no actionable correctness or security finding. The published source head is unchanged.

  • plugin-sdk:check-exports passed. Canonical base/head API comparison exited 0: no added/removed entrypoints; all 167 reported public root declarations and kinds are identical. Four unique reachable declaration diffs are the verbatim four-type relocation and import/export regrouping (digest f1e960552e923833329907680a4de26cff5f7ad966d2662a0ce5f55c04c8c099). No API baseline or acknowledgement was changed.

Current State

Local proof and fresh source review passed at the unchanged published head 853f131be5e663f7e6e2dbc8028f930c981cbfa0. Normal preparation completed at the same head and publication transport was skipped because hosted equals prepared HEAD. The PR is ready for review. Exact-head CI 42657650202 completed successfully, including openclaw/ci-gate (38 successful jobs; 29 scope skips are not claimed as passing jobs). Normal native admission passed and the exact head was squash-merged as cf1ae7bb6a729a7f13a28ca2ef9d6f108c00566f. Uncached remote MERGED and native COMPLETE receipt d692d870a2f8d773d6cdc1c58d9a53a93cdb64c9 were verified. The newer self-hosted token-limit helper is present in the landed tree. The first native request was refused before dispatch while the historical draft ci-gate was skipped; no merge was submitted then.

@vincentkoc vincentkoc self-assigned this Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 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 commands Command implementations size: S labels Nov 1, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR moves four provider-auth data types into an existing import-free module while preserving their declarations and public facade exports.

Example: Noninteractive onboarding resolves EXAMPLE_API_KEY to an environment-backed credential.

  • Before: The result type comes from the host authentication contract module; the credential records source "env" and envVarName "EXAMPLE_API_KEY".
  • After: The result type comes from provider-auth-types.ts; the credential fields and onboarding behavior remain identical.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and source-compatible on inspection, but syntax checks and skipped CI do not establish type or emitted declaration correctness.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored, type-only refactor is outside the ordinary runtime proof gate; no runtime demonstration is claimed, and source inspection shows no changed authority or execution path.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
Reason: The maintainer-directed campaign authorizes focused contract cleanup, and this change isolates plain data declarations without new machinery or behavior changes.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored draft open: it makes a coherent, narrowly scoped dependency cut, and source review found no introduced defect.

Priority: P3
Reviewed head: 853f131be5e663f7e6e2dbc8028f930c981cbfa0

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Affected authentication/onboarding tests, targeted type and lint checks, and emitted declaration/API validation remain unverified; this type-only refactor introduces no runtime scenario requiring a new end-to-end demonstration.
Agent review details

How this fits together

Provider-auth contracts connect onboarding and provider setup to host credential orchestration; this change separates plain input/result types from configuration, runtime, and persistence contracts.

flowchart TD
  A[Onboarding commands] --> B[Provider auth helpers]
  A --> C[Auth data contracts]
  B --> C
  D[Host authentication contracts] --> C
  E[Stable plugin facade] --> C
  E --> D
Loading

Technical review

Best possible solution:

Keep the existing leaf module as the sole definition owner, retain the stable facade exports, and validate the affected type and onboarding contracts before landing.

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

This PR reports no runtime bug; source inspection confirms the dependency coupling and unchanged declaration bodies without executing target code.

Is this the best way to solve the issue?

The extraction is the smallest complete change: it reuses an existing owner, removes the former definitions, migrates affected imports, and preserves the public surface without compatibility wrappers.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: none.

Security

None.

Evidence

What I checked:

  • Pinned introduction: The introduced diff relocates unchanged declarations and adjusts type-only imports and exports; runtime statements and existing assertions remain unchanged. (src/plugins/provider-auth-types.ts:4, 853f131be5e6)
  • Public facade preserved: The facade explicitly exports all four moved names without adding SecretInputMode; the caller search found no remaining imports of those names from their former definition modules. (src/plugins/types.ts:61, 853f131be5e6)
  • Maintainer-directed scope: The maintainer-authored parent campaign explicitly requests narrow contract refactors with complete caller migration and preserved behavior: Refactor inference contracts and remove duplicate integration glue #188252.
  • Current main still has the original placement: Fetched main retains only SecretInputMode in the leaf module; the four-declaration extraction remains distinct work in this PR. (src/plugins/provider-auth-types.ts:2, bcf8f7b74556)
  • Validation has not run: Exact-head type, lint, shared SDK declaration, and CI gate checks are skipped; successful checks cover dispatch, resolution, labeling, scan scope, and actionlint rather than the moved contracts. (853f131be5e6)
  • History and original intent: Symbol history identifies the earlier noninteractive setup and leaf-contract extraction; the supplied provenance for refactor(plugins): split plugin type contracts #108416 explains retaining a stable facade over focused modules. One older-content search stopped at unavailable promisor object 7f1842b152a1d6956dfbe2d2c3ce164e4f834451; current and base contract blobs were readable. (src/plugins/provider-authentication.types.ts:13, 87ad1ce9b1f8)

Likely related people:

  • Peter Steinberger: Raw commit dde89d2 adds src/plugins/provider-auth-types.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: dde89d2a834a; files: src/plugins/provider-auth-types.ts)
  • Vincent Koc: Raw commit c0eb484 adds src/plugins/provider-authentication.types.ts:47 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c0eb48424c0b; files: src/plugins/provider-authentication.types.ts)

PR surface

Source 0, Tests 0. Total 0 across 10 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 9 49 49 0
Tests 1 1 1 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 50 50 0

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is behavior-preserving contract maintenance without an established user-facing failure or urgent regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

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

  • Validate the exact head with affected authentication/onboarding tests, targeted types and lint, and emitted declaration/API checks.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 1, 2026, 12:25 PM ET / 17:25 UTC.

@vincentkoc
vincentkoc marked this pull request as ready for review November 9, 2026 16:43
@vincentkoc
vincentkoc merged commit cf1ae7b into main Nov 9, 2026
195 checks passed
@vincentkoc
vincentkoc deleted the refactor/provider-auth-data-contracts branch November 9, 2026 16:59
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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