Skip to content

@W-23128917 document order hook lifecycle and two-hook pattern#577

Open
charithaT07 wants to merge 1 commit into
mainfrom
W-23157033-document-order-hook-patterns
Open

@W-23128917 document order hook lifecycle and two-hook pattern#577
charithaT07 wants to merge 1 commit into
mainfrom
W-23157033-document-order-hook-patterns

Conversation

@charithaT07

@charithaT07 charithaT07 commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

@W-23157033 Add order hook rollback semantics, the afterPOST + modifyPOSTResponse two-hook pattern for persisting failed orders while returning HTTP errors, and request.custom inter-hook data passing to the b2c-hooks skill. Includes new ORDER-HOOK-LIFECYCLE.md reference and additional trigger eval queries.

Summary

  • Document the SCAPI/OCAPI order hook lifecycle: beforePOSTafterPOST (inside txn) → modifyPOSTResponse (after commit)
  • Document rollback semantics: Status.ERROR in afterPOST rolls back the order; in modifyPOSTResponse it does not
  • Add the two-hook pattern for persisting a FAILED order AND returning HTTP 400 to the storefront
  • Document request.custom as the idiomatic channel for inter-hook data passing
  • Add ORDER-HOOK-LIFECYCLE.md reference with full code examples and verified sandbox results
  • Add 2 new trigger eval queries covering the new content

Context

Follow-up to W-23128917. While building the production-triage demo on zzpq-019, we discovered that a single afterPOST hook cannot both persist a failed order and return an error — the b2c-hooks skill did not document this constraint or the
workaround.

Test plan

  • Run pnpm run skills:eval -- --skill-path skills/b2c/skills/b2c-hooks to verify trigger accuracy
  • Manual: ask Claude about order hook rollback behavior and confirm it references the new content

Dependencies

  • No net-new third-party dependencies were added
  • If net-new third-party dependencies were added, rationale/discussion is included and 3pl-approved is set by a maintainer

  • Tests pass (pnpm test)
  • Code is formatted (pnpm run format)

@W-23157033 Add order hook rollback semantics, the afterPOST +
modifyPOSTResponse two-hook pattern for persisting failed orders while
returning HTTP errors, and request.custom inter-hook data passing to
the b2c-hooks skill. Includes new ORDER-HOOK-LIFECYCLE.md reference
and additional trigger eval queries.
@charithaT07
charithaT07 marked this pull request as ready for review July 16, 2026 12:50
@charithaT07
charithaT07 requested a review from clavery as a code owner July 16, 2026 12:50
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