audit-tools 0.30.31 → 0.30.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/remediate/contractPipeline/artifactStore.d.ts +20 -0
- package/dist/remediate/contractPipeline/artifactStore.d.ts.map +1 -1
- package/dist/remediate/contractPipeline/artifactStore.js +39 -8
- package/dist/remediate/contractPipeline/artifactStore.js.map +1 -1
- package/dist/remediate/contractPipeline/derive.d.ts +27 -6
- package/dist/remediate/contractPipeline/derive.d.ts.map +1 -1
- package/dist/remediate/contractPipeline/derive.js +73 -25
- package/dist/remediate/contractPipeline/derive.js.map +1 -1
- package/dist/remediate/contractPipeline/testPlanCarry.d.ts +11 -0
- package/dist/remediate/contractPipeline/testPlanCarry.d.ts.map +1 -0
- package/dist/remediate/contractPipeline/testPlanCarry.js +69 -0
- package/dist/remediate/contractPipeline/testPlanCarry.js.map +1 -0
- package/dist/remediate/phases/close.d.ts.map +1 -1
- package/dist/remediate/phases/close.js +42 -2
- package/dist/remediate/phases/close.js.map +1 -1
- package/dist/remediate/state/closingActions.d.ts +1 -1
- package/dist/remediate/state/closingActions.d.ts.map +1 -1
- package/dist/remediate/state/closingActions.js +1 -0
- package/dist/remediate/state/closingActions.js.map +1 -1
- package/dist/remediate/state/types.d.ts +6 -6
- package/dist/remediate/steps/contractPipeline.d.ts +20 -10
- package/dist/remediate/steps/contractPipeline.d.ts.map +1 -1
- package/dist/remediate/steps/contractPipeline.js +89 -32
- package/dist/remediate/steps/contractPipeline.js.map +1 -1
- package/dist/remediate/steps/dispatch.d.ts +10 -1
- package/dist/remediate/steps/dispatch.d.ts.map +1 -1
- package/dist/remediate/steps/dispatch.js +39 -4
- package/dist/remediate/steps/dispatch.js.map +1 -1
- package/dist/remediate/steps/nextStep.d.ts.map +1 -1
- package/dist/remediate/steps/nextStep.js +1 -1
- package/dist/remediate/steps/nextStep.js.map +1 -1
- package/dist/remediate/steps/prompts.d.ts.map +1 -1
- package/dist/remediate/steps/prompts.js +2 -1
- package/dist/remediate/steps/prompts.js.map +1 -1
- package/dist/shared/types/contractPipeline/obligations.d.ts +9 -0
- package/dist/shared/types/contractPipeline/obligations.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -34,7 +34,27 @@ export declare function contractPipelineDir(artifactsDir: string): string;
|
|
|
34
34
|
* is a structured audit-findings report; absent for document/conversation runs.
|
|
35
35
|
*/
|
|
36
36
|
export declare function pathASeedFilePath(artifactsDir: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Canonical envelope path `<name>.json` — the TOOL-owned content-hash envelope.
|
|
39
|
+
* Host code never reads or writes this; every tool-side consumer reaches it
|
|
40
|
+
* through `readContractArtifact`.
|
|
41
|
+
*/
|
|
37
42
|
export declare function contractArtifactFilePath(artifactsDir: string, name: ContractPipelineArtifactName): string;
|
|
43
|
+
/**
|
|
44
|
+
* Host input path `<name>.input.json` — the plain payload the host writes (and
|
|
45
|
+
* reads for upstreams). The host never sees the tool's canonical envelope; the
|
|
46
|
+
* tool reads this at ingest, validates, and derives the canonical `<name>.json`
|
|
47
|
+
* envelope from it (D3). Keeping the two paths disjoint means the on-disk file
|
|
48
|
+
* the host wrote is never mutated into an envelope in place.
|
|
49
|
+
*/
|
|
50
|
+
export declare function contractInputFilePath(artifactsDir: string, name: ContractPipelineArtifactName): string;
|
|
51
|
+
/**
|
|
52
|
+
* Hash an artifact's semantic projection (order-independent, stamp-stripped).
|
|
53
|
+
* Exported so the ingest idempotency guard can compare a freshly-read host input
|
|
54
|
+
* against the canonical envelope without re-deriving a new (stamp-bearing)
|
|
55
|
+
* content hash on every next-step.
|
|
56
|
+
*/
|
|
57
|
+
export declare function payloadSemanticHash(name: ContractPipelineArtifactName, payload: unknown): string;
|
|
38
58
|
/**
|
|
39
59
|
* The semantic hash to compare a dependency against. ALWAYS recomputed from the
|
|
40
60
|
* envelope's current `payload` — never read from a stored header field — so an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifactStore.d.ts","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/artifactStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"artifactStore.d.ts","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/artifactStore.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,iBAAiB,mWAgBpB,CAAC;AAEX,MAAM,MAAM,4BAA4B,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAM9E,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,4BAA4B,EAAE,4BAA4B,EAAE,CAiC/F,CAAC;AAIF,MAAM,WAAW,gCAAgC;IAC/C,aAAa,EAAE,4BAA4B,CAAC;IAC5C,+EAA+E;IAC/E,YAAY,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,iBAAiB,EAAE,OAAO,CAAC,MAAM,CAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC,CAAC;IACzE,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,gCAAgC,CAO3C;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAMzE;AAED,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,4BAA4B,GACjC,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,4BAA4B,GACjC,MAAM,CAER;AAMD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,4BAA4B,EAClC,OAAO,EAAE,OAAO,GACf,MAAM,CAKR;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,gCAAgC,GACzC,MAAM,CAER;AAID,wEAAwE;AACxE,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,4BAA4B,EAClC,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,gCAAgC,CAAC,CAuB3C;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,gCAAgC,GAAG,IAAI,GAChD,OAAO,CAGT;AAED,0DAA0D;AAC1D,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,4BAA4B,GACjC,OAAO,CAAC,gCAAgC,GAAG,IAAI,CAAC,CAMlD;AAED,MAAM,WAAW,eAAe;IAC9B,uFAAuF;IACvF,KAAK,EAAE,4BAA4B,EAAE,CAAC;IACtC,gEAAgE;IAChE,MAAM,EAAE,4BAA4B,EAAE,CAAC;CACxC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,eAAe,CAAC,CAqD1B;AAED,8DAA8D;AAC9D,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,4BAA4B,GACjC,OAAO,CAET"}
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Typed read/write helpers for the contract-pipeline artifacts.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* Two distinct, non-overlapping path roles live under
|
|
5
|
+
* `<artifactsDir>/intake/contract/` (D3):
|
|
6
|
+
*
|
|
7
|
+
* - **Host input** `<name>.input.json` — the plain payload the host *writes*,
|
|
8
|
+
* and the plain payload a downstream host *reads* for its upstreams. The
|
|
9
|
+
* host's world is entirely plain `.input.json` files; it never sees or
|
|
10
|
+
* touches an envelope.
|
|
11
|
+
* - **Canonical envelope** `<name>.json` — the tool-owned content-hash envelope
|
|
12
|
+
* the tool derives at ingest. Purely internal bookkeeping (staleness DAG,
|
|
13
|
+
* dependency hashes); every tool-side read goes through `readContractArtifact`.
|
|
14
|
+
*
|
|
15
|
+
* No file is ever both: the host writes `<name>.input.json`, the tool owns the
|
|
16
|
+
* canonical `<name>.json` envelope. This keeps the host-authored INPUT path and
|
|
17
|
+
* the tool-derived envelope path cleanly separated (no in-place re-wrap).
|
|
7
18
|
*
|
|
8
19
|
* Independence from StateStore is intentional: these helpers operate on the
|
|
9
20
|
* contract-pipeline subdirectory only and do not touch the remediation
|
|
@@ -111,14 +122,34 @@ export function contractPipelineDir(artifactsDir) {
|
|
|
111
122
|
export function pathASeedFilePath(artifactsDir) {
|
|
112
123
|
return join(contractPipelineDir(artifactsDir), "path_a_seed.json");
|
|
113
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Canonical envelope path `<name>.json` — the TOOL-owned content-hash envelope.
|
|
127
|
+
* Host code never reads or writes this; every tool-side consumer reaches it
|
|
128
|
+
* through `readContractArtifact`.
|
|
129
|
+
*/
|
|
114
130
|
export function contractArtifactFilePath(artifactsDir, name) {
|
|
115
131
|
return join(contractPipelineDir(artifactsDir), `${name}.json`);
|
|
116
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Host input path `<name>.input.json` — the plain payload the host writes (and
|
|
135
|
+
* reads for upstreams). The host never sees the tool's canonical envelope; the
|
|
136
|
+
* tool reads this at ingest, validates, and derives the canonical `<name>.json`
|
|
137
|
+
* envelope from it (D3). Keeping the two paths disjoint means the on-disk file
|
|
138
|
+
* the host wrote is never mutated into an envelope in place.
|
|
139
|
+
*/
|
|
140
|
+
export function contractInputFilePath(artifactsDir, name) {
|
|
141
|
+
return join(contractPipelineDir(artifactsDir), `${name}.input.json`);
|
|
142
|
+
}
|
|
117
143
|
function computeHash(value) {
|
|
118
144
|
return hashContent(JSON.stringify(value), { length: 32 });
|
|
119
145
|
}
|
|
120
|
-
/**
|
|
121
|
-
|
|
146
|
+
/**
|
|
147
|
+
* Hash an artifact's semantic projection (order-independent, stamp-stripped).
|
|
148
|
+
* Exported so the ingest idempotency guard can compare a freshly-read host input
|
|
149
|
+
* against the canonical envelope without re-deriving a new (stamp-bearing)
|
|
150
|
+
* content hash on every next-step.
|
|
151
|
+
*/
|
|
152
|
+
export function payloadSemanticHash(name, payload) {
|
|
122
153
|
return hashContent(stableStringifyProjection(semanticProjection(name, payload)), { length: 32 });
|
|
123
154
|
}
|
|
124
155
|
/**
|
|
@@ -129,7 +160,7 @@ function computeSemanticHash(name, payload) {
|
|
|
129
160
|
* still do not re-stale downstreams (B3).
|
|
130
161
|
*/
|
|
131
162
|
export function envelopeSemanticHash(envelope) {
|
|
132
|
-
return
|
|
163
|
+
return payloadSemanticHash(envelope.artifact_name, envelope.payload);
|
|
133
164
|
}
|
|
134
165
|
// ── Public API ────────────────────────────────────────────────────────────────
|
|
135
166
|
/** Write an artifact envelope. Creates parent directories as needed. */
|
|
@@ -206,7 +237,7 @@ export async function detectStaleArtifacts(artifactsDir) {
|
|
|
206
237
|
stale.add(name);
|
|
207
238
|
break;
|
|
208
239
|
}
|
|
209
|
-
const recordedHash = envelope.dependency_hashes[dep];
|
|
240
|
+
const recordedHash = (envelope.dependency_hashes ?? {})[dep];
|
|
210
241
|
if (recordedHash !== envelopeSemanticHash(depEnvelope)) {
|
|
211
242
|
stale.add(name);
|
|
212
243
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifactStore.js","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/artifactStore.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"artifactStore.js","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/artifactStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM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C;gBAAE,SAAS;YAClD,KAAK,MAAM,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;gBACvC,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;oBACtC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBAChB,OAAO,GAAG,IAAI,CAAC;oBACf,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC;QACjB,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC;KACpB,CAAC;AACJ,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,sBAAsB,CACpC,YAAoB,EACpB,IAAkC;IAElC,OAAO,UAAU,CAAC,wBAAwB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -76,14 +76,31 @@ export interface TestValidatorPlanScaffold {
|
|
|
76
76
|
assertions: string[];
|
|
77
77
|
}>;
|
|
78
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* A prior round's authored test spec, keyed by obligation_id, used to diff-carry
|
|
81
|
+
* unchanged assertions across a re-emit (C3). Carries the identity signals
|
|
82
|
+
* (`name` + `scope_anchors`) the carry decision is gated on plus the assertions.
|
|
83
|
+
*/
|
|
84
|
+
export interface PriorTestSpec {
|
|
85
|
+
name: string;
|
|
86
|
+
scope_anchors: string[];
|
|
87
|
+
assertions: string[];
|
|
88
|
+
}
|
|
79
89
|
/**
|
|
80
90
|
* Build the test-plan skeleton: one spec per *testable* (invariant/behavioral)
|
|
81
91
|
* obligation, with `obligation_id`/`name`/`kind`/`scope_anchors` filled and
|
|
82
92
|
* `assertions` left blank for the model. The model fills only the assertions
|
|
83
93
|
* (each spec needs a paired positive + negative assertion per the OBL-CO-01
|
|
84
94
|
* gate, and the negative must name one of `scope_anchors` per CE-006).
|
|
95
|
+
*
|
|
96
|
+
* C3 diff-carry: when `priorByObligation` carries a prior round's authored spec
|
|
97
|
+
* for an obligation whose premise is UNCHANGED (same `name` + same
|
|
98
|
+
* `scope_anchors`), its assertions are pre-filled instead of left blank, so an
|
|
99
|
+
* unchanged obligation is not re-authored from scratch every repair round. A
|
|
100
|
+
* changed premise (renamed/re-scoped obligation) carries nothing — the host
|
|
101
|
+
* re-authors it (fail-safe toward re-author, never toward stale carry).
|
|
85
102
|
*/
|
|
86
|
-
export declare function buildTestValidatorPlanScaffold(ledger: ObligationLedger | undefined): TestValidatorPlanScaffold;
|
|
103
|
+
export declare function buildTestValidatorPlanScaffold(ledger: ObligationLedger | undefined, priorByObligation?: Record<string, PriorTestSpec>): TestValidatorPlanScaffold;
|
|
87
104
|
export interface ImplementationDagScaffoldNode {
|
|
88
105
|
id: string;
|
|
89
106
|
title: string;
|
|
@@ -123,11 +140,15 @@ export interface ImplementationDagScaffold {
|
|
|
123
140
|
/** Accepted counterexample ids from a judge_report payload (defensive read). */
|
|
124
141
|
export declare function acceptedCounterexampleIds(judgeReport: unknown): string[];
|
|
125
142
|
/**
|
|
126
|
-
* Build the implementation-DAG skeleton:
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
143
|
+
* Build the implementation-DAG skeleton: ONE node per finalized *module*
|
|
144
|
+
* (grouping all that module's obligations), blank title/description/
|
|
145
|
+
* targeted_commands for the model, and accepted counterexamples attached so
|
|
146
|
+
* coverage holds by construction. Grouping by module means a 1-module change
|
|
147
|
+
* derives 1 node instead of N obligation-nodes the host then has to merge (B2);
|
|
148
|
+
* obligations with no module home (counterexample/critique-sourced) fall back
|
|
149
|
+
* to one node each. Empty edges (the derived ledger declares no inter-module
|
|
150
|
+
* ordering). Advisory: the model fills the blanks and may further merge/split
|
|
151
|
+
* nodes as long as coverage is preserved.
|
|
131
152
|
*/
|
|
132
153
|
export declare function buildImplementationDagScaffold(ledger: ObligationLedger | undefined, acceptedCeIds: string[]): ImplementationDagScaffold;
|
|
133
154
|
//# sourceMappingURL=derive.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/derive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAuB5B,sFAAsF;AACtF,MAAM,WAAW,aAAa;IAC5B,gFAAgF;IAChF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CACpC,wBAAwB,EAAE,OAAO,EACjC,OAAO,GAAE,aAAkB,GAC1B,gBAAgB,
|
|
1
|
+
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/derive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAuB5B,sFAAsF;AACtF,MAAM,WAAW,aAAa;IAC5B,gFAAgF;IAChF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CACpC,wBAAwB,EAAE,OAAO,EACjC,OAAO,GAAE,aAAkB,GAC1B,gBAAgB,CA8DlB;AAmBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAI/D;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE3D;AASD,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,KAAK,CAAC;QAChB,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb;;;;;;WAMG;QACH,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CAC5C,MAAM,EAAE,gBAAgB,GAAG,SAAS,EACpC,aAAa,EAAE,MAAM,EAAE,GACtB,yBAAyB,CAsD3B"}
|
|
@@ -63,6 +63,7 @@ export function deriveObligationLedger(finalizedModuleContracts, options = {}) {
|
|
|
63
63
|
depends_on: [],
|
|
64
64
|
status: "pending",
|
|
65
65
|
source: "design_spec",
|
|
66
|
+
module: mod.name,
|
|
66
67
|
});
|
|
67
68
|
mod.invariants.forEach((invariant, i) => {
|
|
68
69
|
obligations.push({
|
|
@@ -72,6 +73,7 @@ export function deriveObligationLedger(finalizedModuleContracts, options = {}) {
|
|
|
72
73
|
depends_on: [],
|
|
73
74
|
status: "pending",
|
|
74
75
|
source: "design_spec",
|
|
76
|
+
module: mod.name,
|
|
75
77
|
change_classification: classifyObligationChange(invariant, baselineSymbols),
|
|
76
78
|
});
|
|
77
79
|
});
|
|
@@ -83,6 +85,7 @@ export function deriveObligationLedger(finalizedModuleContracts, options = {}) {
|
|
|
83
85
|
depends_on: [],
|
|
84
86
|
status: "pending",
|
|
85
87
|
source: "design_spec",
|
|
88
|
+
module: mod.name,
|
|
86
89
|
change_classification: classifyObligationChange(failureMode, baselineSymbols),
|
|
87
90
|
});
|
|
88
91
|
});
|
|
@@ -138,25 +141,49 @@ function scaffoldName(obligation) {
|
|
|
138
141
|
return obligation.id;
|
|
139
142
|
return text.length > 64 ? `${text.slice(0, 61)}...` : text;
|
|
140
143
|
}
|
|
144
|
+
function sameStringSet(a, b) {
|
|
145
|
+
if (a.length !== b.length)
|
|
146
|
+
return false;
|
|
147
|
+
const setB = new Set(b);
|
|
148
|
+
return a.every((x) => setB.has(x));
|
|
149
|
+
}
|
|
141
150
|
/**
|
|
142
151
|
* Build the test-plan skeleton: one spec per *testable* (invariant/behavioral)
|
|
143
152
|
* obligation, with `obligation_id`/`name`/`kind`/`scope_anchors` filled and
|
|
144
153
|
* `assertions` left blank for the model. The model fills only the assertions
|
|
145
154
|
* (each spec needs a paired positive + negative assertion per the OBL-CO-01
|
|
146
155
|
* gate, and the negative must name one of `scope_anchors` per CE-006).
|
|
156
|
+
*
|
|
157
|
+
* C3 diff-carry: when `priorByObligation` carries a prior round's authored spec
|
|
158
|
+
* for an obligation whose premise is UNCHANGED (same `name` + same
|
|
159
|
+
* `scope_anchors`), its assertions are pre-filled instead of left blank, so an
|
|
160
|
+
* unchanged obligation is not re-authored from scratch every repair round. A
|
|
161
|
+
* changed premise (renamed/re-scoped obligation) carries nothing — the host
|
|
162
|
+
* re-authors it (fail-safe toward re-author, never toward stale carry).
|
|
147
163
|
*/
|
|
148
|
-
export function buildTestValidatorPlanScaffold(ledger) {
|
|
164
|
+
export function buildTestValidatorPlanScaffold(ledger, priorByObligation = {}) {
|
|
149
165
|
const obligations = ledger?.obligations ?? [];
|
|
150
166
|
return {
|
|
151
167
|
test_specs: obligations
|
|
152
168
|
.filter((o) => isTestablePhaseObligation(o.kind))
|
|
153
|
-
.map((o) =>
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
169
|
+
.map((o) => {
|
|
170
|
+
const name = scaffoldName(o);
|
|
171
|
+
const scope_anchors = obligationScopeAnchors(o.id, o.description, readObligationChangeClassification(o));
|
|
172
|
+
const prior = priorByObligation[o.id];
|
|
173
|
+
const carried = prior &&
|
|
174
|
+
prior.name === name &&
|
|
175
|
+
sameStringSet(prior.scope_anchors, scope_anchors) &&
|
|
176
|
+
prior.assertions.length > 0
|
|
177
|
+
? [...prior.assertions]
|
|
178
|
+
: [];
|
|
179
|
+
return {
|
|
180
|
+
obligation_id: o.id,
|
|
181
|
+
name,
|
|
182
|
+
kind: o.kind === "invariant" ? "invariant" : "unit",
|
|
183
|
+
scope_anchors,
|
|
184
|
+
assertions: carried,
|
|
185
|
+
};
|
|
186
|
+
}),
|
|
160
187
|
};
|
|
161
188
|
}
|
|
162
189
|
/**
|
|
@@ -193,26 +220,47 @@ export function acceptedCounterexampleIds(judgeReport) {
|
|
|
193
220
|
return ids;
|
|
194
221
|
}
|
|
195
222
|
/**
|
|
196
|
-
* Build the implementation-DAG skeleton:
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
223
|
+
* Build the implementation-DAG skeleton: ONE node per finalized *module*
|
|
224
|
+
* (grouping all that module's obligations), blank title/description/
|
|
225
|
+
* targeted_commands for the model, and accepted counterexamples attached so
|
|
226
|
+
* coverage holds by construction. Grouping by module means a 1-module change
|
|
227
|
+
* derives 1 node instead of N obligation-nodes the host then has to merge (B2);
|
|
228
|
+
* obligations with no module home (counterexample/critique-sourced) fall back
|
|
229
|
+
* to one node each. Empty edges (the derived ledger declares no inter-module
|
|
230
|
+
* ordering). Advisory: the model fills the blanks and may further merge/split
|
|
231
|
+
* nodes as long as coverage is preserved.
|
|
201
232
|
*/
|
|
202
233
|
export function buildImplementationDagScaffold(ledger, acceptedCeIds) {
|
|
203
234
|
const obligations = (ledger?.obligations ?? []).filter((o) => isDagPhaseObligation(o.kind));
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
235
|
+
// Group by module in first-appearance order; obligations with no module key
|
|
236
|
+
// on their own id (one node each, preserving coverage).
|
|
237
|
+
const groups = [];
|
|
238
|
+
const groupIndex = new Map();
|
|
239
|
+
for (const o of obligations) {
|
|
240
|
+
const key = o.module ? `module:${o.module}` : `obligation:${o.id}`;
|
|
241
|
+
let idx = groupIndex.get(key);
|
|
242
|
+
if (idx === undefined) {
|
|
243
|
+
idx = groups.length;
|
|
244
|
+
groupIndex.set(key, idx);
|
|
245
|
+
groups.push({ key, obligations: [] });
|
|
246
|
+
}
|
|
247
|
+
groups[idx].obligations.push(o);
|
|
248
|
+
}
|
|
249
|
+
const nodes = groups.map((g, i) => {
|
|
250
|
+
const ids = g.obligations.map((o) => o.id);
|
|
251
|
+
return {
|
|
252
|
+
id: `CP-NODE-${i + 1}`,
|
|
253
|
+
title: "",
|
|
254
|
+
description: "",
|
|
255
|
+
satisfies_obligations: [...ids],
|
|
256
|
+
addresses_counterexamples: [],
|
|
257
|
+
addressed_critique_items: [],
|
|
258
|
+
depends_on: [],
|
|
259
|
+
verification_obligation_ids: [...ids],
|
|
260
|
+
targeted_commands: [],
|
|
261
|
+
status: "pending",
|
|
262
|
+
};
|
|
263
|
+
});
|
|
216
264
|
if (acceptedCeIds.length > 0) {
|
|
217
265
|
if (nodes.length === 0) {
|
|
218
266
|
nodes.push({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive.js","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/derive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EACL,qBAAqB,EACrB,QAAQ,EACR,YAAY,GAGb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,kCAAkC,GACnC,MAAM,2BAA2B,CAAC;AAuBnC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,sBAAsB,CACpC,wBAAiC,EACjC,UAAyB,EAAE;IAE3B,MAAM,SAAS,GAAG,sBAAsB,CAAC,wBAAwB,CAAC,CAAC;IACnE,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,MAAM,WAAW,GAAsB,EAAE,CAAC;IAE1C,8EAA8E;IAC9E,+EAA+E;IAC/E,wEAAwE;IACxE,+EAA+E;IAC/E,wDAAwD;IACxD,MAAM,eAAe,GAAG,yBAAyB,CAAC,wBAAwB,CAAC,CAAC;IAE5E,KAAK,MAAM,GAAG,IAAI,SAAS,CAAC,gBAAgB,EAAE,CAAC;QAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC;QAExC,uEAAu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EAAE;QACrE,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAChC,OAAO;YACL,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ;YACtD,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC;YAC3B,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC;YAC7B,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC,UAAU,CAAC;YACnC,aAAa,EAAE,QAAQ,CAAC,EAAE,CAAC,aAAa,CAAC;YACzC,mBAAmB,EACjB,OAAO,EAAE,CAAC,mBAAmB,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE;SAC3E,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PriorTestSpec } from "./derive.js";
|
|
2
|
+
export declare function testPlanCarryPath(artifactsDir: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Snapshot a freshly-ingested test-plan's authored specs (identity + assertions)
|
|
5
|
+
* keyed by obligation_id, overwriting any prior snapshot. Only specs with at
|
|
6
|
+
* least one assertion are carried (an `inapplicable_claim` spec re-authors).
|
|
7
|
+
*/
|
|
8
|
+
export declare function captureTestPlanCarry(artifactsDir: string, payload: unknown, capturedAt: string): Promise<void>;
|
|
9
|
+
/** Read the carried prior specs keyed by obligation_id; empty when none. */
|
|
10
|
+
export declare function readTestPlanCarry(artifactsDir: string): Promise<Record<string, PriorTestSpec>>;
|
|
11
|
+
//# sourceMappingURL=testPlanCarry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testPlanCarry.d.ts","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/testPlanCarry.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAajD,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE9D;AAYD;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAuBf;AAED,4EAA4E;AAC5E,wBAAsB,iBAAiB,CACrC,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAKxC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diff-carry for the test-validator plan (C3).
|
|
3
|
+
*
|
|
4
|
+
* Friction: the test-plan is re-derived whole whenever the obligation ledger
|
|
5
|
+
* re-stales (e.g. a repair round changes a module contract). The host then
|
|
6
|
+
* re-authors EVERY spec's assertions — even for obligations whose premise did
|
|
7
|
+
* not change at all.
|
|
8
|
+
*
|
|
9
|
+
* Fix: when a test-plan is ingested, snapshot each authored spec's identity
|
|
10
|
+
* (`name` + `scope_anchors`) plus its assertions, keyed by obligation_id. On a
|
|
11
|
+
* later re-emit, the scaffold pre-fills assertions for every obligation whose
|
|
12
|
+
* premise is unchanged (see `buildTestValidatorPlanScaffold`), so the host only
|
|
13
|
+
* authors the genuinely new/changed specs. Enforced by the tool (the re-emitted
|
|
14
|
+
* skeleton carries the assertions), never left to the host to remember.
|
|
15
|
+
*/
|
|
16
|
+
import { mkdir } from "node:fs/promises";
|
|
17
|
+
import { join } from "node:path";
|
|
18
|
+
import { readOptionalJsonFile, writeJsonFile } from "audit-tools/shared";
|
|
19
|
+
import { contractPipelineDir } from "./artifactStore.js";
|
|
20
|
+
const CARRY_SCHEMA_VERSION = "remediate-code-contract-pipeline/test-plan-carry/v1alpha1";
|
|
21
|
+
export function testPlanCarryPath(artifactsDir) {
|
|
22
|
+
return join(contractPipelineDir(artifactsDir), "test-plan-carry.json");
|
|
23
|
+
}
|
|
24
|
+
function isRecord(value) {
|
|
25
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26
|
+
}
|
|
27
|
+
function asStringArray(value) {
|
|
28
|
+
return Array.isArray(value)
|
|
29
|
+
? value.filter((x) => typeof x === "string")
|
|
30
|
+
: [];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Snapshot a freshly-ingested test-plan's authored specs (identity + assertions)
|
|
34
|
+
* keyed by obligation_id, overwriting any prior snapshot. Only specs with at
|
|
35
|
+
* least one assertion are carried (an `inapplicable_claim` spec re-authors).
|
|
36
|
+
*/
|
|
37
|
+
export async function captureTestPlanCarry(artifactsDir, payload, capturedAt) {
|
|
38
|
+
const specsArray = isRecord(payload) ? payload.test_specs : undefined;
|
|
39
|
+
if (!Array.isArray(specsArray))
|
|
40
|
+
return;
|
|
41
|
+
const specs = {};
|
|
42
|
+
for (const raw of specsArray) {
|
|
43
|
+
if (!isRecord(raw))
|
|
44
|
+
continue;
|
|
45
|
+
const id = typeof raw.obligation_id === "string" ? raw.obligation_id : "";
|
|
46
|
+
const name = typeof raw.name === "string" ? raw.name : "";
|
|
47
|
+
const assertions = asStringArray(raw.assertions);
|
|
48
|
+
if (!id || assertions.length === 0)
|
|
49
|
+
continue;
|
|
50
|
+
specs[id] = {
|
|
51
|
+
name,
|
|
52
|
+
scope_anchors: asStringArray(raw.scope_anchors),
|
|
53
|
+
assertions,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const carry = {
|
|
57
|
+
schema_version: CARRY_SCHEMA_VERSION,
|
|
58
|
+
captured_at: capturedAt,
|
|
59
|
+
specs,
|
|
60
|
+
};
|
|
61
|
+
await mkdir(contractPipelineDir(artifactsDir), { recursive: true });
|
|
62
|
+
await writeJsonFile(testPlanCarryPath(artifactsDir), carry);
|
|
63
|
+
}
|
|
64
|
+
/** Read the carried prior specs keyed by obligation_id; empty when none. */
|
|
65
|
+
export async function readTestPlanCarry(artifactsDir) {
|
|
66
|
+
const carry = await readOptionalJsonFile(testPlanCarryPath(artifactsDir));
|
|
67
|
+
return carry?.specs ?? {};
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=testPlanCarry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testPlanCarry.js","sourceRoot":"","sources":["../../../src/remediate/contractPipeline/testPlanCarry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,MAAM,oBAAoB,GACxB,2DAAoE,CAAC;AAUvE,MAAM,UAAU,iBAAiB,CAAC,YAAoB;IACpD,OAAO,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,EAAE,sBAAsB,CAAC,CAAC;AACzE,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACzB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;QACzD,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UA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,UAAU,iBAAiB,CACrC,YAAoB;IAEpB,MAAM,KAAK,GAAG,MAAM,oBAAoB,CACtC,iBAAiB,CAAC,YAAY,CAAC,CAChC,CAAC;IACF,OAAO,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"close.d.ts","sourceRoot":"","sources":["../../../src/remediate/phases/close.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"close.d.ts","sourceRoot":"","sources":["../../../src/remediate/phases/close.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAmB1D,OAAO,KAAK,EAIV,yBAAyB,EACzB,SAAS,EAIV,MAAM,oBAAoB,CAAC;AAI5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAOV,qBAAqB,EAItB,MAAM,mBAAmB,CAAC;AAiF3B,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,gBAAgB,EACvB,aAAa,EAAE,aAAa,GAC3B,yBAAyB,CAoI3B;AAsDD;;;;;;;;GAQG;AACH,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CA6B5C;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,gBAAgB,EAAE,wCAAwC,CAAC;IAC3D,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;IACzC,QAAQ,EAAE,oBAAoB,EAAE,CAAC;CAClC;AAyCD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAI1D;AAkDD,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,mBAAmB,GAC3B,aAAa,CA2Ff;AA4oBD,wBAAsB,aAAa,CACjC,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,mBAAmB,EAC5B,SAAS,CAAC,EAAE,SAAS,GACpB,OAAO,CAAC,gBAAgB,CAAC,CA6K3B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { remediationBranchName, listQuarantinedCommits } from "../steps/dispatch.js";
|
|
1
|
+
import { remediationBranchName, listQuarantinedCommits, readRemediationBaseBranch, } from "../steps/dispatch.js";
|
|
2
2
|
import { dirname, extname, isAbsolute, join } from "node:path";
|
|
3
3
|
import { readFileSync, existsSync } from "node:fs";
|
|
4
4
|
import { AGENT_FEEDBACK_FILENAME, parseReflectionsNdjson, readOptionalJsonFile, readOptionalTextFile, renderProcessFeedbackSection, stagedAndUntracked, writeJsonFile, writeTextFile, RemediationOutcomeStatusSchema, } from "audit-tools/shared";
|
|
@@ -365,6 +365,43 @@ export function executeClosingAction(state, options) {
|
|
|
365
365
|
else if (action === "tag") {
|
|
366
366
|
run("git", ["tag", "auto-remediation"]);
|
|
367
367
|
}
|
|
368
|
+
else if (action === "merge-to-base") {
|
|
369
|
+
const runId = state.plan?.plan_id ?? "";
|
|
370
|
+
const branch = remediationBranchName(runId);
|
|
371
|
+
const base = readRemediationBaseBranch(options.artifactsDir);
|
|
372
|
+
// No recorded base (detached HEAD at launch, or a branch from a prior run):
|
|
373
|
+
// never guess a merge target — leave everything untouched and tell the host.
|
|
374
|
+
if (!base) {
|
|
375
|
+
return {
|
|
376
|
+
contract_version: "remediate-code-closing-result/v1alpha1",
|
|
377
|
+
action,
|
|
378
|
+
status: "skipped",
|
|
379
|
+
commands: [
|
|
380
|
+
{
|
|
381
|
+
command: ["git", "merge", "--no-ff", branch],
|
|
382
|
+
exit_code: 1,
|
|
383
|
+
stderr: `No recorded base branch for this run — merge \`${branch}\` into your base branch manually.`,
|
|
384
|
+
},
|
|
385
|
+
],
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
// Check out the base and attempt a no-ff merge so the run lands as one
|
|
389
|
+
// revertable merge commit. On any conflict, abort and restore the
|
|
390
|
+
// remediation branch — the base branch is left exactly as it was.
|
|
391
|
+
if (run("git", ["checkout", base])) {
|
|
392
|
+
const merged = run("git", [
|
|
393
|
+
"merge",
|
|
394
|
+
"--no-ff",
|
|
395
|
+
branch,
|
|
396
|
+
"-m",
|
|
397
|
+
`Merge remediation run ${runId}`,
|
|
398
|
+
]);
|
|
399
|
+
if (!merged) {
|
|
400
|
+
run("git", ["merge", "--abort"]);
|
|
401
|
+
run("git", ["checkout", branch]);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
368
405
|
else if (action === "custom" && state.closing_plan.custom_command?.length) {
|
|
369
406
|
run(state.closing_plan.custom_command[0], state.closing_plan.custom_command.slice(1));
|
|
370
407
|
}
|
|
@@ -560,7 +597,10 @@ function buildRemediationReportMarkdown(state, entries, closingResult, e2ePassed
|
|
|
560
597
|
// node actually committed a change — a no-change/skip-only run leaves no commits.
|
|
561
598
|
if (entries.resolved.length > 0) {
|
|
562
599
|
const branch = remediationBranchName(state.plan?.plan_id ?? "");
|
|
563
|
-
|
|
600
|
+
const mergedToBase = closingResult.action === "merge-to-base" && closingResult.status === "success";
|
|
601
|
+
reportContent += mergedToBase
|
|
602
|
+
? `## Review\n\nAll code changes were applied on \`${branch}\` and merged into your base branch as one \`--no-ff\` merge commit (\`Merge remediation run ${state.plan?.plan_id ?? ""}\`). Review the diff; revert the whole run with \`git revert -m 1 <merge-commit>\` if needed.\n\n`
|
|
603
|
+
: `## Review\n\nAll code changes were applied on the dedicated branch \`${branch}\` — your base branch was left untouched. Review the diff and merge \`${branch}\` into your base branch (or re-run with the \`merge-to-base\` closing action to land it automatically).\n\n`;
|
|
564
604
|
}
|
|
565
605
|
reportContent += `## Resolved — Changed Files\n\n`;
|
|
566
606
|
if (entries.resolved.length === 0) {
|