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
|
|
@ -68,14 +68,22 @@ export function makeClassifier(tax) {
|
|||
/**
|
||||
* Build a file-priority function mirroring report-changes getFilePriority:
|
||||
* ordered regex rules over the lowercased path; first match wins; else default.
|
||||
*
|
||||
* A file with NO "Last updated:" header (hasDate=false) cannot have its currency
|
||||
* verified, so it lands in the dedicated `dateless` tier ('unverified') instead
|
||||
* of inheriting a path-based priority — otherwise dateless files flood the
|
||||
* critical bucket and drown the genuinely-stale critical files (carry-forward B).
|
||||
* hasDate defaults to true so existing single-arg callers keep path-based scoring.
|
||||
* @param {object} tax
|
||||
* @returns {(filePath: string) => string}
|
||||
* @returns {(filePath: string, hasDate?: boolean) => string}
|
||||
*/
|
||||
export function makePriorityFn(tax) {
|
||||
const rules = tax.priority.rules.map((r) => ({ re: new RegExp(r.match), priority: r.priority }));
|
||||
const fallback = tax.priority.default;
|
||||
const datelessTier = tax.priority.dateless ?? fallback;
|
||||
|
||||
return function getFilePriority(filePath) {
|
||||
return function getFilePriority(filePath, hasDate = true) {
|
||||
if (!hasDate) return datelessTier;
|
||||
const lower = filePath.toLowerCase();
|
||||
for (const r of rules) {
|
||||
if (r.re.test(lower)) return r.priority;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue