@cosyte/transform 0.0.4 → 0.0.6
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 +95 -0
- package/README.md +4 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,95 @@ its public history at `0.0.x`, per the cosyte version ladder (`0.0.x` until firs
|
|
|
14
14
|
|
|
15
15
|
### Fixed
|
|
16
16
|
|
|
17
|
+
- **A staged rename walked a symbolic link, or a real patient name, straight into a scan root
|
|
18
|
+
without the pre-commit PHI gate ever looking at it** (`PHI-SCAN-RENAME-BLIND-AT-PRECOMMIT`; port of
|
|
19
|
+
the graded fix in `dicom#60`). `R` (rename) and `C` (copy) records are returned by neither `AM` nor
|
|
20
|
+
`AMT`, so the `--staged` route's `--diff-filter=AMT` deleted the whole two-path record before any
|
|
21
|
+
mode or any content was read. Measured on this repo's own scanner before the fix, on both shapes it
|
|
22
|
+
reaches: `git mv notes/leak.txt src/leak.ts` over a link to a name-bearing synthetic payload staged
|
|
23
|
+
as `:120000 120000 <sha> <sha> R100` (`git ls-files --stage` reading `120000` on the destination)
|
|
24
|
+
and reported a clean scan, exiting **0**; `git mv notes/payload.txt src/payload.ts` over an ordinary
|
|
25
|
+
file full of the same payload passed identically. Both are ordinary developer actions, not
|
|
26
|
+
contrived ones.
|
|
27
|
+
|
|
28
|
+
**The gap is at PRE-COMMIT.** The hook is `phi-scan --staged`; the all-mode walk CI runs does
|
|
29
|
+
enumerate the renamed entry, so the exposure was "PHI enters a local commit or a pushed branch",
|
|
30
|
+
not "PHI merges". Stated because the containment is the difference between a defect and an
|
|
31
|
+
incident.
|
|
32
|
+
|
|
33
|
+
**The remedy is `--no-renames`, and it costs no stride work.** With detection off git cannot emit
|
|
34
|
+
`R` or `C` at all, so the destination arrives as an ordinary single-path `A`
|
|
35
|
+
(`:000000 120000 0000000 <sha> A`) and the source as a `D` the filter drops. No two-path record
|
|
36
|
+
shape is needed, and the enumeration is a strict **superset** of the previous one: re-measured
|
|
37
|
+
under `diff.renames=true|copies|false|1` and `renameLimit=1`, every setting yields that same
|
|
38
|
+
single-path `A`, so the flag also makes the two-field stride **structural** rather than conditional
|
|
39
|
+
on whatever a caller has configured. This repo previously disclosed the residual as "admitting them
|
|
40
|
+
needs the two-path record shape, a scope decision"; **that framing was false**, and it had been
|
|
41
|
+
carried in from a sibling repo rather than measured here.
|
|
42
|
+
|
|
43
|
+
**Unmerged (`U`) records were dropped by the same filter and are now refused rather than admitted.**
|
|
44
|
+
A conflicted path has no stage-0 entry, so `git show :<path>` answers
|
|
45
|
+
`fatal: path ... is in the index, but not at stage 0` rather than any content. It now refuses
|
|
46
|
+
(exit 2) through the same closed-set path as a link or a gitlink, naming the path and an
|
|
47
|
+
engine-owned kind and nothing else. The refusal keys on the **status**, not the mode, and that is
|
|
48
|
+
measured rather than assumed: across six conflict flavours (both-modified, add/add, modify/delete,
|
|
49
|
+
delete/modify, rename/rename, symlink/symlink) the status is always `U` and the destination mode
|
|
50
|
+
always `000000`, while the source mode and the set of index stages present both vary.
|
|
51
|
+
|
|
52
|
+
**One route this does not close, measured and disclosed rather than quietly left out:** a scan
|
|
53
|
+
root's **own path** staged as a non-regular entry is still outside the `--staged` route's scope,
|
|
54
|
+
because that scope tests `test/fixtures/` and `src/` as path prefixes. Measured on both trees:
|
|
55
|
+
`ln -s elsewhere src && git add -A` stages `:000000 120000 0000000 <sha> A src`, and `--staged`
|
|
56
|
+
reports clean and exits 0 while the all-mode walk over the same tree exits 1 on the payload behind
|
|
57
|
+
it. Pre-existing and unchanged by this slice; the reference implementation this was ported from
|
|
58
|
+
carries a guard for it that did not come across, and closing it is its own item.
|
|
59
|
+
|
|
60
|
+
Pinned in `test/scripts/phi-scan.test.ts` against throwaway git repos under `os.tmpdir()`, with the
|
|
61
|
+
premise itself pinned (git really does stage `git mv <link>` as `R100` at mode `120000`, and `AMT`
|
|
62
|
+
really does return nothing for it) so the fix cannot come to rest on a claim about git that stopped
|
|
63
|
+
being true. **Six of the new cases run red against the previous scanner**, including a repo whose
|
|
64
|
+
own `diff.renames` is set to `copies`. Two controls stay green on both trees deliberately: a rename
|
|
65
|
+
landing **outside** a scan root still passes (the fix narrows what the route's existing scope
|
|
66
|
+
admits; it does not widen the scope), and a stage mixing an add, a modify and a rename still
|
|
67
|
+
reports the violator behind them.
|
|
68
|
+
|
|
69
|
+
- **The PHI scanner exited `1`, its code for HITS FOUND, when it could not run at all.**
|
|
70
|
+
`loadAllowList()` runs outside every `try` in `main`, so a missing `scripts/phi-allow-list.txt`
|
|
71
|
+
threw out of the process and left node's uncaught-exception status, `1`. A `readdirSync` failure
|
|
72
|
+
under a walk root did the same. A caller keying on the exit code therefore read a gate that never
|
|
73
|
+
ran as a gate that ran and fired: the wrong direction to be wrong in. Every failure to complete
|
|
74
|
+
now exits **2**: `run()` at the foot of the file is the outermost net, and `walk` names an
|
|
75
|
+
unreadable directory and its errno itself instead of throwing raw. An unexpected throw still
|
|
76
|
+
prints its stack, deliberately.
|
|
77
|
+
|
|
78
|
+
- **The exported `VERSION` constant said `"0.0.0"` on a package published as `0.0.4`, and the
|
|
79
|
+
documented install smoke test told an installer to print exactly that constant**
|
|
80
|
+
(`VERSION-CONSTANT-DRIFT`). Measured on the released tarball, not inferred from source:
|
|
81
|
+
`npm pack @cosyte/transform@0.0.4` yields a `dist/index.mjs`, `dist/index.cjs`, `dist/index.d.ts`
|
|
82
|
+
and `dist/index.d.cts` that all carry `"0.0.0"`. It is not one bad release: **every** version ever
|
|
83
|
+
published (`0.0.2`, `0.0.3`, `0.0.4`) ships `"0.0.0"`, so the wrong constant is live on the registry today
|
|
84
|
+
and stays wrong there until the next publish. The constant's own doc comment already claimed it
|
|
85
|
+
was "synced with `package.json#version` by the release tooling" while no such step existed: the
|
|
86
|
+
`version` script ran `changeset version` alone, which rewrites `package.json` and nothing else.
|
|
87
|
+
The fix is structural rather than a hand-bump, because a hand-bumped constant goes stale at the
|
|
88
|
+
very next release. `scripts/sync-version.mjs` (ported from `terminology#12`, `67f73db`, the commit
|
|
89
|
+
that added it there) rewrites the declaration from `package.json` and is wired into the `version` script
|
|
90
|
+
immediately after `changeset version`, so the bump and the constant land in the same
|
|
91
|
+
"Version Packages" commit. The drift guard is `test/sanity.test.ts`, which now compares the export
|
|
92
|
+
against `package.json` instead of asserting shape only; it fails on the unfixed tree
|
|
93
|
+
(`expected '0.0.0' to be '0.0.4'`), which is how it was checked for bite. The declaration also
|
|
94
|
+
gains the `: string` annotation the sync script keys on, which stops the published declaration
|
|
95
|
+
files leaking the literal type `"0.0.0"` into consumers' types (they did — both `dist/index.d.ts`,
|
|
96
|
+
which `exports["."].import.types` points at, and `dist/index.d.cts`).
|
|
97
|
+
This is a known repeat class in the suite: `@cosyte/astm@0.0.1` and `@cosyte/terminology@0.0.1`
|
|
98
|
+
shipped the same defect, the latter with the same install-smoke-test amplifier.
|
|
99
|
+
- **`docs-content/installation.md` claimed the package was "not yet published to npm"** and that
|
|
100
|
+
both peers were unpublished. The package is on the registry; `@cosyte/hl7` is too. The page now
|
|
101
|
+
says what is actually true and keeps the two halves together, because either half alone misleads:
|
|
102
|
+
the package **is** published **and** it **cannot be installed from npm**, because the
|
|
103
|
+
`@cosyte/fhir` peer is not on the registry. Measured today:
|
|
104
|
+
`npm install @cosyte/transform @cosyte/hl7 @cosyte/fhir` fails with `ERESOLVE`, `Could not resolve
|
|
105
|
+
dependency: peer @cosyte/fhir@">=0.0.0" from @cosyte/transform@0.0.4`.
|
|
17
106
|
- **The PHI scanner read a symbolic link as clean on BOTH of its enumerating routes, so a link
|
|
18
107
|
under a scan root pointing at a file full of PHI passed the commit gate**
|
|
19
108
|
(`PHI-SCAN-SYMLINK-BLIND-ON-BOTH-ROUTES`; port of the graded fix in `terminology#37`, `5f81640`).
|
|
@@ -79,6 +168,12 @@ its public history at `0.0.x`, per the cosyte version ladder (`0.0.x` until firs
|
|
|
79
168
|
exposure is a local commit or a pushed branch, not a merge. And this scanner has no
|
|
80
169
|
refuse-a-scan-that-observed-nothing rule, so an empty enumeration still reports clean.
|
|
81
170
|
|
|
171
|
+
**▶ SUPERSEDED IN THIS SAME RELEASE, AND THE FRAMING ABOVE WAS FALSE.** The `R`/`C` residual is
|
|
172
|
+
closed by `PHI-SCAN-RENAME-BLIND-AT-PRECOMMIT` (the first entry in this section): the remedy is
|
|
173
|
+
`--no-renames`, which needs neither the two-path record shape nor a scope decision. The paragraph
|
|
174
|
+
above is kept as written because the two bullets ship as one release note and a reader will meet
|
|
175
|
+
both; what would mislead is leaving it as the last word. The other two residuals it names stand.
|
|
176
|
+
|
|
82
177
|
- **The `attw` publish gate passed an untyped pack, so a tarball with no type declarations in it
|
|
83
178
|
would have merged and published as green** (`ATTW-FALSE-GREEN-PORT`; port of the graded fix in
|
|
84
179
|
`terminology#28`, `bf153cb`). `@arethetypeswrong/cli@0.18.4` opens `getExitCode()` with
|
package/README.md
CHANGED
|
@@ -34,6 +34,10 @@ npm install @cosyte/transform @cosyte/hl7 @cosyte/fhir
|
|
|
34
34
|
`@cosyte/hl7` and `@cosyte/fhir` are **peer dependencies** — the transform maps between the models
|
|
35
35
|
they own. Its own third-party runtime dependencies are **zero**.
|
|
36
36
|
|
|
37
|
+
**That command does not work yet.** This package is published, but `@cosyte/fhir` is not on the
|
|
38
|
+
registry, so npm fails with `ERESOLVE` and refuses to resolve that peer. Until it publishes, consume
|
|
39
|
+
this package from source or a workspace link.
|
|
40
|
+
|
|
37
41
|
## Convert a datatype
|
|
38
42
|
|
|
39
43
|
```ts
|
package/dist/index.cjs
CHANGED