Skip to content

Commit a3bd3f5

Browse files
rustyconoverclaude
andcommitted
test: write the planned_days plan record only for filtered calls
Unfiltered scan-branch calls (vgi_table_branches() in concurrently run tests sharing VGI_TEST_BRANCH_DIR) overwrote planned_days_last_plan.json with received_filters: false just before scan_planning_filtered.test read it. Match the reference fixture: record only when the call carried predicates, always with received_filters: true. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 41b5050 commit a3bd3f5

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

‎example-worker/catalog_def.cpp‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,20 +188,24 @@ vgi::CatalogTable planned_days_table(std::string name, std::string comment) {
188188
}
189189

190190
// planned_days: the worker prunes the day files with the query's predicates.
191-
// It records what it saw in planned_days_last_plan.json so a test can assert
192-
// that the predicates arrived.
191+
// A filtered call records what it saw in planned_days_last_plan.json so a test
192+
// can assert that the predicates arrived.
193193
std::vector<vgi::CatalogBranch> plan_planned_days(const vgi::ScanPlanningRequest& request) {
194194
std::vector<std::string> days;
195195
for (const auto& day : kPlannedDays) {
196196
if (!request.pushdown_filters ||
197197
request.pushdown_filters->may_match(planned_day_stats(day)))
198198
days.push_back(day);
199199
}
200-
std::ofstream out(branch_path("planned_days_last_plan.json"), std::ios::trunc);
201-
out << "{\"received_filters\": " << (request.pushdown_filters ? "true" : "false")
202-
<< ", \"days\": [";
203-
for (size_t i = 0; i < days.size(); ++i) out << (i ? ", " : "") << '"' << days[i] << '"';
204-
out << "]}";
200+
// Only a call that carried predicates writes the record: unfiltered calls
201+
// (vgi_table_branches() in concurrently running tests) would otherwise
202+
// overwrite it while scan_planning_filtered.test is about to read it.
203+
if (request.pushdown_filters) {
204+
std::ofstream out(branch_path("planned_days_last_plan.json"), std::ios::trunc);
205+
out << "{\"received_filters\": true, \"days\": [";
206+
for (size_t i = 0; i < days.size(); ++i) out << (i ? ", " : "") << '"' << days[i] << '"';
207+
out << "]}";
208+
}
205209
if (days.empty()) return {};
206210
std::vector<std::string> files;
207211
for (const auto& day : days) files.push_back(planned_day_file(day));

‎tests/protocol_routing_test.cpp‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,8 @@ TEST_CASE("protocol 3.2 filtered scan planning", "[catalog][scan-planning][stdio
462462
CHECK(vgi::wire::get_string(all[0], "function_name") == "read_parquet");
463463
CHECK(vgi::wire::get_optional_int64(all[0], "row_count") == 50);
464464
CHECK(vgi::wire::column(all[0], "column_statistics")->IsNull(0));
465-
CHECK(last_plan() == nlohmann::json::parse(R"({"received_filters": false, "days": )"
466-
R"(["2026-10-01", "2026-10-02", "2026-10-03", )"
467-
R"("2026-10-04", "2026-10-05"]})"));
465+
// An unfiltered call writes no plan record.
466+
CHECK_FALSE(std::filesystem::exists(dir / "planned_days_last_plan.json"));
468467

469468
// With them, the hook prunes the days before 2026-10-03.
470469
auto pruned = branches("planned_days", filters);

0 commit comments

Comments
 (0)