Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Packages lists like a registry: Type, search, Visibility and Sort in one bar, richer rows, and a registry to choose from to start | 1 | //! A workspace renamed: rows kept under its old slug move to the one it |
| 2 | //! has now. See `g1t_kit::rename`. | |
| 3 | ||
| 4 | /// `?1` is the current slug, `?2` a stale one. | |
| 5 | pub const STATEMENTS: &[&str] = &[ | |
| 6 | "UPDATE settings SET owner = ?1 WHERE scope = 'workspace' AND owner = ?2", | |
| 7 | "UPDATE jobs SET namespace = ?1 WHERE namespace = ?2", | |
| 8 | "UPDATE cache_entries SET namespace = ?1 WHERE namespace = ?2", | |
| 9 | "UPDATE cache_days SET namespace = ?1 WHERE namespace = ?2", | |
| Actions: OIDC tokens, the toolkit's cache and artifact services, and artifacts in R2 | 10 | "UPDATE artifacts SET namespace = ?1 WHERE namespace = ?2", |
| Merge branch 'worktree-agent-a3abfcce648e87dca' | 11 | "UPDATE workspace_actions_settings SET namespace = ?1 WHERE namespace = ?2", |
| Merge GitHub pull request #8 (claude/cool-newton-7nm8r9): Docker deployments on g1t.page behind a switch that stays off until Cloudflare's container APIs are checked live, workflows a workspace manages in its repositories, tarball and zipball downloads, refs/pull/* kept to g1t alone, framework detection for g1t.page builds, and a workflow's event payload matching GitHub's. | 12 | "UPDATE workspace_managed_workflows SET namespace = ?1 WHERE namespace = ?2", |
| 13 | "UPDATE workspace_managed_workflows SET source_ref = ?1 || substr(source_ref, length(?2) + 1) WHERE substr(source_ref, 1, length(?2) + 1) = ?2 || '/'", | |
| Packages lists like a registry: Type, search, Visibility and Sort in one bar, richer rows, and a registry to choose from to start | 14 | "UPDATE workflows SET repo = ?1 || substr(repo, length(?2) + 1) WHERE substr(repo, 1, length(?2) + 1) = ?2 || '/'", |
| 15 | "UPDATE runs SET repo = ?1 || substr(repo, length(?2) + 1) WHERE substr(repo, 1, length(?2) + 1) = ?2 || '/'", | |
| 16 | ]; | |
| 17 | ||
| 18 | /// A repository renamed or transferred (see `g1t_kit::transfer`): its | |
| 19 | /// workflows, its runs and their jobs go with it. Its own secrets and | |
| 20 | /// variables are kept by its id (or its project's), so they go with it | |
| 21 | /// too; the old workspace's stop reaching it. A workspace's rows name the | |
| 22 | /// projects they reach by slug, not repositories, so a rename leaves them. | |
| 23 | pub const TRANSFERRED: &[&str] = &[ | |
| 24 | "UPDATE workflows SET repo = ?1 WHERE repo_id = ?5 AND repo = ?2", | |
| 25 | "UPDATE runs SET repo = ?1 WHERE repo_id = ?5 AND repo = ?2", | |
| 26 | "UPDATE jobs SET namespace = ?3 WHERE repo_id = ?5 AND namespace = ?4", | |
| 27 | "UPDATE cache_entries SET namespace = ?3 WHERE repo_id = ?5 AND namespace = ?4", | |
| Actions: OIDC tokens, the toolkit's cache and artifact services, and artifacts in R2 | 28 | "UPDATE artifacts SET namespace = ?3 WHERE repo_id = ?5 AND namespace = ?4", |
| Packages lists like a registry: Type, search, Visibility and Sort in one bar, richer rows, and a registry to choose from to start | 29 | ]; |
| 30 | ||
| 31 | /// A repository purged (see `g1t_kit::lifecycle`): its workflows, runs, | |
| 32 | /// jobs and their logs go, and secrets and variables still kept under its | |
| 33 | /// id (from before projects held them). `?1` its id. A project's own rows | |
| 34 | /// stay with the project. | |
| 35 | pub const PURGED: &[&str] = &[ | |
| 36 | "DELETE FROM logs WHERE job_id IN (SELECT id FROM jobs WHERE repo_id = ?1)", | |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 37 | // Earlier attempts' logs and summaries, kept under their own ids. |
| 38 | "DELETE FROM logs WHERE job_id IN (SELECT id FROM job_attempts WHERE repo_id = ?1)", | |
| 39 | "DELETE FROM job_summaries WHERE job_id IN (SELECT id FROM jobs WHERE repo_id = ?1)", | |
| 40 | "DELETE FROM job_summaries WHERE job_id IN (SELECT id FROM job_attempts WHERE repo_id = ?1)", | |
| 41 | "DELETE FROM job_attempts WHERE repo_id = ?1", | |
| 42 | "DELETE FROM run_attempts WHERE repo_id = ?1", | |
| Packages lists like a registry: Type, search, Visibility and Sort in one bar, richer rows, and a registry to choose from to start | 43 | "DELETE FROM jobs WHERE repo_id = ?1", |
| 44 | "DELETE FROM runs WHERE repo_id = ?1", | |
| 45 | "DELETE FROM workflows WHERE repo_id = ?1", | |
| 46 | "DELETE FROM synced WHERE repo_id = ?1", | |
| 47 | "DELETE FROM settings WHERE scope <> 'workspace' AND owner = ?1", | |
| Merge branch 'worktree-agent-a3abfcce648e87dca' | 48 | "DELETE FROM environments WHERE repo_id = ?1", |
| 49 | "DELETE FROM environment_gates WHERE repo_id = ?1", | |
| Packages lists like a registry: Type, search, Visibility and Sort in one bar, richer rows, and a registry to choose from to start | 50 | // Its cache's objects are deleted from R2 by the next sweep, then the rows. |
| 51 | "UPDATE cache_entries SET status = 'expired' WHERE repo_id = ?1", | |
| Actions: OIDC tokens, the toolkit's cache and artifact services, and artifacts in R2 | 52 | // Its artifacts too, and its own settings. |
| 53 | "UPDATE artifacts SET status = 'expired' WHERE repo_id = ?1", | |
| 54 | "DELETE FROM repo_settings WHERE repo_id = ?1", | |
| Packages lists like a registry: Type, search, Visibility and Sort in one bar, richer rows, and a registry to choose from to start | 55 | ]; |
| 56 | ||
| 57 | /// A workspace deleted: its own secrets and variables go. `?1` its slug. | |
| Merge branch 'worktree-agent-a3abfcce648e87dca' | 58 | pub const DELETED: &[&str] = &[ |
| 59 | "DELETE FROM settings WHERE scope = 'workspace' AND owner = ?1", | |
| 60 | "DELETE FROM workspace_actions_settings WHERE namespace = ?1", | |
| Merge GitHub pull request #8 (claude/cool-newton-7nm8r9): Docker deployments on g1t.page behind a switch that stays off until Cloudflare's container APIs are checked live, workflows a workspace manages in its repositories, tarball and zipball downloads, refs/pull/* kept to g1t alone, framework detection for g1t.page builds, and a workflow's event payload matching GitHub's. | 61 | "DELETE FROM workspace_managed_workflows WHERE namespace = ?1", |
| Merge branch 'worktree-agent-a3abfcce648e87dca' | 62 | ]; |
| Packages lists like a registry: Type, search, Visibility and Sort in one bar, richer rows, and a registry to choose from to start | 63 | |
| 64 | #[cfg(test)] | |
| 65 | mod tests { | |
| 66 | use super::{DELETED, PURGED, STATEMENTS, TRANSFERRED}; | |
| 67 | ||
| 68 | #[test] | |
| 69 | fn every_statement_takes_the_two_slugs() { | |
| 70 | for sql in STATEMENTS { | |
| 71 | assert_eq!(g1t_kit::rename::parameters(sql), 2, "{sql}"); | |
| 72 | } | |
| 73 | } | |
| 74 | ||
| 75 | #[test] | |
| 76 | fn transfer_and_deletion_statements_take_what_they_name() { | |
| 77 | for sql in TRANSFERRED { | |
| 78 | assert!((1..=5).contains(&g1t_kit::transfer::parameters(sql)), "{sql}"); | |
| 79 | } | |
| 80 | for sql in DELETED { | |
| 81 | assert_eq!(g1t_kit::rename::parameters(sql), 1, "{sql}"); | |
| 82 | } | |
| 83 | for sql in PURGED { | |
| 84 | assert_eq!(g1t_kit::transfer::parameters(sql), 1, "{sql}"); | |
| 85 | } | |
| 86 | } | |
| 87 | } |
This file's history is long; its oldest lines are credited to the oldest commit read.