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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
#!/usr/bin/env python3
"""Flag functions that lost their doc comment between two revisions.
Rust attaches a `///` block to whatever item FOLLOWS it, so inserting a new
`fn` between an existing function and its doc silently hands that prose to the
newcomer. Nothing reports it: the build stays green, clippy is silent, and the
rendered rustdoc is confidently wrong rather than absent (#314).
The snapshot is undetectable - the reassigned prose is well formed and sits
above a plausible function - but the DIFF is not. A function that had a doc
comment and now has none is the exact fingerprint the insertion leaves behind,
and it is what both known instances did.
Deliberate removals are rare and are declared: put
`doc-removal: <path>::<item key>` in a commit message on the branch, where
the key is the one the gate's own error names: a bare name for a free item
(`src/foo.rs::bar`), or the enclosing impl header for a method
(`src/foo.rs::Foo::new`, `src/foo.rs::Display for Foo::fmt`). The path
qualifier keeps one declared removal from excusing a same-named item
elsewhere.
Usage: check_doc_ownership.py <base-rev> <head-rev>
"""
# Every item kind a doc block can sit above. `fn` alone was the original
# scope and it let the same failure through twice in one day on `const`
# declarations: a doc block does not care what follows it, so neither can
# this. `impl` and bare `mod` are deliberately absent - an `impl` block's
# name is not unique enough to key on, and its methods are matched as `fn`
# in their own right.
=
# The one git failure this checker tolerates, in the two spellings git uses:
# the path is simply not present in that revision, because the branch added or
# deleted the file. Anything else - a bad revision, a malformed object, a
# broken repository - is a failure to report, not an empty file to accept.
=
# The head of an `impl` or `trait` block. Its methods are keyed
# `<header>::<name>` so that `new` in two impl blocks is two items, not one
# merged key whose "any documented" reading hides a capture on either
# (#405). The whole header is the key rather than the type alone: `impl
# Display for X` and `impl Debug for X` both define `fmt`. A trait's own
# method declarations get the same treatment, keyed `trait Foo::id`, since
# two traits declaring `id` are the same shape. Generics and lifetimes are
# stripped so a branch that reformats them does not move every method to a
# new key.
=
# Everything on a CODE line that is not block structure, in the order a
# left-to-right scan meets it: a complete raw string (`r#"{"#` is not a
# `"..."` and its braces are content), a complete ordinary string, a char
# literal (exactly one, possibly escaped, character between quotes, which
# is what keeps a lifetime `'a` from opening one), a raw string that runs
# past its line, an ordinary one that does (a `"...\` continuation), and a
# `//` comment. `format!("{x}")` is on most lines that matter, and one
# miscounted brace keys every item after it to the wrong block.
=
# The first `"` not escaped by a backslash: where an ordinary string that
# ran past its line ends.
=
"""Drop every `<...>` group, nested ones included."""
, = , 0
+= 1
-= 1
return
"""`impl<T> fmt::Display for Foo<T> where T: X {` -> `fmt::Display for Foo`;
`trait Foo: Bar {` -> `trait Foo`.
Everything from the first `where` or `{` on is the block's body or
bounds, not its identity. A trait keeps its keyword so `trait Foo` and an
inherent `impl Foo` on a same-named type stay distinct.
"""
=
=
=
return f
"""Which `impl`/`trait` block each line of a file is in.
Fed CODE lines in order. Counts braces after removing literals and a
trailing `//` comment; a string that runs past its line puts the tracker
in "content" mode until the terminator, so a multi-line raw string full
of JSON braces is invisible to it. A header whose `{` comes later (a
`where` clause, a rustfmt-wrapped `impl<T>\n Trait for X<T>\n{`) is
accumulated until that brace opens. A body-less `impl Eq for X {}` opens
and closes on one line and must not leak its key onto the next block.
The counter is line-based and therefore fallible in principle; the
invariants a caller can check are `depth == 0` and no open blocks at
EOF, and the test-suite asserts both over every file in `src/`. Depth is
floored at zero so one miscount cannot corrupt every later block.
"""
= 0
# (depth the block opened at, key or None for a `mod`/`fn` body).
=
# Header text accumulated while waiting for its opening brace.
= None
# Terminator of a string that ran past its line, or None.
= None
"""The innermost impl/trait key, or None. A block with no key (a
nested `fn` or `mod`) is transparent: it still lives in the impl."""
return
"""The line with literals and comments removed, tracking strings
that span lines."""
=
return
=
=
return
=
= None
=
= 0
=
return
= +
return
=
return
return
=
=
=
=
# Still inside a wrapped header: `impl<T>` / `Trait for X<T>`.
=
= -
=
# Opened and closed on one line (`impl Eq for X {}`): the header
# is spent either way.
= None
=
"""Run git, failing closed.
A silent failure here is worse than a crash: an errored `git diff` yields
an empty file list, the checker reports "no documentation lost" and exits
zero, and the gate has passed by not running.
`allow_missing_path` narrows that tolerance to exactly the expected case.
Tolerating every non-zero exit would let an invalid revision or a
malformed object read as empty content, which is the same fail-open bug
one door further in. A probe whose exit status IS the answer does not go
through here at all: see `exists_at`.
"""
=
return
return
"""Whether `path` is present at `rev`.
A probe: `git cat-file -e` prints nothing either way and answers with
its exit status. Reading its stdout, as the added-file detection once
did, made every changed file look branch-added: each took the pairwise
commit walk (minutes on a real branch, for nothing) and a capture in an
existing file was reported twice, once per loop.
"""
=
return == 0
"""The changed files that do not exist at `base`: the branch added them,
so their history lives only in its own commits."""
return
"""A `///` outer doc comment, and not a `////` rule.
Four or more slashes is an ordinary comment to rustc, so counting it as
documentation invents losses that never happened.
"""
=
return and not
# Lines a doc comment on this repo can never be MEANT for. Deliberately a
# short allowlist of shapes that have actually stranded prose rather than an
# attempt to enumerate everything: a false accusation here is worse than a
# miss, because a gate that cries wolf stops being read. A plain `use` is
# the one observed in the wild (#436).
#
# Any VISIBILITY-QUALIFIED `use` is excluded, not just `pub use`.
# Documenting a re-export is legitimate Rust and rustdoc renders a `pub use`,
# so flagging one would fail a correct PR; `pub(crate) use` does not reach
# an external reader either, but a doc above one is a deliberate note rather
# than stranded prose. A bare private `use` is the only form that has ever
# taken another item's doc here, and the only one this treats as unable to
# hold prose.
=
# What a line is, for the backward scan. Computed in one FORWARD pass,
# because both multi-line constructs (an attribute spanning lines, a `/** */`
# doc block) can only be recognised by reading downward: from below, `))]` and
# `*/` are indistinguishable from code.
, , , = , , ,
"""Label every line DOC, ATTR, SKIP (blank or ordinary comment) or CODE.
Both multi-line shapes were false-ACCUSATION bugs rather than misses: an
attribute spanning lines, or a `/** */` block doc, made a documented item
read as undocumented and the gate reported a loss that had not happened.
For a gate that is the worse direction, since a gate that cries wolf stops
being read.
"""
=
= 0
= False
= False
=
= False
continue
= False
continue
+= -
continue
# `/** ... */` is an outer doc comment lowering to the same `#[doc]`
# attribute as `///`. `/*! */` is INNER (it documents the enclosing
# item, not the next one) and `/***` is an ordinary comment, so
# neither counts.
= True
continue
= True
continue
= -
=
continue
continue
continue
return
"""Map item key -> True when ANY definition under it carries a doc comment.
Keyed by name because two revisions cannot be lined up by position, and
a method's name is qualified by its enclosing `impl` or `trait` header
(`Foo::new`, `Display for Foo::fmt`) because a bare name is not unique
where it matters most: `new` across impl blocks is the common shape,
and merging them let a capture on one hide behind the other's surviving
prose (#405). Items outside any impl, and items in a `mod` or a `fn`
body, keep the bare name, so every pre-existing key for those survives.
Where one key still covers several definitions (a `cfg`-gated pair, say)
"any documented" remains the deliberately conservative reading: the
check fires only when every definition under that key has lost its
prose. Under-reporting there is the safer direction for a gate that
blocks merges; a mis-aligned key would turn it into a false accusation.
`///` lowers to an outer `#[doc]` attribute, and an attribute is not
detached from its item by blank lines or ordinary comments - verified
against rustc, which warns `unused_doc_comments` when a doc really is
orphaned and stays silent here, and against rustdoc, which renders the
prose on the function in both shapes. So the backward scan steps over
attributes, blanks and `//` comments alike; stopping at the first blank
reported documentation as missing when rustc could see it perfectly well.
"""
=
= or is not None
return
"""Every item `ITEM` models, keyed as `documented` keys it, with the
`///` block that reaches it: a tuple of the block's stripped lines, or
None when nothing documents it. One scan serves both the "is it
documented" question and the "which prose documented it" one, so the
two can never disagree about where a block's reach ends."""
=
=
=
# The scope an item belongs to is the one in force BEFORE its own
# line: `trait A {` is itself an item, keyed to whatever encloses
# it, not to the block it opens.
=
=
continue
# Exactly one alternative captures per match.
=
= f
= - 1
-= 1
= None
= + 1
-= 1
=
yield , ,
"""The `///` blocks sitting above the items in `names`, as tuples of
stripped lines, one entry per documented definition. What a stranded
block at HEAD is compared against to tell "the prose this loss already
accounts for" from a second defect (#463)."""
return
"""Line numbers of the stranded blocks in `candidates` that the losses
of `lost` already account for (#463).
An insertion strands the block that sat above its victim, so the
explained copy is the NEAREST stranded block above where the victim now
sits at HEAD, and it stands down only when its text is one a loss
explains. Pairing by position rather than by text alone matters when
the same prose occurs twice in a file: `/// Creates a new instance.`
above two `new`s is ordinary, and a match on text would let one loss
silence a stranded copy that never documented it. Taking the nearest
block regardless of text, rather than the nearest MATCHING one, is what
stops a loss whose own prose the branch also rewrote from reaching past
that rewritten block to an identical one further up, and when two blocks
above the victim carry that text the pairing is ambiguous and stands
nothing down. Each lost definition explains at most one block, and a
block with no victim below it is reported as usual.
"""
=
=
=
=
continue
=
continue
# Two blocks with the victim's prose above it: nothing says which one
# it lost, and the nearer may be an independent capture that reads
# the same. Standing it down would hide that defect and leave the
# report pointing at the other block, so an ambiguous pairing stands
# nothing down and every block prints.
continue
return
"""Doc blocks in `text` that no item can be attached to.
The diff-based check above cannot see a capture whose VICTIM is new on
the branch: relative to the merge base that item does not exist, so it
cannot have lost a doc it never had (#427). Nor can it see one where
the capturing item is of a kind the `ITEM` regex does not model, such
as a `use` (#436).
Both are the same shape at HEAD, and it needs no base revision to see:
a `///` block that is not immediately followed by something a doc can
attach to. When an item is inserted between a doc and its subject, the
ORIGINAL doc lands on the newcomer and the newcomer's own doc — or, for
a `use`, nothing at all — is left with no item beneath it.
Deliberately narrow. Only a doc block followed by another DOC block, or
by a non-item line that ends the block's reach, is reported; a doc above
an `impl`, a `mod`, a macro invocation or any other legal-but-unmodelled
item is left alone, because reporting those would be the false accusation
that stops a gate being read. The check answers "is this prose stranded",
not "do I recognise what follows".
KNOWN LIMITATION, and the reason #427 is only partly closed: this sees a
capture solely through the doc it STRANDS. When the inserted item carries
its own doc, nothing is stranded — the original prose has silently moved
to the newcomer and both items look documented — and when the inserted
item is a `mod`, an `impl` or a macro invocation, the doc above it is
legal, so that case is deliberately unreportable here. All three remain
invisible to a merge-base comparison too when the victim is new on the
branch, which is what #427 filed. Catching them needs the commit-walk
that issue also proposed, or a semantic check of whether prose describes
the item beneath it; neither is in scope for this pass.
"""
=
=
=
= 0
+= 1
continue
=
+= 1
# Each entry is `(line, first line, what follows, block)`; the block
# is the stripped text of the whole `///` run, which is how the
# caller recognises the block a reported loss already explains.
=
# Attributes and blank lines sit legally between a doc and its item.
=
+= 1
# A doc block at end of file documents nothing.
continue
# Two doc blocks with no item between them: the first cannot
# reach an item, because the second one gets there first. This
# is what an insertion above a documented item leaves behind.
continue
# A line that syntactically cannot carry a doc comment. `use`
# is the one that has actually happened (#436) — an import
# dropped between a doc and its function takes prose that
# rustdoc then renders against the import, and neither the
# diff check nor `unused_doc_comments` says a word.
return
"""Every `///` block in the file, with the line it documents.
Yields `(start, end, subject)`: the block spans `lines[start:end]`, and
`subject` is the first line under it that a doc can attach to - blank
lines, ordinary comments and attributes sit legally in between - or None
when the block reaches the end of the file. The subject is the line's own
text rather than a parsed item, because the captures that get through the
other two passes are on kinds `ITEM` deliberately does not model: an enum
variant is what #455 was filed for.
"""
= 0
+= 1
continue
=
+= 1
=
+= 1
# A block followed by ANOTHER doc block documents nothing, and the
# head-only pass above reports exactly that. Handing the second
# block's text back as a "subject" made one defect print two
# annotations, the second of them saying the prose now describes a
# `///` line, which is not an item and not something a reader can act
# on. The two passes cannot now report the same block: this one needs
# a real subject, and the other one fires only when there is none.
=
yield , ,
# A doc line carrying no prose of its own: the `///` separators a long block
# is full of, and the `*/` that closes a `/** */` one. They repeat, they move
# whenever anything near them moves, and they say nothing about which item
# they describe. The lookahead is what keeps `*/` out: the continuation-line
# branch matches its `*`, leaving `/` to read as prose.
=
"""Doc lines that occur exactly once in `text`, and what each sits above.
Uniqueness is the whole guard against reading a coincidence as a move: a
`/// The width, in cells.` that appears above three different fields has
no single owner to have changed, so it is dropped rather than guessed at.
"""
=
=
=
=
=
= + 1
=
return
"""Every line that some doc block reaches, unique or not."""
=
return
"""How often each stripped line occurs, for the "still there, and only
once" test the report depends on."""
=
=
= + 1
return
"""Doc lines that changed the item they sit above, leaving it bare (#455).
The two passes above see a capture only through prose that is STRANDED -
a doc block with nothing a doc can attach to under it. A newcomer that
brings its own doc strands nothing: rustfmt leaves the stolen line and
the thief's own contiguous, they read as one ordinary two-line block, and
at HEAD the file is indistinguishable from one where somebody wrote a
two-line doc. That is why #455 could not be closed in the snapshot; the
signal only exists in the diff, where the same line used to sit above a
different item.
Three conditions have to hold together, and each one is a false-accusation
class removed rather than a nicety:
* the doc line is unchanged and unique on both sides, so there is exactly
one thing it can be talking about;
* its old subject is still in the file, exactly once, and now has no doc
block of its own - prose that merely moved between two documented items
cost nobody their documentation;
* the line it landed on is NEW. Moving a doc DOWN onto an item that was
already there is how a capture gets repaired, and a gate that fails the
fix as well as the bug is one people route around.
Returns `(line at head, the doc line, the old subject, the new one)`.
"""
=
=
return
=
=
=
=
=
continue
, =
continue
continue
continue
# One insertion is one defect. Every line of a block sits above the same
# item, so a three-line doc reported per line names the same victim and
# the same thief three times; the block's FIRST line is the one a reader
# recognises, and it is the lowest line number.
=
return
# The leading name on a subject line. `r#` is part of the name, not a
# prefix to skip: `r#type` and `r#match` are different items, and
# capturing `r` for both would let one declared removal excuse the other.
=
# Words that lead an item rather than name one.
=
"""The name to declare a deliberate removal against, for a subject line
`ITEM` does not model.
#455 was filed for an enum variant, and a variant is not an item this
file parses. Without a key derived from the line itself, the branch would
have a merge-blocking check and no way to declare a removal against it,
which is the one thing that turns a gate into an obstacle.
"""
# An impl or trait header keys the way the loss pass already keys its
# methods, so one declaration cannot cover two impls of one type: `impl
# fmt::Display for Foo {` is `Display for Foo`, not `fmt`. Taking the
# first word gave `fmt` to both a Display and a Debug impl, and one
# `doc-removal: a.rs::fmt` excused either.
=
=
return or None
# EVERY leading keyword, not one. `pub async unsafe extern "C" fn bar(`
# walks four before the name, and stopping after the first keyed it as
# `unsafe`. The bound is a guard against a pathological line rather than
# a real limit: Rust has no item with eight qualifiers.
=
=
return None
=
return
=
# `extern "C" fn bar(`: the ABI is a string literal, which the
# name pattern cannot step over.
=
# The bang belongs to the keyword, and `\w` stops before it.
=
=
return None
"""Whether a git command succeeds, for a question rather than an answer."""
return
"""The bare item name a subject line declares, or None.
Only used to tell the two passes apart: when the diff pass and the loss
pass have found the same capture, the loss pass owns the report, and one
defect must not print two annotations.
"""
=
return
, = ,
=
# File-qualified: `doc-removal: src/foo.rs::bar`. Keyed on the bare name,
# one deliberate removal of `new` would excuse every `new` in every
# changed file, including an accidental loss elsewhere in the same branch.
=
=
=
# A file the branch ADDS has no base version, so `documented(before)` is
# empty and no loss can ever be reported in it: a doc captured within the
# branch is invisible to a merge-base comparison. Those files are checked
# commit-by-commit instead, which is the only place their history exists.
=
# What matters is the state at HEAD. A doc captured in one commit and
# restored in a later one is not a loss: the branch is fine, and
# reporting it blocks a PR whose head is correct. Without this the
# pairwise pass reports every intermediate state a branch passed
# through, which is exactly the false accusation that makes a gate
# untrustworthy.
=
=
=
=
# Name the commit the doc was last seen at. Saying
# "at {base}" would be wrong for a file the branch
# ADDED: it does not exist there, and a reader sent
# to that revision finds nothing.
# A path can legitimately be absent on one side: the branch added the
# file, or deleted it. That is the one git failure this tolerates -
# `allow_missing_path` exists for exactly it, and not passing it here
# made the gate abort on every PR that adds a Rust file, which is how
# it failed on the first one that did.
=
=
# The head-only pass (#427, #436): a capture the diff cannot see because
# its victim is new on the branch, or because the capturing item is of a
# kind `ITEM` does not model. Runs on the same changed files, needs no
# base, and reports separately so the two failure shapes stay legible.
# The diff pass (#455): a doc line that changed the item it sits above.
# Runs per file over the revisions that actually touched it - the merge
# base, then each commit on the branch - so a capture made in one commit
# of a branch is seen even though the merge base predates both items.
# Every candidate is then re-tested against HEAD, because a capture that
# a later commit repaired is not a defect in the branch being merged.
=
=
=
continue
# One insertion, one annotation (#463). When the victim is an item
# `ITEM` models and was documented before, the loss pass has already
# named it, and the block it left stranded at HEAD is the very block
# that sat above it at the revision the loss names. Reporting that
# block again describes the same edit a second time. The match is on
# the block's full text AND its position above the victim, not on
# the file: a stranded block that never documented the lost item is
# a second defect and keeps its line, and prose the branch also
# rewrote no longer matches and is reported, which is the
# conservative side for a gate.
=
=
=
=
=
continue
# `--no-merges`, and the omission is not a shortcut. A merge's first
# parent is the branch tip, so the pair `(M^, M)` is everything the
# OTHER side brought in, replayed as though this branch had written
# it - and this repo's convention is to merge main into a branch that
# needs it, so that is the common shape rather than an exotic one. The
# declaration that excused such a change on main is invisible here
# too, because the commit-message scan starts above the merge base, so
# the report would name an escape hatch the reader cannot use.
#
# What it COSTS, stated rather than waved at: a capture made by the
# resolution itself, when the thief is a line the other side already
# had. The base-to-head pair does not cover that one, because "the
# line the prose landed on is new" is false for a line main brought
# in. A resolution that invents a new thief line IS still caught.
# `test_a_capture_inside_a_merge_resolution_is_a_known_gap` pins that
# boundary, and an earlier version of this comment claimed the pair
# covered it, which was wrong.
=
# Each commit against its OWN first parent, not against the previous
# entry in the log. Path limiting simplifies history before `--reverse`
# orders it, so two adjacent entries need not be parent and child, and
# comparing them reads a doc as having moved between states that were
# never one edit apart.
#
# The base-to-head pair is kept as well, and it is not redundant: the
# per-commit walk asks whether the line the prose landed on is new IN
# THAT PAIR, so a capture split across two commits - the thief added
# above the block in one, moved under it in the next - is invisible to
# every pair but this one. It is also the pair that caught the real
# #454 instance.
=
# A root commit has no `rev^`, which is a git failure rather than
# a missing path, so it would abort instead of being skipped.
# Unreachable under CI's full-depth checkout, reachable in a
# shallow clone running the documented local invocation.
continue
=
continue
# FIRST owner wins. A doc captured twice on one branch
# (A -> B -> C) would otherwise be reported as having left B,
# which is the thief from the first move; the item that
# actually lost its documentation is A, and a reader who
# repairs the item the message names leaves A bare.
continue
=
=
=
=
=
continue
continue
# The same capture, when its victim is an item `ITEM` models and
# was documented at the base, is already reported as a loss. One
# defect, one annotation: the loss message is the older and more
# precise of the two, so it keeps the report. The declared-removal
# exemption travels with it for the same reason.
=
continue
# The declared-removal hatch reaches this pass too. Keyed on the
# modelled name where there is one, and otherwise on the leading
# name of the subject line - an enum variant has no other key, and
# a variant is what #455 was filed for.
= or
continue
=
return 1
return 0