feat(ms-ai-architect): Sesjon 5 carry-forward B — datoløse filer → unverified-tier
Rotårsak: en datoløs ref-fil fikk effectiveDate=0000-01-01 (alltid «stale») OG en path-basert prioritet (kunne bli critical) → flommet critical-bøtta og druknet genuint kritiske filer. Fix: ny unverified-tier deklarert i domain-taxonomy.json (lag 0, eneste sannhetskilde for prioritet). makePriorityFn(tax) tar nå valgfri hasDate (default true → bakoverkompatibelt for eksisterende én-args-kallere); report-changes sender Boolean(fileDate). unverified rangerer sist i sorteringen — manglende dato er metadata-hygiene, ikke currency-hast. Ekte registry: 1 fil skilt ut som Unverified. TDD: 4 tester FØR kode (test-priority-unverified.test.mjs). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01REiKFhP4w6xGXXqWKpPCJJ
This commit is contained in:
parent
97aa5d3378
commit
94a5d1bb14
4 changed files with 63 additions and 8 deletions
|
|
@ -41,8 +41,10 @@ function parseLastUpdated(filePath) {
|
|||
return null; // No date found — treat as always stale
|
||||
}
|
||||
|
||||
// Priority sort order
|
||||
const PRIORITY_ORDER = { critical: 0, high: 1, medium: 2, low: 3 };
|
||||
// Priority sort order. 'unverified' (dateless files — no "Last updated:" header)
|
||||
// ranks last: a missing date is a metadata-hygiene gap, not a currency-urgency
|
||||
// signal, and must not masquerade as critical (carry-forward B).
|
||||
const PRIORITY_ORDER = { critical: 0, high: 1, medium: 2, low: 3, unverified: 4 };
|
||||
|
||||
// --- Main ---
|
||||
const registry = loadRegistry(DATA_DIR);
|
||||
|
|
@ -79,7 +81,8 @@ for (const [url, entry] of Object.entries(registry.urls)) {
|
|||
// Build report entries
|
||||
const files = [];
|
||||
for (const [path, changes] of fileChanges) {
|
||||
const priority = getFilePriority(path);
|
||||
// Dateless files (no "Last updated:" header) → 'unverified', not path-based.
|
||||
const priority = getFilePriority(path, Boolean(changes.fileDate));
|
||||
const pathParts = path.split('/');
|
||||
files.push({
|
||||
path,
|
||||
|
|
@ -101,7 +104,7 @@ files.sort((a, b) => {
|
|||
});
|
||||
|
||||
// Count by priority
|
||||
const byPriority = { critical: 0, high: 0, medium: 0, low: 0 };
|
||||
const byPriority = { critical: 0, high: 0, medium: 0, low: 0, unverified: 0 };
|
||||
for (const f of files) byPriority[f.priority]++;
|
||||
|
||||
const report = {
|
||||
|
|
@ -122,7 +125,7 @@ if (jsonOnly) {
|
|||
console.log(`\n=== KB Change Report (${report.generated_at}) ===`);
|
||||
console.log(`Sources last polled: ${registry.last_poll}`);
|
||||
console.log(`URLs tracked: ${report.total_tracked}/${Object.keys(registry.urls).length} (${report.total_not_in_sitemap} not in sitemap)`);
|
||||
console.log(`Files needing update: ${files.length} (Critical: ${byPriority.critical}, High: ${byPriority.high}, Medium: ${byPriority.medium}, Low: ${byPriority.low})`);
|
||||
console.log(`Files needing update: ${files.length} (Critical: ${byPriority.critical}, High: ${byPriority.high}, Medium: ${byPriority.medium}, Low: ${byPriority.low}, Unverified: ${byPriority.unverified})`);
|
||||
|
||||
if (files.length > 0) {
|
||||
console.log('\nTop 20 by priority:');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue