Skip to content

Delete the sumupApi and squareApi alias wrapper exports - #2061

Merged
stefan-burke merged 4 commits into
mainfrom
claude/plan-md-review-jarsho
Aug 9, 2026
Merged

Delete the sumupApi and squareApi alias wrapper exports#2061
stefan-burke merged 4 commits into
mainfrom
claude/plan-md-review-jarsho

Conversation

@stefan-burke

@stefan-burke stefan-burke commented Aug 9, 2026

Copy link
Copy Markdown
Member

What this does

Removes the eleven one-line wrapper exports that only renamed members of the stubbable api objects — four on sumup.ts (createCheckout, refundTransaction, getTransactionStatus, testSumupConnection) and seven on square.ts (getSquareClient, resetSquareClient, testSquareConnection, createPaymentLink, retrieveOrder, retrievePayment, refundPayment). This is the sweep recorded in TODO.md during #2060's review: AGENTS.md's "No alias exports" rule says to expose the shared mechanism itself, so every caller now writes sumupApi.X(...) / squareApi.X(...) directly, which late-binds through test stubs exactly like the wrappers did.

The two places that capture a function at module load — the SumUp checkout builder handed to makeCreateCheckoutSession, and each settings page's testFn — become lambdas over the api member, so test stubbing keeps working. Stripe already had no wrapper layer.

Migrated callers: sumup-provider.ts, square-provider.ts, settings-sumup.ts, settings-square.ts, and the seven direct test importers (test/shared/sumup/*, test/shared/square/*, test/test-utils/square/harness.ts).

Also in this PR

Budgets

65 changed src/ lines. No behaviour change: every call resolves to the same api member it did before, one hop earlier. No query or provider-call counts change.

Tests and gates

  • The ten affected suites pass (155 tests): the sumup and square client suites, both provider suites, and the settings-sumup feature suite.
  • deno task lint clean, jscpd 0%, deno check clean on every touched file.
  • Full deno task precommit and targeted mutation on the four touched payment modules are running now; results will be confirmed on this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AqLNrpvmNdGSSqUtSafiMd


Generated by Claude Code

Summary by CodeRabbit

  • Refactor

    • Consolidated Square and SumUp payment operations behind their shared API interfaces.
    • Removed legacy standalone payment-operation wrappers without changing provider behavior.
    • Updated payment settings and transaction workflows to use the consolidated interfaces.
  • Tests

    • Updated payment, refund, checkout, connection, and client tests to reflect the consolidated API access.
    • Added coverage for transaction status handling, including empty and missing statuses.
  • Documentation

    • Marked milestone M3 complete and removed an outdated migration task.

The eleven one-line wrappers (four on sumup.ts, seven on square.ts)
only renamed members of the stubbable api objects. Every caller now
uses the shared mechanism itself — sumupApi.X(...) / squareApi.X(...)
— which late-binds through test stubs exactly like the wrappers did.
The two functions captured at module load (the SumUp checkout builder
handed to makeCreateCheckoutSession, and each settings page's testFn)
become lambdas over the api member so stubbing keeps working.

Migrated callers: sumup-provider, square-provider, settings-sumup,
settings-square, and the seven direct test importers. Stripe already
had no wrapper layer. Closes the TODO entry recorded for this sweep,
and marks M3 complete in the plan now that #2060 is merged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AqLNrpvmNdGSSqUtSafiMd
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 46 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3eec120a-50c1-46ce-b0c1-bf75d9b1fb70

📥 Commits

Reviewing files that changed from the base of the PR and between 366a499 and 855c65f.

📒 Files selected for processing (1)
  • scripts/mutation/equivalent-mutants/features.txt
📝 Walkthrough

Walkthrough

The change removes Square and SumUp alias wrapper exports. Production callers and tests now access methods through squareApi and sumupApi. SumUp transaction tests also distinguish empty status values from missing status fields.

Changes

Payment API migration

Layer / File(s) Summary
Consolidated API access
src/shared/square.ts, src/shared/sumup.ts, src/shared/*-provider.ts, src/features/admin/settings-*.ts, PLAN.md, TODO.md
Removed wrapper exports. Updated provider and settings call sites to use squareApi and sumupApi, including call-time method resolution. Updated milestone and TODO records.
Square API test migration
test/shared/square/*, test/test-utils/square/harness.ts, test/integration/code-quality.test.ts
Updated Square tests and harnesses to use squareApi. Removed validation for the deleted wrapper exports.
SumUp API test migration
test/shared/sumup/*
Updated connection, checkout, transaction-status, and refund tests to use sumupApi. Added coverage for empty versus missing transaction status values.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: removing the alias wrapper exports for sumupApi and squareApi.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/plan-md-review-jarsho
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch claude/plan-md-review-jarsho

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6f09d0788f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

},
async ({ paymentsGet }) => {
const result = await retrievePayment("pay_wrapper");
const result = await squareApi.retrievePayment("pay_wrapper");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove the obsolete wrapper-only test

After deleting the wrapper export, this changed call invokes squareApi.retrievePayment directly, so the suite can no longer verify the delegation named by its title and merely repeats the retrievePayment coverage immediately above. Delete this wrapper-only case rather than retaining a misleading dead test; the repository specifically requires removing a deleted export's now-pointless test.

AGENTS.md reference: AGENTS.md:L170-L177

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 9039160 — the whole "retrievePayment wrapper export" describe block is deleted, exactly per the dead-code rule you cite: with the wrapper gone the test asserted nothing the direct squareApi.retrievePayment coverage above it doesn't already pin. The same commit also fixes the two type-position leftovers (typeof getSquareClient / typeof testSquareConnection) that failed CI's typecheck.


Generated by Claude Code

The sweep's call-site migration missed two references in type position
(typeof getSquareClient / typeof testSquareConnection in the client
suite), which failed CI's typecheck; they now name the api members.
The "retrievePayment wrapper export delegates" test asserted the very
hop the sweep deleted, so it duplicated the direct coverage above it —
removed, as the dead-code rule requires for a deleted export's test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AqLNrpvmNdGSSqUtSafiMd

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 90391606cc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/shared/square.ts
@@ -846,16 +846,6 @@ export const squareApi: {
},
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove the stale resetSquareClient exemption

Because this deletion removes the top-level resetSquareClient export, the ALLOWED_TEST_HOOKS entry shared/square.ts:resetSquareClient in test/integration/code-quality.test.ts no longer matches any export. Leaving that dead exemption misdocuments the API and would silently exempt the same test-only alias if it were reintroduced later, so remove its entry and comment with the wrapper.

AGENTS.md reference: AGENTS.md:L170-L177

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 366a499 — the shared/square.ts:resetSquareClient entry and its comment are removed from ALLOWED_TEST_HOOKS. Tests reach the reset through squareApi.resetSquareClient(), and squareApi itself has production callers, so the export scan needs no exemption; the code-quality suite passes with the entry gone (19/19, including the test-only-exports scan). I also checked the rest of the list for entries orphaned by this sweep — constructTestWebhookEvent is still a live top-level export, and no sumup.ts entries exist — so this was the only stale one.


Generated by Claude Code

The wrapper sweep deleted the top-level resetSquareClient export, so the
ALLOWED_TEST_HOOKS entry for it no longer matches anything — tests reach
the member through squareApi, which the export scan already credits.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AqLNrpvmNdGSSqUtSafiMd

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/features/admin/settings-square.ts`:
- Around line 45-47: Annotate the public testFn callback in settings-square.ts
(lines 45-47) with ReturnType<typeof squareApi.testSquareConnection>, preserving
its late-bound squareApi.testSquareConnection() call. Apply the equivalent
explicit return type in settings-sumup.ts (lines 33-35) using ReturnType<typeof
sumupApi.testSumupConnection>.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 95b5a21c-56f3-46bc-9691-6069d561b0e4

📥 Commits

Reviewing files that changed from the base of the PR and between e2d34db and 366a499.

📒 Files selected for processing (17)
  • PLAN.md
  • TODO.md
  • src/features/admin/settings-square.ts
  • src/features/admin/settings-sumup.ts
  • src/shared/square-provider.ts
  • src/shared/square.ts
  • src/shared/sumup-provider.ts
  • src/shared/sumup.ts
  • test/integration/code-quality.test.ts
  • test/shared/square/client.test.ts
  • test/shared/square/refund-transport.test.ts
  • test/shared/square/rest-transport.test.ts
  • test/shared/square/retrieve-refund.test.ts
  • test/shared/sumup/connection.test.ts
  • test/shared/sumup/create-checkout.test.ts
  • test/shared/sumup/transactions.test.ts
  • test/test-utils/square/harness.ts
💤 Files with no reviewable changes (4)
  • src/shared/sumup.ts
  • test/integration/code-quality.test.ts
  • src/shared/square.ts
  • TODO.md

Comment thread src/features/admin/settings-square.ts
The square mutation run reports the testSquareConnection.locations
?? -> || entry as redundant: a test kills that mutant, so the registry
entry no longer describes a real survivor.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AqLNrpvmNdGSSqUtSafiMd

Copy link
Copy Markdown
Member Author

Gate results, as promised in the description — all green:

  • deno task precommit: passed (typecheck, lint, cpd, copy check, equivalents check, edge build, full suite with coverage).
  • Targeted mutation, all four touched payment modules at 100% kill rate, 0 survivors:
    • src/shared/sumup-provider.ts — 69/69 detected
    • src/shared/square-provider.ts — 89/89 detected
    • src/shared/sumup.ts — 94/94 detected
    • src/shared/square.ts — 194/194 detected

One piece of fallout the square run surfaced: the recorded equivalent-mutant entry for testSquareConnection.locations (?? → ||) is now killed by a test, so the runner flagged it as redundant. Removed in 855c65f to keep the registry in sync with reality (check:equivalents still passes).

All three review threads on this PR are answered: two fixed (9039160, 366a499), one declined with reasons and withdrawn by CodeRabbit.


Generated by Claude Code

@stefan-burke
stefan-burke added this pull request to the merge queue Aug 9, 2026
Merged via the queue into main with commit cd700ca Aug 9, 2026
3 checks passed
@stefan-burke
stefan-burke deleted the claude/plan-md-review-jarsho branch August 9, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants