Skip to content

chore: enable digest without creating its config row by hand - #1425

Merged
MicBun merged 1 commit into
mainfrom
chore/seed-digest-config-row
Sep 4, 2026
Merged

chore: enable digest without creating its config row by hand#1425
MicBun merged 1 commit into
mainfrom
chore/seed-digest-config-row

Conversation

@MicBun

@MicBun MicBun commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

digest_config has never had its row created by a migration. The table ships
empty, the scheduler reads that as "disabled" and stops, and in the logs that is
indistinguishable from digest having been switched off deliberately. On testnet
it went unnoticed until the pending-day queue had been filling since 2010.

019 now seeds the row, disabled:

INSERT INTO digest_config (id, enabled, digest_schedule)
VALUES (1, false, '0 */6 * * *')
ON CONFLICT (id) DO NOTHING;

Digest starts nowhere new. ON CONFLICT DO NOTHING leaves a network that already
has a row exactly as it was, schedule included, so an existing deployment keeps
its own cadence. Enabling digest stays an operator decision made through a signed
exec-sql. What changes is that the operator now runs an UPDATE, rather than
first having to work out that the row was missing at all.

digest_schedule is NOT NULL with no default, which is why this row cannot be
conjured from column defaults the way duplicate_prune_config's is in 056. The
seeded value matches DefaultDigestSchedule in
extensions/tn_digest/constants.go, the fallback the extension already applies
when the schedule comes back empty, so the two no longer differ by accident.

Tests

testDigestConfigShipsSeeded asserts the row exists, is disabled, and that its
schedule still equals that constant, so drift in either direction fails instead
of quietly changing a fresh network's cadence.

go test -tags kwiltest ./tests/streams/digest/ -run TestDigestActions -count=1
passes in 781s.

Also

Two comments claimed digest_config is not seeded, one in 056 and one in the
prune test. This makes both false, so they are corrected.

Summary by CodeRabbit

  • New Features

    • Digest configuration is now initialized automatically with digests disabled and a six-hour default schedule.
    • Existing digest configuration is preserved during migration.
  • Tests

    • Added coverage confirming exactly one default digest configuration is seeded.
    • Updated configuration documentation to reflect the seeded default.

@MicBun MicBun self-assigned this Sep 4, 2026
@holdex

holdex Bot commented Sep 4, 2026

Copy link
Copy Markdown

Time Submission Status

Member # Time Running Total Status Last Update
MicBun 4h ✅ Submitted Sep 4, 2026, 6:15 PM

Submit or update total time with:

@holdex pr submit-time 2h

Add time on top of previous submission with:

@holdex pr add-time 1h30m

See available commands to help comply with our Guidelines.

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 91d8a7a3-99a9-42a2-a9d9-9053ef71d04b

📥 Commits

Reviewing files that changed from the base of the PR and between 70ba96f and 2fd135b.

📒 Files selected for processing (4)
  • internal/migrations/019-digest-schema.sql
  • internal/migrations/056-duplicate-prune-schema.sql
  • tests/streams/digest/digest_actions_test.go
  • tests/streams/digest/prune_actions_test.go

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Migration 019 now seeds the singleton digest_config row with a disabled state and six-hour schedule. Tests verify the seeded row, preserve existing configurations, and update related documentation.

Changes

Digest configuration seeding

Layer / File(s) Summary
Seed the digest configuration
internal/migrations/019-digest-schema.sql, internal/migrations/056-duplicate-prune-schema.sql
Migration 019 inserts the default disabled configuration and skips insertion when the row already exists. Migration comments describe the seed behavior.
Validate the seeded configuration
tests/streams/digest/digest_actions_test.go, tests/streams/digest/prune_actions_test.go
The test suite checks that one disabled row exists with tn_digest.DefaultDigestSchedule. Related configuration documentation references the new test.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 2fd13

This change provides a disabled default digest configuration for new deployments without altering existing configurations, with coverage for the seeded values. No merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main operational benefit: operators can enable digest without manually creating its configuration row. It is concise and related to the migration and test changes.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. (2 skipped: 2 u…
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.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/seed-digest-config-row

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.

@MicBun

MicBun commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

@holdex pr submit-time 4h

@MicBun
MicBun merged commit bd976a0 into main Sep 4, 2026
7 of 8 checks passed
@MicBun
MicBun deleted the chore/seed-digest-config-row branch September 4, 2026 18:15
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.

Problem: node operators can't run TN without storing repeat data

1 participant