Conversation
SkipTables and SkipFile were accepted from the CLI and stored on SchemaDiffCmd, but parseSkipList() was never implemented for SchemaDiffCmd, so skipTablesList remained nil and the table loop iterated every table regardless of the flag. Mirror the working repset-diff implementation: - add parseSkipList() to SchemaDiffCmd (splits SkipTables on commas, reads SkipFile line-by-line via bufio.Scanner) - call it in RunChecks(), before the cluster connection is opened, matching the position repset-diff uses - guard the SchemaTableDiff() table loop with the same skip check repset-diff uses, logging each skipped table unless --quiet is set - add a tablesSkipped counter and include tables_skipped in the taskstore completion record Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Unit tests (internal/consistency/diff/schema_diff_test.go) exercise parseSkipList directly: empty input, comma-separated flag, skip file, combined sources, missing file error, and single-entry edge case. Integration tests (tests/integration/schema_diff_test.go) verify the end-to-end behaviour against the live Docker cluster: a table with a data divergence is skipped when listed in --skip-tables (no diff file produced) and diffed normally when not listed; a parallel sub-test confirms the --skip-file path works the same way. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds table-skipping functionality to schema diff operations via a new Changes
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
tests/integration/schema_diff_test.go (1)
5-5: Minor: Copyright year inconsistency.This file has "2023 - 2025" while
schema_diff.goandschema_diff_test.gohave "2023 - 2026".🔧 Fix copyright year
-// Copyright (C) 2023 - 2025, pgEdge (https://www.pgedge.com/) +// Copyright (C) 2023 - 2026, pgEdge (https://www.pgedge.com/)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/integration/schema_diff_test.go` at line 5, Update the copyright header in tests/integration/schema_diff_test.go to match the other files by changing the year range string "2023 - 2025" to "2023 - 2026"; locate the top-of-file comment (the copyright line) and replace the year range so it is consistent with schema_diff.go and schema_diff_test.go.internal/consistency/diff/schema_diff.go (1)
112-133: Consider trimming whitespace and filtering empty entries at parse time.The current implementation defers whitespace trimming to the comparison at line 431 (
strings.TrimSpace(skip)). This works but:
- Empty lines from the skip file are added to the list (wasteful iterations)
- Entries like
"table1, table2"(space after comma) work due to runtime trim, but storing untrimmed values is inconsistent♻️ Optional: Normalize entries at parse time
func (c *SchemaDiffCmd) parseSkipList() error { var tables []string if c.SkipTables != "" { - tables = append(tables, strings.Split(c.SkipTables, ",")...) + for _, t := range strings.Split(c.SkipTables, ",") { + if trimmed := strings.TrimSpace(t); trimmed != "" { + tables = append(tables, trimmed) + } + } } if c.SkipFile != "" { file, err := os.Open(c.SkipFile) if err != nil { return fmt.Errorf("could not open skip file: %w", err) } defer file.Close() scanner := bufio.NewScanner(file) for scanner.Scan() { - tables = append(tables, scanner.Text()) + if line := strings.TrimSpace(scanner.Text()); line != "" { + tables = append(tables, line) + } } if err := scanner.Err(); err != nil { return fmt.Errorf("error reading skip file: %w", err) } } c.skipTablesList = tables return nil }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/consistency/diff/schema_diff.go` around lines 112 - 133, The parseSkipList function currently appends raw entries (from c.SkipTables via strings.Split and from file scanner.Text()) without trimming or filtering empties; update parseSkipList to normalize entries by trimming whitespace for each element produced by strings.Split(c.SkipTables, ",") and for each scanner.Text() line, skip any empty strings after trimming, and then assign the cleaned slice to c.skipTablesList so stored values are normalized and empty entries are excluded (refer to parseSkipList, SkipTables, SkipFile, skipTablesList, strings.Split and scanner).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@internal/consistency/diff/schema_diff.go`:
- Around line 112-133: The parseSkipList function currently appends raw entries
(from c.SkipTables via strings.Split and from file scanner.Text()) without
trimming or filtering empties; update parseSkipList to normalize entries by
trimming whitespace for each element produced by strings.Split(c.SkipTables,
",") and for each scanner.Text() line, skip any empty strings after trimming,
and then assign the cleaned slice to c.skipTablesList so stored values are
normalized and empty entries are excluded (refer to parseSkipList, SkipTables,
SkipFile, skipTablesList, strings.Split and scanner).
In `@tests/integration/schema_diff_test.go`:
- Line 5: Update the copyright header in tests/integration/schema_diff_test.go
to match the other files by changing the year range string "2023 - 2025" to
"2023 - 2026"; locate the top-of-file comment (the copyright line) and replace
the year range so it is consistent with schema_diff.go and schema_diff_test.go.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 602b86ca-503a-455a-b81d-77070a19ec62
📒 Files selected for processing (3)
internal/consistency/diff/schema_diff.gointernal/consistency/diff/schema_diff_test.gotests/integration/schema_diff_test.go
--skip-tablesand--skip-fileflags being silently ignored inschema-diff— theskipTablesListfield existed onSchemaDiffCmdbut was never populated becauseparseSkipList()was never implemented (unlikerepset-diff, which had a working implementation)parseSkipList()method to parse both comma-separated--skip-tablesvalues and line-delimited--skip-fileentriesSchemaTableDiff()table loop so matched tables are logged and skippedtables_skippedcount in the taskstore completion recordparseSkipList()covering: empty input, flag-only, file-only, combined, missing file error, and single-entry edge cases--skip-tablesand--skip-file