Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/loop-tools-gate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# A loop tool that exists only in one working directory is not in the project.
#
# scripts/tri_loop/cost.py and diffbin.py were written, used to produce numbers
# that were quoted in a pull request, and lost -- never committed, and the working
# copy was later re-cloned. Every figure they had produced became unreproducible
# at once. Six recovery routes came back empty (#2158).
#
# Nothing in CI could tell the difference between a tool that exists and a tool
# that exists nowhere but one untracked directory. This gate is that difference.
# It is deliberately cheap: no build, no compiler, no corpus run, so there is no
# reason for it to be skipped or made optional.
name: loop-tools-gate

on:
pull_request:
paths:
- "scripts/tri"
- "scripts/tri_loop/**"
- "scripts/ci/loop-tools-tracked.sh"
- ".github/workflows/loop-tools-gate.yml"
push:
branches: [master]
paths:
- "scripts/tri"
- "scripts/tri_loop/**"
- "scripts/ci/loop-tools-tracked.sh"

permissions:
contents: read

jobs:
loop-tools-tracked:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# The check reads git index state, so it needs real history rather than
# a detached blob export.
fetch-depth: 1

- name: Every loop tool is present, tracked, and routed
run: bash scripts/ci/loop-tools-tracked.sh

- name: Each loop helper is syntactically loadable
# A tracked tool that cannot be imported is tracked and useless. This is
# a syntax check only and asserts nothing about behaviour.
run: |
for f in scripts/tri_loop/*.py; do
python3 -c "import py_compile,sys; py_compile.compile('$f', doraise=True)" \
&& echo "ok $f" \
|| { echo "BROKEN $f"; exit 1; }
done

- name: The dispatcher runs its helpers without a built compiler
# tri triage and tri damage read the tracker and the spec text and have no
# use for t27c. The dispatcher used to look for the binary first and
# refuse to run them on a machine with no build, so this step exists to
# keep that ordering from coming back. There is no compiler in this job,
# which is the whole point.
run: |
./scripts/tri loop-help
./scripts/tri damage specs >/dev/null || true
echo "ok helpers dispatch with no t27c present"
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_01.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_01

// shape: [[]X",
// 52 line(s) in the corpus share this shape
// first seen: specs/tri/pipeline/builder.t27:14
// signals: doubled-bracket,odd-quote
pub struct Damaged {
items : [[]T",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_02.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_02

// shape: [[]X X",
// 37 line(s) in the corpus share this shape
// first seen: specs/tri/pipeline/spec_writer.t27:14
// signals: doubled-bracket,odd-quote
pub struct Damaged {
field_type : [[]Const u8",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_03.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_03

// shape: [[]X [,
// 10 line(s) in the corpus share this shape
// first seen: specs/tri/pipeline/spec_writer.t27:23
// signals: doubled-bracket
pub struct Damaged {
steps : [[]Const [,
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_04.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_04

// shape: [[][,
// 7 line(s) in the corpus share this shape
// first seen: specs/tri/encoding/mime.t27:15
// signals: doubled-bracket
pub struct Damaged {
to : [[][,
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_05.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_05

// shape: [[9]X",
// 5 line(s) in the corpus share this shape
// first seen: specs/tri/crypto/hmac.t27:14
// signals: odd-quote
pub struct Damaged {
opad : [[64]U8",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_06.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_06

// shape: [?[]X X",
// 3 line(s) in the corpus share this shape
// first seen: specs/tri/pipeline/spec_writer.t27:36
// signals: doubled-bracket,odd-quote
pub struct Damaged {
error_msg : [?[]Const u8",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_07.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_07

// shape: [X.X([]X X)",
// 2 line(s) in the corpus share this shape
// first seen: specs/tri/encoding/html.t27:15
// signals: odd-quote
pub struct Damaged {
attributes : [std.StringHashMap([]Const u8)",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_08.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_08

// shape: [[9]?X",
// 2 line(s) in the corpus share this shape
// first seen: specs/tri/trees/octree.t27:24
// signals: odd-quote
pub struct Damaged {
children : [[8]?OctNode",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_09.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_09

// shape: [[]?X",
// 1 line(s) in the corpus share this shape
// first seen: specs/tri/graph/dijkstra.t27:15
// signals: doubled-bracket,odd-quote
pub struct Damaged {
parent : [[]?Usize",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_10.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_10

// shape: [X.X(X, []X)",
// 1 line(s) in the corpus share this shape
// first seen: specs/tri/graph/graph.t27:14
// signals: odd-quote
pub struct Damaged {
nodes : [std.HashMap(T, []T)",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_11.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_11

// shape: [[]?*X",
// 1 line(s) in the corpus share this shape
// first seen: specs/tri/trees/b_tree.t27:15
// signals: doubled-bracket,odd-quote
pub struct Damaged {
children : [[]?*BTreeNode",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_12.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_12

// shape: [[][9,
// 1 line(s) in the corpus share this shape
// first seen: specs/tri/trees/quadtree.t27:23
// signals: doubled-bracket
pub struct Damaged {
points : [[][2,
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_13.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_13

// shape: [[9]?*X",
// 1 line(s) in the corpus share this shape
// first seen: specs/tri/search/aho_corasick.t27:14
// signals: odd-quote
pub struct Damaged {
children : [[256]?*ACTrieNode",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_14.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_14

// shape: [[]X(X, X)",
// 1 line(s) in the corpus share this shape
// first seen: specs/tri/collections/btree.t27:21
// signals: doubled-bracket,odd-quote
pub struct Damaged {
children : [[]BTreeNode(K, V)",
}
9 changes: 9 additions & 0 deletions bootstrap/tests/fixtures/damage/damage_class_15.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module damage_class_15

// shape: [[]?X(X)",
// 1 line(s) in the corpus share this shape
// first seen: specs/tri/collections/skip_list.t27:15
// signals: doubled-bracket,odd-quote
pub struct Damaged {
forward : [[]?SkipNode(T)",
}
15 changes: 15 additions & 0 deletions bootstrap/tests/fixtures/damage_classes/DC-06dafedd.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// damage class DC-06dafedd
// shape: [[]?X",
// lines: 1 in the corpus, across 1 file(s)
// origin: specs/tri/graph/dijkstra.t27:15
// snapshot: 1b5a37b7a89efb782db7efd2ca7af728d4ed48b1c13ac2a35088c7926b16afd9
//
// The damage: the opening quote of the type string was replaced by '['.
// candidate: replace the leading [ with a quote -> "[]?Usize",


// expected: parse-restored

pub const DamageCase = struct {
parent : [[]?Usize",
};
15 changes: 15 additions & 0 deletions bootstrap/tests/fixtures/damage_classes/DC-546b13cd.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// damage class DC-546b13cd
// shape: [[]?*X",
// lines: 1 in the corpus, across 1 file(s)
// origin: specs/tri/trees/b_tree.t27:15
// snapshot: 1b5a37b7a89efb782db7efd2ca7af728d4ed48b1c13ac2a35088c7926b16afd9
//
// The damage: the opening quote of the type string was replaced by '['.
// candidate: replace the leading [ with a quote -> "[]?*BTreeNode",


// expected: parse-restored

pub const DamageCase = struct {
children : [[]?*BTreeNode",
};
15 changes: 15 additions & 0 deletions bootstrap/tests/fixtures/damage_classes/DC-550ec752.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// damage class DC-550ec752
// shape: [X.X([]X X)",
// lines: 2 in the corpus, across 2 file(s)
// origin: specs/tri/encoding/html.t27:15
// snapshot: 1b5a37b7a89efb782db7efd2ca7af728d4ed48b1c13ac2a35088c7926b16afd9
//
// The damage: the opening quote of the type string was replaced by '['.
// candidate: replace the leading [ with a quote -> "std.StringHashMap([]Const u8)",


// expected: parse-restored

pub const DamageCase = struct {
attributes : [std.StringHashMap([]Const u8)",
};
15 changes: 15 additions & 0 deletions bootstrap/tests/fixtures/damage_classes/DC-7247f52e.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// damage class DC-7247f52e
// shape: [[9]X",
// lines: 5 in the corpus, across 4 file(s)
// origin: specs/tri/crypto/hmac.t27:14
// snapshot: 1b5a37b7a89efb782db7efd2ca7af728d4ed48b1c13ac2a35088c7926b16afd9
//
// The damage: the opening quote of the type string was replaced by '['.
// candidate: replace the leading [ with a quote -> "[64]U8",


// expected: parse-restored

pub const DamageCase = struct {
opad : [[64]U8",
};
15 changes: 15 additions & 0 deletions bootstrap/tests/fixtures/damage_classes/DC-72bb7dcf.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// damage class DC-72bb7dcf
// shape: [[]X [,
// lines: 10 in the corpus, across 3 file(s)
// origin: specs/tri/pipeline/spec_writer.t27:23
// snapshot: 1b5a37b7a89efb782db7efd2ca7af728d4ed48b1c13ac2a35088c7926b16afd9
//
// The damage: the opening quote of the type string was replaced by '['.
// candidate: NONE -- substituting the delimiter yields '"[]Const [,',
// which is not a closed string. The type text was truncated as well,
// so the element type is gone and a repair would have to invent it.
// expected: needs-human-language-decision

pub const DamageCase = struct {
steps : [[]Const [,
};
15 changes: 15 additions & 0 deletions bootstrap/tests/fixtures/damage_classes/DC-73be92fd.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// damage class DC-73be92fd
// shape: [[]X(X, X)",
// lines: 1 in the corpus, across 1 file(s)
// origin: specs/tri/collections/btree.t27:21
// snapshot: 1b5a37b7a89efb782db7efd2ca7af728d4ed48b1c13ac2a35088c7926b16afd9
//
// The damage: the opening quote of the type string was replaced by '['.
// candidate: replace the leading [ with a quote -> "[]BTreeNode(K, V)",


// expected: parse-restored

pub const DamageCase = struct {
children : [[]BTreeNode(K, V)",
};
15 changes: 15 additions & 0 deletions bootstrap/tests/fixtures/damage_classes/DC-774471d4.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// damage class DC-774471d4
// shape: [?[]X X",
// lines: 3 in the corpus, across 3 file(s)
// origin: specs/tri/pipeline/spec_writer.t27:36
// snapshot: 1b5a37b7a89efb782db7efd2ca7af728d4ed48b1c13ac2a35088c7926b16afd9
//
// The damage: the opening quote of the type string was replaced by '['.
// candidate: replace the leading [ with a quote -> "?[]Const u8",


// expected: parse-restored

pub const DamageCase = struct {
error_msg : [?[]Const u8",
};
15 changes: 15 additions & 0 deletions bootstrap/tests/fixtures/damage_classes/DC-801c2390.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// damage class DC-801c2390
// shape: [[][9,
// lines: 1 in the corpus, across 1 file(s)
// origin: specs/tri/trees/quadtree.t27:23
// snapshot: 1b5a37b7a89efb782db7efd2ca7af728d4ed48b1c13ac2a35088c7926b16afd9
//
// The damage: the opening quote of the type string was replaced by '['.
// candidate: NONE -- substituting the delimiter yields '"[][2,',
// which is not a closed string. The type text was truncated as well,
// so the element type is gone and a repair would have to invent it.
// expected: needs-human-language-decision

pub const DamageCase = struct {
points : [[][2,
};
15 changes: 15 additions & 0 deletions bootstrap/tests/fixtures/damage_classes/DC-83e0cb30.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// damage class DC-83e0cb30
// shape: [[][,
// lines: 7 in the corpus, across 6 file(s)
// origin: specs/tri/encoding/mime.t27:15
// snapshot: 1b5a37b7a89efb782db7efd2ca7af728d4ed48b1c13ac2a35088c7926b16afd9
//
// The damage: the opening quote of the type string was replaced by '['.
// candidate: NONE -- substituting the delimiter yields '"[][,',
// which is not a closed string. The type text was truncated as well,
// so the element type is gone and a repair would have to invent it.
// expected: needs-human-language-decision

pub const DamageCase = struct {
to : [[][,
};
15 changes: 15 additions & 0 deletions bootstrap/tests/fixtures/damage_classes/DC-ab5c5903.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// damage class DC-ab5c5903
// shape: [[]?X(X)",
// lines: 1 in the corpus, across 1 file(s)
// origin: specs/tri/collections/skip_list.t27:15
// snapshot: 1b5a37b7a89efb782db7efd2ca7af728d4ed48b1c13ac2a35088c7926b16afd9
//
// The damage: the opening quote of the type string was replaced by '['.
// candidate: replace the leading [ with a quote -> "[]?SkipNode(T)",


// expected: parse-restored

pub const DamageCase = struct {
forward : [[]?SkipNode(T)",
};
15 changes: 15 additions & 0 deletions bootstrap/tests/fixtures/damage_classes/DC-b8514836.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// damage class DC-b8514836
// shape: [[]X X",
// lines: 37 in the corpus, across 17 file(s)
// origin: specs/tri/pipeline/spec_writer.t27:14
// snapshot: 1b5a37b7a89efb782db7efd2ca7af728d4ed48b1c13ac2a35088c7926b16afd9
//
// The damage: the opening quote of the type string was replaced by '['.
// candidate: replace the leading [ with a quote -> "[]Const u8",


// expected: parse-restored

pub const DamageCase = struct {
field_type : [[]Const u8",
};
Loading
Loading