Repository navigation
Conversation
The decisions of derives Table that need no compiler move to TableRules, a plain object that TableRulesSuite calls directly: the table and column names, the place of the key, and the text of each compile error. No test run executes a macro body, so before this change Stryker4s gave every mutant of TableMacro the status NoCoverage. TableMacro keeps only what needs Quotes, split into methods of complexity 2 or lower. The derived Table and the compile errors are the same. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Four derivations in CapabilitySuite, each asserting the only compile error and its full text: a model with no fields; an id of type Id[Untabled], which a check on the outer type alone would let through; and the two cases where a key refusal and a missing mapping apply to the same model, where the key refusal wins.
The shell picks the FK target of a column with map and getOrElse. The Some outcome was asserted on a derived Table already; this asserts the None one, on every column of Author.
The Expansion scaladoc named the fields as the order of every check, but the key type and the missing mapping are checked while table runs. The claim that no test run executes a macro body was not exact: the compiler runs it while it compiles the test sources, and a suite sees its trees and its compile errors. isKey now says it is a test on the name.
…derivation isKey refuses ID and Id, pinned as it is today. A field of type java.net.URI is refused with the whole noMapping text, through derives Table, which also shows that the two refusal order tests have a second refusal to lose to. The TableRulesSuite scaladoc no longer says no test run sees the macro.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
derives Tableis a macro. Its body runs in the compiler, so no test run executes it. Stryker4s gave every mutant ofTableMacrothe status NoCoverage, and a change to a table name, a column name or the text of a compile error could not be caught by a mutant.What
TableMacrobecomes a thin shell over a new object,TableRules.TableRulesholds the decisions that need no compiler: the table name, the column names, the place of the key (isKey), and the text of each compile error. It is a plain object, private to eezo.TableMacrokeeps only what needsQuotes. Its body is split into methods of complexity 2 or lower.Tableand the compile errors are the same as before. No public API changes.How to review
TableRules.scala(41 lines) first. It is the full list of decisions.TableMacro.scalaand check that each remaining method only talks to the compiler.TableRulesSuitecallsTableRulesdirectly.CapabilitySuitepins four refused derivations by their only compile error and its whole text: a model with no fields; an id of typeId[Untabled]; and the two cases where a key refusal and a missing mapping apply to the same model, where the key refusal wins.TableDerivationSuiteasserts that a column that is not aRefhas no FK target.isKeyrefusesIDandId, pinned as it is today. A field of typejava.net.URIis refused with the whole missing mapping text.The commits are small and can be read one at a time.
How it was tested
bin/gateis green on this branch, rebased ondevat0444b6e, with JDK 25. Thedbmodule has 383 tests, all green.🤖 Generated with Claude Code