Skip to content

Remove legacy jobs and RunLog observability residue - #1215

Merged
kentcdodds merged 3 commits into
mainfrom
cursor/reap-jobs-runlog-f0ea
Aug 4, 2026
Merged

kentcdodds merged 3 commits into
mainfrom
cursor/reap-jobs-runlog-f0ea

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Aug 4, 2026 •

Copy link
Copy Markdown
Owner

Intent

Complete the jobs/RunLog legacy-observability hard cut from #1069 so RunLog is the only source for job error, duration, and counters at launch.

Summary

  • add migration 0144 to drop the five quiescent jobs observability columns while retaining last_run_at and last_run_status (0142 was renumbered after 0143 landed first)
  • remove D1 serialization, fallback hydration, scheduler residue, and the final storage-byte reader; keep MCP/UI response fields sourced from RunLog
  • rebuild job_run_observability at RunLog schema v9 without legacy_seeded
  • move admin job outcome aggregates to content-free per-user RunLog snapshots and trim completed rollout narration
  • align jobs test schemas with the post-migration table contract

Testing

  • npm run validate — passed on the final rebased revision with fresh E2E D1 state (553 files / 1,855 tests, 2 MCP files / 3 tests, 7 E2E tests, plus format, lint, typecheck, backup build, primitives, migrations, and docs)
  • npx vitest run packages/worker/src/entitlements/d1-storage-reconciliation.workers.test.ts — 6 passed
  • npx vitest run packages/worker/src/community/community-flow.workers.test.ts — 2 passed
  • final CI Validate, Static, Node, Workers, MCP, E2E, Cursor Bugbot, and CodeRabbit — passed
  • clean preview resource deployment — passed, including migration 0144
  • production deploy — passed; migration 0144 reported ✅ and healthcheck served merge SHA 984b2fcc

System changes

System recap — extends existing primitives (medium risk)

Mode: recap · Base: main @ e090800e · Head: 7e2c2353

Classification: extends — removes retired D1 storage and changes the RunLog Durable Object schema while preserving the public jobs observability contract.

Primitives touched

Primitive Group Impact
jobs assistant extends — job views receive error, duration, and counters only from RunLog
run-records storage extends — schema v9 rebuild removes rollback residue and serves admin aggregates
d1-app-db storage extends — migration 0144 drops five quiescent jobs columns
entitlements auth composes — storage-byte SQL stops reading the removed text column
app-ui surfaces composes — admin insights consumes folded RunLog job counters
mcp-server surfaces composes — existing job response contract is retained through RunLog hydration

System map

Job inspection overlays RunLog observability on D1 schedule anchors; admin insights folds content-free RunLog counters; migration 0144 removes retired D1 copies.

Legend: green = composes (wiring only) · amber = extended by this PR · red = new primitive · gray = context (unchanged, included only when an edge crosses it).

flowchart LR
	mcpServer["mcp-server<br/>MCP endpoint (/mcp)"]:::touched
	appUi["app-ui<br/>Browser app (Remix 3)"]:::touched
	entitlements["entitlements<br/>Plans & entitlements"]:::touched
	jobs["jobs<br/>Scheduled jobs"]:::extended
	runRecords["run-records<br/>Run records"]:::extended
	d1AppDb["d1-app-db<br/>D1 app database"]:::extended
	mcpServer -->|"job_list / job_get views"| jobs
	appUi -->|"admin job-health aggregate"| runRecords
	jobs -->|"error, duration, counters"| runRecords
	jobs -->|"schedule + retention anchors"| d1AppDb
	entitlements -->|"post-0144 storage-byte columns"| d1AppDb
	d1AppDb -->|"0144 drops retired copies"| jobs
	classDef touched fill:#1a7f37,color:#fff
	classDef extended fill:#9a6700,color:#fff
	classDef added fill:#cf222e,color:#fff
	classDef untouched fill:#57606a,color:#fff
Loading

Before / after

Before After
D1 jobs rows retained quiescent error/duration/counter copies D1 retains only last_run_at / last_run_status anchors
missing RunLog rows could expose D1 fallback values missing RunLog rows expose empty observability values
RunLog schema v8 retained legacy_seeded schema v9 rebuild preserves data without the inert column

Invariants

  • state-vs-history: scheduling and retention anchors remain on the job entity; observability remains dedicated RunLog state outside pruned run history.
  • per-user-isolation: admin aggregation continues bounded per-user RunLog point reads without names, errors, or logs.

Conductor report

