@@ -107,16 +107,6 @@ export interface ScanResult {
107107 // reads as superseded rather than contradictory; the additive gate consumes that reading.
108108 readonly supersedes : ReadonlyArray < string > ;
109109 readonly retireCandidates : ReadonlyArray < SituatedDeclaration > ;
110- // Whole-series rehearsal only (`--replay-of` with `--since == --target`):
111- // `upstream-test`/`replaced-export` warnings and `additive:*` findings
112- // whose normalised key already exists on `replayOf` against its own base —
113- // legacy debt, not something this replay introduced. Kept out of
114- // `warnings`/`additive` (and so out of `scanFailures`) but rendered
115- // separately, advisory-only. Empty and null outside that mode.
116- readonly historicalWarnings : ReadonlyArray < ScanAuthoringWarning > ;
117- readonly historicalAdditive : ReadonlyArray < AdditiveFinding > ;
118- readonly historicalBase : string | null ;
119- readonly replayOf : string | null ;
120110}
121111
122112export { UsageError } from "./lib/fork-cli.ts" ;
@@ -132,8 +122,6 @@ Options:
132122 --since <ref> Guard only commits in <ref>..head; the overlap report covers the whole range
133123 --replay-of <ref>
134124 Guard only commits whose added lines differ from the same-subject commit on this ref.
135- When --since equals --target, upstream-test/replaced-export/additive findings already
136- present on <ref> against its own base are advisory, not fatal.
137125 --no-typecheck Skip the rehearsed-head typechecks
138126 -h, --help Show help
139127
@@ -275,51 +263,8 @@ export interface ScanInput extends ScanRange {
275263 // declaration refusals plus undeclared-contradiction findings.
276264 readonly supersedes ?: ReadonlyArray < string > ;
277265 readonly retireCandidates ?: ReadonlyArray < SituatedDeclaration > ;
278- // Whole-series rehearsal baseline, computed by the runner from a second
279- // scan of replayOf against its own base. Absent outside that mode.
280- readonly baseline ?: BaselineKeys | undefined ;
281- }
282-
283- export interface BaselineKeys {
284- readonly base : string ;
285- readonly replayOf : string ;
286- readonly warningKeys : ReadonlySet < string > ;
287- readonly additiveKeys : ReadonlySet < string > ;
288266}
289267
290- const SHA_PATTERN = / \b [ 0 - 9 a - f ] { 7 , 40 } \b / g;
291- // A whole-word integer between spaces is a count ("gains 4 fork test
292- // block(s)"). A squash sums its members' counts, so the count leaves the key
293- // too; a digit inside a path sits against a non-space and survives.
294- const COUNT_PATTERN = / (?< = \s ) \d + (? = \s ) / g;
295- export const normaliseFindingDetail = ( text : string ) : string =>
296- text . replace ( SHA_PATTERN , "<sha>" ) . replace ( COUNT_PATTERN , "<n>" ) ;
297-
298- // One key per finding shape, sha-free and count-free so a finding rebases or
299- // squashes into an identical key on both scans. `warning.detail` always
300- // carries its path (the messages `fork-scan-authoring.ts` builds all open on
301- // it, or name it a sentence in), so folding it into the normalised detail is
302- // enough for uniqueness without a separate path field on
303- // `ScanAuthoringWarning`.
304- const warningKey = ( warning : ScanAuthoringWarning ) : string =>
305- `${ warning . rule } |${ normaliseFindingDetail ( warning . detail ) } ` ;
306- const additiveKey = ( finding : AdditiveFinding ) : string =>
307- `${ finding . check } |${ finding . path } |${ normaliseFindingDetail ( finding . detail ) } ` ;
308-
309- const partitionBaseline = < Finding > (
310- findings : ReadonlyArray < Finding > ,
311- keyOf : ( finding : Finding ) => string ,
312- baselineKeys : ReadonlySet < string > | undefined ,
313- ) : { readonly fatal : ReadonlyArray < Finding > ; readonly historical : ReadonlyArray < Finding > } => {
314- if ( baselineKeys === undefined ) return { fatal : findings , historical : [ ] } ;
315- const fatal : Array < Finding > = [ ] ;
316- const historical : Array < Finding > = [ ] ;
317- for ( const finding of findings ) {
318- ( baselineKeys . has ( keyOf ( finding ) ) ? historical : fatal ) . push ( finding ) ;
319- }
320- return { fatal, historical } ;
321- } ;
322-
323268export const buildScanResult = ( input : ScanInput ) : ScanResult => {
324269 const touched = new Map < string , Set < string > > ( ) ;
325270 const commitCounts = new Map < string , number > ( ) ;
@@ -362,28 +307,15 @@ export const buildScanResult = (input: ScanInput): ScanResult => {
362307 for ( const path of shared ) overlaps . push ( { path, domain, covered : covers ( path ) } ) ;
363308 }
364309
365- const rawWarnings = input . guard === undefined ? [ ] : collectAuthoringWarnings ( input . guard ) ;
366- const rawAdditive = input . additive ?? [ ] ;
367- const warningPartition = partitionBaseline ( rawWarnings , warningKey , input . baseline ?. warningKeys ) ;
368- const additivePartition = partitionBaseline (
369- rawAdditive ,
370- additiveKey ,
371- input . baseline ?. additiveKeys ,
372- ) ;
373-
374310 return {
375311 range : { base : input . base , head : input . head , target : input . target } ,
376312 domains,
377313 overlaps : overlaps . toSorted ( ( left , right ) => left . path . localeCompare ( right . path ) ) ,
378314 typecheckGaps : [ ] ,
379315 undeclaredDomains,
380316 untaggedCommits,
381- warnings : warningPartition . fatal ,
382- additive : additivePartition . fatal ,
383- historicalWarnings : warningPartition . historical ,
384- historicalAdditive : additivePartition . historical ,
385- historicalBase : input . baseline ?. base ?? null ,
386- replayOf : input . baseline ?. replayOf ?? null ,
317+ warnings : input . guard === undefined ? [ ] : collectAuthoringWarnings ( input . guard ) ,
318+ additive : input . additive ?? [ ] ,
387319 supersedes : input . supersedes ?? [ ] ,
388320 retireCandidates : input . retireCandidates ?? [ ] ,
389321 hookDetails :
@@ -499,18 +431,6 @@ export const renderScanReport = (result: ScanResult): string => {
499431 lines . push ( "" , `Hook guard, ${ result . hookDetails . length } finding(s):` ) ;
500432 for ( const detail of result . hookDetails ) lines . push ( ` HOOK ${ detail } ` ) ;
501433 }
502- const historicalCount = result . historicalWarnings . length + result . historicalAdditive . length ;
503- if ( historicalCount > 0 && result . replayOf !== null && result . historicalBase !== null ) {
504- lines . push (
505- "" ,
506- `historical: ${ historicalCount } finding(s) already on ${ result . replayOf } against ${ result . historicalBase } , advisory` ,
507- "Advisory, already on the replay baseline:" ,
508- ) ;
509- lines . push ( ...renderAuthoringWarnings ( result . historicalWarnings ) . map ( ( line ) => ` ${ line } ` ) ) ;
510- if ( result . historicalAdditive . length > 0 ) {
511- lines . push ( ...renderAdditiveFindings ( result . historicalAdditive ) . map ( ( line ) => ` ${ line } ` ) ) ;
512- }
513- }
514434 if ( result . untaggedCommits . length > 0 ) {
515435 lines . push (
516436 `skipped ${ result . untaggedCommits . length } commit(s) without Fork-Domain (vp run fork:delta --check owns them): ${ result . untaggedCommits . join ( ", " ) } ` ,
@@ -624,47 +544,9 @@ export const readScan = (
624544 { head : range . head } ,
625545 ) ,
626546 ...readSupersedesAssessment ( git , range ) ,
627- baseline : resolveBaselineKeys ( git , options , range , ledger , additiveRunner ) ,
628547 } ) ;
629548} ;
630549
631- // Whole-series rehearsal only: `--replay-of` scans every replayed commit, so
632- // this second scan of `replayOf` against its own base (never live upstream —
633- // `range.target` may already be pinned to a merge base by the caller) finds
634- // the legacy debt the replay did not introduce. `--since != --target` means
635- // the caller bounded the guard to a real commit range already, so the
636- // baseline diff is a no-op there (recursing with replayOf: null never loops).
637- const resolveBaselineKeys = (
638- git : GitReader ,
639- options : ScanOptions ,
640- range : ScanRange ,
641- ledger : string ,
642- additiveRunner : AdditiveRunner | undefined ,
643- ) : BaselineKeys | undefined => {
644- if ( options . replayOf === null ) return undefined ;
645- if ( options . since === null || options . since !== options . target ) return undefined ;
646- const historicalBase = git . run ( [ "merge-base" , range . target , options . replayOf ] ) . trim ( ) ;
647- const baselineResult = readScan (
648- git ,
649- {
650- base : null ,
651- head : options . replayOf ,
652- target : historicalBase ,
653- typecheck : false ,
654- since : historicalBase ,
655- replayOf : null ,
656- } ,
657- ledger ,
658- additiveRunner ,
659- ) ;
660- return {
661- base : historicalBase ,
662- replayOf : options . replayOf ,
663- warningKeys : new Set ( baselineResult . warnings . map ( warningKey ) ) ,
664- additiveKeys : new Set ( baselineResult . additive . map ( additiveKey ) ) ,
665- } ;
666- } ;
667-
668550/** What `checkAdditive` needs beyond the git reads: the worktree the trees resolve in. */
669551export interface AdditiveRunner extends CwdCommandRunner {
670552 readonly worktree : string ;
0 commit comments