@juicesharp/rpiv-pi 2.10.0 → 2.10.1

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.
@@ -139,15 +139,8 @@ const FRONTMATTER_PHASE_FANOUT = fanout({
139
139
  });
140
140
 
141
141
  /**
142
- * The elaborate fanout: `FRONTMATTER_PHASE_FANOUT` with one re-dispatch for a
143
- * unit whose output failed its contract after the in-session retries — a
144
- * malformed section is re-produced with the failure memo, not stitched.
145
- */
146
- const ELABORATE_PHASE_FANOUT = { ...FRONTMATTER_PHASE_FANOUT, retryHaltedUnits: 1 };
147
-
148
- /**
149
- * Derive the directed `deps` edges for ONE implement phase under the dep-gated
150
- * DAG fanout (`IMPLEMENT_DAG_FANOUT`). Edges point strictly downward (toward
142
+ * Derive the directed `deps` edges for ONE phase under the dep-gated DAG
143
+ * fanouts (`IMPLEMENT_DAG_FANOUT`, `ELABORATE_PHASE_FANOUT`). Edges point strictly downward (toward
151
144
  * LOWER phase numbers), so the graph is acyclic by construction. Two clauses:
152
145
  *
153
146
  * - clause A (self declares a `files:` write-set): `self` depends on every
@@ -163,7 +156,7 @@ const ELABORATE_PHASE_FANOUT = { ...FRONTMATTER_PHASE_FANOUT, retryHaltedUnits:
163
156
  * and `phaseDeps` — both defined later textually, but only inside this
164
157
  * runtime closure, so no TDZ (same pattern as `sliceDeps`).
165
158
  */
