Skip to content

test: lock public-surface barrel exports - #30

Merged
vvillait88 merged 1 commit into
mainfrom
chore/public-surface-tests
May 14, 2026
Merged

test: lock public-surface barrel exports#30
vvillait88 merged 1 commit into
mainfrom
chore/public-surface-tests

Conversation

@vvillait88

Copy link
Copy Markdown
Contributor

Summary

Locks every public helper's documented import path so a future barrel-export gap fails CI.

The trigger was a Node-side gap on loadUCPSigningKeyFromEnv during the recent helper lift: the function was defined in src/identity/ucp-jwks.ts but never re-exported from src/index.ts. The helper's own test imported from the module path so the gap stayed invisible until a consumer tried importing from the documented top-level barrel.

Python's barrel was correct the first time around, but the same gap could hit any future helper. These tests give us a single-failure signal in CI whenever a helper lands in a submodule and is forgotten in the __init__.py re-export.

What's covered

  • agentscore_commerce.identityhash_operator_token, load_ucp_signing_key_from_env, LoadUCPSigningKeyOptions
  • agentscore_commerce.paymentdetect_rail_from_headers, zero_amount_carve_out, usd_to_atomic, classify_orchestration_error, classify_x402_settle_result, extract_payment_signer, read_x402_payment_header

Each test asserts the barrel-imported symbol is the same object as the module-level one (barrel.foo is module.foo), so a future barrel rewrite that re-binds rather than re-exports also fails.

Test plan

  • uv run pytest tests/test_public_surface.py — 5 passed
  • Full suite still green
  • uv run ruff check + uv run ty check clean

Add tests asserting every TEC-302 lift-up helper is importable from its
documented path. Triggered by a Node-side gap on loadUCPSigningKeyFromEnv:
the helper was defined in src/identity/ucp-jwks.ts but never re-exported
from src/index.ts, and the helper's own test imported from the module
path so it never noticed. Consumers couldn't import it from the
documented top-level barrel until the export was patched.

Python's barrel was correct the first time around but the same gap could
hit any future helper. These tests give us a single-failure signal in CI
whenever a future helper lands in a submodule and is forgotten in the
__init__.py re-export.

Covers: hash_operator_token, load_ucp_signing_key_from_env +
LoadUCPSigningKeyOptions, detect_rail_from_headers, zero_amount_carve_out,
usd_to_atomic, classify_orchestration_error, classify_x402_settle_result,
extract_payment_signer, read_x402_payment_header.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vvillait88
vvillait88 merged commit 2816520 into main May 14, 2026
7 checks passed
@vvillait88
vvillait88 deleted the chore/public-surface-tests branch May 14, 2026 17:45
vvillait88 added a commit that referenced this pull request May 14, 2026
## Summary

Additive update to the README inventory table — documents the helpers
that landed in PRs #22#29 + the public-surface guard in #30. Pure docs,
no code changes.

## What was added

**`agentscore_commerce.identity` (package level)** row:
- `load_ucp_signing_key_from_env` + `LoadUCPSigningKeyOptions`
(env-driven UCP signing key loader; cached, alg-detected, sanitized
errors)
- `hash_operator_token` (sha256 hex of plaintext `opc_...` for merchants
persisting `operator_token_id` to their own DB)

**`agentscore_commerce.payment`** row:
- `extract_payment_signer` now documents both the positional
`x402_payment_header` path AND the `authorization_header=` MPP kwarg
(`did:pkh:eip155` / `did:pkh:solana` source DIDs)
- `detect_rail_from_headers` (returns `"x402"` / `"mpp"` / `None`)
- `classify_orchestration_error` (companion to
`classify_x402_settle_result` for orchestration-time exceptions)
- `zero_amount_carve_out` (skip CDP/pympp upstream when settle_cents ==
0)
- `usd_to_atomic` (Decimal-based USD → atomic int, ROUND_HALF_UP)

## Test plan

Docs-only; no code changes. Markdown renders cleanly in the existing
table.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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