Repository navigation
Conversation
SanHsien
referenced
this pull request
in SanHsien/commerce-agents
Sep 11, 2026
逐筆讀 diff 記錄判決於 docs/DECISIONS.md:多筆採納候選(含兩筆安全性最高優先—— next 16.3.0 現受兩個 CRITICAL RCE 影響、sharp 0.35.3 現受一個 HIGH 影響), #13 標記為被 #25 取代,#19–#24 為無程式碼設計提案列為觀察。本輪不移植任何程式碼。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference implementation available (2026-09-18): the implementation this note describes is published in https://github.com/vishkaty/commerce-agents-medusa (a Medusa v2 backend and host), checked by https://github.com/vishkaty/commerce-agents-conformance. Issues and pull requests are taken there; this draft stays as the design note.
Proposal: undo and scheduled apply
The gap
Merchants ask for "put it back" and "apply at midnight". The ledger records
beforevalues for every item and has no use for them after apply; nothing carries a time.
What this adds
Two optional
MerchantBackendmethods:undo_change(session, change_id) -> StagedChange: stage the inverse of an appliedprice, stock or content change from its
beforevalues, as a normal staged change(guardrails, preview, approval apply). Promotions and campaigns create platform
objects and are refused.
schedule_change(session, change_id, at)andapply_due_changes(session, now): atime on the staged change, durable in the ledger; the host runs the due ones, stamped
with the scheduling operator; a refusal (stale, guardrail) unschedules rather than
retrying forever.
Reference implementation
Done in a lab ledger and adapter, with tests for the inverse, the second undo being
refused, and a due change applying only once its time has come.
Opened as a draft: this is a design note for discussion before code is written against the interface. A reference implementation exists and can follow as a pull request in the agreed shape.