Skip to content

refactor(planner): split monolithic planner_test.go into focused test…#23

Merged
bella-247 merged 1 commit into
devfrom
refactor/planner-tests
Jul 4, 2026
Merged

refactor(planner): split monolithic planner_test.go into focused test…#23
bella-247 merged 1 commit into
devfrom
refactor/planner-tests

Conversation

@bella-247

Copy link
Copy Markdown
Owner

This pull request adds comprehensive unit and integration tests for the planner package, focusing on the correctness and robustness of the BuildPlan function for database table generation order, especially in the presence of foreign key cycles, nullable constraints, and real-world schemas.

Cycle handling and edge cases:

  • Adds tests to cycles_test.go that verify BuildPlan correctly handles various cycle scenarios, including cycles with nullable and non-nullable foreign keys, self-referencing tables, composite foreign keys, and mixed acyclic/cyclic graphs. These tests ensure that cycles with nullable breakpoints are deferred properly, and errors are raised when cycles are unresolvable.

Integration and realistic schema coverage:

  • Introduces integration tests in integration_test.go that check row count propagation, deferred foreign key metadata, and the ability to generate a valid plan for a realistic ecommerce schema with multiple tables and dependencies.
  • Verifies that all tables are present in the plan, dependency order is respected, and deferred columns are handled for self-referencing and cyclic cases in the ecommerce schema.

Test coverage and helper utilities:

  • Provides helper functions for extracting table names from the plan and constructing realistic schema models, improving test readability and maintainability.

These additions significantly increase test coverage for complex schema scenarios and help ensure the correctness of the table generation planning logic.… files

Extract test suites into dedicated files:

  • cycles_test.go — Tarjan's SCC and cycle resolution tests
  • integration_test.go — full pipeline integration tests
  • planner_test.go now contains only core planner tests

What does this PR do?

Why is it needed?

Closes #

How was it tested?

Does it change any existing behavior?

Checklist

  • Tests added or updated
  • make test passes (go test ./... -race)
  • make lint passes (golangci-lint run ./...)
  • No cross-stage imports (parser doesn't import generator, etc.)
  • No time.Now() or unseeded randomness in the generation pipeline
  • Error messages follow the format in SRS §12.2
  • Exported functions have doc comments
  • Golden files updated if output format changed (make test-golden UPDATE=true)

… files

Extract test suites into dedicated files:
- cycles_test.go — Tarjan's SCC and cycle resolution tests
- integration_test.go — full pipeline integration tests
- planner_test.go now contains only core planner tests
@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: fd440a97-3788-42a0-8ce7-3b69a7c36431

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

@bella-247 bella-247 merged commit 79bf4b0 into dev Jul 4, 2026
1 check passed
@bella-247 bella-247 deleted the refactor/planner-tests branch July 4, 2026 13:23
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