Fix cross-project target grounding and add handoff note

This commit is contained in:
Bill
2026-03-08 10:53:30 -06:00
parent 9f9d9590c3
commit a09fc55325
6 changed files with 670 additions and 22 deletions

View File

@@ -1,4 +1,4 @@
// Step 615: whetstone_generate_taskitems MCP Tool (12 tests)
// Step 615: whetstone_generate_taskitems MCP Tool (13 tests)
#include "MCPServer.h"
@@ -199,6 +199,37 @@ void test_rejects_invalid_requirement_kind() {
PASS();
}
void test_cross_project_repo_signal_grounds_target_files() {
TEST(cross_project_repo_signal_grounds_target_files);
MCPServer mcp;
json reqs = json::array({{
{"requirementId", "goal-constcad"},
{"kind", "goal"},
{"normalizedText", "ConstCAD ecosystem integration across cad_orchestrator, hivemind, gleaner, and constcad"},
{"anchor", "goals"},
{"sourceLine", 1},
{"ambiguous", false}
}});
json out = callTool(mcp, "whetstone_generate_taskitems",
{{"normalizedRequirements", reqs}, {"strictExecutionContract", true}});
CHECK(out.value("success", false), "success should be true");
const auto& files = out["tasks"][0]["executionContract"]["targetFiles"];
bool hasExternal = false;
for (const auto& f : files) {
if (!f.is_string()) continue;
std::string v = f.get<std::string>();
if (v.rfind("cad_orchestrator/", 0) == 0 ||
v.rfind("hivemind/", 0) == 0 ||
v.rfind("gleaner/", 0) == 0 ||
v.rfind("constcad/", 0) == 0) {
hasExternal = true;
}
CHECK(v.rfind("editor/src/mcp/", 0) != 0, "should not fallback to editor/src/mcp internal defaults");
}
CHECK(hasExternal, "expected at least one cross-project target file");
PASS();
}
int main() {
std::cout << "Step 615: whetstone_generate_taskitems MCP Tool\n";
@@ -214,6 +245,7 @@ int main() {
test_normalized_requirements_must_be_array(); // 10
test_rejects_empty_normalized_requirements(); // 11
test_rejects_invalid_requirement_kind(); // 12
test_cross_project_repo_signal_grounds_target_files(); // 13
std::cout << "\nResults: " << passed << "/" << (passed + failed) << " passed\n";
return failed == 0 ? 0 : 1;