@skillstech/thunderlang 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +207 -0
  2. package/dist/core.cjs +13779 -10043
  3. package/dist/index.cjs +28500 -24392
  4. package/dist/learn.cjs +12853 -9579
  5. package/intent-graph.schema.json +11 -0
  6. package/package.json +6 -2
  7. package/src/cli.mjs +141 -58
  8. package/src/codegen.mjs +145 -55
  9. package/src/conformance.mjs +15 -6
  10. package/src/core/check.mjs +725 -0
  11. package/src/core/cli.mjs +133 -0
  12. package/src/core/diagnostics.mjs +81 -0
  13. package/src/core/format.mjs +20 -0
  14. package/src/core/from-python.mjs +645 -0
  15. package/src/core/index.mjs +38 -0
  16. package/src/core/lexer.mjs +115 -0
  17. package/src/core/parser.mjs +742 -0
  18. package/src/core/project.mjs +167 -0
  19. package/src/core/round-trip.mjs +150 -0
  20. package/src/core/runtime-python.mjs +801 -0
  21. package/src/core/target-python.mjs +486 -0
  22. package/src/core.d.ts +5 -2
  23. package/src/core.mjs +5 -2
  24. package/src/data-schema.mjs +8 -1
  25. package/src/emit.mjs +1 -1
  26. package/src/evidence.mjs +1 -1
  27. package/src/expr.mjs +81 -4
  28. package/src/form-words.mjs +2 -0
  29. package/src/index.d.ts +8 -1
  30. package/src/index.mjs +5 -1
  31. package/src/intent-schema.mjs +1 -0
  32. package/src/libraries.mjs +2 -2
  33. package/src/mcp.mjs +23 -0
  34. package/src/meaning.mjs +47 -7
  35. package/src/model.d.mts +7 -3
  36. package/src/model.mjs +30 -9
  37. package/src/money.d.mts +18 -0
  38. package/src/money.mjs +124 -0
  39. package/src/plain-contract.mjs +18 -2
  40. package/src/powershell.mjs +24 -5
  41. package/src/read-repo.mjs +1 -0
  42. package/src/read.d.mts +11 -0
  43. package/src/read.mjs +121 -13
  44. package/src/review-comment.d.mts +16 -0
  45. package/src/review-comment.mjs +145 -0
  46. package/src/rlang.mjs +10 -3
  47. package/src/say-less.mjs +1432 -0
  48. package/src/shell.mjs +45 -8
  49. package/src/sql-proc.mjs +1198 -0
  50. package/src/sql.mjs +87 -119
  51. package/src/steps.mjs +188 -37
  52. package/src/system.mjs +153 -44
  53. package/src/target-cs.mjs +39 -34
  54. package/src/target-elixir.mjs +40 -30
  55. package/src/target-go.mjs +41 -36
  56. package/src/target-java.mjs +34 -27
  57. package/src/target-kotlin.mjs +43 -35
  58. package/src/target-py.mjs +57 -55
  59. package/src/target-result.d.mts +48 -0
  60. package/src/target-result.mjs +112 -0
  61. package/src/target-rust.mjs +42 -38
  62. package/src/target-scala.mjs +45 -35
  63. package/src/target-ts.mjs +37 -45
  64. package/src/target-types.mjs +41 -5
  65. package/src/target-util.mjs +55 -2
  66. package/src/trace-cli.mjs +58 -0
  67. package/src/trace-fs.mjs +76 -0
  68. package/src/trace.mjs +261 -0
  69. package/src/translate.d.mts +3 -0
  70. package/src/translate.mjs +62 -32
  71. package/src/why-cli.mjs +31 -0
  72. package/src/why.d.mts +28 -0
  73. package/src/why.mjs +532 -0
  74. package/src/write-steps.mjs +22 -5
package/CHANGELOG.md CHANGED
@@ -1,3 +1,210 @@
1
+ # 1.1.0
2
+
3
+ - **Thunder Why: what an AI agent did, in plain words.** `thunder why run.json` reads an agent run's OpenTelemetry
4
+ record and says what the agent was asked and answered, what went wrong, what happened just before, what would have
5
+ changed the outcome, and what it changed, with every step in order. It reads OTLP JSON, the collector's file
6
+ exporter, the Python console exporter, and OpenInference span arrays, with the GenAI, OpenInference, HTTP, and
7
+ database conventions. Retries are one step ("3 tries"); a failed change is never reported as done; a tool whose
8
+ name doesn't say whether it changes anything is listed as "could not judge". Errors are in plain words, with the
9
+ original kept in the details. Values that look like secrets are hidden. `--step n` shows one step in full;
10
+ `--json` gives the same as data. Nothing is run and no AI is used. Also available as `@skillstech/thunderlang/why`.
11
+ - **Inputs with defaults.** `Receive price and rate (7% if not given)`: a call may leave the input out. A default
12
+ is a fixed value: a number, money, a percent, text, yes/no, `nothing`, or a kept value. It comes after the inputs
13
+ without one. A list or map default is an error (TC404), because Python would share it between calls. `--as-core`
14
+ reads Python's fixed defaults (`rate=0.07`, `label="x"`, `flag=None`, `rate=TAX`) this way, and still refuses list,
15
+ dict, and computed defaults. Real Python (150 files): 240 → 261 exact functions. Core text also accepts `\r`.
16
+ - **Core's standard operations for text, lists, numbers, and JSON.** The new forms:
17
+ - text: `names joined with ", "`, `line split at ","`, `the parts of text`, `date replacing "-" with "/"`,
18
+ `name starts with "Dr"`, `file ends with ".csv"`;
19
+ - lists and numbers: `scores sorted` and `sorted descending`, `the absolute value of x`;
20
+ - JSON: `the JSON data in text`, which reads numbers exactly, and `the JSON text of value`.
21
+ Each checks its kinds: before running when known, while running otherwise. Invalid JSON stops with TC509. The
22
+ words `joined`, `split`, `replacing`, `starts`, and `ends` now belong to Thunder and cannot be part of a name.
23
+ `--as-core` reads Python's `join`, `split`, `replace`, `startswith`/`endswith`, `abs`, `max`/`min` of several
24
+ values, `sorted(xs)`, `list()`, `dict()`, and `json.loads`/`json.dumps` (only when the file imports `json`) as
25
+ these forms. A call whose meaning differs is still refused: `maxsplit`, a replace count, a tuple of prefixes, or
26
+ `key=`. The benchmark's exact functions rose to 19 of 20, and all 19 give the same results as the original.
27
+ - **Methods read as Core.** `thunder read <file.py> --as-core` now prints each method of a class as a Core function
28
+ that receives the object first (`To Account withdraw:` / `Receive self and amount`). `self.other()` calls that
29
+ class's own function, and this is written down as an assumption, since a subclass could replace it. Static methods
30
+ are printed as plain functions. Special methods, inner functions, and `self.other()` calls the class does not
31
+ define are refused. The round trip now runs methods too, and compares the object afterwards. Benchmark:
32
+ `Account` 6 of 6 and `Cart` 4 of 5 methods printed exactly, all giving the same results. On 150 real Python
33
+ files, exact functions rose from 66 to 236 (3% to 12%), and every file's Core still compiles.
34
+ - **Fix (Core): changing a field or an entry whose kind is not known.** `Add 3 to box's items`, `Increase box's count
35
+ by 1`, and `Set xs at 1 to v` on a value from Python compiled to invalid Python (`get_field(...) = …`) or set the
36
+ wrong list position (`xs[1]` for Core's position 1). They now read and store through the same helpers as `Set`.
37
+ Reading `pair at 1` works on a Python tuple.
38
+ - **Read Python as Thunder Core: reading and writing are one language.** `thunder read <file.py> --as-core` prints
39
+ the reader's meaning tree as Core you can edit, compile, and run. It never prints from the English. A line Core
40
+ cannot say with the same meaning becomes `# Not translated (line N): <why>` plus a `Stop with` line. Such a
41
+ function is reported as not safely editable; Thunder never rewrites a line into something close. Assumptions are
42
+ written next to the line. The output always compiles. On the 20-function benchmark (`docs/core-read-write.md`),
43
+ the printed Core compiles 20 of 20, is exact 18 of 20, and the 18 exact ones give the same results as the
44
+ original Python on 52 of 52 sample inputs, checked by running both (`verifyRoundTrip`, `compiler/src/core/round-trip.mjs`).
45
+ - **Core is strict about yes/no and exact with Python floats.** A condition, `and`/`or`/`not`, or a comparison with
46
+ `true`/`false` on a value of unknown kind now checks it is yes/no while running. `1` or `"yes"` stops with a
47
+ clear error instead of being treated as true or false. A Python float reaching Core arithmetic or a comparison
48
+ becomes the exact decimal it is written as (`19.99`). Before, `float * Decimal` crashed, and a float `0.1`
49
+ compared as more than `0.1`.
50
+ - **Thunder Trace: how your repositories depend on each other.** `thunder trace <folder…>` links HTTP requests to
51
+ the routes that handle them and published events to their listeners, across repositories, and cites every link
52
+ `repo@sha:file:line`. `thunder trace impact "<route | event | repo:file[:line]>" <folder…>` and
53
+ `thunder trace impact --diff [--base ref] <folder…>` list what a change can affect, ranked high/medium/low, one
54
+ hop out. A route or event that was removed is caught by reading each changed file as it was before. Links are made
55
+ only on a fact: `/health`-style paths, paths with no fixed part, and two equal matches are never linked, and each
56
+ is listed with the reason. The graph (`thunder-trace-v1`) is fingerprinted. The MCP server offers it as
57
+ `intent_trace` (local only). Reference: `docs/trace.md`.
58
+ - **Routes include their controller's prefix.** ASP.NET `[Route("api/[controller]")]` and Spring
59
+ `@RequestMapping("/api")` on a class now prefix each handler's path (`POST /api/Orders`, not `POST`). An ASP.NET
60
+ path with no prefix now starts at the root (`/docs/{id}`).
61
+ - **Thunder Core: write a program in Thunder and run it (Python first).** `thunder new <dir>` creates a project
62
+ (`thunder.toml`, `src/main.thunder`, `tests/`); `thunder run`, `build`, `test`, `check` and `format` work in it,
63
+ or on one file with `--core`. Core has values, kept values, functions, conditions, loops, lists, maps, records with
64
+ `Never allow` rules, `If this fails:`, tests, and `Use <python module>` to reach the Python ecosystem. It compiles
65
+ to readable Python 3.10+ plus a standard-library-only `thunder_runtime.py`: division and money are exact, rounding
66
+ is half up, positions start at 1, `nothing` is never silently a value, and every failure names the Thunder line
67
+ (TC5xx). The site's playground example (several `Receive` lines, `yes or no`, a condition continued on an
68
+ `and …` line) compiles and runs as written. Reference: `docs/core.md`. Demos: `examples/core/`. Python is the only
69
+ target so far.
70
+ - **`thunder new` now creates a Core project.** For an intent mission file, use `thunder init <Name>` (or
71
+ `thunder new --mission <Name>`); `thunder new` says so when it runs.
72
+ - **Fix: a rule Thunder cannot translate never becomes `false`.** The scaffolds (`thunder gen`, all four targets),
73
+ the executable targets (TypeScript, Python, C#, Java, Go, Rust, Kotlin, Scala, Elixir) and the in-browser
74
+ translator used to replace an untranslatable rule condition with `false` (Python with no note at all), so generated
75
+ or executed code silently skipped that rule and returned another answer. Now generation reports the new diagnostic
76
+ **`IL-GEN-001`** ("Thunder could not translate the condition '…' for <target>: <reason>"), `thunder gen` prints it
77
+ on stderr and exits 1, the generated rule throws with that message (`throw new Error(...)`,
78
+ `raise NotImplementedError(...)`), and `thunder test --target`, `--all-targets` and `thunder conform --run` refuse
79
+ to run that decision and report its cases as *not translated*, never as an answer. New API:
80
+ `generateWithDiagnostics(ast, target)` and `translateDecisionsWithDiagnostics(ast, lang)`.
81
+ - **Fix: Money is exact, never binary floating point.** `Money` is a decimal with 2 minor units (or the currency's:
82
+ `Money(JPY)` 0, `Money(KWD)` 3); extra precision is an error, never rounded; rounding, where a spec asks, is half
83
+ up (a half goes away from zero), the same rule as Thunder Core's `round`. TypeScript Money was `number`; it is now `bigint` minor units with a generated zero-dependency
84
+ `parseMoney` / `formatMoney` helper. Python Money was `float`; it is now `decimal.Decimal`. Decision inputs typed
85
+ `Money` were `double`/`float64`/`f64` in every target; they are now `decimal` (C#), `BigDecimal` (Java), `int64`
86
+ (Go) and `i64` (Rust) minor units, and a Money comparison a target cannot do exactly (Kotlin, Scala, Elixir, or
87
+ multiplying Money) is refused with `IL-GEN-001`. The decision engine adds, subtracts and multiplies decimals
88
+ exactly, so `0.1 + 0.2 == 0.3`. Plain contracts read `$12.30` as exact cents (and show `$12.30`, not `$12.3`), and
89
+ reject `$12.305` instead of rounding it. JSON Schema / OpenAPI describe Money as a decimal string, not a number.
90
+ See "Money is exact" in `docs/spec.md`.
91
+ - **Fix: a failed run is never a `null` answer.** The live target runners turned a missing toolchain, a compile
92
+ failure, a crash or a timeout into `null` (and Python turned an exception into `None`), so a real null answer
93
+ looked the same as a failure. Each run now returns `{ status: 'ok', results }` with one
94
+ `{ status: 'ok', value }` or `{ status: 'error', kind, message }` per case (`kind`: `missing-toolchain`,
95
+ `compile-failed`, `runtime-error`, `timeout`, `assertion-failed`, `not-translated`, `missing-input`), or a whole-run
96
+ `{ status: 'error', kind, message }`. `thunder test --target` / `--all-targets` and `thunder conform` show
97
+ `ERROR` with the kind and reason (and fail the run); a missing toolchain is still skipped. Conformance evidence
98
+ counts an error as a failure. Types: `compiler/src/target-result.d.mts`. The playground's Code tab lists any rule
99
+ that was not translated.
100
+ - **Fix: a case is never run with a made-up input.** A test case that left out an input was run in Java, Go, Rust
101
+ and the others with `0`, `false`, `""` (or `$0` for Money), so a typed target answered for a value nobody wrote and
102
+ its FAIL blamed the target (Python crashed instead). Every target now reports such a case as `missing-input`,
103
+ naming the inputs to add. Target names print as TypeScript and C# (not Typescript and Csharp).
104
+ - **Say less: words only where Thunder is sure (`src/say-less.mjs`).** Every worded step is now checked after it is
105
+ read, and a step stays in words only when its form is recognized and the words account for its code (every word from
106
+ the code or Thunder's own wording, every value exact, no negation, and/or, comparison, arithmetic, cast, or named
107
+ argument part dropped, no ambiguous names, recognized endings, certain block structure, inputs from the signature).
108
+ Anything else is shown as its code, exactly as written. On new repositories graded independently the false rate fell
109
+ from 10.4% to 3–4% (target 1% not yet reached; see docs/accuracy.md); steps explained fell from 90.0% to 81.7%.
110
+ - **New fields (OpenThunder):** every step and flow node has `explained` and, when false, `notExplainedWhy`;
111
+ functions and members have `explainedSteps` / `totalSteps`; the model has `explainedSteps` / `totalSteps`.
112
+ - **C and C++ meaning trees:** `->`, unary `*` / `&`, C casts, typed and array declarations, `struct` / `static`
113
+ declarations, C++ template calls (`static_cast<T>(x)` is a call, never a comparison), range-for with `const auto&`.
114
+ Swift `try f()` is an expression, not a try block.
115
+ - **Rules** are drawn only for a certain yes/no answer (`state.copy_ || state.base_` is not a rule); **doc comments**
116
+ only from the `/** … */` right above a function (a `/*#__PURE__*/` no longer pulls in another function's doc).
117
+ - **Reviews:** a question's two sides keep quoted text exactly (`hasattr(fp, "read")`, never `hasattr(fp, 0)`).
118
+ - A length reads one way: "the length of password" (never "how many password").
119
+ - `scripts/form-words.mjs` regenerates the readers' fixed wording list; `SAYLESS_DEBUG=1` prints why each step was
120
+ shown as code.
121
+ - Tests changed only where a reading correctly became code: gin#13 (an `if` with a setup statement other than the
122
+ err idiom), ripgrep#3 (a loop over a pattern), Kingfisher#2 / Alamofire#3 (`guard case`), Rectangle#5 (`for …
123
+ where`), nvm#18 (`test && cmd || other`), neofetch#3 and nvm#2 (`ls` alone is not "the files in ".""), #179
124
+ (`out var`), vapor#8 (a closure with a capture list), the Swift `if let …, cond` reading, httr#19 (quotes inside a
125
+ value), jquery#15 (`queue || []` is not "when that has no value"), #165 (the shown code is the source as written),
126
+ and four expectations of "how many x" that now read "the length of x".
127
+ - **Fix (writing in Thunder):** an inline route handler's own model id (`auth.ts##POST/api/auth/register#3`) now resolves in `thunderWrite`, and `says` names only the changed step, once, when a one-line `if` holds several steps. Reported by OpenThunder.
128
+ - **Thunder review on every pull request (GitHub Action).** `uses: SkillsTechTalk/thunderlang@main` (the repository's
129
+ root `action.yml`) runs `thunder review` on the pull request's two commits with the published compiler, writes the
130
+ review to the job summary, and keeps one pull request comment up to date (found by `<!-- thunder-review -->`), with
131
+ the workflow's own `GITHUB_TOKEN`. Inputs: `base`, `head`, `comment`, `fail-on` (none | risk), `paths` (globs),
132
+ `version`. Pull requests from forks get the job summary only, and it says why; `pull_request_target` is never
133
+ needed. Runs in your CI: no code leaves GitHub, no AI. Docs: `docs/github-action.md`. The `.thunder` check action
134
+ moved to `SkillsTechTalk/thunderlang/check` (the old root action pointed at a package name that does not exist).
135
+ - **`renderReviewComment(review)`** (core, browser-safe): the comment, grouped by changed action, rule, or function,
136
+ risks first, with honest counts (explained in sentences, shown as code, Thunder cannot check), a link to
137
+ thunderlang.dev, and a size cap that leaves out whole entries and says "N more not shown".
138
+ - **`thunder review --base <ref> --head <ref> --format markdown|json --paths <glob,...>`**: flag forms of the existing
139
+ positional arguments and `--json`, and `--paths` to review only matching files.
140
+
141
+ # 1.0.4
142
+
143
+ - **Fix: no false readings left in the fresh audit outside SQL.** An independent review of 1.0.3 on 32 repositories
144
+ it had never seen (480 non-SQL samples) graded 53 readings false (11%). Each now reads true or is shown as code, and
145
+ each has a regression test (`compiler/test/faithfulness-fresh-*.test.mjs`). What changed:
146
+ - **Endings.** A bare `raise` / `throw;` passes the error on ("Stop: the same error again"), never "Gives back
147
+ raise". Rust gives back its last expression (`Ok(n)`, `Some(v)`, a `match` arm, a value over several lines); Go's
148
+ bare `return` with named results gives back those results; Ruby's last value is shown as given back; R's
149
+ `stop_input_type`, `ui_abort`, `*_abort` and `stop_*` always stop; shell `exec prog` runs prog in place of the
150
+ script (and `exec -a NAME prog` never "Runs -a"). `try … finally` and Swift `do { }` without `catch` no longer
151
+ claim to handle any error. A value given back that could not be put into words says "Gives back `…`".
152
+ - **Structure.** A brace-less `else if` / `else` after a braced `if` keeps its branch (C, C++, Java, JavaScript, …);
153
+ a variable named `end` is a step, not the end of a block; `break` in a `switch` "Leaves the choice", never the
154
+ loop; a check that returns before the rules (`if shape != Line { return shape }`) means the body is read as
155
+ steps, so no rule card drops an answer; a C loop header inside `#if … #endif` no longer marks the steps after
156
+ `#endif` as build-only; Go `if init; a ||\n b {` keeps its whole condition; Go `for {` keeps its body; Rust text
157
+ over several lines is one value, not steps; Ruby calls over several lines are one step.
158
+ - **Values, not yes/no.** `queue || []`, `(@cache[k] ||= {})`, `a << b`, `x.filterIsInstance<T>()` and value-giving
159
+ calls are never worded "whether"; `+=` adds to a total; `== null` / `is None` / `== nil` say null / None / nil,
160
+ never "empty"; Ruby `reject` keeps the items that do not match; a C/C++ function that returns an enum is not a
161
+ yes/no rule; Swift `guard` on a known closure, `guard case T.x = v`, and `for x in xs where c` keep their meaning;
162
+ `strncmp(a, b, n) == 0` (a prefix check) is never said as "a is b".
163
+ - **Literal fidelity.** Quoted text keeps its spaces, case, sign, escapes, and quote characters (`" put '"`,
164
+ `` "`-Inf`" ``, `'"'`, `'\t'`); constants keep their names (`PATH_MAX`, R `.stroke`); shell quotes in a pattern are not
165
+ text; PowerShell lists are never said with fewer items than they have, a backtick-escaped quote inside `$( … )`
166
+ no longer swallows the next line, and a table made with entries is not "an empty table"; shell `$( … )` inside a
167
+ list is one item; a path that goes on past an index is shown as written.
168
+ - **Calls and creation.** `Status s = FindTable(…)` calls FindTable (C++); `Builder::new()….build()` is what build
169
+ makes; a list or table made with items is not "empty"; `static` / `const` in a Rust body names a value; keywords
170
+ (`unsafe`, `using`, `foreach`, `for`, …) are never "called"; `@GetMapping({"/vets"})` is GET /vets; a static
171
+ `Factory::create()` saves nothing; `return md5(…)` gives back what md5 makes; `[ -d "$path" ]` asks about a
172
+ folder; narrowing `static_cast` is kept.
173
+ - **Checker (`compiler/scripts/accuracy.mjs`).** `--seed N` picks samples in a seeded random order (`--only`
174
+ narrows to one language); samples leave out test code (`*.test.ts`, `*_test.go`, `*Tests.swift`, `*Spec.*`, Rust
175
+ `#[cfg(test)]` modules); the polarity self-check no longer flags `!= nullptr`, `!strcmp`, names that contain
176
+ "no"/"not", Rust `matches!`/`cfg!`, TypeScript and Kotlin `!`/`!!`, or regex `(?!…)`, and now catches a question
177
+ turned round at an "is" inside brackets and a Swift `guard` asked by a rule's name; «placeholders», `‹secrets›`
178
+ and "(worked out when it runs)" are not invented values, and a workflow step is checked against its whole block;
179
+ a step the run check cannot build a case for (JSX) is skipped, never a crash (`meaning.mjs` span fix).
180
+
181
+ - **Fix: SQL routines never read falsely.** An independent review of 1.0.3 found half of its SQL readings stated
182
+ something false: an `ELSE`'s `RAISE` shown as an unconditional Stop, steps hoisted out of their `IF`, `CASE`, or
183
+ `FOR`, `ELSIF x = 'id'` read as "Sets x to "id"", `IF v_done THEN LEAVE` read as "Yes: continue", `EXECUTE stmt`
184
+ missing, and `"stack_created"` rewritten as "stack created". Routine bodies are now tokenized and parsed block by
185
+ block (`compiler/src/sql-proc.mjs`) for PL/pgSQL, MySQL/MariaDB stored programs, and T-SQL:
186
+ `IF`/`ELSIF`/`ELSEIF`/`ELSE`, `CASE` (with no `ELSE`, a value that matches no `WHEN` is an error, as the database
187
+ says), `LOOP`/`WHILE`/`FOR`/`FOREACH`/`REPEAT`, labels, `EXIT`/`LEAVE`/`ITERATE`/`CONTINUE`/`BREAK` ("Leaves the
188
+ loop", "Skips to the next round of the loop"), `RAISE`/`SIGNAL`/`THROW`/`RAISERROR` (a `RAISE NOTICE`, a
189
+ severity-10 `RAISERROR`, or `PRINT` is a message, not a Stop; a severity-16 `RAISERROR` outside `TRY` reports the
190
+ error and carries on), `RETURN` / `RETURN NEXT` / `RETURN QUERY` (rows added, "and carries on"; a set-returning
191
+ function's last `RETURN` "Gives back the rows it has added"), `BEGIN … EXCEPTION … END` and `BEGIN TRY … CATCH`,
192
+ `DECLARE … HANDLER`, `PREPARE`/`EXECUTE`/`DEALLOCATE`, cursors, and dynamic SQL (`EXECUTE format('…%I…', x)` →
193
+ "Runs the SQL "…«x as %I»…"").
194
+ - **Faithful words.** Every condition and value passes the faithfulness gate or is shown as code; quoted text is held
195
+ aside and kept exactly (`IN ('create_table')` stays `"create_table"`); `%` in a `RAISE` message pairs with its
196
+ argument as a «placeholder»; two names compared read "is the same as"; `<>` and `NOT IN` are asked as written ("is different from", "is none
197
+ of"), so a NULL lands on the side the code takes; MySQL `/*!50602 … */` versioned comments are read as the
198
+ statements they are, on the versions that run them; a name whose words would read as logic
199
+ (`v_is_default`, `p_control_not_null`) is kept as written; MySQL `@variables` and `@@system` values stay as written.
200
+ A body whose blocks do not match (an `IF` without its `END IF`) is shown as not read, never guessed.
201
+ - **Inputs and spans.** Routine inputs come from a real parameter list (`IN`/`OUT`/`INOUT`, defaults, T-SQL
202
+ `@params` with or without parentheses; `OUT` parameters are what it gives back); every routine and view spans its
203
+ whole definition, not its first line.
204
+ - **T-SQL procedures** (`CREATE`/`ALTER PROCEDURE … AS BEGIN … END`, up to `GO`) are read; **dbt models** (Jinja
205
+ templates) are listed as skipped with the reason, never guessed.
206
+ - Regression tests: `compiler/test/faithfulness-sql.test.mjs`, one case per false reading found.
207
+
1
208
  # 1.0.3
2
209
 
3
210
  - **Version:** ThunderLang now shares OpenThunder's version number, so the two always go together. 1.0.3 has the same contents as 0.5.12; nothing in the language or the compiler changed.