Skip to content
Merged
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
10 changes: 8 additions & 2 deletions dev/varka_generated_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -1242,14 +1242,20 @@ def merged(name, b, o, t):
f"22: BLOCKS drifted from the tracked markers: {found}",
)

# The attributes patterns match the files git gives the attributes, and each names one.
# The attributes patterns match the files git gives the attributes, and each names one: a
# generated file, or for a rule of git's union driver alone (the skip list's) a tracked file,
# so that a misspelt attribute still fails here.
tracked = subprocess.run(
["git", "ls-files", "-z"], cwd=root, capture_output=True, text=True
).stdout.split("\0")[:-1]
by_git = git_generated(tracked, None, root) or set()
rules = attribute_rules(lambda p: open(os.path.join(root, p), encoding="utf-8").read())
ours = {p for p in tracked if is_generated(p, rules)}
unused = [g for g, rx, _ in rules if not any(rx.match(p) for p in ours)]
unused = [
g
for g, rx, attrs in rules
if not any(rx.match(p) for p in (tracked if attrs == ["merge=union"] else ours))
]
expect(
ours == by_git - {DOCS} and not unused,
f"22: attributes read unlike git: {sorted(ours ^ (by_git - {DOCS}))[:5]}, {unused}",
Expand Down
20 changes: 19 additions & 1 deletion dev/varka_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,14 +416,21 @@ def rule_skips_tsv(ch):
if SKIPS not in ch.files:
return
options = option_names()
seen = {}
seen, keys = {}, {}
for n, line in enumerate(read(SKIPS).splitlines(), 1):
if not line.strip() or line.startswith("#"):
continue
if line in seen:
yield f"{SKIPS}:{n}: skips-tsv: repeats line {seen[line]}"
continue
seen[line] = n
# Git merges the file by union, which keeps both the old and the new form of a line one
# side edited; the matrix acts on the first fails line for a test and ignores the rest.
key = tuple(line.split("\t")[:3])
if key in keys:
yield f"{SKIPS}:{n}: skips-tsv: names the test of line {keys[key]} again"
continue
keys[key] = n
if not ch.wrote(SKIPS, n):
continue
fields = line.split("\t")
Expand Down Expand Up @@ -991,6 +998,17 @@ def case(name, files, expect_rule, expect):
"skips-tsv:has no test named",
True,
)
case(
"a skip line kept in its old and its edited form, as a union merge leaves it",
{
tables: split,
suite: lic + "class VarkaShapeSuite {}\n",
SKIPS: skip % "a name split across two lines"
+ (skip % "a name split across two lines").replace("the reason", "another"),
},
"skips-tsv:names the test of line",
True,
)
case(
"'task 236' in a Varka file",
{"sql/varka/plans/X.md": "Done in task 236.\n"},
Expand Down
4 changes: 4 additions & 0 deletions sql/varka/.gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
/plans/m8/census.tsv merge=varka-generated
/plans/m8/casts.tsv merge=varka-generated
/plans/m8/casts_fused.tsv merge=varka-generated
# The option matrix's skip list is hand-written and mostly appended to, so git's built-in union
# driver keeps both sides' lines and two branches adding skips never conflict; it needs no
# --install-hook. Union also keeps a line one side removed or edited next to the other's append.
/matrix/skips.tsv merge=union
# Other files a tool writes (VARKA-554): the pull-request size check does not count them, and
# GitHub folds them in a diff. Results files under results/ and benchmarks/ need no line here.
/ci/step-budget.tsv linguist-generated
Expand Down
8 changes: 7 additions & 1 deletion sql/varka/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,13 @@ subject is the defaults' emitted structure takes the tag `PinsDefaults`; a test
whose subject is what C2 makes of a kernel takes `C2Code`, which runs it only
under a configuration that changes what C2 is given (`VarkaMatrixRuns.C2_OPTIONS`);
and an answer test a configuration breaks by design gets a line in
`sql/varka/matrix/skips.tsv` with its reason. A Varka pull request's Build runs
`sql/varka/matrix/skips.tsv` with its reason. A local `git merge` or rebase,
on a branch that has the rule, merges that file with git's union driver, so two
branches appending skips do not conflict (GitHub's own merge check may not use
it). Union also keeps a line one side removed or edited next to the other's
append, so after such a merge run `dev/varka_lint.py sql/varka/matrix/skips.tsv`,
which reads every line and flags a test named twice.
A Varka pull request's Build runs
the suites at the defaults only: its option configurations are checked by the
`varka-option-matrix` workflow dispatched on its branch, which runs all of them,
as the weekly run does. There a configuration
Expand Down