pi-fovea 0.28.0 → 0.28.2
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/README.md +48 -0
- package/dist/cli.mjs +333 -116
- package/package.json +2 -2
- package/src/core/astgrep.ts +18 -39
- package/src/core/build.ts +41 -41
- package/src/core/cochange.ts +6 -5
- package/src/core/config.ts +16 -3
- package/src/core/extension-runtime.ts +5 -0
- package/src/core/provenance.ts +9 -13
- package/src/core/render.ts +3 -3
- package/src/core/temp-storage.ts +237 -0
- package/src/index.ts +24 -6
package/README.md
CHANGED
|
@@ -568,6 +568,54 @@ ast-grep. Failed extractions keep fact-free hash markers that stay visible
|
|
|
568
568
|
across launches. Those files skip the retry on each start. Bump `CACHE_VERSION`
|
|
569
569
|
in `src/core/build.ts` whenever extractor semantics change.
|
|
570
570
|
|
|
571
|
+
### Temporary-storage retention
|
|
572
|
+
|
|
573
|
+
Retention runs asynchronously on actual facts/cochange, journal, spill, or scan
|
|
574
|
+
activity—not extension registration or idle lifecycle hooks. Sweeps are coalesced
|
|
575
|
+
and throttled to once per five minutes per process. No background timer is kept.
|
|
576
|
+
Policies apply across roots in the OS `tmpdir()` (`$TMPDIR` where supported):
|
|
577
|
+
|
|
578
|
+
| Artifacts | Retention |
|
|
579
|
+
| --- | --- |
|
|
580
|
+
| Facts + cochange (`pi-fovea-<16hex>.json`, `pi-fovea-cochange-<16hex>.json`) | Combined 128 MiB / 128 files; expire after 7 days; oldest modification first; 5-minute fresh-write grace |
|
|
581
|
+
| Focus/dwell/impact/sketch spills (`pi-fovea-<op>-<8hex>.txt`) | Combined 32 MiB / 128 files; expire after 24 hours; oldest modification first; 1-hour grace for reading advertised paths |
|
|
582
|
+
| Provenance journals (`pi-fovea-provenance-<16hex>-<16hex>.json`) | Only the existing 7-day record TTL; **never pressure-evict fresh attribution** |
|
|
583
|
+
| Partial atomic writes (`<recognized-name>.tmp-<PID>-<UUID>`) and new scan rules (`pi-fovea-scan-<PID>-<UUID>.yml`) | Clean in `finally`; recover abandoned files only after 1 hour and only when their PID is definitely dead |
|
|
584
|
+
|
|
585
|
+
These are best-effort, eventual limits, not global quotas: grace periods, active
|
|
586
|
+
writers, concurrent processes, permission failures, and no subsequent activity can
|
|
587
|
+
leave totals temporarily above budget. Reads do not refresh modification times.
|
|
588
|
+
Cache reads/writes are capped at **64 MiB per file**. Oversized facts persistence
|
|
589
|
+
is skipped without changing in-memory extraction, and the prior cache remains
|
|
590
|
+
valid through normal content/stat checks; oversized disk caches are misses.
|
|
591
|
+
Spills are capped at **8 MiB**; rejected writes omit the artifact pointer, never
|
|
592
|
+
advertise a truncated full list. All cache/spill replacements use exclusive 0600
|
|
593
|
+
staging files and atomic rename. Journals retain their existing 256-record cap
|
|
594
|
+
without a new byte cap; malformed or oversized journals are conservatively left
|
|
595
|
+
alone by housekeeping.
|
|
596
|
+
|
|
597
|
+
Cleanup recognizes exact names only, checks `lstat` for regular, singly linked,
|
|
598
|
+
current-UID files, and rechecks device/inode/size/mtime/ctime immediately before
|
|
599
|
+
unlink. Symlinks, directories, unrelated names and other users' files are never
|
|
600
|
+
cleanup candidates; unknown ownership is a reason to skip. Platforms without UID
|
|
601
|
+
verification do not create persistent caches, spills or attribution journals;
|
|
602
|
+
analysis continues without disk reuse and cross-session attribution is unavailable.
|
|
603
|
+
Exclusively created per-invocation scan files still clean up by inode identity.
|
|
604
|
+
Descriptor reads remain byte-bounded even if a file grows after validation. Filesystem APIs do not
|
|
605
|
+
provide atomic unlink-by-inode, so this is best-effort race detection, not a
|
|
606
|
+
security boundary against a hostile same-UID process. New scans have independent
|
|
607
|
+
rule files kept until every chunk finishes, with no unbounded rule-file map.
|
|
608
|
+
Legacy `pi-fovea-scan-*` directories have no trustworthy PID metadata and are left
|
|
609
|
+
for explicit, separately reviewed reclamation—there is no recursive prefix purge.
|
|
610
|
+
Adjacent configuration staging is also cleaned on write/rename failure, but
|
|
611
|
+
configuration files and developer-owned reports are not retention candidates.
|
|
612
|
+
The performance-corpus benchmark retains `raw.json`/`summary.json` reports under
|
|
613
|
+
`tmpdir()`, but removes its uniquely allocated per-worker scratch (facts and Git
|
|
614
|
+
index) after worker success or failure. Existing reports, coverage work directories
|
|
615
|
+
and history-corpus data are not swept. For explicit maintenance, the internal
|
|
616
|
+
`pruneTempStorage({ directory })` helper returns eligible paths without mutation;
|
|
617
|
+
only `{ directory, dryRun: false }` applies the same rechecked policy.
|
|
618
|
+
|
|
571
619
|
## Acknowledgments
|
|
572
620
|
|
|
573
621
|
Thanks to [Alp](https://www.patreon.com/cw/alpderps), the original user whose request for a better LSP extension started this project.
|