166
- const implementPhaseDeps = (records: readonly PhaseRecord[], self: PhaseRecord): string[] => {
159
+ const phaseWriteSetDeps = (records: readonly PhaseRecord[], self: PhaseRecord): string[] => {
167
160
  // Twin-expanded (`withTestTwins`) so a phase declaring `x.ts` conflicts with
168
161
  // one declaring `x.test.ts` — the production phase's implicit twin write would
169
162
  // otherwise race a concurrent sibling that owns the test explicitly.
@@ -186,30 +179,59 @@ const implementPhaseDeps = (records: readonly PhaseRecord[], self: PhaseRecord):
186
179
  };
187
180
 
188
181
  /**
189
- * Dep-gated DAG variant of `FRONTMATTER_PHASE_FANOUT` — `implement`'s twin that
190
- * emits per-phase `id`/`deps` edges so the wave scheduler orders phases by their
191
- * declared write-set overlap + explicit `depends_on`. The spread idiom inherits
192
- * `source`/`unit`/`max`/`onCap`/`result`/`kind` verbatim from the base; the new
193
- * `units` closure emits the SAME `prompt`/`label` strings AND adds
194
- * `id: \`phase-${r.n}\`` + `deps: implementPhaseDeps(records, r)`. NO
195
- * `depArtifactFlag` — implement phases feed each other through the working tree
196
- * (not published artifacts), so `deps` drive ONLY wave ordering. NO
197
- * `concurrency` property is set (the spread overrides only `units`), so the loop
198
- * inherits the host cap and phases fan out concurrently, bounded by `deps`.
182
+ * The dep-gated `units` closure shared by the DAG fanouts: emits the SAME
183
+ * `prompt`/`label` strings as `FRONTMATTER_PHASE_FANOUT` AND adds
184
+ * `id: \`phase-${r.n}\`` + `deps: phaseWriteSetDeps(records, r)`, so the wave
185
+ * scheduler orders phases by their declared write-set overlap + explicit
186
+ * `depends_on`. `who` names the fanout in preflight halts.
199
187
  */
200
- const IMPLEMENT_DAG_FANOUT = {
201
- ...FRONTMATTER_PHASE_FANOUT,
202
- units: ({ state, cwd }: FanoutContext) => {
203
- const read = readPlanPhaseRecords(state, cwd, "IMPLEMENT_DAG_FANOUT");
188
+ const dagPhaseUnits =
189
+ (who: string) =>
190
+ ({ state, cwd }: FanoutContext) => {
191
+ const read = readPlanPhaseRecords(state, cwd, who);
204
192
  if (!read) return [];
205
193
  const { records, promptPath } = read;
206
194
  return records.map((r) => ({
207
195
  prompt: `${promptPath} Phase ${r.n}: ${r.title}`.trimEnd(),
208
196
  label: `phase ${r.index + 1}/${r.total}`,
209
197
  id: `phase-${r.n}`,
210
- deps: implementPhaseDeps(records, r),
198
+ deps: phaseWriteSetDeps(records, r),
211
199
  }));
212
- },
200
+ };
201
+
202
+ /**
203
+ * Dep-gated DAG variant of `FRONTMATTER_PHASE_FANOUT` — `implement`'s twin. The
204
+ * spread idiom inherits `source`/`unit`/`max`/`onCap`/`result`/`kind` verbatim
205
+ * from the base; `units` is `dagPhaseUnits`. NO `depArtifactFlag` — implement
206
+ * phases feed each other through the working tree (not published artifacts), so
207
+ * `deps` drive ONLY wave ordering. NO `concurrency` property is set (the spread
208
+ * overrides only `units`), so the loop inherits the host cap and phases fan out
209
+ * concurrently, bounded by `deps`.
210
+ */
211
+ const IMPLEMENT_DAG_FANOUT = {
212
+ ...FRONTMATTER_PHASE_FANOUT,
213
+ units: dagPhaseUnits("IMPLEMENT_DAG_FANOUT"),
214
+ };
215
+
216
+ /**
217
+ * The elaborate fanout: the same dep-gated `units` as `IMPLEMENT_DAG_FANOUT`,
218
+ * plus one re-dispatch for a unit whose output failed its contract after the
219
+ * in-session retries — a malformed section is re-produced with the failure
220
+ * memo, not stitched.
221
+ *
222
+ * Dep-gated for the same reason implement is: every lane's self-check probes
223
+ * the ONE shared working tree (apply → check → revert its own write-scope), and
224
+ * two lanes whose `files:` overlap cannot both revert byte-identically — a lane
225
+ * that snapshots a co-owned file while a sibling's probe is live restores the
226
+ * sibling's transient blocks after the sibling reverted them (run
227
+ * 2026-09-12_14-29-13-5eb9: phase 5's test blocks came back through phase 3's
228
+ * copy-back and phase 2's rebuild, and broke the test target for implement).
229
+ * File-disjoint phases still fan out concurrently.
230
+ */
231
+ const ELABORATE_PHASE_FANOUT = {
232
+ ...FRONTMATTER_PHASE_FANOUT,
233
+ units: dagPhaseUnits("ELABORATE_PHASE_FANOUT"),
234
+ retryHaltedUnits: 1,
213
235
  };
214
236
 
215
237
  /**
@@ -258,7 +280,7 @@ const phaseDeps = (entry: unknown): number[] => {
258
280
  * read straight off `PhaseRecord.entry` so `planPhaseRecords` preserves the new
259
281
  * key unchanged. Consumed by the plan-time coverage floor
260
282
  * (`verifyPhaseFilesCoverage`) and, in a later phase, the dep-gated implement
261
- * fanout (`implementPhaseDeps`). */
283
+ * fanout (`phaseWriteSetDeps`). */
262
284
  const phaseFiles = (entry: unknown): string[] => {
263
285
  const raw = (entry as { files?: unknown } | undefined)?.files;
264
286
  return Array.isArray(raw) ? raw.filter((f): f is string => typeof f === "string") : [];
@@ -271,7 +293,7 @@ const phaseFiles = (entry: unknown): string[] => {
271
293
  * mechanical follow-up edit in its twin — so requiring every plan author,
272
294
  * elaborator, and grader to re-declare the twin is paperwork the convention
273
295
  * already guarantees. Applied at BOTH consumers of the declared set — the
274
- * DAG conflict fold (`implementPhaseDeps`) and the scope floors — so the
296
+ * DAG conflict fold (`phaseWriteSetDeps`) and the scope floors — so the
275
297
  * planner and the floor can never disagree; on the DAG side it also closes the
276
298
  * latent race where phases declaring `x.ts` and `x.test.ts` counted as
277
299
  * disjoint yet predictably collide. Asymmetric by design: declaring a TEST
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juicesharp/rpiv-pi",
3
- "version": "2.10.0",
3
+ "version": "2.10.1",
4
4
  "description": "A skill-based development workflow for Pi Agent. 30 contract-carrying skills (discover → research → design → plan → implement → validate → code-review → commit, and more), the 15 named subagents they dispatch, and four built-in /wf workflows that chain them end to end in detached parallel runs.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -51,7 +51,7 @@
51
51
  ]
52
52
  },
53
53
  "dependencies": {
54
- "@juicesharp/rpiv-config": "^2.10.0",
54
+ "@juicesharp/rpiv-config": "^2.10.1",
55
55
  "typebox": "^1.1.24"
56
56
  },
57
57
  "peerDependencies": {
@@ -57,7 +57,7 @@ Copy values verbatim. `<iso>` is the first tab-separated field (use as `date`);
57
57
  3. **Write the code for this phase only.** For each file in the phase's Changes, emit a concrete, paste-ready code block: the full function/section to add, or the exact edit (enough that `implement` applies it without guessing). Match the surrounding code's conventions. Where the phase depends on a sibling phase's symbol, reference it by the shape the plan/Synthesis Notes already fixed — do not redefine it.
58
58
  4. **Carry the success criteria.** Preserve the phase's `### Success Criteria` (Automated + Manual), tightening a check only if your code makes it more concrete. Do not drop or weaken a criterion.
59
59
  5. **Resolve ambiguity yourself.** Decide from the plan, the Synthesis Notes, and the real code. This skill is **non-interactive** — if a genuine blocker can't be settled from those inputs, make the most defensible call, record it under `## Notes / Deferred`, and let the grade panel catch a bad call. Do **not** ask the user (N lanes run concurrently).
60
- 6. **Self-check (probe → revert → guard).** Before emitting, verify the drafted code blocks actually apply and pass the project's checks at their REAL placement — declaration-order / initialization-order and integration defects only surface when a block lands at its true anchor, not an idealized layout. Define **write-scope** = the set of repo-root-relative paths the phase's `### Changes` names (the files below this step's emitted `#### \`...\`` headings); the whole self-check applies and reverts ONLY those paths — sibling phase lanes run concurrently in the same working tree, so touching a file another phase owns corrupts its in-flight edit. The cycle is exactly:
60
+ 6. **Self-check (probe → revert → guard).** Before emitting, verify the drafted code blocks actually apply and pass the project's checks at their REAL placement — declaration-order / initialization-order and integration defects only surface when a block lands at its true anchor, not an idealized layout. Define **write-scope** = the set of repo-root-relative paths the phase's `### Changes` names (the files below this step's emitted `#### \`...\`` headings); the whole self-check applies and reverts ONLY those paths — sibling phase lanes run concurrently in the same working tree (the fanout serializes phases whose `files:` overlap, so a concurrent sibling never owns a path in your write-scope), so touching a file another phase owns corrupts its in-flight edit. Never snapshot, copy back, or rebuild a file from a copy taken earlier: revert is `git restore` only. The cycle is exactly:
61
61
  - **Snapshot.** Capture `git status --porcelain` BEFORE the probe (the byte-identical revert target).
62
62
  - **Probe.** Apply each drafted code block via `Edit` at its REAL anchor position in the current file (not a speculative layout). New files named by the phase are written for the probe.
63
63
  - **Verify, in order, attributing only write-scope errors.** Take the command vocabulary from the project's guidance `# Commands` table — never substitute a tool the project does not use: