Skip to content

Commit 30f88e1

Browse files
feat: Allow replacing vault cards whose provider outcome is unknown
Stainless-Generated-From: eb64d6365c4ab1f4031fb1c725d53c3486e45882
1 parent 9869c91 commit 30f88e1

3 files changed

Lines changed: 41 additions & 37 deletions

File tree

‎src/kernel/resources/vaults/items.py‎

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ def update(
154154
request, subject to atomic provider approval checks; omitted optional fields
155155
remain unchanged and explicit empty lists clear them. Wallet/provider binding
156156
and unsupported fields cannot change after authorization starts. An uncertain
157-
update enters recovery_required and must not be retried. Checkout cards may be
158-
edited between authorizations. A Link card authorized with browser_id and
159-
page_url cannot be changed; delete it and create a new card with the updated
160-
details.
157+
update enters recovery_required; delete the card and create a new one rather
158+
than retrying the update. Checkout cards may be edited between authorizations. A
159+
Link card authorized with browser_id and page_url cannot be changed; delete it
160+
and create a new card with the updated details.
161161
162162
Args:
163163
spec: Live Link card request. Test-mode card creation is not supported. The spec can
@@ -205,10 +205,10 @@ def update(
205205
request, subject to atomic provider approval checks; omitted optional fields
206206
remain unchanged and explicit empty lists clear them. Wallet/provider binding
207207
and unsupported fields cannot change after authorization starts. An uncertain
208-
update enters recovery_required and must not be retried. Checkout cards may be
209-
edited between authorizations. A Link card authorized with browser_id and
210-
page_url cannot be changed; delete it and create a new card with the updated
211-
details.
208+
update enters recovery_required; delete the card and create a new one rather
209+
than retrying the update. Checkout cards may be edited between authorizations. A
210+
Link card authorized with browser_id and page_url cannot be changed; delete it
211+
and create a new card with the updated details.
212212
213213
Args:
214214
version: Expected current item version from the latest read.
@@ -321,11 +321,12 @@ def delete(
321321
Unresolved payment operations normally block deletion, including operations on
322322
child cards of a wallet. Deleting a connected Kernel wallet first blocks new
323323
payments on it, then removes its enrolled card. If that fails, the wallet is
324-
kept and keeps refusing payments; retry the deletion. An AgentCard card in
325-
recovery_required whose checkout create response returned no authorization ID
326-
may be explicitly abandoned by deleting that card directly; deleting its wallet
327-
or vault remains blocked. Deleting or recreating an item is not proof that a
328-
payment did not occur. Deleting a managed auth credential item leaves the
324+
kept and keeps refusing payments; retry the deletion. A Link or Kernel card in
325+
recovery_required for issuance, or an AgentCard card in recovery_required whose
326+
checkout create response returned no authorization ID, may be explicitly
327+
abandoned by deleting that card directly; deleting its wallet or vault remains
328+
blocked until the card is deleted. Deleting or recreating an item is not proof
329+
that a payment did not occur. Deleting a managed auth credential item leaves the
329330
connection and its saved credential unchanged.
330331
331332
Args:
@@ -1526,10 +1527,10 @@ async def update(
15261527
request, subject to atomic provider approval checks; omitted optional fields
15271528
remain unchanged and explicit empty lists clear them. Wallet/provider binding
15281529
and unsupported fields cannot change after authorization starts. An uncertain
1529-
update enters recovery_required and must not be retried. Checkout cards may be
1530-
edited between authorizations. A Link card authorized with browser_id and
1531-
page_url cannot be changed; delete it and create a new card with the updated
1532-
details.
1530+
update enters recovery_required; delete the card and create a new one rather
1531+
than retrying the update. Checkout cards may be edited between authorizations. A
1532+
Link card authorized with browser_id and page_url cannot be changed; delete it
1533+
and create a new card with the updated details.
15331534
15341535
Args:
15351536
spec: Live Link card request. Test-mode card creation is not supported. The spec can
@@ -1577,10 +1578,10 @@ async def update(
15771578
request, subject to atomic provider approval checks; omitted optional fields
15781579
remain unchanged and explicit empty lists clear them. Wallet/provider binding
15791580
and unsupported fields cannot change after authorization starts. An uncertain
1580-
update enters recovery_required and must not be retried. Checkout cards may be
1581-
edited between authorizations. A Link card authorized with browser_id and
1582-
page_url cannot be changed; delete it and create a new card with the updated
1583-
details.
1581+
update enters recovery_required; delete the card and create a new one rather
1582+
than retrying the update. Checkout cards may be edited between authorizations. A
1583+
Link card authorized with browser_id and page_url cannot be changed; delete it
1584+
and create a new card with the updated details.
15841585
15851586
Args:
15861587
version: Expected current item version from the latest read.
@@ -1693,11 +1694,12 @@ async def delete(
16931694
Unresolved payment operations normally block deletion, including operations on
16941695
child cards of a wallet. Deleting a connected Kernel wallet first blocks new
16951696
payments on it, then removes its enrolled card. If that fails, the wallet is
1696-
kept and keeps refusing payments; retry the deletion. An AgentCard card in
1697-
recovery_required whose checkout create response returned no authorization ID
1698-
may be explicitly abandoned by deleting that card directly; deleting its wallet
1699-
or vault remains blocked. Deleting or recreating an item is not proof that a
1700-
payment did not occur. Deleting a managed auth credential item leaves the
1697+
kept and keeps refusing payments; retry the deletion. A Link or Kernel card in
1698+
recovery_required for issuance, or an AgentCard card in recovery_required whose
1699+
checkout create response returned no authorization ID, may be explicitly
1700+
abandoned by deleting that card directly; deleting its wallet or vault remains
1701+
blocked until the card is deleted. Deleting or recreating an item is not proof
1702+
that a payment did not occur. Deleting a managed auth credential item leaves the
17011703
connection and its saved credential unchanged.
17021704
17031705
Args:

‎src/kernel/types/vaults/card_vault_item_state.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ class LinkCardState(BaseModel):
4747
status: Literal[
4848
"requested", "pending_authorization", "ready", "consumed", "expired", "declined", "recovery_required"
4949
]
50-
"""recovery_required means an original provider operation has an unresolved
51-
outcome.
52-
53-
Do not retry, delete, or replace it. Known references may be observed safely,
54-
but unknown creation without an ID and uncertain card-material retrieval require
55-
manual reconciliation with the provider or support. There is no reset or
56-
caller-asserted reconciliation operation.
50+
"""
51+
recovery_required means an original provider operation has an unresolved outcome
52+
and the card cannot be used. Reads keep observing a known provider request and
53+
may clear the recovery. To continue, delete this card and create a new one;
54+
deleting cancels the original request when its ID is known and keeps the
55+
recovery evidence. The user may see an approval request for the original card
56+
and should approve only the new one.
5757
"""
5858

5959
domains: Optional[List[str]] = None

‎src/kernel/types/vaults/kernel_card_state.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ class KernelCardState(BaseModel):
5151
fresh local verification link; this does not approve spending or replay any
5252
provider request. Unclassified legacy recovery and uncertain intent creation
5353
cannot restart. Kernel never approves again or issues another code for the item
54-
automatically, and the item cannot be deleted or replaced until the original
55-
attempt is reconciled with support. When status_reason says the provider refused
56-
retrieval before acceptance, no code was issued and a later read retries.
57-
declined means the card network refused to issue a code.
54+
automatically. To continue, delete this card and create a new purchase; the
55+
cardholder approves the new purchase separately. Recovery while reporting a
56+
merchant transaction cannot be deleted and must be reconciled with support. When
57+
status_reason says the provider refused retrieval before acceptance, no code was
58+
issued and a later read retries. declined means the card network refused to
59+
issue a code.
5860
"""
5961

6062
domains: Optional[List[str]] = None

0 commit comments

Comments
 (0)