Skip to content

update function, view, high tests, and readme#28

Merged
randoneering merged 1 commit intomainfrom
bugfix/mismatch_naming
Mar 13, 2026
Merged

update function, view, high tests, and readme#28
randoneering merged 1 commit intomainfrom
bugfix/mismatch_naming

Conversation

@randoneering
Copy link
Owner

@randoneering randoneering commented Mar 13, 2026

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

  • New health check
  • Bug fix
  • Performance improvement
  • Documentation update
  • Refactoring/code cleanup
  • Breaking change

Related Issues

  • Fixes #
  • Related to #
  • Closes #

Testing

PostgreSQL Version Compatibility

Has this code been tested against the following PostgreSQL versions?

  • PostgreSQL 15
  • PostgreSQL 16
  • PostgreSQL 17
  • PostgreSQL 18

Testing notes:

Managed Database Platforms

Has this code been deployed and tested on the following platforms?

  • Amazon RDS for PostgreSQL
  • Google Cloud SQL for PostgreSQL
  • Azure Database for PostgreSQL
  • Self-managed PostgreSQL

Platform-specific notes:


Additional Notes


Summary by CodeRabbit

Release Notes

  • Documentation

    • Updated PostgreSQL compatibility information with actively validated versions and specific database providers.
    • Added testing coverage details to performance impact section.
  • Bug Fixes

    • Updated large table health check threshold from 100GB to 50GB.
  • Tests

    • Added new test cases for 50GB table size detection.

@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

📝 Walkthrough

Walkthrough

This 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

Cohort / File(s) Summary
Documentation
README.md
Added Testing subsection detailing pgTAP assertions, integration tests, and coverage validation. Updated PostgreSQL compatibility to specify version focus (15–18) and enumerate specific managed database providers (RDS, Aurora, Azure DB, GCP Cloud SQL).
Health Check Functions and Views
pgFirstAid.sql, view_pgFirstAid.sql, view_pgFirstAid_managed.sql
Changed the check_name label from "Tables larger than 100GB" to "Tables larger than 50GB" across the main function and both view definitions. Threshold values and filtering logic remain unchanged.
Test Suite
testing/pgTAP/03_high_tests.sql
Updated test plan count from 42 to 44 and added two new test blocks validating the "Tables larger than 50GB" check via both pg_firstaid() function and v_pgfirstaid view, following existing test patterns.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A fifty feels just right to me,
No hundred here—let's set them free!
With tests aligned and docs so bright,
The thresholds now dance in the light!
PostgreSQL hops, from past to present,
This update's quite pleasant! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is generic and vague, using non-specific phrasing ('update function, view, high tests, and readme') that doesn't convey the main purpose: fixing a naming mismatch and updating documentation. Consider a more descriptive title like 'Fix table-size health check naming mismatch (100GB → 50GB)' that clearly indicates the primary change and bug fix.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description follows the template structure with most required sections completed, including Type of Change, Testing checkboxes for all PostgreSQL versions and platforms. However, Testing notes and Platform-specific notes sections are empty.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix/mismatch_naming
📝 Coding Plan
  • Generate coding plan for human review comments

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

Tip

CodeRabbit can generate a title for your PR based on the changes.

Add @coderabbitai placeholder anywhere in the title of your PR and CodeRabbit will replace it with a title based on the changes in the PR. You can change the placeholder by changing the reviews.auto_title_placeholder setting.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between e85c65b and 038d204.

📒 Files selected for processing (5)
  • README.md
  • pgFirstAid.sql
  • testing/pgTAP/03_high_tests.sql
  • view_pgFirstAid.sql
  • view_pgFirstAid_managed.sql

Comment on lines +175 to +182
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'
);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

Suggested change
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.

@randoneering randoneering merged commit 5e77b75 into main Mar 13, 2026
5 checks passed
@randoneering randoneering deleted the bugfix/mismatch_naming branch March 13, 2026 01:29
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.

1 participant