Skip to content

feat(weave): carry alice bio 10 -> 11 second payload weave slice#5

Merged
djradon merged 2 commits intomainfrom
11-alice-bio-v2-woven
Apr 5, 2026
Merged

feat(weave): carry alice bio 10 -> 11 second payload weave slice#5
djradon merged 2 commits intomainfrom
11-alice-bio-v2-woven

Conversation

@djradon
Copy link
Copy Markdown
Contributor

@djradon djradon commented Apr 5, 2026

  • add the narrow second payload-state weave path for an already woven payload artifact
  • create alice/bio/_history001/_s0002 and advance alice/bio/_knop/_inventory to _s0002 while keeping _mesh/_inventory unchanged
  • treat a second payload weave as eligible only when the working payload differs from the latest historical snapshot
  • add unit, integration, and black-box CLI coverage for 11-alice-bio-v2-woven
  • document the carried 11 slice and update the weave behavior and codebase overview notes

Summary by CodeRabbit

  • New Features

    • Added automated second-stage payload weave to create a second historical snapshot and advance payload history/state.
  • Documentation

    • Updated overview/specs and added task notes describing the expanded weave slices, acceptance rules, payload update contract, and next extract task.
  • Tests

    • Added unit, integration, and end-to-end tests and manifest-based acceptance checks covering the second-stage payload weave and related validations.

- add the narrow second payload-state weave path for an already woven payload artifact
- create alice/bio/_history001/_s0002 and advance alice/bio/_knop/_inventory to _s0002 while keeping _mesh/_inventory unchanged
- treat a second payload weave as eligible only when the working payload differs from the latest historical snapshot
- add unit, integration, and black-box CLI coverage for 11-alice-bio-v2-woven
- document the carried 11 slice and update the weave behavior and codebase overview notes
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 5, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a2cf1fbd-ee9a-4477-aebf-53da6a4c2fa7

📥 Commits

Reviewing files that changed from the base of the PR and between 63158e1 and 0bf3cf2.

⛔ Files ignored due to path filters (1)
  • documentation/notes/wd.conv.2026.2026-04-05_0842-implement-wd-task-2026-2026-04-04-1553-weave-alice-bio-re-codex.md is excluded by !documentation/notes/wd.conv.*
📒 Files selected for processing (3)
  • documentation/notes/wd.task.2026.2026-04-05_1004-extract-bob.md
  • src/runtime/weave/weave.ts
  • tests/integration/weave_test.ts

📝 Walkthrough

Walkthrough

Adds a new "secondPayloadWeave" slice to the weave workflow, implementing planner and runtime logic to create a second historical snapshot for an alice/bio payload, updating inventories and generating corresponding artifact pages; updates docs and tests to cover the new slice.

Changes

Cohort / File(s) Summary
Documentation & Specs
documentation/notes/wd.codebase-overview.md, documentation/notes/wd.spec.2026-04-03-weave-behavior.md, documentation/notes/wd.task.2026.2026-04-04_2019-update-alice-bio-payload.md, documentation/notes/wd.task.2026.2026-04-05_0903-weave-alice-bio-v2-woven.md, documentation/notes/wd.task.2026.2026-04-05_1004-extract-bob.md
Expanded weave coverage to include the 10->11 transition; clarified payload update input/validation rules and testing scope; added full task note for the 10->11 -> 11 second-payload-weave with versioning, invariant constraints, and test plan; added extract-bob planning note for subsequent slice.
Core Weave Planning & Validation
src/core/weave/weave.ts
Added secondPayloadWeave to WeaveSlice; extended PayloadWorkingArtifact with optional latestHistoricalSnapshotTurtle; added detection/classification guards; implemented planSecondPayloadWeave, pre-weave assertions, renderers, and a generalized payload manifestation path helper.
Runtime Weave Execution
src/runtime/weave/weave.ts
Made runtime candidate loading aware of secondPayloadWeave; extended loadPayloadWorkingArtifact to optionally load latestHistoricalSnapshotTurtle and return it; adjusted error handling for missing historical snapshots; updated isWeaveableKnopCandidate to require and compare historical snapshot; added helpers for historical snapshot path derivation.
Core Test Coverage
src/core/weave/weave_test.ts
Added Turtle constant for second weave knop inventory and a unit test asserting planWeave produces expected created/updated files, pages, and inventory triples for the secondPayloadWeave slice.
Integration & E2E Tests
tests/integration/weave_test.ts, tests/e2e/weave_cli_test.ts
Added integration test executing the second payload weave materialization and asserting produced artifact paths and contents; added e2e manifest test for 11-alice-bio-v2-woven and a compareTextFiles?: boolean option to the test helper to allow existence-only checks for text files.

Sequence Diagram(s)

