@lsctech/polaris 0.4.3 → 0.4.4
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.
|
@@ -132,6 +132,7 @@ function gateForemanResentPacket(artifacts) {
|
|
|
132
132
|
/** Counts per-child dispatches from all available artifact sources, or null if none are present. */
|
|
133
133
|
function countChildDispatches(artifacts) {
|
|
134
134
|
const counts = new Map();
|
|
135
|
+
// Count from open_children_meta dispatch_record
|
|
135
136
|
const state = asRecord(artifacts.currentState);
|
|
136
137
|
const openChildrenMeta = asRecord(state?.["open_children_meta"]);
|
|
137
138
|
for (const [childId, meta] of Object.entries(openChildrenMeta ?? {})) {
|
|
@@ -142,20 +143,30 @@ function countChildDispatches(artifacts) {
|
|
|
142
143
|
counts.set(childId, Math.max(counts.get(childId) ?? 0, dispatchCount));
|
|
143
144
|
}
|
|
144
145
|
}
|
|
146
|
+
// Count child-dispatched events from ledger (each event = evidence of one dispatch)
|
|
147
|
+
const ledgerCounts = new Map();
|
|
145
148
|
for (const event of artifacts.ledgerEvents) {
|
|
146
149
|
const rec = asRecord(event);
|
|
147
150
|
if (rec?.["event"] === "child-dispatched" && typeof rec["issue_id"] === "string") {
|
|
148
151
|
const childId = rec["issue_id"];
|
|
149
|
-
|
|
152
|
+
ledgerCounts.set(childId, (ledgerCounts.get(childId) ?? 0) + 1);
|
|
150
153
|
}
|
|
151
154
|
}
|
|
155
|
+
for (const [childId, count] of ledgerCounts.entries()) {
|
|
156
|
+
counts.set(childId, Math.max(counts.get(childId) ?? 0, count));
|
|
157
|
+
}
|
|
158
|
+
// Count child-dispatched events from telemetry (each event = evidence of one dispatch)
|
|
159
|
+
const telemetryCounts = new Map();
|
|
152
160
|
for (const event of artifacts.telemetryEvents) {
|
|
153
161
|
const rec = asRecord(event);
|
|
154
162
|
if (rec?.["event"] === "child-dispatched" && typeof rec["child_id"] === "string") {
|
|
155
163
|
const childId = rec["child_id"];
|
|
156
|
-
|
|
164
|
+
telemetryCounts.set(childId, (telemetryCounts.get(childId) ?? 0) + 1);
|
|
157
165
|
}
|
|
158
166
|
}
|
|
167
|
+
for (const [childId, count] of telemetryCounts.entries()) {
|
|
168
|
+
counts.set(childId, Math.max(counts.get(childId) ?? 0, count));
|
|
169
|
+
}
|
|
159
170
|
return counts.size > 0 ? counts : null;
|
|
160
171
|
}
|
|
161
172
|
/**
|
|
@@ -167,6 +167,10 @@ function loadRunArtifacts(repoRoot, runId) {
|
|
|
167
167
|
const completedChildrenResults = stateRec?.["completed_children_results"];
|
|
168
168
|
if (completedChildrenResults && typeof completedChildrenResults === "object" && !Array.isArray(completedChildrenResults)) {
|
|
169
169
|
workerResultContracts = Object.values(completedChildrenResults).filter((v) => v !== null && typeof v === "object" && typeof v["worker_id"] === "string");
|
|
170
|
+
// If filtering produced zero contracts, fall back to legacy extraction
|
|
171
|
+
if (workerResultContracts.length === 0) {
|
|
172
|
+
workerResultContracts = extractWorkerResultContracts(resultPackets);
|
|
173
|
+
}
|
|
170
174
|
}
|
|
171
175
|
else {
|
|
172
176
|
// Legacy fallback: extract from result packet files
|