@skillstech/thunderlang 1.0.3 → 1.0.4

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,70 @@
1
+ # 1.0.4
2
+
3
+ - **Fix: no false readings left in the fresh audit outside SQL.** An independent review of 1.0.3 on 32 repositories
4
+ it had never seen (480 non-SQL samples) graded 53 readings false (11%). Each now reads true or is shown as code, and
5
+ each has a regression test (`compiler/test/faithfulness-fresh-*.test.mjs`). What changed:
6
+ - **Endings.** A bare `raise` / `throw;` passes the error on ("Stop: the same error again"), never "Gives back
7
+ raise". Rust gives back its last expression (`Ok(n)`, `Some(v)`, a `match` arm, a value over several lines); Go's
8
+ bare `return` with named results gives back those results; Ruby's last value is shown as given back; R's
9
+ `stop_input_type`, `ui_abort`, `*_abort` and `stop_*` always stop; shell `exec prog` runs prog in place of the
10
+ script (and `exec -a NAME prog` never "Runs -a"). `try … finally` and Swift `do { }` without `catch` no longer
11
+ claim to handle any error. A value given back that could not be put into words says "Gives back `…`".
12
+ - **Structure.** A brace-less `else if` / `else` after a braced `if` keeps its branch (C, C++, Java, JavaScript, …);
13
+ a variable named `end` is a step, not the end of a block; `break` in a `switch` "Leaves the choice", never the
14
+ loop; a check that returns before the rules (`if shape != Line { return shape }`) means the body is read as
15
+ steps, so no rule card drops an answer; a C loop header inside `#if … #endif` no longer marks the steps after
16
+ `#endif` as build-only; Go `if init; a ||\n b {` keeps its whole condition; Go `for {` keeps its body; Rust text
17
+ over several lines is one value, not steps; Ruby calls over several lines are one step.
18
+ - **Values, not yes/no.** `queue || []`, `(@cache[k] ||= {})`, `a << b`, `x.filterIsInstance<T>()` and value-giving
19
+ calls are never worded "whether"; `+=` adds to a total; `== null` / `is None` / `== nil` say null / None / nil,
20
+ never "empty"; Ruby `reject` keeps the items that do not match; a C/C++ function that returns an enum is not a
21
+ yes/no rule; Swift `guard` on a known closure, `guard case T.x = v`, and `for x in xs where c` keep their meaning;
22
+ `strncmp(a, b, n) == 0` (a prefix check) is never said as "a is b".
23
+ - **Literal fidelity.** Quoted text keeps its spaces, case, sign, escapes, and quote characters (`" put '"`,
24
+ `` "`-Inf`" ``, `'"'`, `'\t'`); constants keep their names (`PATH_MAX`, R `.stroke`); shell quotes in a pattern are not
25
+ text; PowerShell lists are never said with fewer items than they have, a backtick-escaped quote inside `$( … )`
26
+ no longer swallows the next line, and a table made with entries is not "an empty table"; shell `$( … )` inside a
27
+ list is one item; a path that goes on past an index is shown as written.
28
+ - **Calls and creation.** `Status s = FindTable(…)` calls FindTable (C++); `Builder::new()….build()` is what build
29
+ makes; a list or table made with items is not "empty"; `static` / `const` in a Rust body names a value; keywords
30
+ (`unsafe`, `using`, `foreach`, `for`, …) are never "called"; `@GetMapping({"/vets"})` is GET /vets; a static
31
+ `Factory::create()` saves nothing; `return md5(…)` gives back what md5 makes; `[ -d "$path" ]` asks about a
32
+ folder; narrowing `static_cast` is kept.
33
+ - **Checker (`compiler/scripts/accuracy.mjs`).** `--seed N` picks samples in a seeded random order (`--only`
34
+ narrows to one language); samples leave out test code (`*.test.ts`, `*_test.go`, `*Tests.swift`, `*Spec.*`, Rust
35
+ `#[cfg(test)]` modules); the polarity self-check no longer flags `!= nullptr`, `!strcmp`, names that contain
36
+ "no"/"not", Rust `matches!`/`cfg!`, TypeScript and Kotlin `!`/`!!`, or regex `(?!…)`, and now catches a question
37
+ turned round at an "is" inside brackets and a Swift `guard` asked by a rule's name; «placeholders», `‹secrets›`
38
+ and "(worked out when it runs)" are not invented values, and a workflow step is checked against its whole block;
39
+ a step the run check cannot build a case for (JSX) is skipped, never a crash (`meaning.mjs` span fix).
40
+
41
+ - **Fix: SQL routines never read falsely.** An independent review of 1.0.3 found half of its SQL readings stated
42
+ something false: an `ELSE`'s `RAISE` shown as an unconditional Stop, steps hoisted out of their `IF`, `CASE`, or
43
+ `FOR`, `ELSIF x = 'id'` read as "Sets x to "id"", `IF v_done THEN LEAVE` read as "Yes: continue", `EXECUTE stmt`
44
+ missing, and `"stack_created"` rewritten as "stack created". Routine bodies are now tokenized and parsed block by
45
+ block (`compiler/src/sql-proc.mjs`) for PL/pgSQL, MySQL/MariaDB stored programs, and T-SQL:
46
+ `IF`/`ELSIF`/`ELSEIF`/`ELSE`, `CASE` (with no `ELSE`, a value that matches no `WHEN` is an error, as the database
47
+ says), `LOOP`/`WHILE`/`FOR`/`FOREACH`/`REPEAT`, labels, `EXIT`/`LEAVE`/`ITERATE`/`CONTINUE`/`BREAK` ("Leaves the
48
+ loop", "Skips to the next round of the loop"), `RAISE`/`SIGNAL`/`THROW`/`RAISERROR` (a `RAISE NOTICE`, a
49
+ severity-10 `RAISERROR`, or `PRINT` is a message, not a Stop; a severity-16 `RAISERROR` outside `TRY` reports the
50
+ error and carries on), `RETURN` / `RETURN NEXT` / `RETURN QUERY` (rows added, "and carries on"; a set-returning
51
+ function's last `RETURN` "Gives back the rows it has added"), `BEGIN … EXCEPTION … END` and `BEGIN TRY … CATCH`,
52
+ `DECLARE … HANDLER`, `PREPARE`/`EXECUTE`/`DEALLOCATE`, cursors, and dynamic SQL (`EXECUTE format('…%I…', x)` →
53
+ "Runs the SQL "…«x as %I»…"").
54
+ - **Faithful words.** Every condition and value passes the faithfulness gate or is shown as code; quoted text is held
55
+ aside and kept exactly (`IN ('create_table')` stays `"create_table"`); `%` in a `RAISE` message pairs with its
56
+ argument as a «placeholder»; two names compared read "is the same as"; `<>` and `NOT IN` are asked as written ("is different from", "is none
57
+ of"), so a NULL lands on the side the code takes; MySQL `/*!50602 … */` versioned comments are read as the
58
+ statements they are, on the versions that run them; a name whose words would read as logic
59
+ (`v_is_default`, `p_control_not_null`) is kept as written; MySQL `@variables` and `@@system` values stay as written.
60
+ A body whose blocks do not match (an `IF` without its `END IF`) is shown as not read, never guessed.
61
+ - **Inputs and spans.** Routine inputs come from a real parameter list (`IN`/`OUT`/`INOUT`, defaults, T-SQL
62
+ `@params` with or without parentheses; `OUT` parameters are what it gives back); every routine and view spans its
63
+ whole definition, not its first line.
64
+ - **T-SQL procedures** (`CREATE`/`ALTER PROCEDURE … AS BEGIN … END`, up to `GO`) are read; **dbt models** (Jinja
65
+ templates) are listed as skipped with the reason, never guessed.
66
+ - Regression tests: `compiler/test/faithfulness-sql.test.mjs`, one case per false reading found.
67
+
1
68
  # 1.0.3
2
69
 
3
70
  - **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.