Lacuna/Labs
btn-update
white
#130 / 601

NAME

btn-update — White read-cart in the 'Buttons (write ops, mint-flavor) (15)' group. Operator-commanded data surface in the Analysis tab.

SYNOPSIS

id btn-update tier white section §6. White — atomic tools (142 baseline, 149 post-matrix) trigger operator-commanded tools cortex_query, list_listings / list_orders source carry-forward

DESCRIPTION

The update button. Edits one or more fields on a live listing. Eight-star consent gate.

White read-cart in the 'Buttons (write ops, mint-flavor) (15)' group. Operator-commanded data surface in the Analysis tab.

MECHANISM

PREfetchGUARDtier: whiteACTperformRESULTrenderON-ERRretry / esc
;;~ title    "Update a listing"
;;~ author   "lacuna"
;;~ version  1
;;~ mode     automation
;;~ flavor   green
;;~ id       btn-update
;;~ touches  (etsy-listings)
;;~ summary  "Edit fields on an existing listing."

;; Edit fields on an existing listing.
;;
;; Destructive write cart. Action-wrapper shape with the consent gate:
;;   precondition_fetch (ctx has id + payload + operator-confirmed)
;;     -> guard (consent required) -> perform -> result -> on_error.
;; operator_confirmed rides in args so the driver's destructive-verb
;; gate sees it. Rate-limit retries with backoff; auth-stale escalates.
;; State is `perform` (not `act`) so it never shadows the descriptor
;; constructor of the same name in cartPrelude.

(cart 'btn-update
  '((author    . "lacuna")
    (version   . 1)
    (touches   . (etsy-listings))
    (read-only . #f)))

(define (start ctx)
  (let ((id      (ctx-get 'listing-id ctx))
        (fields (ctx-get 'fields ctx))
        (consent (ctx-get 'operator-confirmed ctx)))
    (cond
      ((null? id)        (escalate 'missing-listing-id null))
      ((null? fields)    (escalate 'missing-fields null))
      ((not consent)     (escalate 'consent-required null))
      (else              (next 'perform ctx)))))

(define (perform ctx)
  (let ((id (ctx-get 'listing-id ctx))
        (fields (ctx-get 'fields ctx)))
    (act 'etsy/update-listing
         (list id fields (list 'operator_confirmed #t))
         'check-result)))

(define (check-result ctx)
  (let ((r (ctx-result ctx)))
    (cond
      ((eq? r 'ok)            (done))
      ((eq? r 'rate-limited)  (after 30 'perform ctx))
      ((eq? r 'auth-stale)    (escalate 'auth-relogin null))
      (else                   (escalate 'write-failed r)))))

source: curator-web/src/scheme/carts/etsy/btn-update.sks · 49 lines

EXAMPLES

Operator edits a listing field (title, price, tags) and confirms. Sakura batches the edit, ships it via the worker spine, and confirms back. The cart records the diff to Cortex so you can replay it later.

TIER

white
atomic · free · operator-commanded

FITNESS

Ready

Fits any shop today — this one has no sample-size floor.

SEE ALSO

HISTORY

canonical source: curator/docs/AUTOMATIONS-CANONICAL.md · §6-white-atomic-tools-142-baseline-149-post-matrix
last regenerated: 2026-06-05 20:31 UTC (mechanical — edits land in the MD or sidecars, not here)

KNOWN BUGS

(none recorded — flag in AUTOMATIONS-CANONICAL.md or open an issue against the cart file)