experiment(confidence-engine): expose reconstruction provider seam
This commit is contained in:
@@ -53,7 +53,7 @@ function readScenarioInput(argv) {
|
||||
return { scenario: argv.slice(startIdx).join(" ") };
|
||||
}
|
||||
|
||||
async function runStartCaseExperiment(scenarioInput, experimentInstruction) {
|
||||
async function runStartCaseExperiment(scenarioInput, experimentInstruction, options = {}) {
|
||||
// ── Experiment seam bridge: supply instruction to production path ──
|
||||
const hadEnvVar = process.env.RECONSTRUCTION_EXPERIMENT_INSTRUCTION != null;
|
||||
const previousEnvValue = process.env.RECONSTRUCTION_EXPERIMENT_INSTRUCTION;
|
||||
@@ -61,10 +61,10 @@ async function runStartCaseExperiment(scenarioInput, experimentInstruction) {
|
||||
process.env.RECONSTRUCTION_EXPERIMENT_INSTRUCTION = experimentInstruction;
|
||||
}
|
||||
|
||||
let startCase;
|
||||
let startCase = options.startCase;
|
||||
const isMock = process.env.START_CASE_EXPERIMENT_HELPER_MOCK === "1";
|
||||
|
||||
if (isMock) {
|
||||
if (!startCase && isMock) {
|
||||
// Deterministic mode: skip environment checks and use inline test double.
|
||||
startCase = async (body) => {
|
||||
// Deterministic inline test double — no live model calls.
|
||||
@@ -81,7 +81,7 @@ async function runStartCaseExperiment(scenarioInput, experimentInstruction) {
|
||||
diagnostics: { validationStatus: "mock", modelName: "inline-test-double", graphReferenceValidation: { valid: true, errors: [] } },
|
||||
};
|
||||
};
|
||||
} else {
|
||||
} else if (!startCase) {
|
||||
const baseUrl = assertRequiredEnv("OLLAMA_BASE_URL");
|
||||
const model = assertRequiredEnv("OLLAMA_MODEL");
|
||||
|
||||
@@ -99,7 +99,10 @@ async function runStartCaseExperiment(scenarioInput, experimentInstruction) {
|
||||
let result;
|
||||
const endToEndStartedAt = Date.now();
|
||||
try {
|
||||
result = await startCase(scenarioInput);
|
||||
result = await startCase(scenarioInput, {
|
||||
reconstructionProvider: options.reconstructionProvider,
|
||||
reconstructionModelName: options.reconstructionModelName,
|
||||
});
|
||||
} finally {
|
||||
// Clean up experiment env var after execution regardless of outcome
|
||||
if (experimentInstruction && !hadEnvVar) {
|
||||
@@ -132,7 +135,8 @@ async function runStartCaseExperiment(scenarioInput, experimentInstruction) {
|
||||
};
|
||||
}
|
||||
|
||||
(async () => {
|
||||
if (require.main === module) {
|
||||
(async () => {
|
||||
// Import-only mode: prove real production seam without invoking startCase.
|
||||
// Used only for deterministic apparatus verification of the import path.
|
||||
if (process.env.START_CASE_EXPERIMENT_HELPER_IMPORT_ONLY === "1") {
|
||||
@@ -183,4 +187,9 @@ async function runStartCaseExperiment(scenarioInput, experimentInstruction) {
|
||||
console.log(JSON.stringify(failure));
|
||||
process.exit(1);
|
||||
}
|
||||
})();
|
||||
})();
|
||||
}
|
||||
|
||||
module.exports = { runStartCaseExperiment };
|
||||
|
||||
module.exports = { runStartCaseExperiment };
|
||||
|
||||
Reference in New Issue
Block a user