You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e5cfd7f
Browse filesBrowse the repository at this point in the historyBrowse files
test(ratchet): a pin on a file at or under the tripwire is itself a finding
Review: a new pin for an unchanged sub-tripwire file (900 pinned at 900)
passed equality and history and grew the map. Pins now exist only for files
over the tripwire — any other pin is red with 'remove it' — which also
subsumes the old shrink-under-the-line message. Planted red in-file and
against real git (a 186-line test pinned at 186). The android snapshot test
pin bootstraps 1636→1660: main grew that file in #1846 before this gate
exists, and history agrees (1660 at the merge-base).
// Pins exist only for files over the tripwire: one on a smaller file grows the map for
104
+
// nothing (900 pinned at 900 would satisfy equality and history alike) and defeats the
105
+
// only-shrink kill criterion.
106
+
findings.push(
107
+
`${file} is ${lines} lines, at or under the ${tripwire}-line tripwire, but has a pin (${pin}): remove it — pins are only for files over the tripwire.`,
108
+
);
109
+
continue;
110
+
}
102
111
if(lines>pin){
103
112
findings.push(
104
113
`${file} grew to ${lines} lines (pinned ${pin}): extract instead of adding to a file over the tripwire.`,
105
114
);
106
115
}elseif(lines<pin){
107
116
findings.push(
108
-
`${file} shrank to ${lines} lines (pinned ${pin}): lower its pin in this PR so the ratchet keeps the gain`+
109
-
(lines<=tripwire ? ' — it is now under the tripwire, so remove the pin.' : '.'),
117
+
`${file} shrank to ${lines} lines (pinned ${pin}): lower its pin in this PR so the ratchet keeps the gain.`,
110
118
);
111
119
}
112
120
}
@@ -241,17 +249,21 @@ test('no test file over the tripwire grows, and every pin matches its file exact
241
249
});
242
250
243
251
test('planted reds: growth, shrink, unpinned crossing, and a stale pin each name their fix',()=>{
'a.test.ts grew to 1201 lines (pinned 1200): extract instead of adding to a file over the tripwire.',
253
-
'b.test.ts shrank to 900 lines (pinned 1500): lower its pin in this PR so the ratchet keeps the gain — it is now under the tripwire, so remove the pin.',
262
+
'b.test.ts is 900 lines, at or under the 1000-line tripwire, but has a pin (1500): remove it — pins are only for files over the tripwire.',
254
263
'c.test.ts is 1001 lines, over the 1000-line tripwire and not pinned: split it along the source module it mirrors (docs/agents/testing.md) rather than pinning it.',
264
+
// The arbitrary-new-pin bypass: equality (900 == 900) and history (900 <= base) both pass,
265
+
// so this rule is the one that rejects it.
266
+
'e.test.ts is 900 lines, at or under the 1000-line tripwire, but has a pin (900): remove it — pins are only for files over the tripwire.',
255
267
'gone.test.ts is pinned but does not exist: remove its pin.',
0 commit comments