Conversation
- Changed the visibility of the `auto_digest` action from private to public in the `020-digest-actions.sql` migration script, allowing it to be called directly from the CLI for verification purposes.
WalkthroughAdded PUBLIC visibility to the auto_digest action declaration in the SQL migration, changing its signature. No other logic, columns, or body content was modified. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes(no out-of-scope functional changes identified) Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Bug Report Checklist
|
|
@pr-time-tracker bug commit 38cdbb8 && bug author @outerlook |
Time Submission Status
|
|
oh, merged wrongly now |
573ba0f to
dfb9349
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
internal/migrations/020-digest-actions.sql (3)
4-8: Reassess exposure: PUBLIC may allow untrusted callersIf PUBLIC means globally invokable, this could become risky once the action performs deletions (hinted by total_deleted_rows). Consider restricting execution to the scheduler/maintenance role instead of PUBLIC, or add a guard to reject non-scheduler callers.
Can you confirm:
- Which role the scheduler uses to invoke actions?
- Whether non-scheduler clients could call this action in production?
If needed, I can propose a follow-up migration to tighten execution permissions once we confirm the engine’s authorization syntax for ACTIONs.
9-13: Implement leader-only guard before enabling real side effectsThe TODO for leader enforcement is noted. Before turning this into a non-noop (deleting rows), add the leader check (or equivalent single-writer semaphore) to avoid concurrent runs across nodes.
If you share the idiomatic way your SQL engine exposes node identity and errors in ACTIONs, I can draft the guard snippet and tests.
4-14: Optional: annotate determinism/read-only if supportedComment says “deterministic, read-only.” If your engine supports attributes (e.g., IMMUTABLE/STABLE, READ ONLY), consider declaring them to help the planner and to fail fast if future edits introduce writes.
Do ACTIONs support such attributes in this engine? If yes, I can update the declaration accordingly.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
internal/migrations/020-digest-actions.sql(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-20T12:22:14.250Z
Learnt from: outerlook
PR: trufnetwork/node#1113
File: internal/migrations/020-digest-init.sql:3-11
Timestamp: 2025-08-20T12:22:14.250Z
Learning: In the trufnetwork/node repository, for the digest_config table in internal/migrations/020-digest-init.sql, the maintainer prefers to leave the table without initial seed rows, allowing the extension to handle the empty state case at runtime rather than seeding default configuration values in the migration.
Applied to files:
internal/migrations/020-digest-actions.sql
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: acceptance-test
🔇 Additional comments (1)
internal/migrations/020-digest-actions.sql (1)
4-8: Change aligns with PR goal to fix broken CI (visibility/syntax). LGTMAssuming the engine expects an explicit visibility for actions callable by the scheduler, adding PUBLIC should address the invalid syntax/broken CI from #1115. No functional logic changed.
| -- No-op, deterministic, read-only; used to verify wiring and scheduler calls | ||
|
|
||
| CREATE OR REPLACE ACTION auto_digest() RETURNS TABLE( | ||
| CREATE OR REPLACE ACTION auto_digest() PUBLIC RETURNS TABLE( |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Confirm placement/semantics of PUBLIC in ACTION signature
Good move to add visibility, but please double-check the grammar/order for your SQL engine. Some dialects place PUBLIC before ACTION or after RETURNS. Ensure this exact placement auto_digest() PUBLIC RETURNS TABLE(...) is valid.
Run this script to compare with other actions in the repo and validate ordering/consistency:
🏁 Script executed:
#!/bin/bash
# Find all ACTION declarations and show surrounding context to compare placement of visibility modifiers
rg -nP -C2 '(?i)^\s*create\s+or\s+replace\s+action\s+[a-zA-Z0-9_]+\s*\([^)]*\)\s*(public)?\s*returns\s+table' --type-add 'sql:*.sql' --type sql
# Also show any variants that put PUBLIC elsewhere (before ACTION or after RETURNS)
rg -nP -C2 '(?i)create\s+or\s+replace\s+(public\s+)?action|returns\s+table\s+public' --type sqlLength of output: 43543
Include VIEW in the auto_digest signature
The repo consistently uses PUBLIC VIEW RETURNS TABLE for table-returning actions (e.g. get_database_size). In internal/migrations/020-digest-actions.sql you have:
CREATE OR REPLACE ACTION auto_digest() PUBLIC RETURNS TABLE(To match the grammar and other declarations, update it to:
CREATE OR REPLACE ACTION auto_digest() PUBLIC VIEW RETURNS TABLE(• File: internal/migrations/020-digest-actions.sql, line 4
🤖 Prompt for AI Agents
In internal/migrations/020-digest-actions.sql around line 4, the ACTION
signature is missing the VIEW keyword; update the declaration to include VIEW so
it reads as "CREATE OR REPLACE ACTION auto_digest() PUBLIC VIEW RETURNS
TABLE(...)" to match the repository convention and correct grammar.
|
I just see this PR, the fix I include in https://github.com/trufnetwork/node/pull/1118/files#diff-23c216da563b1ef4f8ce0d1a5a6ddbd288e9d817f4ed64f03da208943c3cb143 I haven't test |
|
Also fixed here: |
Description
Related Problem
How Has This Been Tested?
Summary by CodeRabbit