sequenceDiagram
  participant CLI as "CLI"
  participant Runtime as "Weave Runtime\n(load candidates, files)"
  participant Planner as "Core Planner\n(planSecondPayloadWeave)"
  participant FS as "Filesystem\n(payload & history files)"
  participant Renderer as "Renderers\n(pages, TTL)"

  CLI->>Runtime: request weave for designatorPaths
  Runtime->>FS: load working payload + historical snapshot (if present)
  Runtime->>Planner: classify slice -> secondPayloadWeave
  Planner->>Planner: planSecondPayloadWeave (create _s0002 paths, inventory updates)
  Planner->>Renderer: generate woven knop inventory TTL + pages
  Renderer->>FS: write new snapshot TTLs and index.html pages
  Planner->>Runtime: return WeavePlan (created/updated files)
  Runtime->>CLI: report wovenDesignatorPaths & updatedPaths
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

🐰 I hop through Turtle lines and thread,

where alice's bio gains a bed.
A second snapshot, wrapped in care,
inventories tidy, pages fair.
Hooray — another woven lair! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: implementing a second payload weave slice that transitions alice bio from state 10 to 11, which is the primary objective of the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 11-alice-bio-v2-woven

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/runtime/weave/weave.ts (1)

319-357: ⚠️ Potential issue | 🟡 Minor

Run deno fmt on this block.

