Implement Seriatim subprocess adapter

This commit is contained in:
2026-05-03 22:01:07 -05:00
parent 7aedca2ca1
commit a155af700a
4 changed files with 736 additions and 2 deletions

View File

@@ -18,7 +18,15 @@ func (n *NoopRunner) Run(ctx context.Context, req MergeRequest) (MergeResult, er
if err := materializePlaceholders(req); err != nil {
return MergeResult{}, err
}
return MergeResult{MergedTranscriptPath: req.OutputMergedTranscriptPath, Metadata: map[string]any{"placeholder": true}}, nil
return MergeResult{
MergedTranscriptPath: req.OutputMergedTranscriptPath,
ReportPath: req.ReportPath,
StdoutLogPath: req.StdoutLogPath,
StderrLogPath: req.StderrLogPath,
GeneratedConfigPath: req.GeneratedConfigPath,
InvokedBinary: "noop",
Metadata: map[string]any{"placeholder": true},
}, nil
}
// FakeRunner captures merge requests and returns deterministic responses.
@@ -44,6 +52,21 @@ func (f *FakeRunner) Run(ctx context.Context, req MergeRequest) (MergeResult, er
if res.MergedTranscriptPath == "" {
res.MergedTranscriptPath = req.OutputMergedTranscriptPath
}
if res.ReportPath == "" {
res.ReportPath = req.ReportPath
}
if res.StdoutLogPath == "" {
res.StdoutLogPath = req.StdoutLogPath
}
if res.StderrLogPath == "" {
res.StderrLogPath = req.StderrLogPath
}
if res.GeneratedConfigPath == "" {
res.GeneratedConfigPath = req.GeneratedConfigPath
}
if res.InvokedBinary == "" {
res.InvokedBinary = "fake"
}
if res.Metadata == nil {
res.Metadata = map[string]any{"fake": true}
}
@@ -72,5 +95,10 @@ func materializePlaceholders(req MergeRequest) error {
return fmt.Errorf("write stderr log %q: %w", req.StderrLogPath, err)
}
}
if req.ReportPath != "" {
if err := subprocess.WriteFileAtomic(req.ReportPath, []byte(`{"schema":"seriatim.report.v1","placeholder":true}`), 0o644); err != nil {
return fmt.Errorf("write report %q: %w", req.ReportPath, err)
}
}
return nil
}