@ontrails/regrade 0.2.2 → 0.2.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,5 +1,15 @@
1
1
  # @ontrails/regrade
2
2
 
3
+ ## 0.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b155fde`](https://github.com/outfitter-dev/trails/commit/b155fde9aa271ead2e76d675f2d281e28c9289f4): Report a directory that disappears between listing and reading as `vanished-directory` instead of `unreadable-directory` in `collectSourceTree`. Permission and other read failures still report `unreadable-directory`. Static project identity discovery now rescans, up to three attempts, when a directory vanishes mid-walk. A removed directory, such as a parallel test's temp dir, drops out of the next listing, and a renamed one, including one holding a `trails.config.*` marker, is found under its new path. Churn that outlasts the retries still fails closed. Regrade also fails closed on both reasons, because a vanished directory may have been renamed and its sources would otherwise escape a prepared run or apply.
8
+
9
+ ## 0.2.3
10
+
11
+ No changes in this release.
12
+
3
13
  ## 0.2.2
4
14
 
5
15
  No changes in this release.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ontrails/regrade",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Downstream migration reporting and safe rewrite helpers for Trails.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,14 +27,14 @@
27
27
  "clean": "rm -rf dist *.tsbuildinfo"
28
28
  },
29
29
  "dependencies": {
30
- "@ontrails/core": "^0.2.2",
31
- "@ontrails/source": "^0.2.2",
32
- "@ontrails/warden": "^0.2.2",
30
+ "@ontrails/core": "^0.2.4",
31
+ "@ontrails/source": "^0.2.4",
32
+ "@ontrails/warden": "^0.2.4",
33
33
  "tar": "7.5.22",
34
34
  "zod": "^4.3.5"
35
35
  },
36
36
  "devDependencies": {
37
- "@ontrails/testing": "^0.2.2",
38
- "@ontrails/topography": "^0.2.2"
37
+ "@ontrails/testing": "^0.2.4",
38
+ "@ontrails/topography": "^0.2.4"
39
39
  }
40
40
  }
@@ -54,6 +54,17 @@ export interface SkippedSource {
54
54
  readonly reason: string;
55
55
  }
56
56
 
57
+ /**
58
+ * Whether a skipped directory leaves the collection incomplete.
59
+ *
60
+ * A directory that vanished mid-walk may have been renamed rather than
61
+ * removed, so its sources can still exist under a path the walk never saw.
62
+ * Regrade fails closed on both reasons.
63
+ */
64
+ export const isIncompleteDirectorySkip = (entry: SkippedSource): boolean =>
65
+ entry.reason === 'unreadable-directory' ||
66
+ entry.reason === 'vanished-directory';
67
+
57
68
  /** Deterministic result of collecting downstream sources from a root. */
58
69
  export interface DownstreamSourceCollection {
59
70
  /** The root the collection ran against. */
@@ -22,6 +22,7 @@ import { createAstStringLiteralRenameClass } from './ast-rewrite.js';
22
22
  import {
23
23
  DEFAULT_IGNORED_DIRECTORIES,
24
24
  collectDownstreamSources,
25
+ isIncompleteDirectorySkip,
25
26
  } from './collect.js';
26
27
  import type {
27
28
  RegradeClassResult,
@@ -175,8 +176,7 @@ const fileRenameSourceStateHash = (params: {
175
176
  const unreadable = params.collected.skipped
176
177
  .filter(
177
178
  (entry) =>
178
- entry.reason === 'unreadable-file' ||
179
- entry.reason === 'unreadable-directory'
179
+ entry.reason === 'unreadable-file' || isIncompleteDirectorySkip(entry)
180
180
  )
181
181
  .map((entry) => entry.path);
182
182
  if (unreadable.length > 0) {
@@ -29,6 +29,7 @@ import {
29
29
  DEFAULT_IGNORED_DIRECTORIES,
30
30
  DEFAULT_SOURCE_EXTENSIONS,
31
31
  collectDownstreamSources,
32
+ isIncompleteDirectorySkip,
32
33
  } from './collect.js';
33
34
  import type { DownstreamCollectionOptions, SkippedSource } from './collect.js';
34
35
  import {
@@ -1488,7 +1489,7 @@ const collectRegradeEvaluation = (
1488
1489
  const sourceBytes: { readonly bytes: string; readonly path: string }[] = [];
1489
1490
  const unreadable = new Set(
1490
1491
  collected.skipped
1491
- .filter((entry) => entry.reason === 'unreadable-directory')
1492
+ .filter(isIncompleteDirectorySkip)
1492
1493
  .map((entry) => entry.path)
1493
1494
  );
1494
1495
  const manifestPaths = new Set<string>();
@@ -1589,7 +1590,7 @@ const collectRegradeSourceState = (
1589
1590
  const sourceBytes: { readonly bytes: string; readonly path: string }[] = [];
1590
1591
  const unreadable = new Set(
1591
1592
  collected.skipped
1592
- .filter((entry) => entry.reason === 'unreadable-directory')
1593
+ .filter(isIncompleteDirectorySkip)
1593
1594
  .map((entry) => entry.path)
1594
1595
  );
1595
1596
  const manifestPaths = new Set<string>();
@@ -23,6 +23,7 @@ import { z } from 'zod';
23
23
  import {
24
24
  DEFAULT_IGNORED_DIRECTORIES,
25
25
  collectDownstreamSources,
26
+ isIncompleteDirectorySkip,
26
27
  } from './collect.js';
27
28
  import type { DownstreamCollectionOptions, SkippedSource } from './collect.js';
28
29
  import type {
@@ -2232,8 +2233,7 @@ const unreadableVocabularyPaths = (
2232
2233
  skipped
2233
2234
  .filter(
2234
2235
  (entry) =>
2235
- entry.reason === 'unreadable-file' ||
2236
- entry.reason === 'unreadable-directory'
2236
+ entry.reason === 'unreadable-file' || isIncompleteDirectorySkip(entry)
2237
2237
  )
2238
2238
  .map((entry) => entry.path);
2239
2239