Enhance Slack integration and database backup workflows#21
Conversation
… database backups
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds startup Slack-status enqueueing at process boot and converts the GitHub Actions DB backup to a staging/production matrix that uploads environment-scoped dumps to gs://insights-db-backups/paperscout//; documentation and tests updated accordingly. ChangesStartup Status Notification
Database Backup Parallelization
Sequence Diagram(s)sequenceDiagram
participant Main as __main__
participant MQ as MessageQueue
participant Scout as scout
participant Slack as NOTIFICATION_CHANNEL
Main->>Scout: enqueue_startup_status(mq, state, paper_count_fn)
Scout->>Scout: format_status_message(...)
Scout->>MQ: enqueue(message)
MQ->>Slack: post formatted status
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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 @.github/workflows/db-backup.yml:
- Around line 27-33: The STAMP/DUMP/DEST naming is too coarse and can collide;
change how STAMP, DUMP and DEST are constructed so they include the environment
(matrix.environment) plus a unique run identifier (e.g. GITHUB_RUN_ID or
GITHUB_RUN_NUMBER) and/or a random suffix or use a safe temporary filename
generator for DUMP (instead of fixed /tmp/paperscout-${STAMP}.dump). Update the
DUMP variable (used by sudo -u postgres pg_dump) to use that unique temp name
and update DEST (gs://.../paperscout/${{ matrix.environment }}/...) to include
the same unique run id so uploaded object keys are unique per run and per
environment.
In `@deploy/SERVER_SETUP.md`:
- Around line 240-243: The pg_restore invocation shown for restoring paperscout
omits the --no-owner flag; update the pg_restore command (the line containing
"pg_restore -U paperscout -h localhost -d paperscout -c /tmp/paperscout.dump")
to include --no-owner (i.e., add the --no-owner option alongside -c) so the
restore mirrors the earlier examples and avoids ownership-related failures.
🪄 Autofix (Beta)
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
Run ID: de02fba6-fb94-4a0a-bb0b-5b320053720a
📒 Files selected for processing (9)
.github/workflows/db-backup.yml.gitignoreCHANGELOG.mdREADME.mddeploy/SERVER_SETUP.mddocs/onboarding.mdsrc/paperscout/__main__.pysrc/paperscout/scout.pytests/test_scout.py
… keys and improved restore instructions
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 @.github/workflows/db-backup.yml:
- Around line 26-34: The script may leave the temporary dump file if a command
fails because set -e skips the final rm; ensure cleanup always runs by
installing an EXIT trap immediately after defining DUMP that removes the file
(use a safe conditional that checks the DUMP variable exists before removing),
e.g. set the trap right after the DUMP assignment so any early failures invoke
the trap and remove the artifact; keep the existing rm -f "$DUMP" at the end
(harmless) and ensure the trap runs only once (or is idempotent).
🪄 Autofix (Beta)
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
Run ID: 4c8fa1ca-a950-420d-806d-eaf056e6ca64
📒 Files selected for processing (4)
.github/workflows/db-backup.ymlCHANGELOG.mdREADME.mddeploy/SERVER_SETUP.md
✅ Files skipped from review due to trivial changes (2)
- README.md
- deploy/SERVER_SETUP.md
…porary dump files on failure; update documentation for clarity on backup processes.
Summary by CodeRabbit
New Features
Documentation
Tests
Chores