filegrc 0.12.2 → 0.12.3
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/package.json +1 -1
- package/src/git.js +398 -65
- package/src/reconciliation.js +607 -150
- package/src/validate.js +39 -7
package/src/validate.js
CHANGED
|
@@ -218,14 +218,29 @@ async function validateWorkspaceUnmeasured(input) {
|
|
|
218
218
|
}
|
|
219
219
|
if (modelSupports(loaded.model, "guided-workflow")) {
|
|
220
220
|
const { planReconciliation, validateReconciliationDismissals } = await import("./reconciliation.js");
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
221
|
+
try {
|
|
222
|
+
const rawReconciliation = await validateReconciliationDismissals(loaded, diagnostics);
|
|
223
|
+
reconciliation = rawReconciliation?.filteredPlan ?? await planReconciliation(loaded);
|
|
224
|
+
for (const candidate of reconciliation.candidates.filter(({ committedRevision }) => committedRevision)) {
|
|
225
|
+
diagnostics.push(warning(
|
|
226
|
+
"unreconciled-committed-transition",
|
|
227
|
+
candidate.sourcePath,
|
|
228
|
+
`${candidate.eventType} transition in Git commit ${candidate.committedRevision.slice(0, 8)} still needs confirmation or dismissal.`
|
|
229
|
+
));
|
|
230
|
+
}
|
|
231
|
+
} catch (cause) {
|
|
232
|
+
diagnostics.push(error(
|
|
233
|
+
"reconciliation-history-unavailable",
|
|
234
|
+
"data/workspace.json",
|
|
235
|
+
cause instanceof Error ? cause.message : "Git history is unavailable for reconciliation."
|
|
228
236
|
));
|
|
237
|
+
reconciliation = {
|
|
238
|
+
contractVersion: 1,
|
|
239
|
+
gitRevision: null,
|
|
240
|
+
changedPaths: [],
|
|
241
|
+
candidates: [],
|
|
242
|
+
unavailable: true
|
|
243
|
+
};
|
|
229
244
|
}
|
|
230
245
|
}
|
|
231
246
|
|
|
@@ -2134,6 +2149,23 @@ function validateLocation(record, definition, relativePath, diagnostics) {
|
|
|
2134
2149
|
}
|
|
2135
2150
|
}
|
|
2136
2151
|
|
|
2152
|
+
export function assertHistoricalRecordValid(record, model, relativePath) {
|
|
2153
|
+
const displayPath = `data/${relativePath}`;
|
|
2154
|
+
const diagnostics = [];
|
|
2155
|
+
let definition;
|
|
2156
|
+
try {
|
|
2157
|
+
definition = getResourceDefinition(model, record?.type);
|
|
2158
|
+
} catch {
|
|
2159
|
+
throw new Error(`Unknown historical resource type "${record?.type ?? ""}" at ${displayPath}.`);
|
|
2160
|
+
}
|
|
2161
|
+
validateLocation(record, definition, relativePath, diagnostics);
|
|
2162
|
+
validateRecord(record, definition, model, displayPath, diagnostics);
|
|
2163
|
+
validateDateRanges(record, displayPath, diagnostics);
|
|
2164
|
+
if (diagnostics.some(({ severity }) => severity === "error")) {
|
|
2165
|
+
throw new Error(`Invalid historical resource at ${displayPath}: ${diagnostics.map(({ message }) => message).join(" ")}`);
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
|
|
2137
2169
|
function validateRecord(record, definition, model, path, diagnostics) {
|
|
2138
2170
|
const fields = { ...model.commonFields, ...definition.fields };
|
|
2139
2171
|
const required = new Set([
|