Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions migrations/0146_drop_gate_check_mode.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Dead-column cleanup (#5373). gate_check_mode has been a computed read-back of review_check_mode only
-- since #4618 (0107_repository_review_check_mode.sql backfilled review_check_mode from it and made it the
-- real publish authority): getRepositorySettings/upsertRepositorySettings in db/repositories.ts have re-derived
-- it from review_check_mode on every read and write since then, self-healing any stale stored value. The
-- stored column itself has carried no independent information for any live row since that migration.
-- SQLite 3.35+ / D1 supports DROP COLUMN directly (same precedent as 0122_drop_private_trust_enabled.sql).
ALTER TABLE repository_settings DROP COLUMN gate_check_mode;
11 changes: 3 additions & 8 deletions src/db/repositories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -604,9 +604,9 @@ export async function getRepositorySettings(env: Env, fullName: string): Promise
publicSignalLevel: row.publicSignalLevel === "minimal" ? "minimal" : "standard",
checkRunMode: parseCheckRunMode(row.checkRunMode),
checkRunDetailLevel: parseCheckRunDetailLevel(row.checkRunDetailLevel),
// #4618: gateCheckMode is a computed read-back value, never its own stored source of truth -- derive it
// from the real authority (reviewCheckMode) on every read instead of trusting the DB column, so a row
// whose gate_check_mode column has drifted (e.g. pre-#4618 data) self-heals on the very next read.
// #4618/#5373: gateCheckMode is a computed field, not its own stored source of truth -- always derive it
// from the real authority (reviewCheckMode) rather than a stored value. The gate_check_mode column itself
// was dropped (#5373, migrations/0146) since it never carried any information a fresh derivation didn't.
gateCheckMode: parseReviewCheckMode(row.reviewCheckMode) === "disabled" ? "off" : "enabled",
regateSweepOrderMode: parseRegateSweepOrderMode(row.regateSweepOrderMode),
reviewCheckMode: parseReviewCheckMode(row.reviewCheckMode),
Expand Down Expand Up @@ -725,9 +725,6 @@ export async function upsertRepositorySettings(env: Env, settings: Partial<Repos
publicSignalLevel: settings.publicSignalLevel ?? "standard",
checkRunMode: settings.checkRunMode ?? "off",
checkRunDetailLevel: settings.checkRunDetailLevel ?? "minimal",
// #4618: gateCheckMode is no longer an independent write input (dropped from every write schema) --
// derive it from reviewCheckMode below so the DB column stays a self-consistent read-back value.
gateCheckMode: (settings.reviewCheckMode ?? "disabled") === "disabled" ? "off" : "enabled",
regateSweepOrderMode: settings.regateSweepOrderMode ?? "staleness",
reviewCheckMode: settings.reviewCheckMode ?? "disabled",
autoProjectMilestoneMatch: settings.autoProjectMilestoneMatch ?? "off",
Expand Down Expand Up @@ -810,7 +807,6 @@ export async function upsertRepositorySettings(env: Env, settings: Partial<Repos
publicSignalLevel: resolved.publicSignalLevel,
checkRunMode: resolved.checkRunMode,
checkRunDetailLevel: resolved.checkRunDetailLevel,
gateCheckMode: resolved.gateCheckMode,
regateSweepOrderMode: resolved.regateSweepOrderMode,
reviewCheckMode: resolved.reviewCheckMode,
projectMilestoneMatchMode: resolved.autoProjectMilestoneMatch,
Expand Down Expand Up @@ -899,7 +895,6 @@ export async function upsertRepositorySettings(env: Env, settings: Partial<Repos
publicSignalLevel: resolved.publicSignalLevel,
checkRunMode: resolved.checkRunMode,
checkRunDetailLevel: resolved.checkRunDetailLevel,
gateCheckMode: resolved.gateCheckMode,
regateSweepOrderMode: resolved.regateSweepOrderMode,
reviewCheckMode: resolved.reviewCheckMode,
projectMilestoneMatchMode: resolved.autoProjectMilestoneMatch,
Expand Down
1 change: 0 additions & 1 deletion src/db/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export const repositorySettings = sqliteTable("repository_settings", {
publicSignalLevel: text("public_signal_level").notNull().default("standard"),
checkRunMode: text("check_run_mode").notNull().default("off"),
checkRunDetailLevel: text("check_run_detail_level").notNull().default("minimal"),
gateCheckMode: text("gate_check_mode").notNull().default("off"),
// Scheduled re-gate sweep candidate ordering (#3815). staleness | oldest-first. Default staleness — see
// RepositorySettings["regateSweepOrderMode"] for the full convergence-guarantee rationale.
regateSweepOrderMode: text("regate_sweep_order_mode").notNull().default("staleness"),
Expand Down
Loading
Loading