From 24b8aa9c65b704fd852d5b728ae9eac3c81e0cac Mon Sep 17 00:00:00 2001 From: Ram Sreerangam Date: Wed, 28 Jan 2026 20:53:49 -0800 Subject: [PATCH 1/3] Update schema-review-curl.yml Fixed issue with multi-line strings in YAML. --- .github/workflows/schema-review-curl.yml | 26 ++++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/schema-review-curl.yml b/.github/workflows/schema-review-curl.yml index ef807b8..3605408 100644 --- a/.github/workflows/schema-review-curl.yml +++ b/.github/workflows/schema-review-curl.yml @@ -68,16 +68,17 @@ jobs: SQL_CONTENT=$(cat "$sql_file") # Build the review prompt - PROMPT="You are an expert PostgreSQL schema reviewer. + cat > prompt.txt << 'PROMPT_EOF' +You are an expert PostgreSQL schema reviewer. Review this SQL file against ISV Schema Review Guidelines: -**File:** $sql_file +**File:** FILENAME_PLACEHOLDER **SQL Content:** -\`\`\`sql -$SQL_CONTENT -\`\`\` +```sql +SQL_CONTENT_PLACEHOLDER +``` **Check for:** 1. Primary key must start with tenant_id (or partition_id, tenant_id if partitioned) @@ -93,13 +94,13 @@ $SQL_CONTENT **Output Format:** Generate a detailed markdown report with: -## 📄 File: \`$sql_file\` +## 📄 File: `FILENAME_PLACEHOLDER` ### ❌ Critical Issues (count) For each critical issue: - **Line X:** Description -- **Current:** \`problematic code\` -- **Fix:** \`corrected code\` +- **Current:** `problematic code` +- **Fix:** `corrected code` - **Why:** Explanation ### ⚠️ Warnings (count) @@ -113,7 +114,14 @@ List checks that passed ### Summary - Critical: X 🔴 - Warnings: X 🟡 -- Status: BLOCKED/NEEDS_REVIEW/APPROVED" +- Status: BLOCKED/NEEDS_REVIEW/APPROVED +PROMPT_EOF + + # Replace placeholders + sed -i "s|FILENAME_PLACEHOLDER|$sql_file|g" prompt.txt + sed -i "s|SQL_CONTENT_PLACEHOLDER|$(cat "$sql_file" | sed 's/|/\\|/g')|g" prompt.txt + + PROMPT=$(cat prompt.txt) # Escape the prompt for JSON PROMPT_JSON=$(echo "$PROMPT" | jq -Rs .) From abb4b5c479ceb51233a47c8511bc943cae9da537 Mon Sep 17 00:00:00 2001 From: Ram Sreerangam Date: Wed, 28 Jan 2026 20:57:28 -0800 Subject: [PATCH 2/3] Update schema-review-curl.yml --- .github/workflows/schema-review-curl.yml | 68 +++++------------------- 1 file changed, 14 insertions(+), 54 deletions(-) diff --git a/.github/workflows/schema-review-curl.yml b/.github/workflows/schema-review-curl.yml index 3605408..829a0db 100644 --- a/.github/workflows/schema-review-curl.yml +++ b/.github/workflows/schema-review-curl.yml @@ -67,61 +67,22 @@ jobs: # Read the SQL file content SQL_CONTENT=$(cat "$sql_file") - # Build the review prompt - cat > prompt.txt << 'PROMPT_EOF' -You are an expert PostgreSQL schema reviewer. + # Build a simple review prompt + PROMPT="You are an expert PostgreSQL schema reviewer. Review this SQL file: $sql_file -Review this SQL file against ISV Schema Review Guidelines: +SQL Content: +$SQL_CONTENT -**File:** FILENAME_PLACEHOLDER - -**SQL Content:** -```sql -SQL_CONTENT_PLACEHOLDER -``` - -**Check for:** -1. Primary key must start with tenant_id (or partition_id, tenant_id if partitioned) -2. Use TIMESTAMPTZ for all timestamp fields (not TIMESTAMP) -3. Tables must have 'created' and 'last_modified' TIMESTAMPTZ fields -4. No foreign key constraints (application handles referential integrity) -5. Use TEXT instead of VARCHAR or CHAR +Check for: +1. Primary key must start with tenant_id +2. Use TIMESTAMPTZ for timestamps (not TIMESTAMP) +3. Tables must have created and last_modified TIMESTAMPTZ fields +4. No foreign key constraints +5. Use TEXT instead of VARCHAR 6. No LISTEN/NOTIFY usage -7. Meaningful table and column names -8. Comments on tables and columns -9. Clustering index specified - -**Output Format:** -Generate a detailed markdown report with: - -## 📄 File: `FILENAME_PLACEHOLDER` - -### ❌ Critical Issues (count) -For each critical issue: -- **Line X:** Description -- **Current:** `problematic code` -- **Fix:** `corrected code` -- **Why:** Explanation +7. Meaningful names and comments -### ⚠️ Warnings (count) -For each warning: -- **Line X:** Description -- **Suggestion:** Recommendation - -### ✅ Passed Checks (count) -List checks that passed - -### Summary -- Critical: X 🔴 -- Warnings: X 🟡 -- Status: BLOCKED/NEEDS_REVIEW/APPROVED -PROMPT_EOF - - # Replace placeholders - sed -i "s|FILENAME_PLACEHOLDER|$sql_file|g" prompt.txt - sed -i "s|SQL_CONTENT_PLACEHOLDER|$(cat "$sql_file" | sed 's/|/\\|/g')|g" prompt.txt - - PROMPT=$(cat prompt.txt) +Provide a detailed markdown report with critical issues, warnings, and passed checks." # Escape the prompt for JSON PROMPT_JSON=$(echo "$PROMPT" | jq -Rs .) @@ -199,7 +160,7 @@ EOF echo "📝 Generating combined report..." # Start the report - cat > combined_review.md << 'HEADER' + cat > combined_review.md << HEADER ## 🤖 Bob AI Schema Review **PR:** #${{ github.event.pull_request.number }} @@ -249,7 +210,7 @@ SUMMARY fi # Add footer - cat >> combined_review.md << 'FOOTER' + cat >> combined_review.md << FOOTER --- @@ -341,4 +302,3 @@ FOOTER fi echo "" -# Made with Bob From 65d7acd598fd20a92da0baefc69f44cf47222543 Mon Sep 17 00:00:00 2001 From: Ram Sreerangam Date: Wed, 28 Jan 2026 20:59:48 -0800 Subject: [PATCH 3/3] Update schema-review-curl.yml --- .github/workflows/schema-review-curl.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/schema-review-curl.yml b/.github/workflows/schema-review-curl.yml index 829a0db..22dfbd5 100644 --- a/.github/workflows/schema-review-curl.yml +++ b/.github/workflows/schema-review-curl.yml @@ -67,11 +67,9 @@ jobs: # Read the SQL file content SQL_CONTENT=$(cat "$sql_file") - # Build a simple review prompt - PROMPT="You are an expert PostgreSQL schema reviewer. Review this SQL file: $sql_file - -SQL Content: -$SQL_CONTENT + # Build review prompt using a temp file to avoid YAML issues + cat > prompt_temp.txt <<'EOF' +You are an expert PostgreSQL schema reviewer. Review this SQL file. Check for: 1. Primary key must start with tenant_id @@ -82,10 +80,16 @@ Check for: 6. No LISTEN/NOTIFY usage 7. Meaningful names and comments -Provide a detailed markdown report with critical issues, warnings, and passed checks." +Provide a detailed markdown report with critical issues, warnings, and passed checks. + +SQL Content: +EOF + + # Append SQL content to prompt + cat "$sql_file" >> prompt_temp.txt # Escape the prompt for JSON - PROMPT_JSON=$(echo "$PROMPT" | jq -Rs .) + PROMPT_JSON=$(cat prompt_temp.txt | jq -Rs .) # Call Bob AI API echo "🔄 Calling Bob AI API..."