@dzhechkov/harness-core 0.3.125 → 0.3.127

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/src/sign.ts CHANGED
@@ -113,23 +113,32 @@ export function checkManifestEntries(files: unknown): string | null {
113
113
  return null;
114
114
  }
115
115
 
116
+ /**
117
+ * Directory names that are NOT pack content and are excluded from BOTH walks. node_modules/.git:
118
+ * installed deps / VCS metadata. `.agentic-qe`/`.dz`: LOCAL RUNTIME STATE (learning DBs, RVF
119
+ * stores, witness keys) that background workers create inside pack cwds — gitignored, machine-
120
+ * specific, never shipped. Signing them made 19 packs verify green LOCALLY (files present, hashes
121
+ * match) and TAMPERED in CI (clean checkout lacks the gitignored state) — found live on GH run
122
+ * #103, 2026-07-19. State is not content; the walks must never see it.
123
+ */
124
+ const EXCLUDED_DIRS = new Set(['node_modules', '.git', '.agentic-qe', '.dz']);
125
+
116
126
  /** Every file under `root`, POSIX-relative, excluding the manifest and the SBOM themselves. */
117
127
  export function listPackFiles(root: string): string[] {
118
128
  const out: string[] = [];
119
129
  const walk = (dir: string, rel: string): void => {
120
130
  for (const e of readdirSync(dir, { withFileTypes: true })) {
121
- // node_modules/.git are unsigned territory BY DESIGN (installed deps / VCS metadata — not pack
122
- // content; npm tarballs ship neither). The SIGN and VERIFY walks MUST share these exclusions:
123
- // an asymmetry here false-TAMPERs every pnpm workspace pack whose node_modules holds symlinks
124
- // (found live arming task #36 — 10 of 23 skill packs flagged right after signing).
125
- if (e.name === 'node_modules' || e.name === '.git') continue;
131
+ // Excluded dirs are unsigned territory BY DESIGN (see EXCLUDED_DIRS). The SIGN and VERIFY
132
+ // walks MUST share these exclusions: an asymmetry here false-TAMPERs every pnpm workspace
133
+ // pack whose node_modules holds symlinks (found live arming task #36 10 of 23 packs).
134
+ if (EXCLUDED_DIRS.has(e.name)) continue;
126
135
  if (e.name === MANIFEST_NAME || e.name === SBOM_NAME) continue;
127
136
  const abs = join(dir, e.name);
128
137
  const r = rel ? rel + '/' + e.name : e.name;
129
138
  if (e.isDirectory()) walk(abs, r);
130
139
  // NOT else-isFile: a symlink (or other non-file) OUTSIDE the excluded dirs must stay VISIBLE to the
131
140
  // verify sweep — it fails as "present but not signed" / "is a symlink" (R3-4: a smuggled symlink is a
132
- // finding, not something to silently ignore). Only node_modules/.git are exempt territory.
141
+ // finding, not something to silently ignore). Only EXCLUDED_DIRS are exempt territory.
133
142
  else out.push(r);
134
143
  }
135
144
  };
@@ -146,7 +155,7 @@ export function listSignablePackFiles(root: string): string[] {
146
155
  const out: string[] = [];
147
156
  const walk = (dir: string, rel: string): void => {
148
157
  for (const e of readdirSync(dir, { withFileTypes: true })) {
149
- if (e.name === 'node_modules' || e.name === '.git') continue;
158
+ if (EXCLUDED_DIRS.has(e.name)) continue;
150
159
  if (e.name === MANIFEST_NAME || e.name === SBOM_NAME) continue;
151
160
  const abs = join(dir, e.name);
152
161
  const r = rel ? rel + '/' + e.name : e.name;