bulltrackers-module 1.0.315 → 1.0.317
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.
|
@@ -129,7 +129,8 @@ async function dispatchComputationPass(config, dependencies, computationManifest
|
|
|
129
129
|
const etaSeconds = Math.max(20, Math.ceil(totalweight * BASE_SECONDS_PER_WEIGHT_UNIT));
|
|
130
130
|
const remainingDatesCount = Math.max(0, dirtyDates.length - targetCursorN);
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
// [UPDATED] Capture both name and reason for transparency
|
|
133
|
+
const taskDetails = selectedTasks.map(t => `${t.name} (${t.reason})`);
|
|
133
134
|
|
|
134
135
|
logger.log('INFO', `[Dispatcher] ✅ Dispatching ${selectedTasks.length} tasks for ${selectedDate}. ETA: ${etaSeconds}s. [Mode: ${isSweep ? 'RECOVERY' : 'NORMAL'}]`, {
|
|
135
136
|
date: selectedDate,
|
|
@@ -139,7 +140,7 @@ async function dispatchComputationPass(config, dependencies, computationManifest
|
|
|
139
140
|
totalweight: totalweight,
|
|
140
141
|
etaSeconds: etaSeconds,
|
|
141
142
|
dispatchId: currentDispatchId,
|
|
142
|
-
tasks:
|
|
143
|
+
tasks: taskDetails // [UPDATED] Now logs "calc-name (Reason)"
|
|
143
144
|
});
|
|
144
145
|
|
|
145
146
|
const mapToTaskPayload = (t) => ({
|
|
@@ -149,7 +150,7 @@ async function dispatchComputationPass(config, dependencies, computationManifest
|
|
|
149
150
|
date: selectedDate,
|
|
150
151
|
pass: passToRun,
|
|
151
152
|
dispatchId: currentDispatchId,
|
|
152
|
-
triggerReason: t.reason,
|
|
153
|
+
triggerReason: t.reason, // Already passed to worker
|
|
153
154
|
resources: t.resources || 'standard'
|
|
154
155
|
});
|
|
155
156
|
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* fileName: computation-system/tools/BuildReporter.js
|
|
5
|
-
* }
|
|
2
|
+
* FILENAME: computation-system/tools/BuildReporter.js
|
|
3
|
+
* UPDATED: Replaced hardcoded 90-day window with a dynamic window based on system data availability.
|
|
6
4
|
*/
|
|
7
5
|
const { analyzeDateExecution } = require('../WorkflowOrchestrator');
|
|
8
6
|
const { fetchComputationStatus, updateComputationStatus } = require('../persistence/StatusRepository');
|
|
9
|
-
const { normalizeName, getExpectedDateStrings, DEFINITIVE_EARLIEST_DATES
|
|
7
|
+
const { normalizeName, getExpectedDateStrings, DEFINITIVE_EARLIEST_DATES } = require('../utils/utils');
|
|
10
8
|
const { checkRootDataAvailability } = require('../data/AvailabilityChecker');
|
|
11
9
|
const SimRunner = require('../simulation/SimRunner');
|
|
12
|
-
const SYSTEM_EPOCH = require('../system_epoch');
|
|
10
|
+
const SYSTEM_EPOCH = require('../system_epoch');
|
|
13
11
|
const pLimit = require('p-limit');
|
|
14
12
|
const path = require('path');
|
|
15
13
|
const crypto = require('crypto');
|
|
@@ -65,11 +63,6 @@ function calculateBlastRadius(targetCalcName, reverseGraph) {
|
|
|
65
63
|
};
|
|
66
64
|
}
|
|
67
65
|
|
|
68
|
-
/**
|
|
69
|
-
* [OPTIMIZED] Logic Stability Check
|
|
70
|
-
* We trust SimHash here. If the code logic (behavior) is stable, we mark it stable.
|
|
71
|
-
* We do NOT check dependency drift here. The WorkflowOrchestrator handles that at runtime.
|
|
72
|
-
*/
|
|
73
66
|
async function verifyBehavioralStability(candidates, manifestMap, dailyStatus, logger, simHashCache, db) {
|
|
74
67
|
const trueReRuns = [];
|
|
75
68
|
const stableUpdates = [];
|
|
@@ -80,13 +73,11 @@ async function verifyBehavioralStability(candidates, manifestMap, dailyStatus, l
|
|
|
80
73
|
const manifest = manifestMap.get(item.name);
|
|
81
74
|
const stored = dailyStatus[item.name];
|
|
82
75
|
|
|
83
|
-
// 1. If no history exists, it must run.
|
|
84
76
|
if (!stored || !stored.simHash || !manifest) {
|
|
85
77
|
trueReRuns.push(item);
|
|
86
78
|
return;
|
|
87
79
|
}
|
|
88
80
|
|
|
89
|
-
// 2. Fetch or Compute SimHash
|
|
90
81
|
let newSimHash = simHashCache.get(manifest.hash);
|
|
91
82
|
if (!newSimHash) {
|
|
92
83
|
newSimHash = await SimRunner.run(manifest, manifestMap);
|
|
@@ -98,11 +89,7 @@ async function verifyBehavioralStability(candidates, manifestMap, dailyStatus, l
|
|
|
98
89
|
}).catch(err => logger.log('WARN', `Failed to write SimHash registry for ${manifest.name}: ${err.message}`));
|
|
99
90
|
}
|
|
100
91
|
|
|
101
|
-
// 3. Behavioral Comparison
|
|
102
92
|
if (newSimHash === stored.simHash) {
|
|
103
|
-
// STABLE: The logic is identical for mocked data.
|
|
104
|
-
// We mark this as stable, allowing the Orchestrator to skip it
|
|
105
|
-
// UNLESS the actual production input data has changed.
|
|
106
93
|
stableUpdates.push({
|
|
107
94
|
...item,
|
|
108
95
|
reason: "Code Updated (Logic Stable)",
|
|
@@ -110,7 +97,6 @@ async function verifyBehavioralStability(candidates, manifestMap, dailyStatus, l
|
|
|
110
97
|
newHash: manifest.hash
|
|
111
98
|
});
|
|
112
99
|
} else {
|
|
113
|
-
// UNSTABLE: The logic actually produces different results.
|
|
114
100
|
trueReRuns.push({
|
|
115
101
|
...item,
|
|
116
102
|
reason: item.reason + ` [SimHash Mismatch]`,
|
|
@@ -128,6 +114,9 @@ async function verifyBehavioralStability(candidates, manifestMap, dailyStatus, l
|
|
|
128
114
|
return { trueReRuns, stableUpdates };
|
|
129
115
|
}
|
|
130
116
|
|
|
117
|
+
/**
|
|
118
|
+
* UPDATED: Now calculates daysBack dynamically based on absoluteEarliest data date.
|
|
119
|
+
*/
|
|
131
120
|
async function ensureBuildReport(config, dependencies, manifest) {
|
|
132
121
|
const { db, logger } = dependencies;
|
|
133
122
|
const now = new Date();
|
|
@@ -164,8 +153,17 @@ async function ensureBuildReport(config, dependencies, manifest) {
|
|
|
164
153
|
}
|
|
165
154
|
}
|
|
166
155
|
|
|
167
|
-
|
|
168
|
-
|
|
156
|
+
// [DYNAMIC WINDOW CALCULATION]
|
|
157
|
+
const { absoluteEarliest } = DEFINITIVE_EARLIEST_DATES;
|
|
158
|
+
let dynamicDaysBack = 90; // Fallback default
|
|
159
|
+
if (absoluteEarliest) {
|
|
160
|
+
const today = new Date();
|
|
161
|
+
const diffTime = Math.abs(today - absoluteEarliest);
|
|
162
|
+
dynamicDaysBack = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + 2; // Days difference + 2 day buffer
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
logger.log('INFO', `[BuildReporter] 🚀 Change Detected. Running Pre-flight Report for v${packageVersion} (Scope: ${dynamicDaysBack} days)...`);
|
|
166
|
+
await generateBuildReport(config, dependencies, manifest, dynamicDaysBack, buildId, currentSystemHash);
|
|
169
167
|
lockRef.update({ status: 'COMPLETED', completedAt: new Date() }).catch(() => {});
|
|
170
168
|
|
|
171
169
|
} catch (e) {
|
|
@@ -210,7 +208,6 @@ async function generateBuildReport(config, dependencies, manifest, daysBack = 90
|
|
|
210
208
|
};
|
|
211
209
|
|
|
212
210
|
let totalRun = 0, totalReRun = 0, totalStable = 0;
|
|
213
|
-
|
|
214
211
|
const limit = pLimit(5);
|
|
215
212
|
|
|
216
213
|
const processingPromises = datesToCheck.map(dateStr => limit(async () => {
|
|
@@ -261,10 +258,8 @@ async function generateBuildReport(config, dependencies, manifest, daysBack = 90
|
|
|
261
258
|
targetArray.push(entry);
|
|
262
259
|
};
|
|
263
260
|
|
|
264
|
-
// 1. RUN
|
|
265
261
|
analysis.runnable.forEach(item => pushIfValid(dateSummary.run, item, "New Calculation"));
|
|
266
262
|
|
|
267
|
-
// 2. RE-RUN & STABLE Analysis
|
|
268
263
|
if (analysis.reRuns.length > 0) {
|
|
269
264
|
const { trueReRuns, stableUpdates } = await verifyBehavioralStability(analysis.reRuns, manifestMap, dailyStatus, logger, simHashCache, db);
|
|
270
265
|
|
|
@@ -275,15 +270,13 @@ async function generateBuildReport(config, dependencies, manifest, daysBack = 90
|
|
|
275
270
|
const updatesPayload = {};
|
|
276
271
|
for (const stable of stableUpdates) {
|
|
277
272
|
const m = manifestMap.get(stable.name);
|
|
278
|
-
// We must grab the EXISTING data from the DB to preserve the OLD result hash.
|
|
279
|
-
// This allows the Orchestrator to compare Old Result vs New Dependency Result.
|
|
280
273
|
const stored = dailyStatus[stable.name];
|
|
281
274
|
if (m && stored) {
|
|
282
275
|
updatesPayload[stable.name] = {
|
|
283
|
-
hash: m.hash,
|
|
284
|
-
simHash: stable.simHash,
|
|
285
|
-
resultHash: stored.resultHash,
|
|
286
|
-
dependencyResultHashes: stored.dependencyResultHashes || {},
|
|
276
|
+
hash: m.hash,
|
|
277
|
+
simHash: stable.simHash,
|
|
278
|
+
resultHash: stored.resultHash,
|
|
279
|
+
dependencyResultHashes: stored.dependencyResultHashes || {},
|
|
287
280
|
category: m.category,
|
|
288
281
|
composition: m.composition,
|
|
289
282
|
lastUpdated: new Date()
|
|
@@ -328,7 +321,6 @@ async function generateBuildReport(config, dependencies, manifest, daysBack = 90
|
|
|
328
321
|
reportHeader.summary = { totalReRuns: totalReRun, totalNew: totalRun, totalStable: totalStable, scanRange: `${datesToCheck[0]} to ${datesToCheck[datesToCheck.length-1]}` };
|
|
329
322
|
|
|
330
323
|
await db.collection('computation_build_records').doc(buildId).set(reportHeader);
|
|
331
|
-
|
|
332
324
|
await db.collection('computation_build_records').doc('latest').set({ ...reportHeader, note: "Latest build report pointer." });
|
|
333
325
|
|
|
334
326
|
logger.log('SUCCESS', `[BuildReporter] Report ${buildId} saved. Re-runs: ${totalReRun}, Stable (Fixed): ${totalStable}, New: ${totalRun}.`);
|