PipelineStageSpec/Registry, PipelineGraph (Kahn topo sort), PipelineExecutionPlan, PipelineParityValidator — 26/26 tests pass. Integration step 1947: Python→Rust→Go→Haskell→TypeScript pipeline verified. Metrics: 7 whetstone calls, 8566 tokens. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
57 lines
1.6 KiB
C++
57 lines
1.6 KiB
C++
#pragma once
|
|
#include "PipelineGraph.h"
|
|
#include "PipelineStageSpec.h"
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace whetstone {
|
|
|
|
class PipelineExecutionPlan {
|
|
public:
|
|
void addStage(const PipelineStageSpec& spec) {
|
|
registry_.registerStage(spec);
|
|
graph_.addStage(spec.stageId);
|
|
}
|
|
|
|
void addEdge(const std::string& fromId, const std::string& toId) {
|
|
graph_.addEdge(fromId, toId);
|
|
}
|
|
|
|
// Stages in topological order.
|
|
std::vector<PipelineStageSpec> executionOrder() const {
|
|
std::vector<PipelineStageSpec> result;
|
|
for (const auto& id : graph_.topologicalOrder())
|
|
result.push_back(registry_.getStage(id));
|
|
return result;
|
|
}
|
|
|
|
// Language per stage in execution order.
|
|
std::vector<std::string> languageSequence() const {
|
|
std::vector<std::string> langs;
|
|
for (const auto& spec : executionOrder())
|
|
langs.push_back(spec.language);
|
|
return langs;
|
|
}
|
|
|
|
bool isValid() const {
|
|
return !graph_.hasCycle() && graph_.stageCount() > 0;
|
|
}
|
|
|
|
// Pairs "langA->langB" wherever adjacent stages in execution order differ in language.
|
|
std::vector<std::string> boundaryPairs() const {
|
|
auto order = executionOrder();
|
|
std::vector<std::string> pairs;
|
|
for (std::size_t i = 1; i < order.size(); ++i) {
|
|
if (order[i-1].language != order[i].language)
|
|
pairs.push_back(order[i-1].language + "->" + order[i].language);
|
|
}
|
|
return pairs;
|
|
}
|
|
|
|
private:
|
|
PipelineStageRegistry registry_;
|
|
PipelineGraph graph_;
|
|
};
|
|
|
|
} // namespace whetstone
|