Lacuna/Labs
detect-duplicate-title-in-shop
pink
#178 / 601

NAME

detect-duplicate-title-in-shop — Surfaces on new-listing creation. Addresses pain #26.

SYNOPSIS

id detect-duplicate-title-in-shop tier pink section §7. Pink — Sakura local (65 baseline, 131 post-matrix) trigger event tools search_listings source carry-forward

DESCRIPTION

Pure-logic check — one feature inspected per row. Surfaces a flag for the operator's eye; never acts alone.

Surfaces on new-listing creation. Addresses pain #26.

MECHANISM

PREfetchGUARDtier: pinkACTperformRESULTrenderON-ERRretry / esc
;;~ title    "Detect duplicate title in shop"
;;~ author   "lacuna"
;;~ version  1
;;~ mode     automation
;;~ flavor   pink
;;~ id       detect-duplicate-title-in-shop
;;~ touches  ()
;;~ summary  "Find an existing listing with the same title."

;; Find an existing listing with the same title.
;;
;; Local Sakura runs over one listing's context. precondition_fetch
;; pulls the listing record, sakura/decide produces the summary or
;; comparison, type-trap on the output, then announce.

(cart 'detect-duplicate-title-in-shop
  '((author    . "lacuna")
    (version   . 1)
    (read-only . #t)))

(define (start ctx)
  (let ((id (ctx-get 'listing-id ctx)))
    (if (null? id)
        (escalate 'missing-listing-id null)
        (next 'fetch ctx))))

(define (fetch ctx)
  (let ((id (ctx-get 'listing-id ctx)))
    (act 'etsy/listing (list id) 'invoke)))

(define (invoke ctx)
  (let ((listing (ctx-result ctx)))
    (cond
      ((null? listing)              (escalate 'no-data null))
      ((eq? listing 'rate-limited)  (after 30 'fetch ctx))
      (else (act 'sakura/decide
                 (list 'task 'detect-duplicate-title-in-shop listing)
                 'check-result)))))

(define (check-result ctx)
  (let ((r (ctx-result ctx)))
    (cond
      ((null? r)                  (escalate 'sakura-empty null))
      ((not (string? r))          (escalate 'sakura-garbled null))
      (else                       (next 'announce (ctx-set 'output r ctx))))))

(define (announce ctx) (done))

source: curator-web/src/scheme/carts/etsy/detect-duplicate-title-in-shop.sks · 47 lines

EXAMPLES

Example forthcoming — docs/automations/examples.json entry editable in place.

TIER

pink
Sakura local 8B · free · on-device

FITNESS

Ready

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

SEE ALSO

HISTORY

canonical source: curator/docs/AUTOMATIONS-CANONICAL.md · §7-pink-sakura-local-65-baseline-131-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)