update function, view, high tests, and readme#28
Conversation
📝 WalkthroughWalkthroughThis pull request updates health check threshold labels from 100GB to 50GB across multiple SQL modules and documentation, adds corresponding pgTAP tests, and enhances the README with testing coverage details and PostgreSQL compatibility information. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment Tip CodeRabbit can generate a title for your PR based on the changes.Add |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@testing/pgTAP/03_high_tests.sql`:
- Around line 175-182: The tests use tautological assertions (count(*) >= 0)
that always pass; update the two assertions to assert the check exists by
verifying count(*) > 0 or using EXISTS for pg_firstAid() and v_pgfirstaid where
check_name = 'Tables larger than 50GB' so they fail if that check/view row is
missing; target the tests calling the pg_firstAid() function and the
v_pgfirstaid view and replace the predicate accordingly to detect name
regressions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b72f0829-6c98-46e6-91c5-20c62afe6849
📒 Files selected for processing (5)
README.mdpgFirstAid.sqltesting/pgTAP/03_high_tests.sqlview_pgFirstAid.sqlview_pgFirstAid_managed.sql
| SELECT ok( | ||
| (SELECT count(*) >= 0 FROM pg_firstAid() WHERE check_name = 'Tables larger than 50GB'), | ||
| 'Function executes Tables larger than 50GB check' | ||
| ); | ||
| SELECT ok( | ||
| (SELECT count(*) >= 0 FROM v_pgfirstaid WHERE check_name = 'Tables larger than 50GB'), | ||
| 'View executes Tables larger than 50GB check' | ||
| ); |
There was a problem hiding this comment.
New assertions are tautologies and won’t detect name regressions.
count(*) >= 0 always passes, even if 'Tables larger than 50GB' is absent. For this rename-focused PR, these tests should validate definition presence directly.
🔧 Suggested test fix
-SELECT ok(
- (SELECT count(*) >= 0 FROM pg_firstAid() WHERE check_name = 'Tables larger than 50GB'),
- 'Function executes Tables larger than 50GB check'
-);
-SELECT ok(
- (SELECT count(*) >= 0 FROM v_pgfirstaid WHERE check_name = 'Tables larger than 50GB'),
- 'View executes Tables larger than 50GB check'
-);
+SELECT ok(
+ position('Tables larger than 50GB' in pg_get_functiondef('pg_firstaid()'::regprocedure)) > 0,
+ 'Function definition includes Tables larger than 50GB check'
+);
+SELECT ok(
+ position('Tables larger than 50GB' in pg_get_viewdef('v_pgfirstaid'::regclass, true)) > 0,
+ 'View definition includes Tables larger than 50GB check'
+);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| SELECT ok( | |
| (SELECT count(*) >= 0 FROM pg_firstAid() WHERE check_name = 'Tables larger than 50GB'), | |
| 'Function executes Tables larger than 50GB check' | |
| ); | |
| SELECT ok( | |
| (SELECT count(*) >= 0 FROM v_pgfirstaid WHERE check_name = 'Tables larger than 50GB'), | |
| 'View executes Tables larger than 50GB check' | |
| ); | |
| SELECT ok( | |
| position('Tables larger than 50GB' in pg_get_functiondef('pg_firstaid()'::regprocedure)) > 0, | |
| 'Function definition includes Tables larger than 50GB check' | |
| ); | |
| SELECT ok( | |
| position('Tables larger than 50GB' in pg_get_viewdef('v_pgfirstaid'::regclass, true)) > 0, | |
| 'View definition includes Tables larger than 50GB check' | |
| ); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@testing/pgTAP/03_high_tests.sql` around lines 175 - 182, The tests use
tautological assertions (count(*) >= 0) that always pass; update the two
assertions to assert the check exists by verifying count(*) > 0 or using EXISTS
for pg_firstAid() and v_pgfirstaid where check_name = 'Tables larger than 50GB'
so they fail if that check/view row is missing; target the tests calling the
pg_firstAid() function and the v_pgfirstaid view and replace the predicate
accordingly to detect name regressions.
Pull Request Summary
This PR cleans up the gap between the recent feature work and the docs. The README now reflects the current testing and validation setup, including pgTAP coverage, integration checks, and the reusable managed database validation workflow.
It also fixes a naming mismatch in the table-size health checks so the SQL, views, docs, and pgTAP coverage all agree again. In short: better docs, more consistent output, and one less quiet drift point between code and tests.
Type of Change
Related Issues
Testing
PostgreSQL Version Compatibility
Has this code been tested against the following PostgreSQL versions?
Testing notes:
Managed Database Platforms
Has this code been deployed and tested on the following platforms?
Platform-specific notes:
Additional Notes
Summary by CodeRabbit
Release Notes
Documentation
Bug Fixes
Tests