Skip to content
safran

Type to search. Enter opens the first result.

    From a ticket link to a merged change

    This page follows one ticket from the moment someone pastes its key into Claude Code to the moment the change is merged, through the four skills that carry it: implement, review-pr, pr-fix and verify-acceptance. You will see where each skill stops and asks, what it hands over, and what stays a person's job.

    The setting

    acme writes tickets in Turkish and code in English. The profile says so (languages.tickets: tr), maps İade to refund in the glossary, and gives the Payments team the project PAY and the repositories payments-api and ledger. Its conventions include "Branch names follow feature/<TICKET-KEY>-short-description".

    Writes are enabled for two kinds only:

    writes:
      enabled: true
      allow: [ticket.comment, pull_request.reply]
      marker: "Bir yapay zekâ asistanıyla hazırlandı."

    The ticket is PAY-1500, "Refund webhook retries are not idempotent". Ayşe Yılmaz picks it up; Çağrı Öztürk reviews. In the excerpts they type in English, so the skills answer in English; with a Turkish prompt the answers would be Turkish. The ticket's own text stays as it was written.

    1. Implement

    Ayşe is in her clone of payments-api.

    Illustrative session excerpt
    > /safran:implement PAY-1500
    
    Read PAY-1500 "Refund webhook retries are not idempotent" (Story, In Progress, team Payments).
      3 comments · 1 attachment (retry-log.csv, read as a table: 42 rows) · no design links
      Linked work: not blocked. PAY-1488 "Webhook imza doğrulaması" blocked this ticket and is Done.
      Family: parent PAY-1400 "İade altyapısı". Sibling PAY-1501 is in progress with Deniz Kaya, in another area.
      Open or merged work for this ticket: none.
    
    Acceptance criteria
      AC1  A retried webhook with the same event id does not create a second refund.   description
      AC2  The duplicate is answered with 200, not with an error.                      comment, Çağrı Öztürk, 2026-11-12
      AC3  "Yinelenen olaylar makul bir süre saklanır."                                description
    
    One thing is not ready: AC3 does not say how long, and no comment settles it.
      1  Stop; I give you the question to post on the ticket
      2  Agree a working value now (recorded as "agreed in this conversation", not as the ticket's)
    
    > 2. 24 hours, that is the provider's retry window.

    What happened before the first line of code:

    • The whole ticket was read, not its description: every comment, the spreadsheet attachment as a table, the linked and blocking work, the family, and whether someone already opened a pull request for it.
    • The blocker verdict came from get_linked_work. Had it been blocked, the skill would have named the blocker with its status and assignee and asked whether to stop. unknown is treated the same way: "could not check" is not "not blocked".
    • A vague criterion became a question, not a guess. The skill did not pick a retention period. Ayşe did, and it is recorded as hers.

    Then the evidence and the plan:

    Illustrative session excerpt
    Evidence
      E1  payments-api src/webhook/retry.ts:18-41        handleRefundWebhook() calls refundService.apply() on every delivery
      E2  payments-api src/refund/service.ts:55-73       apply() creates the ledger entry; nothing checks for a seen event
      E3  payments-api test/webhook/retry.test.ts:1-60   covers signature failure and timeout, not duplicates
      Past work on these files: PAY-1423 (payments-api#482) changed rounding in service.ts; its test must keep passing.
      No trace found in the indexed code of an existing idempotency store
      (searched: "idempotency", "event id seen", "yinelenen olay"; grep: processed_events).
    
    You are in payments-api on main with a clean tree: the repository the evidence points at.
    
    Plan
      Branch  feature/PAY-1500-idempotent-webhook-retries      convention: feature/<TICKET-KEY>-short-description
      1  Failing test: the same event id delivered twice creates one refund            AC1
      2  processed_events table and repository, 24 h retention                         AC3 (agreed here)
      3  retry.ts: look the event id up before apply(); answer 200 for a duplicate     AC1, AC2
      4  Tests for the 200 answer and for an event older than 24 h                     AC2, AC3
      Checks  bun test · bun run typecheck                                             from package.json
      Not part of this change: ledger consumes the same webhook (same team); that stays open.
      Commit after each step?
    
    Go ahead / change the plan / stop?
    • Every claim about code has a citation a tool returned, and "no trace found" comes with what was searched.
    • The plan is short enough to read in a minute, and nothing is created or edited before the answer. Saying "go ahead" approves the plan. It does not approve a push, a pull request or a post.

    After the steps, each with its test and the project's own checks:

    Illustrative session excerpt
    Acceptance criteria
      AC1  met   src/webhook/retry.ts:22-31 · test/webhook/retry.test.ts:62-88
      AC2  met   src/webhook/retry.ts:27 · test/webhook/retry.test.ts:90-104
      AC3  met against the value agreed in this conversation (24 h). The ticket still says "makul bir süre".
    Checks    bun test: 148 pass, 0 fail · bun run typecheck: clean
    Not done  ledger's consumer · AC3 is not confirmed on the ticket
    Pull request title  PAY-1500 Make refund webhook retries idempotent
    
    Nothing was pushed, no pull request was opened, nothing was written to the tracker.

    Ayşe pushes the branch and opens the pull request herself, with the title and description the skill drafted. It becomes payments-api#487.

    2. Review

    Çağrı is asked to review. He does not need to be in the repository.

    Illustrative session excerpt
    > /safran:review-pr payments-api#487
    
    payments-api#487 "PAY-1500 Make refund webhook retries idempotent": open, by Ayşe Yılmaz, can be merged.
    It covers AC2 of PAY-1500 and most of AC1. One must-fix finding.
    
    Must fix
      src/webhook/retry.ts:24   The event id is looked up and then inserted in two separate statements.
        Scenario: the provider delivers event evt_901 twice within a few milliseconds. Both requests run the lookup
        before either inserts, both find nothing, and refundService.apply() runs twice: two refunds.
        Fix: insert first, with a unique key on event_id, and treat a conflict as "seen".
    
    Consider
      src/webhook/processed-events.ts:40   The 24 h cleanup runs on every request. A scheduled job would keep it
        off the request path. Unmeasured.
    
    Criteria coverage
      AC1  description             partly   retry.ts:22-31, test retry.test.ts:62-88; fails under concurrent delivery
      AC2  comment, Çağrı Öztürk   yes      retry.ts:27, test retry.test.ts:90-104
      AC3  description             cannot tell from the diff: the ticket says "makul bir süre", the code keeps 24 h
    
    Existing threads  1 active. Deniz Kaya on retry.ts:27 (log level): still open, and I agree. Not repeated here.
    Not reviewed      nothing was left out. The index of payments-api is from 2026-11-18.
    
    This profile does not allow pull_request.comment, so nothing was posted. Two comments, ready to paste: …
    • A finding carries a failure scenario: a concrete input, what the code at that line does with it, what should happen. Something the skill cannot turn into a scenario goes under questions for the author.
    • The ticket sits beside the diff. The coverage table has one row per criterion, and "cannot tell from the diff" is an allowed answer.
    • What a reviewer already said is not said again. The skill read every thread in every status first.
    • Nothing was posted, because the profile does not list pull_request.comment. Çağrı pastes the two comments on the host himself. The skill does not approve, vote or resolve anything on any setup.

    3. Answer the review

    Back to Ayşe, on her branch.

    Illustrative session excerpt
    > /safran:pr-fix
    
    Pull request of this branch: payments-api#487. You are on feature/PAY-1500-idempotent-webhook-retries
    at its head with a clean tree. 3 active threads.
    
      1  src/webhook/retry.ts:24              Çağrı Öztürk   lookup then insert can race   Change
           insert first with a unique key on event_id; add a test with concurrent delivery
      2  src/webhook/retry.ts:27              Deniz Kaya     "info yerine debug olmalı"    Change
           log the duplicate at debug
      3  src/webhook/processed-events.ts:40   Çağrı Öztürk   cleanup on every request      Out of scope
           a fair point, larger than this ticket; reply suggests a follow-up ticket
    
    2 changes, 1 out of scope. Order: 1, then 2.
    Go ahead as proposed / change classes (say which numbers) / replies only / stop?
    • Every thread gets a class and one line of reasoning. The skill reads the code under a comment before it agrees, and before it disagrees.
    • Ayşe's reclassification wins. If she wants number 3 fixed here, it is fixed here.
    • Each fix is the change the comment asks for and no more, as a new commit on top. Nothing is amended or squashed unless she asks.

    A reply that is posted, with writes on

    acme allows pull_request.reply, and Ayşe asks for the replies to be posted. Each one is a preview, a look, a yes, and one write:

    Illustrative session excerpt
    Thread 1: the fix is in commit 4c1d2e7 (pushed). Preview of the reply:
    
      Reply in review thread t-31 of pull request payments-api#487 "PAY-1500 Make refund webhook retries idempotent"
      In reply to Çağrı Öztürk: "Arama ve ekleme iki ayrı ifade; eşzamanlı iki teslimde ikisi de bulamaz…"
    
        Haklısın. Önce ekleyip event_id üzerindeki tekil anahtar çakışmasını "görüldü" sayacak şekilde değiştirdim
        (4c1d2e7, src/webhook/retry.ts:22-29). Eşzamanlı teslim testi: test/webhook/retry.test.ts:106-131.
    
        Bir yapay zekâ asistanıyla hazırlandı.
    
    Post it / change the text / skip this one / stop?
    
    > post it
    
    Posted: reply added to thread t-31.
      https://azure.acme.example/Platform/_git/payments-api/pullrequest/487?discussionId=31
    Next: thread 2.
    • What is shown is the preview's text, marker line included, not the skill's draft of it. That text is what the token commits.
    • One yes, one post. Three replies are three previews and three answers. "Post them all" is answered by showing the first one.
    • A changed text is a new preview. If Ayşe edits the wording, the old token is never used for the new text.
    • The reply is in the language of the thread, here Turkish.
    • Claude Code may show its own permission prompt for commit_write as well. That is a second check and is left in place on purpose.

    With writes off, the same step ends with three paste-ready replies, each labelled with its thread, and the sentence that Safran is read-only here. The model behind this is on the Writes page.

    Pushing, resolving the threads and re-requesting review remain Ayşe's.

    4. Verify

    Before merging, anyone can ask whether the work does what the ticket asked. This is not a second review.

    Illustrative session excerpt
    > /safran:verify-acceptance PAY-1500
    
    Work found: payments-api#487 (open, approved by Çağrı Öztürk, can be merged, 0 active threads). Nothing in ledger.
    
      AC1  met                     retry.ts:22-29 inserts first with a unique key · retry.test.ts:62-88 and 106-131
      AC2  met                     retry.ts:27 · retry.test.ts:90-104
      AC3  cannot tell from code   the ticket says "makul bir süre"; the code keeps 24 h
    
    For a person to check
      - Confirm 24 h with the product owner and write it into PAY-1500.
      - The processed_events migration has to be run in each environment before the deploy.
    
    Regression risks
      - PAY-1423 changed rounding in src/refund/service.ts. Its test is untouched by this change and passes.
      - ledger consumes the same webhook and has no duplicate check. Not covered by this pull request.
    
    2 of 3 criteria met, 1 not decidable from code.
    Nothing was written to the tracker or the pull request; the status of PAY-1500 is unchanged.
    • Approval is not coverage. The pull request is approved, and the verdict still says that one criterion cannot be decided by reading code.
    • "Cannot tell from code" names the check a person has to make. The agreed 24 hours never reached the ticket; the skill keeps saying so until someone writes it there.
    • Regression risks come from history: earlier tickets on the same files, callers of what changed, tests that were removed or loosened.

    5. Merge, and after

    Çağrı merges on the host. No Safran skill merges, approves or changes a ticket's status.

    Two things make the merged work visible to the next person:

    safran links refresh --profile /work/acme/safran.yaml
    safran sync payments-api --profile /work/acme/safran.yaml

    The first puts payments-api#487 into the work history, so "what was done for PAY-1500" and "who changed src/webhook/retry.ts" have an answer. The second brings the index to the new default branch. The next morning's /safran:standup Payments lists the pull request under "Merged".

    Who did what

    The skillsA person
    Read the ticket, its links, family and historyYes
    Decide what "makul bir süre" meansAskedAyşe
    Find the code, with citationsYes
    Approve the planAskedAyşe
    Change code, run the checksYes, after the plan was approved, through Claude Code's permission prompts
    Push, open the pull requestDrafted the title and descriptionAyşe
    Find the race conditionYes
    Post the review commentsDrafted (the kind is not enabled at acme)Çağrı
    Reply in the threadsYes, each one previewed and confirmedAyşe said yes three times
    Approve, resolve threads, mergeNeverÇağrı
    Write the agreed value into the ticketNever by itselfStill open

    Where to go next

    • The reference for these four and the other eight skills: Skills.
    • How pull requests, votes and thread states are read on each host: Pull requests.
    • Before enabling any kind of write: Writes.
    • The rules every skill follows: Red lines.