---
id: T01
parent: S03
milestone: M009
provides: []
requires: []
affects: []
key_files: ["backend/routers/techniques.py", "frontend/src/api/public-client.ts"]
key_decisions: ["Followed same pattern as creators.py for sort param (func.random() for random, created_at DESC for recent)"]
patterns_established: []
drill_down_paths: []
observability_surfaces: []
duration: ""
verification_result: "TypeScript compiles cleanly (npx tsc --noEmit), backend grep confirms sort=random logic present, frontend grep confirms sort param wired through."
completed_at: 2026-03-31T05:46:25.296Z
blocker_discovered: false
---

# T01: Added sort=random|recent query param to list_techniques endpoint and wired it through the frontend API client

> Added sort=random|recent query param to list_techniques endpoint and wired it through the frontend API client

## What Happened
---
id: T01
parent: S03
milestone: M009
key_files:
  - backend/routers/techniques.py
  - frontend/src/api/public-client.ts
key_decisions:
  - Followed same pattern as creators.py for sort param (func.random() for random, created_at DESC for recent)
duration: ""
verification_result: passed
completed_at: 2026-03-31T05:46:25.296Z
blocker_discovered: false
---

# T01: Added sort=random|recent query param to list_techniques endpoint and wired it through the frontend API client

**Added sort=random|recent query param to list_techniques endpoint and wired it through the frontend API client**

## What Happened

Added an optional `sort` query parameter to `list_techniques` in `backend/routers/techniques.py`, accepting "recent" (default, existing created_at DESC) and "random" (using func.random()). Replaced the hardcoded order_by with a conditional. On the frontend, added `sort?: string` to `TechniqueListParams` and wired it through `fetchTechniques` as a query string parameter.

## Verification

TypeScript compiles cleanly (npx tsc --noEmit), backend grep confirms sort=random logic present, frontend grep confirms sort param wired through.

## Verification Evidence

| # | Command | Exit Code | Verdict | Duration |
|---|---------|-----------|---------|----------|
| 1 | `cd frontend && npx tsc --noEmit` | 0 | ✅ pass | 7900ms |
| 2 | `grep -q 'sort.*random' backend/routers/techniques.py` | 0 | ✅ pass | 100ms |
| 3 | `grep -q 'sort' frontend/src/api/public-client.ts` | 0 | ✅ pass | 100ms |


## Deviations

None.

## Known Issues

None.

## Files Created/Modified

- `backend/routers/techniques.py`
- `frontend/src/api/public-client.ts`


## Deviations
None.

## Known Issues
None.
