From 9bbcd8e978e7aa97448e3d6950790d36451cd6c8 Mon Sep 17 00:00:00 2001 From: Atharva Sehgal Date: Tue, 12 May 2026 00:24:09 +0000 Subject: [PATCH] feat(supabase): add task_id_map table (formula-code/fc-eval#19) Maps the legacy `analysis/tasks.txt` on-disk task identifiers (e.g. `pandas_dev-pandas_3`) to the canonical (owner, repo, issue_number) identity used by `pull_requests`, `harbor_runs`, and the `findings_*` tables. The legacy format uses an inconsistently sanitized seq-num, not the GitHub issue/PR number. Public-read RLS + anon grant follow the 00021 pattern. Populated by `analysis/export_website_findings.py:build_task_id_map` in formula-code/fc-eval. Co-Authored-By: Claude Opus 4.7 (1M context) --- supabase/migrations/00022_task_id_map.sql | 37 +++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 supabase/migrations/00022_task_id_map.sql diff --git a/supabase/migrations/00022_task_id_map.sql b/supabase/migrations/00022_task_id_map.sql new file mode 100644 index 00000000..5071efa6 --- /dev/null +++ b/supabase/migrations/00022_task_id_map.sql @@ -0,0 +1,37 @@ +-- Map FormulaCode's legacy on-disk task identifiers (the strings under +-- `analysis/tasks.txt` in formula-code/fc-eval, e.g. `pandas_dev-pandas_3`) +-- to the canonical (owner, repo, issue_number) identity used everywhere +-- else in the public API (`pull_requests`, `harbor_runs`, +-- `findings_workload_tradeoff`, etc.). +-- +-- Why this exists: the legacy task-id format is `{owner_sanitized}_{repo_ +-- sanitized}_{seq_num}` where `seq_num` is a per-run sequence number (NOT +-- the GitHub issue/PR number) and the sanitization rule for `_` vs `-` is +-- inconsistent across rows in `tasks.txt`. Anyone consuming an +-- `analysis/tasks.txt`-style id needs this table to recover the PR's +-- actual identity and commit SHA. +-- +-- See formula-code/fc-eval#19 for context; rows are populated by the +-- `task_id_map` builder in `analysis/export_website_findings.py`. + +CREATE TABLE IF NOT EXISTS task_id_map ( + legacy_task_id TEXT PRIMARY KEY, -- e.g. 'pandas_dev-pandas_3' + canonical_task_id TEXT NOT NULL, -- '{owner}_{repo}_{issue_number}' + owner TEXT NOT NULL, + repo TEXT NOT NULL, + issue_number INT NOT NULL, + pr_merge_commit_sha TEXT, + pr_base_sha TEXT, + FOREIGN KEY (owner, repo, issue_number) + REFERENCES pull_requests (owner, repo, issue_number) +); + +CREATE INDEX IF NOT EXISTS idx_task_id_map_canonical + ON task_id_map (canonical_task_id); +CREATE INDEX IF NOT EXISTS idx_task_id_map_pr + ON task_id_map (owner, repo, issue_number); + +-- RLS + anon grant (same pattern as 00021_findings_tables.sql). +ALTER TABLE task_id_map ENABLE ROW LEVEL SECURITY; +CREATE POLICY "public_read" ON task_id_map FOR SELECT TO anon USING (true); +GRANT SELECT ON task_id_map TO anon;