From 9d99cc83cd0c5ddd5001f2031f5faf5d9fecfb66 Mon Sep 17 00:00:00 2001 From: t Date: Sun, 22 Nov 2026 19:33:09 +0100 Subject: [PATCH 1/2] [VARKA] Merge sql/varka/matrix/skips.tsv by union, so appended skip lines do not conflict Two branches that each append a line to the option matrix's skip list conflicted at the file's end (#1619 and #1617 on 22 Nov 2026). sql/varka/.gitattributes now gives the file git's built-in union driver. The generated-file driver's self-test accepts a rule that marks no file generated, as long as it names a tracked file. AGENTS.md says what union keeps. Generated-by: Claude Code (Claude Opus 5.5) --- dev/varka_generated_merge.py | 13 +++++++++++-- sql/varka/.gitattributes | 4 ++++ sql/varka/AGENTS.md | 6 +++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/dev/varka_generated_merge.py b/dev/varka_generated_merge.py index 45a83d790c4f6..c405d7cfaec58 100755 --- a/dev/varka_generated_merge.py +++ b/dev/varka_generated_merge.py @@ -1242,14 +1242,23 @@ 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 that marks none (the skip list's merge=union) a tracked file. 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)] + + def marks(attrs): + return marks_generated(attribute_values("", [("", re.compile(""), attrs)])) + + unused = [ + g + for g, rx, attrs in rules + if not any(rx.match(p) for p in (ours if marks(attrs) else tracked)) + ] expect( ours == by_git - {DOCS} and not unused, f"22: attributes read unlike git: {sorted(ours ^ (by_git - {DOCS}))[:5]}, {unused}", diff --git a/sql/varka/.gitattributes b/sql/varka/.gitattributes index 67eba05cf1844..3fc953fafb48b 100644 --- a/sql/varka/.gitattributes +++ b/sql/varka/.gitattributes @@ -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 diff --git a/sql/varka/AGENTS.md b/sql/varka/AGENTS.md index bfc0fbcd805fb..0b05a9a638893 100644 --- a/sql/varka/AGENTS.md +++ b/sql/varka/AGENTS.md @@ -178,7 +178,11 @@ 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. Git merges that file with its +union driver, so two branches appending skips never conflict; but union also +brings back a line one side removed or edited, so after such a merge check the +file by hand and with `dev/varka_lint.py sql/varka/matrix/skips.tsv`, which +reads every line. 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 From 97b17502cbccaa19a900008d8225ef1cd52784cb Mon Sep 17 00:00:00 2001 From: t Date: Sun, 22 Nov 2026 19:51:35 +0100 Subject: [PATCH 2/2] [VARKA] Keep the attributes self-test strict and flag a skip line kept twice The self-test's tracked-file fallback now takes a merge=union rule only, so a misspelt attribute on a generated file still fails it. The skip list's lint flags a second line for the same configuration, suite and test, the form a union merge leaves when one side edits a line beside the other's append. AGENTS.md says the rule acts on local merges only. Generated-by: Claude Code (Claude Opus 5.5) --- dev/varka_generated_merge.py | 9 +++------ dev/varka_lint.py | 20 +++++++++++++++++++- sql/varka/AGENTS.md | 12 +++++++----- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/dev/varka_generated_merge.py b/dev/varka_generated_merge.py index c405d7cfaec58..c7121f61c9a65 100755 --- a/dev/varka_generated_merge.py +++ b/dev/varka_generated_merge.py @@ -1243,21 +1243,18 @@ def merged(name, b, o, t): ) # The attributes patterns match the files git gives the attributes, and each names one: a - # generated file, or for a rule that marks none (the skip list's merge=union) a tracked file. + # 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)} - - def marks(attrs): - return marks_generated(attribute_values("", [("", re.compile(""), attrs)])) - unused = [ g for g, rx, attrs in rules - if not any(rx.match(p) for p in (ours if marks(attrs) else tracked)) + if not any(rx.match(p) for p in (tracked if attrs == ["merge=union"] else ours)) ] expect( ours == by_git - {DOCS} and not unused, diff --git a/dev/varka_lint.py b/dev/varka_lint.py index 8543963c1ddaf..25abd7741ad9d 100755 --- a/dev/varka_lint.py +++ b/dev/varka_lint.py @@ -416,7 +416,7 @@ 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 @@ -424,6 +424,13 @@ def rule_skips_tsv(ch): 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") @@ -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"}, diff --git a/sql/varka/AGENTS.md b/sql/varka/AGENTS.md index 0b05a9a638893..e94a12f6a8c02 100644 --- a/sql/varka/AGENTS.md +++ b/sql/varka/AGENTS.md @@ -178,11 +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. Git merges that file with its -union driver, so two branches appending skips never conflict; but union also -brings back a line one side removed or edited, so after such a merge check the -file by hand and with `dev/varka_lint.py sql/varka/matrix/skips.tsv`, which -reads every line. 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