STATUS done — squash-merged as 984b2fcc; final local validation, CI, AI review, clean preview, main validation, and production deploy are green. Production deploy applied 0144-drop-jobs-observability-columns.sql successfully and healthchecked the merge SHA. legacy_seeded is absent outside immutable history, D1 job observability readers/writers are removed, and RunLog is the sole error/duration/counter source. Tracks #1069.

Open in Web Open in Cursor 

Summary by CodeRabbit

  • Refactor

    • Restructured job metrics sourcing: Admin insights now retrieve job success and error counts from RunLog aggregation rather than from the jobs table. Job execution metadata no longer persists in the primary jobs table but remains available through dedicated observability data structures.
  • Tests

    • Updated admin insights and job persistence tests to reflect revised data sourcing and schema changes.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR makes RunLog authoritative for job execution metrics, removes legacy observability columns from D1, adds RunLog-based job health totals to admin insights, and upgrades the RunLog schema to version 9.

Changes

Job observability migration

Layer / File(s) Summary
RunLog schema and snapshot contract
packages/worker/src/run-records/run-log-do.ts, packages/worker/src/run-records/admin-insights-snapshot.ts, packages/worker/src/run-records/*test.ts
RunLog schema version 9 removes the retired column, preserves existing data during upgrades, and adds jobRunCounts to admin snapshots.
Admin insights aggregation
packages/worker/src/app/admin-insights-data.ts, packages/worker/src/app/admin-insights-data.node.test.ts, docs/contributing/architecture/run-records.md
Admin insights now read schedule totals from D1 and aggregate successful and failed job runs from bounded RunLog snapshots.
D1 job column removal and persistence
packages/worker/migrations/0144-drop-jobs-observability-columns.sql, packages/worker/src/jobs/*, packages/worker/src/community/*, packages/worker/src/entitlements/*, tools/migration-ledger.json
D1 job persistence, schemas, migrations, execution handling, storage accounting, and test doubles remove legacy error, duration, and counter fields while retaining scheduling data.
Missing observability hydration
packages/worker/src/jobs/job-run-observability-hydrate.ts, packages/worker/src/jobs/job-run-observability-hydrate.node.test.ts
Missing RunLog data now clears stale error and duration values and resets execution counters to zero.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • kentcdodds/kody#1114: Modifies the same job observability migration, hydration, repository, and RunLog admin-insights paths.
  • kentcdodds/kody#1053: Shares RunLog admin-insights aggregation and run-log-do.ts changes.
  • kentcdodds/kody#969: Covers the related migration of job execution observability from D1 fields to RunLog storage.

Sequence Diagram(s)

sequenceDiagram
  participant AdminInsightsData
  participant D1
  participant RunLog
  participant AdminSnapshot
  AdminInsightsData->>D1: Read total and enabled job schedules
  AdminInsightsData->>RunLog: Read bounded per-user job outcome snapshots
  RunLog-->>AdminInsightsData: Return success and error totals
  AdminInsightsData->>AdminSnapshot: Return combined job health metrics
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the removal of legacy jobs and RunLog observability data.
Description check ✅ Passed The description includes the required Intent, Summary, Testing, and System changes sections with relevant implementation and validation details.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/reap-jobs-runlog-f0ea

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kody-bot
kody-bot marked this pull request as ready for review August 4, 2026 14:21
@github-actions

github-actions Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

🔎 Preview deployed: https://kody-pr-1215.kody-a99.workers.dev

Worker: kody-pr-1215
D1: kody-pr-1215-db
KV: kody-pr-1215-oauth-kv

Mocks:

@cursor

cursor Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai review

1 similar comment
@kentcdodds

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

cursoragent and others added 2 commits August 4, 2026 15:33
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@cursor
cursor Bot force-pushed the cursor/reap-jobs-runlog-f0ea branch from 541468c to e44e883 Compare August 4, 2026 15:34

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/worker/src/run-records/dedicated-state.workers.test.ts (1)

1251-1254: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use test.each for the warm schema upgrade cases.

The loop runs the v7 and v8 paths under one test name. If v8 fails, the failure does not identify the installed version.

Inline legacy_seeded unless a repo guard requires the join.

['legacy', 'seeded'].join('_') hides the column name inside the test, while repo config does not reference a legacy-column guard.

♻️ Proposed refactor to parameterize the test
-test('warm schema v7 and v8 objects upgrade to v9 without losing job data', async () => {
-	const retiredColumn = ['legacy', 'seeded'].join('_')
-	for (const installedVersion of [7, 8]) {
+const retiredColumn = 'legacy_seeded'
+
+test.each([7, 8])(
+	'warm schema v%i object upgrades to v9 without losing job data',
+	async (installedVersion) => {
 		const userId = uniqueUserId(`schema-v${installedVersion}-warm`)

Then close the callback where the loop currently ends and remove one indentation level.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/worker/src/run-records/dedicated-state.workers.test.ts` around lines
1251 - 1254, Refactor the warm schema upgrade test to use test.each with
installed versions 7 and 8, so each case reports its version independently;
remove the loop and adjust the callback body indentation while preserving the
existing assertions and job-data behavior. Replace the retiredColumn join
expression with the literal legacy_seeded, unless an existing repository guard
requires retaining the join.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/worker/src/run-records/dedicated-state.workers.test.ts`:
- Around line 1251-1254: Refactor the warm schema upgrade test to use test.each
with installed versions 7 and 8, so each case reports its version independently;
remove the loop and adjust the callback body indentation while preserving the
existing assertions and job-data behavior. Replace the retiredColumn join
expression with the literal legacy_seeded, unless an existing repository guard
requires retaining the join.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 845d4dd7-376d-4199-a383-3c4d1588a322

📥 Commits

Reviewing files that changed from the base of the PR and between 541468c and e44e883.

📒 Files selected for processing (20)
  • docs/contributing/architecture/run-records.md
  • packages/worker/migrations/0142-drop-jobs-observability-columns.sql
  • packages/worker/src/app/admin-insights-data.node.test.ts
  • packages/worker/src/app/admin-insights-data.ts
  • packages/worker/src/community/community-flow-test-schema.ts
  • packages/worker/src/entitlements/service.ts
  • packages/worker/src/jobs/job-run-observability-hydrate.node.test.ts
  • packages/worker/src/jobs/job-run-observability-hydrate.ts
  • packages/worker/src/jobs/process-due-jobs.ts
  • packages/worker/src/jobs/repo.ts
  • packages/worker/src/jobs/repo.workers.test.ts
  • packages/worker/src/jobs/run-due-jobs-claim-fence.node.test.ts
  • packages/worker/src/jobs/service.node.test.ts
  • packages/worker/src/mcp/run-kody-registry.node.test.ts
  • packages/worker/src/run-records/admin-insights-snapshot.ts
  • packages/worker/src/run-records/dedicated-state.workers.test.ts
  • packages/worker/src/run-records/run-log-do.ts
  • packages/worker/src/run-records/service.node.test.ts
  • packages/worker/src/run-records/service.ts
  • tools/migration-ledger.json
💤 Files with no reviewable changes (2)
  • packages/worker/src/jobs/run-due-jobs-claim-fence.node.test.ts
  • packages/worker/src/jobs/process-due-jobs.ts
🚧 Files skipped from review as they are similar to previous changes (16)
  • packages/worker/src/community/community-flow-test-schema.ts
  • packages/worker/src/entitlements/service.ts
  • packages/worker/src/run-records/admin-insights-snapshot.ts
  • packages/worker/src/run-records/service.node.test.ts
  • packages/worker/src/jobs/job-run-observability-hydrate.ts
  • tools/migration-ledger.json
  • docs/contributing/architecture/run-records.md
  • packages/worker/src/jobs/job-run-observability-hydrate.node.test.ts
  • packages/worker/src/app/admin-insights-data.ts
  • packages/worker/src/mcp/run-kody-registry.node.test.ts
  • packages/worker/src/jobs/service.node.test.ts
  • packages/worker/src/jobs/repo.workers.test.ts
  • packages/worker/src/app/admin-insights-data.node.test.ts
  • packages/worker/src/run-records/run-log-do.ts
  • packages/worker/src/jobs/repo.ts
  • packages/worker/src/run-records/service.ts

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/worker/migrations/0144-drop-jobs-observability-columns.sql`:
- Around line 4-8: Reconcile the DROP COLUMN statements in migration 0144 with
the actual pre-0144 jobs schema, removing or correcting references to columns
such as last_run_error that do not exist so the migration completes cleanly.
After updating the migration, regenerate the corresponding checksum entry in
tools/migration-ledger.json.
- Around line 4-8: Update the migration before the DROP COLUMN statements to
backfill existing jobs into job_run_observability, deriving the required userId
and jobId values and migrating the aggregate observability fields from
last_run_error, last_duration_ms, run_count, success_count, and error_count.
Ensure the backfill completes before removing those jobs columns.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b04455b8-c298-468f-818a-5d18dfe3dae6

📥 Commits

Reviewing files that changed from the base of the PR and between e44e883 and 7e2c235.

📒 Files selected for processing (2)
  • packages/worker/migrations/0144-drop-jobs-observability-columns.sql
  • tools/migration-ledger.json

Comment on lines +4 to +8
ALTER TABLE jobs DROP COLUMN last_run_error;
ALTER TABLE jobs DROP COLUMN last_duration_ms;
ALTER TABLE jobs DROP COLUMN run_count;
ALTER TABLE jobs DROP COLUMN success_count;
ALTER TABLE jobs DROP COLUMN error_count;

@coderabbitai coderabbitai Bot Aug 4, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🔴 Critical | 🏗️ Heavy lift

Fix the jobs column contract before applying migration 0144.

Preview deployment fails at Line 4 with SQLite error - no such column: "last_run_error". The migration stops before it applies the remaining drops. Reconcile these statements with the schema produced before migration 0144, then update the checksum in tools/migration-ledger.json at Lines 584-585. Do not deploy until a clean preview applies the migration.

🧰 Tools
🪛 GitHub Actions: 🔎 Preview / 🔎 Deploy Preview Resources

[error] Database migration failed: A request to the Cloudflare API failed. SQLite error - no such column: "last_run_error" at offset 32 [code: 7500]. The migration attempted to reference a column that does not exist in the database schema. Verify that the database schema matches the expected state before applying this migration.

🪛 Squawk (2.61.0)

[warning] 4-4: Dropping a column may break existing clients.

(ban-drop-column)


[warning] 5-5: Dropping a column may break existing clients.

(ban-drop-column)


[warning] 6-6: Dropping a column may break existing clients.

(ban-drop-column)


[warning] 7-7: Dropping a column may break existing clients.

(ban-drop-column)


[warning] 8-8: Dropping a column may break existing clients.

(ban-drop-column)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/worker/migrations/0144-drop-jobs-observability-columns.sql` around
lines 4 - 8, Reconcile the DROP COLUMN statements in migration 0144 with the
actual pre-0144 jobs schema, removing or correcting references to columns such
as last_run_error that do not exist so the migration completes cleanly. After
updating the migration, regenerate the corresponding checksum entry in
tools/migration-ledger.json.

Source: Pipeline failures


🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 8 \
  '0144|last_run_error|last_duration_ms|run_count|success_count|error_count|last_error_at|total_duration_ms|JobRunObservability|job_run_observability|legacySeeded' \
  packages/worker/migrations packages/worker/src tools/migration-ledger.json

Repository: kentcdodds/kody

Length of output: 50372


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "## migration files around 0144"
ls -1 packages/worker/migrations/*.sql | sort | grep -E '(0142|0143|0144|0145)' -n || true

echo
echo "## 0144 + 3 adjacent migrations"
for f in packages/worker/migrations/0142*.sql packages/worker/migrations/0143*.sql packages/worker/migrations/0144*.sql packages/worker/migrations/0145*.sql; do
  [ -f "$f" ] || continue
  echo "### $f"
  sed -n '1,220p' "$f"
done

echo
echo "## job_run_observability migrations in packages/worker/migrations"
rg -n -C 4 'job_run_observability|last_run_error|last_duration_ms|run_count|success_count|error_count' packages/worker/migrations || true

echo
echo "## migration-ledger entries near observability schema"
python3 - <<'PY'
import json
from pathlib import Path
p = Path('tools/migration-ledger.json')
if p.exists():
    data=json.loads(p.read_text())
    print(data[:28])
else:
    print('missing tools/migration-ledger.json')
PY

echo
echo "## source references for legacy D1 fields / backfill"
rg -n -C 3 'legacySeeded|JobRunObservabilityRecord|JobRunObservabilityUpsertInput|upsertJobRunObservability\(|getJobRunObservability\(|last_run_error|last_duration_ms|run_count|success_count|error_count' packages/worker/src packages/worker/migrations | head -n 240

Repository: kentcdodds/kody

Length of output: 21017


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "## migrations before 150"
ls -1 packages/worker/migrations/*.sql | sort | awk 'NR>=120 && NR<=150' | while read f; do
  echo "### $f"
  sed -n '1,180p' "$f"
done

echo
echo "## all migration-ledger entries"
python3 - <<'PY'
import json
from pathlib import Path

p = Path('tools/migration-ledger.json')
if not p.exists():
    print('missing tools/migration-ledger.json')
    raise SystemExit(0)

data = json.loads(p.read_text())
by_id = {}
for item in data:
    mid = item.get('id')
    if mid:
        by_id[vid] = item
        continue
    by_id[f"#{len(data)}"] = item

for i, item in enumerate(data, 1):
    if "observability" in str(item).lower() or "run_log" in str(item).lower() or "job_run" in str(item).lower() or "run_count" in str(item).lower() or "success_count" in str(item).lower() or "error_count" in str(item).lower() or "last_duration_ms" in str(item).lower() or "last_run_error" in str(item).lower():
        print(f"#{i}: {item}")

print(f"\nTotal ledger entries: {len(data)}")
PY

echo
echo "## deterministic scan for D1->run_log job observability backfill"
python3 - <<'PY'
from pathlib import Path
import re

fields = {
    "last_run_error": [],
    "last_duration_ms": [],
    "run_count": [],
    "success_count": [],
    "error_count": [],
}
tables = {"jobs", "job_run_observability", "job_run_observability_v9"}
for path in sorted(Path("packages/worker/migrations").glob("*.sql")):
    text = path.read_text()
    for field, rows in fields.items():
        if field in text:
            rows.append(path.name)
    if "job_run_observability" in text:
        print(f"job_observability_refs: {path.name}")
        for m in re.finditer(r"(CREATE TABLE|DROP TABLE|ALTER TABLE|INSERT INTO),", text):
            print("  ", text[m.start()-60:m.start()], text[m.start():m.start()+120])

print("\ndiffs_migrating_fields_from_jobs:")
for field, paths in fields.items():
    backfills = [p for p in paths if p.startswith(("0021", "0026")) or "backfill" in p.read_text().lower() or "backup" in p.read_text().lower()]
    print(field, ":", paths)

print("\nrun_log_schema_tables:")
for path in sorted(Path("packages/worker/migrations").glob("*.sql")):
    text = path.read_text()
    for table in tables:
        if f"CREATE TABLE `{table}`" in text or f"CREATE TABLE IF NOT EXISTS `{table}`" in text or table in text:
            print(f"{path.name}: {table}")
            print(text[:800])

print("\nrun_log_v9_refs:")
for path in sorted(Path("packages/worker/migrations").glob("*.sql")):
    text = path.read_text()
    if "v9" in text.lower() or "rebuildJobRunObservabilityForV9" in text:
        print(path.name)
PY

echo
echo "## source backfill/search concise"
rg -n 'backfill|backup|copy|populate|upsertJobRunObservability|getJobRunObservability|JobRunObservabilityUpsertInput|legacySeeded|run_count|success_count|error_count|last_duration_ms|last_run_error' packages/worker/src packages/worker/scripts || true

Repository: kentcdodds/kody

Length of output: 50371


Add a D1-to-run-log observability migration before dropping these columns.

0144-drop-jobs-observability-columns.sql removes last_run_error, last_duration_ms, run_count, success_count, and error_count from jobs without populating job_run_observability. Existing job records will lose historical D1 observability after this drop, so backfill userId/jobId and aggregate values into job_run_observability first.

🧰 Tools
🪛 GitHub Actions: 🔎 Preview / 🔎 Deploy Preview Resources

[error] Database migration failed: A request to the Cloudflare API failed. SQLite error - no such column: "last_run_error" at offset 32 [code: 7500]. The migration attempted to reference a column that does not exist in the database schema. Verify that the database schema matches the expected state before applying this migration.

🪛 Squawk (2.61.0)

[warning] 4-4: Dropping a column may break existing clients.

(ban-drop-column)


[warning] 5-5: Dropping a column may break existing clients.

(ban-drop-column)


[warning] 6-6: Dropping a column may break existing clients.

(ban-drop-column)


[warning] 7-7: Dropping a column may break existing clients.

(ban-drop-column)


[warning] 8-8: Dropping a column may break existing clients.

(ban-drop-column)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/worker/migrations/0144-drop-jobs-observability-columns.sql` around
lines 4 - 8, Update the migration before the DROP COLUMN statements to backfill
existing jobs into job_run_observability, deriving the required userId and jobId
values and migrating the aggregate observability fields from last_run_error,
last_duration_ms, run_count, success_count, and error_count. Ensure the backfill
completes before removing those jobs columns.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved operationally and verified on a clean preview. This PR’s persisted preview D1 had already applied the identical migration under its pre-rebase 0142 filename, so the renamed 0144 replay correctly found the columns absent. Production never applied 0142. I cleaned only PR #1215’s disposable preview resources and reran deployment from an empty preview database; migration 0144 and the full preview deploy now pass: https://github.com/kentcdodds/kody/actions/runs/30925518579/job/92049383782. Local npm run validate also passes from fresh E2E D1 state.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skipped: comment is from another GitHub bot.

@kentcdodds
kentcdodds merged commit 984b2fc into main Aug 4, 2026
11 of 12 checks passed
@kentcdodds
kentcdodds deleted the cursor/reap-jobs-runlog-f0ea branch August 4, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants