Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 14x 33x 15x 18x 18x | /**
* @module roll-forward-pirs/horizon
* @description Cycle-horizon helpers used to decide when to emit a
* roll-forward Markdown artifact and to attribute PIR origins.
*
* @author Hack23 AB
* @license Apache-2.0
*/
import { CYCLE_HORIZON_DAYS } from './constants.js';
import type { CycleType, PirEntry, PirStatusFile } from './types.js';
/**
* Determine whether a cycle qualifies for automatic roll-forward Markdown
* emission. Returns true when the cycle has `horizonDays >= 90`.
*/
export function isLongHorizon(cycle: CycleType): boolean {
return CYCLE_HORIZON_DAYS[cycle] >= 90;
}
/**
* Determine whether a PIR was inherited from the source or created in this run.
* Uses `sourcePirIds` (authoritative) when available, otherwise falls back to
* `output.inherited_from` presence or the PIR's own `inherits_from` chain.
*/
export function determineOrigin(
pir: PirEntry,
sourcePirIds: Set<string> | undefined,
output: PirStatusFile,
): 'inherited' | 'this run' {
if (sourcePirIds) {
return sourcePirIds.has(pir.pir_id) ? 'inherited' : 'this run';
}
Eif (output.inherited_from) {
return 'inherited';
}
return pir.inherits_from && pir.inherits_from.length > 0 ? 'inherited' : 'this run';
}
|