@cosyte/hl7 0.0.5 → 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 CHANGED
@@ -436,6 +436,106 @@ kind, value)`** sets one at a field or `field[rep]` dot-path. Component values a
436
436
 
437
437
  ### Changed
438
438
 
439
+ - **The PHI gate's own enumeration no longer lets a vanished build transient refuse an entire sweep
440
+ (`PHI-SCAN-ENUMERATE-THEN-READ-CLASS`).** `scripts/phi-scan.ts` all-mode lists its roots and reads
441
+ each file afterwards; a file deleted inside that window threw `ENOENT` and the scanner refused with
442
+ exit 2. `@cosyte/ccda` is where that landed for real (`ccda#80`, `747ac20`): its walk starts at the
443
+ **repo root**, `tsup` writes and then removes `tsup.config.bundled_<hash>.mjs` there, and a
444
+ publish-time sweep refused, failing `prepublishOnly` and blocking a real publish.
445
+
446
+ **No CI or publish run in this repo was reachable through that window, so this is hardening, not
447
+ the repair of a live defect here.** Say so plainly, because the temptation is to claim the bigger
448
+ thing. The walk is rooted at `test/fixtures` and `src`, so the repo-root transient is never
449
+ enumerated. **Verified in both directions rather than assumed, and re-derived three times in three
450
+ separate runs:** a real `tsup` build was polled while it ran and the only transient observed each
451
+ time was a `tsup.config.bundled_<hash>.mjs` **at the repo root**, outside both walk roots, with
452
+ zero files appearing under either root; and the pre-fix scanner, driven against a throwaway repo
453
+ with an untracked decoy placed **inside** `src/`, refused the whole sweep with exit 2 on the first
454
+ read. The hash differs on every build, which is why no specific filename is quoted here. The
455
+ immunity is scope, not design. Nothing gitignores that name (`git check-ignore` exits 1 on it),
456
+ and `test/docs-content.test.ts` really does run a build from inside the suite while this scanner
457
+ sweeps in all mode from another worker, so the two halves already race. **Widening a walk root,
458
+ for any reason, reintroduces it verbatim.**
459
+
460
+ **A narrower case was already live on a developer box rather than in CI, and the review gate found
461
+ it. It is a class, not one filename.** `.gitignore` covers `*.swp` and `*.swo` and **nothing else
462
+ of the kind**, so editor and atomic-save transients create and remove un-ignored files **inside a
463
+ walk root**. Verified un-ignored: `src/index.ts~`, `src/.index.ts.swn`, `src/#index.ts#`,
464
+ `src/index.ts___jb_tmp___`, `src/.goutputstream-abc123`, `src/4913`, and `.tmp` / `.orig` / `.bak`
465
+ beside a source file. Before this change each is a spurious exit 2 on a developer's machine; none
466
+ reaches CI or a publish, which is why the claim above is scoped to those.
467
+
468
+ **The refusal was correct; the enumeration was unsound.** Refusing a scan it could not complete is
469
+ what makes this gate worth having and it is untouched. Exactly one case is now tolerated: a file
470
+ the walk enumerated **itself**, that git does **not track**, failing with **`ENOENT`**. It is
471
+ written to stderr as skipped, never dropped silently, and the clean line on **stdout** is
472
+ qualified to match (`OK: no hits (N untracked file(s) skipped, see stderr)`), so a reader watching
473
+ stdout alone cannot take an unqualified OK from a sweep that did not observe everything it
474
+ enumerated. A clean sweep still prints the bare line, and a test pins it exactly.
475
+
476
+ **Five of the six bounds are pinned by a test, and which five is measured, not asserted.** Each
477
+ was confirmed by a mutant that only its own test kills:
478
+ - a **tracked** file that cannot be read (mutant: tolerate tracked files too);
479
+ - any **non-`ENOENT`** failure, since `EACCES` / `EISDIR` is a scan that failed, not a file that
480
+ went away (mutant: tolerate any errno);
481
+ - a `git` that cannot report the tracked set, which switches the tolerance off rather than
482
+ guessing (mutant: return an empty set instead of `null`);
483
+ - a tracked set that comes back **empty**, the one state in which the tracked-file bound stops
484
+ existing (same mutant). A **removed** `.git/index` makes `git ls-files` exit 0 with no output,
485
+ which is what the `size > 0` guard catches; a **corrupt** one exits non-zero and was already
486
+ caught by the `catch`;
487
+ - an all-mode sweep that **observed no files at all** (mutant: drop the guard), so the tolerance
488
+ can never decay into a clean report of a tree nothing was read from.
489
+
490
+ **The sixth is UNPINNED and named as the gap it is:** a tolerated file that is **back on disk**
491
+ when the sweep ends still refuses, but no test drives it. The scanner calls `git` only before the
492
+ first read, so there is no deterministic post-read hook, and `walk()` enumerates regular files
493
+ only, so a FIFO cannot be used as a blocking one either (both measured). Reaching it needs a timed
494
+ re-create against a deliberately slowed sweep, and a load-sensitive sleep in a suite guarding a
495
+ load-dependent race is the failure that race teaches. Losing that branch would cost the re-check,
496
+ never the tolerance's bounds. **Unpinned is not unverified:** the review gate drove the branch by
497
+ hand against a deliberately slowed sweep and it refused correctly with exit 2, and deleting the
498
+ re-check outright still leaves all 29 tests green, which is what makes "unpinned" the accurate
499
+ word rather than an understatement.
500
+
501
+ **The test technique is the reusable part: no sleep and no real build.** The scanner runs
502
+ `git check-ignore` and `git ls-files` between the walk and the first read, so a `git` shim placed
503
+ first on `PATH` is a deterministic hook into exactly that gap. Every case runs against a throwaway
504
+ git repo, so no decoy is ever written into this one. As a negative control the same tolerance case
505
+ was replayed against all twelve sibling scanners, and every sibling that has not yet taken this
506
+ change refuses it with exit 2, so the new assertion is not one a sibling's code satisfies by
507
+ accident. **No count is quoted, deliberately:** the same command returned a different tally on
508
+ three consecutive runs while sibling repos landed the same change underneath it, so any number
509
+ written here would be wrong by the time it is read.
510
+
511
+ **Residual, stated rather than closed:** the post-sweep re-check is keyed on the enumerated path,
512
+ not on content, so the class is **content that survives at a path the walk did not enumerate**. An
513
+ untracked file **renamed** inside the window is the obvious instance and goes unscanned under a
514
+ clean report; a hard link followed by an unlink is the other. Both legs of the boundedness
515
+ argument were driven by the review gate rather than argued: after `git add` the all-mode sweep
516
+ catches the renamed file, and `--staged` reports the hit from the index **even with the file
517
+ deleted from disk**. Closing it needs a content-addressed sweep, which is a different design
518
+ rather than a wider bound. The `--staged` pre-commit path reads blobs from the git index
519
+ (`git show :path`) and never depended on any of this.
520
+
521
+ **Two PRE-EXISTING scope limits of the walk are now written down** so they are not confused with
522
+ the window above. Both were measured, and an earlier draft of this entry claimed `--staged` covers
523
+ the commit path in both cases; **the review gate refuted that and it is false, so read `--staged`
524
+ as a compensating control for neither.**
525
+ - **Regular files only**, the sharper of the two. A symlink under a walk root pointing at a
526
+ PHI-bearing file is not enumerated, so all-mode never reads it, **and** git stores a symlink as
527
+ its target string (mode `120000`), so `git show :path` hands `--staged` the path text rather
528
+ than the pointed-to bytes. **Both routes report clean, driven and reproduced independently.**
529
+ What lands in the commit is the link, not the capture, but an identifying _filename_ still
530
+ reaches the tree and gets only the shape pass, which has no name detection. A FIFO is skipped
531
+ rather than blocking the sweep.
532
+ - **Working tree only.** A tracked file absent from the worktree is never enumerated in all-mode.
533
+ `--staged` catches such a file when it is **added** (measured, exit 1), so that coverage is at
534
+ add time and past tense: once it is committed and removed from the worktree, both routes report
535
+ clean.
536
+
537
+ Neither limit is changed here, and widening the walk to close either is a separate slice.
538
+
439
539
  - **`README.md` now opens with the shared Cosyte lockup in a `<picture>` block, replacing the
440
540
  per-package banner (`1aee04b`).** The dark-ground org tile sits behind a
441
541
  `prefers-color-scheme: dark` media query with the light-ground tile as the inner `<img>`, so on a
package/dist/index.cjs CHANGED
@@ -6874,7 +6874,7 @@ async function* parseStream(source, optionsOrProfile) {
6874
6874
  }
6875
6875
 
6876
6876
  // src/index.ts
6877
- var VERSION = "0.0.5";
6877
+ var VERSION = "0.0.6";
6878
6878
 
6879
6879
  exports.ACK_CODES = ACK_CODES;
6880
6880
  exports.ACK_CONDITIONS = ACK_CONDITIONS;