← All showcases
story ↔ source ↔ testsProduct delivery
storytraceabilitydelivery

The story that ships with the code

Write the feature in .rq. @implementation and @tests name the files. rq: comments point back.

The story is an idea in the repo. Click returns the bound files.

booking/seat.rq

seat_hold {
  A selected seat stays reserved for eight minutes.
  Payment confirms the hold. Expiry returns the seat to sale.
  @status done
  @implementation (
      ["./src/booking/hold.ts".startHold]
      ["./src/booking/hold.ts".releaseExpired]
  )
  @tests (
      ["./src/booking/hold.test.ts:releases the seat after eight minutes"]
  )
}

src/booking/hold.ts

// rq:["../booking/seat.rq".seat_hold]
const HOLD_MS = 8 * 60 * 1000;

export function startHold(seatId: string, now: number): Hold {
  return { seatId, expiresAt: now + HOLD_MS };
}

export function releaseExpired(hold: Hold, now: number): boolean {
  return now >= hold.expiresAt;
}

src/booking/hold.test.ts

// rq:["../booking/seat.rq".seat_hold]
test("releases the seat after eight minutes", () => {
  const hold = startHold("A12", 0);
  expect(releaseExpired(hold, 8 * 60 * 1000)).toBe(true);
});

reqlan click

$ click({ target: "seat_hold" })
sessionKey: clk-1  kind: unique
file: booking/seat.rq
idea: seat_hold
outbound (2): startHold, releaseExpired
commentRefs (2): hold.ts, hold.test.ts
  slice: 1 idea · 2 files · ~200 tokens