CI is already failing fmt:check here, so this hunk will block merge until the standard Deno formatting pass is applied.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/runtime/weave/weave.ts` around lines 319 - 357, The code block around
latestHistoricalSnapshotPath, currentPayloadTurtle, and
latestHistoricalSnapshotTurtle is not formatted to Deno standards and is failing
fmt:check; run the Deno formatter (deno fmt) or reformat this section so
spacing, indentation, and line breaks for the Deno.readTextFile calls, the
ternary that sets latestHistoricalSnapshotPath (using
toPayloadHistoricalSnapshotPath and currentKnopInventoryTurtle), and the
WeaveRuntimeError message construction (using toPayloadHistoricalSnapshotPath)
conform to deno fmt output.
🧹 Nitpick comments (1)
src/core/weave/weave.ts (1)

221-231: Consider consolidating duplicate payload artifact validation.

Lines 221-225 and 227-231 perform identical checks with the same error message. These could be combined:

♻️ Optional refactor
-  if (slice === "firstPayloadWeave" && !candidate.payloadArtifact) {
-    throw new WeaveInputError(
-      `Payload weave candidate ${candidate.designatorPath} is missing working payload state.`,
-    );
-  }
-
-  if (slice === "secondPayloadWeave" && !candidate.payloadArtifact) {
+  if (
+    (slice === "firstPayloadWeave" || slice === "secondPayloadWeave") &&
+    !candidate.payloadArtifact
+  ) {
     throw new WeaveInputError(
       `Payload weave candidate ${candidate.designatorPath} is missing working payload state.`,
     );
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/core/weave/weave.ts` around lines 221 - 231, The two identical checks for
payloadArtifact under slice values "firstPayloadWeave" and "secondPayloadWeave"
should be consolidated into a single conditional: check if slice is either
"firstPayloadWeave" or "secondPayloadWeave" and if candidate.payloadArtifact is
falsy, then throw the WeaveInputError with the same message referencing
candidate.designatorPath; update the code around the existing slice check (the
block containing the current throw using WeaveInputError and
candidate.payloadArtifact) to use a combined condition (e.g., slice ===
"firstPayloadWeave" || slice === "secondPayloadWeave") so the duplicate branches
are removed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@documentation/notes/wd.task.2026.2026-04-05_0903-weave-alice-bio-v2-woven.md`:
- Around line 27-29: The doc overstates which pages are regenerated; update the
note so it only claims creation/presence of the new _s0002 pages (e.g.,
alice/bio/_s0002... and related inventory entries) instead of saying
alice/index.html, alice/bio/index.html, or existing history landing pages are
rewritten; align the wording with the tests that enforce this behavior (see
tests/integration/weave_test.ts and tests/e2e/weave_cli_test.ts) and make the
same tightening for the other occurrences noted (around the current blocks at
lines 71-79 and 164-167).

In `@tests/e2e/weave_cli_test.ts`:
- Around line 39-45: The test disables text comparisons by setting
compareTextFiles: false in the call to assertWeaveTransitionMatchesManifest for
the manifest "11-alice-bio-v2-woven.jsonld", which turns manifest
compareMode==="text" checks into mere existence stats and can mask drift;
restore text comparison for this slice (remove or set compareTextFiles: true) so
the fixture is fully validated, and if only a few files are intentionally
unstable, instead add explicit exemptions for those filenames in the compare
routine (or pass a dedicated allowlist option) rather than disabling all text
comparisons; apply the same change for the other similar invocations referenced
around lines 116-120.

In `@tests/integration/weave_test.ts`:
- Around line 191-266: The new integration test block (Deno.test titled
"executeWeave materializes the second alice bio payload weave slice" in
tests/integration/weave_test.ts) is not formatted per project style; run the
repository formatter (deno fmt) over that file or the whole repo and commit the
resulting changes so the test hunk matches CI's fmt:check expectations.

---

Outside diff comments:
In `@src/runtime/weave/weave.ts`:
- Around line 319-357: The code block around latestHistoricalSnapshotPath,
currentPayloadTurtle, and latestHistoricalSnapshotTurtle is not formatted to
Deno standards and is failing fmt:check; run the Deno formatter (deno fmt) or
reformat this section so spacing, indentation, and line breaks for the
Deno.readTextFile calls, the ternary that sets latestHistoricalSnapshotPath
(using toPayloadHistoricalSnapshotPath and currentKnopInventoryTurtle), and the
WeaveRuntimeError message construction (using toPayloadHistoricalSnapshotPath)
conform to deno fmt output.

---

Nitpick comments:
In `@src/core/weave/weave.ts`:
- Around line 221-231: The two identical checks for payloadArtifact under slice
values "firstPayloadWeave" and "secondPayloadWeave" should be consolidated into
a single conditional: check if slice is either "firstPayloadWeave" or
"secondPayloadWeave" and if candidate.payloadArtifact is falsy, then throw the
WeaveInputError with the same message referencing candidate.designatorPath;
update the code around the existing slice check (the block containing the
current throw using WeaveInputError and candidate.payloadArtifact) to use a
combined condition (e.g., slice === "firstPayloadWeave" || slice ===
"secondPayloadWeave") so the duplicate branches are removed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e86091ea-b743-4688-abde-7f4d5cfe63d5

📥 Commits

Reviewing files that changed from the base of the PR and between 1098f28 and 63158e1.

⛔ Files ignored due to path filters (1)
  • documentation/notes/wd.conv.2026.2026-04-05_0842-implement-wd-task-2026-2026-04-04-1553-weave-alice-bio-re-codex.md is excluded by !documentation/notes/wd.conv.*
📒 Files selected for processing (9)
  • documentation/notes/wd.codebase-overview.md
  • documentation/notes/wd.spec.2026-04-03-weave-behavior.md
  • documentation/notes/wd.task.2026.2026-04-04_2019-update-alice-bio-payload.md
  • documentation/notes/wd.task.2026.2026-04-05_0903-weave-alice-bio-v2-woven.md
  • src/core/weave/weave.ts
  • src/core/weave/weave_test.ts
  • src/runtime/weave/weave.ts
  • tests/e2e/weave_cli_test.ts
  • tests/integration/weave_test.ts

Comment on lines +39 to +45
Deno.test("weave matches the manifest-scoped alice bio v2 woven fixture as a black-box CLI run", async () => {
await assertWeaveTransitionMatchesManifest({
manifestName: "11-alice-bio-v2-woven.jsonld",
expectedStdoutFragment: "Wove 1 designator path",
compareTextFiles: false,
});
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Keep slice 11 under fixture text comparison.

documentation/notes/wd.spec.2026-04-03-weave-behavior.md, Line 134 still treats the 11 HTML as fixture-aligned output. With compareTextFiles: false, every manifest compareMode === "text" check becomes an existence-only stat(), so this new acceptance path can pass even when current/history pages drift from the settled fixture. If only a few files are intentionally unstable, exempt those explicitly instead of disabling all text comparisons for the transition.

Also applies to: 116-120

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/e2e/weave_cli_test.ts` around lines 39 - 45, The test disables text
comparisons by setting compareTextFiles: false in the call to
assertWeaveTransitionMatchesManifest for the manifest
"11-alice-bio-v2-woven.jsonld", which turns manifest compareMode==="text" checks
into mere existence stats and can mask drift; restore text comparison for this
slice (remove or set compareTextFiles: true) so the fixture is fully validated,
and if only a few files are intentionally unstable, instead add explicit
exemptions for those filenames in the compare routine (or pass a dedicated
allowlist option) rather than disabling all text comparisons; apply the same
change for the other similar invocations referenced around lines 116-120.

@djradon djradon merged commit dfbefb8 into main Apr 5, 2026
3 of 4 checks passed
@djradon djradon deleted the 11-alice-bio-v2-woven branch April 5, 2026 17:07
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 5, 2026

Codecov Report

❌ Patch coverage is 90.00000% with 33 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/core/weave/weave.ts 92.36% 17 Missing and 4 partials ⚠️
src/runtime/weave/weave.ts 78.18% 11 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant