Skip to content

CI rehearsal only (do not merge) - #18

Open
michael-moffett wants to merge 8 commits into
mainfrom
pay-kit-166-php-from-env-a1-next
Open

michael-moffett wants to merge 8 commits into
mainfrom
pay-kit-166-php-from-env-a1-next

Conversation

@michael-moffett

Copy link
Copy Markdown
Member

Fork CI only. Do not merge.

michael-moffett and others added 2 commits October 5, 2026 14:42
Add `Config::fromEnv(string $prefix = 'PAY_KIT_'): Config` to the PHP SDK (the PHP item "Add `Config::fromEnv()`").

`docs/paykit-interface.md:85-95` says every SDK must have a `configure_from_env` entry point, and maps it to `Config::fromEnv()` for PHP. Python (`configure_from`) and TypeScript (`configureFromEnv`) have one. PHP has none.
@greptile-apps

greptile-apps Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 3/5

[Medium risk] Adds environment-based configuration factory to the SDK.

The PR does not appear safe to merge while the previously reported Swift conformance build and payment-retry failures remain.

Findings

  1. P1 Swift conformance build fails ▶
  2. P1 Failed sends strand payments ▶
  3. P2 Blank expiry bypasses validation ▶
  4. P2 Tests clear existing configuration ▶

Summary

This PR adds PHP environment-based configuration and tests, plus Greptile review context.

  • Config::fromEnv() reads prefixed variables and constructs a validated configuration.
  • The new tests cover defaults, overrides, malformed values, and signer failures.

Reviews (4) · Last reviewed commit: "greptile.json: review on request only" · Reviewed by Greptile

Comment thread php/src/Config.php
{
$env = static function (string $name) use ($prefix): ?string {
$raw = getenv($prefix . $name);
return $raw === false || trim($raw) === '' ? null : trim($raw);

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 Blank expiry bypasses validation If PAY_KIT_MPP_EXPIRES_IN is set but blank, this helper turns it into null. The TTL resolver then uses the 120-second default instead of rejecting the malformed value, so a mistyped setting goes unnoticed.

Comment thread php/tests/ConfigTest.php
Comment on lines +26 to +31
protected function tearDown(): void
{
foreach (self::ENV_NAMES as $name) {
putenv("PAY_KIT_{$name}");
putenv("ACME_{$name}");
}

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 Tests clear existing configuration If the shell already has a production configuration variable set, these tests do not isolate themselves from it and tearDown() removes it instead of restoring it. For example, an existing PAY_KIT_NETWORK=solana_mainnet makes the defaults test throw because it selects mainnet with a demo signer; after cleanup, subsequent tests see a different environment.

Comment thread harness/src/artifacts.ts
target("swift", "client", ["swift-x402-upto"], "swift-x402-upto-client", "SwiftX402UptoClient"),
...["kotlin", "kotlin-x402", "kotlin-x402-upto"].map((id) =>
target("kotlin", "client", [id], `${id}-client`, `mpp-${id}-harness-client`)),
target("swift", "conformance", ["swift"], "../swift", "mpp-conformance"),

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 Swift conformance build fails The Swift conformance target builds from swift/, but its Package.swift is at the repository root. The macOS artifact build therefore cannot find the package manifest and fails before the Swift harness legs can run.

Suggested change
target("swift", "conformance", ["swift"], "../swift", "mpp-conformance"),
target("swift", "conformance", ["swift"], "..", "mpp-conformance"),

}
needsConfirmation = replayClaim !== 'retry';
// Retain pending state if the RPC accepted the send but lost its response.
await broadcastTransaction(rpcUrl, txToSend);

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 Failed sends strand payments If sendTransaction fails before accepting a pull-mode payment, the replay reservation remains pending for 21 minutes. A retry of the same signed payment is rejected as already in progress; after the lease expires, recovery only checks for confirmation and never broadcasts it. A transient send failure can therefore leave a valid payment unable to complete.

…_KIT_* env vars; diff kept unchanged per the director's 2026-10-07 ruling on the two Greptile findings
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.

1 participant