Saved queries
The six questions this database is built to answer. Each runs unchanged on SQLite and Postgres.
1. Acceptance criteria with no linked commits or no linked tests2. Commits not tied to any task3. Cycle time4. Requirements changed after the code for one of their criteria merged5. Review turnaround by reviewer6. Full trace for one requirement
4. Requirements changed after the code for one of their criteria merged.
SQL
-- 4. Requirements changed after the code for one of their criteria merged.
-- Reported per (requirement, criterion): those criteria were built against an older
-- version of the requirement and need re-checking.
WITH criterion_code AS (
SELECT tc.criterion_id, MAX(pr.merged_at) AS last_merge
FROM task_criteria tc
JOIN commit_tasks ct ON ct.task_id = tc.task_id
JOIN pull_request_commits prc ON prc.commit_id = ct.commit_id
JOIN pull_requests pr ON pr.id = prc.pull_request_id
WHERE pr.merged_at IS NOT NULL
GROUP BY tc.criterion_id
)
SELECT r.key AS requirement,
r.title,
r.version,
a.key AS criterion,
cc.last_merge AS code_merged_at,
r.updated_at AS requirement_changed_at,
rev.change_note
FROM requirements r
JOIN requirement_criteria rc ON rc.requirement_id = r.id
JOIN acceptance_criteria a ON a.id = rc.criterion_id
JOIN criterion_code cc ON cc.criterion_id = rc.criterion_id
LEFT JOIN requirement_revisions rev ON rev.requirement_id = r.id AND rev.version = r.version
WHERE r.updated_at > cc.last_merge
ORDER BY r.updated_at DESC, r.key, a.key;
12 rows
| requirement | title | version | criterion | code_merged_at | requirement_changed_at | change_note |
|---|---|---|---|---|---|---|
| REQ-CLICK-01 | Terminal output respects user configuration | 2 | AC-CLICK-101-1 | 2026-08-19T15:20:27Z | 2026-09-10T16:00:00Z | Added LESS handling and encoding after a customer report. |
| REQ-CLICK-01 | Terminal output respects user configuration | 2 | AC-CLICK-101-2 | 2026-08-19T15:20:27Z | 2026-09-10T16:00:00Z | Added LESS handling and encoding after a customer report. |
| REQ-CLICK-01 | Terminal output respects user configuration | 2 | AC-CLICK-101-3 | 2026-08-16T23:40:02Z | 2026-09-10T16:00:00Z | Added LESS handling and encoding after a customer report. |
| REQ-CLICK-01 | Terminal output respects user configuration | 2 | AC-CLICK-103-4 | 2026-08-14T18:51:51Z | 2026-09-10T16:00:00Z | Added LESS handling and encoding after a customer report. |
| REQ-REQ-02 | Public type hints describe what callers may pass | 3 | AC-REQ-201-1 | 2026-06-04T21:43:21Z | 2026-06-20T16:00:00Z | Extended to attributes after the 2.33 typing review. |
| REQ-REQ-02 | Public type hints describe what callers may pass | 3 | AC-REQ-202-1 | 2026-05-14T16:16:25Z | 2026-06-20T16:00:00Z | Extended to attributes after the 2.33 typing review. |
| REQ-REQ-02 | Public type hints describe what callers may pass | 3 | AC-REQ-202-2 | 2026-05-13T14:42:42Z | 2026-06-20T16:00:00Z | Extended to attributes after the 2.33 typing review. |
| REQ-HTTPX-01 | TLS configuration has one obvious way | 2 | AC-HTTPX-101-1 | 2024-11-12T11:31:42Z | 2025-01-10T16:00:00Z | Error type tightened to TypeError to match Python conventions for a wrong argument type. |
| REQ-HTTPX-01 | TLS configuration has one obvious way | 2 | AC-HTTPX-101-2 | 2024-11-28T11:46:59Z | 2025-01-10T16:00:00Z | Error type tightened to TypeError to match Python conventions for a wrong argument type. |
| REQ-HTTPX-01 | TLS configuration has one obvious way | 2 | AC-HTTPX-101-3 | 2024-11-28T11:46:59Z | 2025-01-10T16:00:00Z | Error type tightened to TypeError to match Python conventions for a wrong argument type. |
| REQ-HTTPX-01 | TLS configuration has one obvious way | 2 | AC-HTTPX-101-4 | 2024-11-15T10:17:42Z | 2025-01-10T16:00:00Z | Error type tightened to TypeError to match Python conventions for a wrong argument type. |
| REQ-HTTPX-01 | TLS configuration has one obvious way | 2 | AC-HTTPX-101-5 | 2024-12-04T11:29:09Z | 2025-01-10T16:00:00Z | Error type tightened to TypeError to match Python conventions for a wrong argument type. |