@hublo/sentinel 1.7.0-alpha.20 → 1.7.0-alpha.22
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/dist/bin/sentinel.js +3 -3
- package/dist/{chunk-B3Y7F7BA.js → chunk-VSUHHETH.js} +1648 -1482
- package/dist/index.js +2 -2
- package/dist/{validate-B5567Z7X.js → validate-IES226NX.js} +1 -1
- package/docs/sql-adoption.md +24 -3
- package/package.json +1 -1
- package/dist/{chunk-AVT5FSPO.js → chunk-F3Q3JQJ6.js} +1 -1
package/dist/index.js
CHANGED
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
registerAdapters,
|
|
7
7
|
resolve,
|
|
8
8
|
setDefaultRunner
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VSUHHETH.js";
|
|
10
10
|
import {
|
|
11
11
|
BaseAdapter
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-F3Q3JQJ6.js";
|
|
13
13
|
import "./chunk-JT7ZMH44.js";
|
|
14
14
|
import "./chunk-LX7EG6PJ.js";
|
|
15
15
|
import "./chunk-NGLEGAEN.js";
|
package/docs/sql-adoption.md
CHANGED
|
@@ -140,11 +140,12 @@ which a module may turn off) and the 2 timeouts the key calls for.
|
|
|
140
140
|
| squawk 2.72.0, its opt-in rules | 26 | no: one runs once the module gives it a level |
|
|
141
141
|
| sentinel, `unsafe-sql-pasted-value` and `unsafe-sql-raw-fragment` | 2 | **yes**, at `warn` |
|
|
142
142
|
| sentinel, `applied-migration-changed` | 1 | **yes**, at `warn` |
|
|
143
|
+
| sentinel, `enum-value-used-before-commit` | 1 | **yes**, at `warn` |
|
|
143
144
|
|
|
144
|
-
**
|
|
145
|
+
**54 rules run on every module**, the set squawk itself runs, plus sentinel's four. sentinel turns
|
|
145
146
|
no squawk rule off and turns no opt-in rule on: the choice of what runs by default is squawk's, and
|
|
146
|
-
a module moves it in its own config. `pnpm exec sentinel --inspect --sql --json` lists all
|
|
147
|
-
with the level each has in this module: squawk's 76, sentinel's
|
|
147
|
+
a module moves it in its own config. `pnpm exec sentinel --inspect --sql --json` lists all 81 names
|
|
148
|
+
with the level each has in this module: squawk's 76, sentinel's four, and `syntax-error`.
|
|
148
149
|
|
|
149
150
|
**A migration that does not parse** is reported first, with its first error (the ones squawk gives
|
|
150
151
|
after it follow from it), and counts as **one finding** under `syntax-error`, at `warn` like every
|
|
@@ -405,6 +406,26 @@ modifications, 34 deletions), and the role agreed with the oracle on all 60. Two
|
|
|
405
406
|
were renames that also changed the text: the old name is gone, and the new folder is a migration
|
|
406
407
|
Prisma has never seen, read as such.
|
|
407
408
|
|
|
409
|
+
## A new enum value used before it is committed, `enum-value-used-before-commit`
|
|
410
|
+
|
|
411
|
+
`ALTER TYPE "Status" ADD VALUE 'ARCHIVED'` then a use of `'ARCHIVED'` in the same migration: Prisma
|
|
412
|
+
runs a migration of several statements in one transaction, and PostgreSQL refuses a new enum value
|
|
413
|
+
before it is committed. Proven on PostgreSQL 16.8 with Prisma 6.19.3: the deploy fails with **P3018 /
|
|
414
|
+
55P04** "unsafe use of new value", and every next deploy is refused until `prisma migrate resolve`.
|
|
415
|
+
squawk 2.72.0 does not see it.
|
|
416
|
+
|
|
417
|
+
| In the same migration, after the `ADD VALUE` | At deploy (proven) | Reported |
|
|
418
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------- |
|
|
419
|
+
| `UPDATE … = 'ARCHIVED'`, `SET DEFAULT 'ARCHIVED'`, `'ARCHIVED'::"Status"`, a `CHECK` naming it, a SQL function body using it, `IF NOT EXISTS` or not | **fails**, P3018 / 55P04 | **yes** |
|
|
420
|
+
| a `COMMIT;` first, or each part in a `BEGIN … COMMIT` of its own | applies | no |
|
|
421
|
+
| another value added, the same label added to another enum, the value named in a comment only | applies | no |
|
|
422
|
+
| the value alone in its migration, used in the next one | applies | no |
|
|
423
|
+
| the same word written into a **text** column | applies | yes: the rule reads text, not column types, so the message names the value and the enum, and a reviewer tells in one look |
|
|
424
|
+
|
|
425
|
+
The fix it prints: give the `ALTER TYPE … ADD VALUE` a migration of its own, before the one that
|
|
426
|
+
uses the value. Measured on the monorepo (874 migrations, 68 adding an enum value): no finding, and
|
|
427
|
+
the rule's split of each file into statements agrees with squawk's parser on all 874.
|
|
428
|
+
|
|
408
429
|
## The `Unsafe` rule, `unsafe-sql-pasted-value`
|
|
409
430
|
|
|
410
431
|
Prisma's tagged `` $queryRaw`…${value}…` `` sends each `${}` as a parameter. `$queryRawUnsafe` and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hublo/sentinel",
|
|
3
|
-
"version": "1.7.0-alpha.
|
|
3
|
+
"version": "1.7.0-alpha.22",
|
|
4
4
|
"description": "One CLI that guards code health across Hublo repos: shared lint/typescript/build/test presets, static & dynamic analysis, and architecture checks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10026,9 +10026,9 @@ export {
|
|
|
10026
10026
|
walk,
|
|
10027
10027
|
MEMBER_TYPES,
|
|
10028
10028
|
writtenFileFormatter,
|
|
10029
|
-
RESOLVABLE_EXTENSIONS,
|
|
10030
10029
|
findModuleRoot,
|
|
10031
10030
|
resolveContext,
|
|
10031
|
+
RESOLVABLE_EXTENSIONS,
|
|
10032
10032
|
readTestAdoption,
|
|
10033
10033
|
moduleEnvironment,
|
|
10034
10034
|
suiteOf,
|