Skip to content

feat(weave): batch untargeted multi-pending first-payload weave - #33

Merged
djradon merged 1 commit into
mainfrom
lane/untargeted-first-payload-batch
Aug 1, 2026
Merged

feat(weave): batch untargeted multi-pending first-payload weave#33
djradon merged 1 commit into
mainfrom
lane/untargeted-first-payload-batch

Conversation

@djradon

@djradon djradon commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

First-payload bite 1 of wa.task.2026.2026-07-03_1332-stagecraft-weave-planner-generalization (Kim brief in that note; carved and fired from planning-loop wakes 6–8). Addresses the first remaining P1 blocker: multi-pending first-payload weave in one transaction — where "transaction" means one validated VersionPlan and one shared MeshInventory progression, not filesystem atomicity (application-owned, per the recorded decision).

What

Untargeted weave over two-plus pending candidates that ALL classify as firstPayloadWeave now routes through the existing coherent payload-batch planner instead of refusing with the single-candidate cardinality error. One deterministic plan, canonical designator ordering, both payload histories plus configured Knop support histories, one working MeshInventory update, and — under versioned MeshInventory policy — exactly one new HistoricalState per command. Single-target, explicit multi-target, exact-target narrowing, and untargeted mixed/recursive/later-payload sets are all preserved on their existing paths.

Evidence

  • Fail-on-old, all three tests: the untargeted core batch failed with supports exactly one weave candidate; found 2; the integration test failed because the old sequential loop created _s0002 AND _s0003 where one state was owed; the exact-target regression passed on old code (confirming preserved narrowing).
  • Full core planner suite 71 green; recursive mixed-slice, single later-payload, and explicit later-payload batch regressions green; full deno task ci green.
  • Kim's report: no renderer or progression-resolver changes needed; differing scoped policies remain fail-closed; no checkpoint double-hash guarantee added (separate contract decision).

Not in this bite

Current-mode extracted-term preservation (sequenced after #31), condition-specific diagnostics, later-payload/recursive/mixed batching, locking/rollback.

Implemented by Codex (codex exec) as Kim under the standing loop-wake grant; reviewed, validated, and landed by the planning seat.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LHrFYeUefDr227gLuWWuq1

Summary by CodeRabbit

  • New Features

    • Added support for processing multiple initial payloads together in untargeted weave requests.
    • Multiple payloads can now be integrated in a single operation, with corresponding files and resource pages created.
    • Weaving advances metadata correctly after processing batched payloads.
  • Bug Fixes

    • Improved target-specific processing so unrelated payloads remain isolated during targeted requests.
  • Tests

    • Added coverage for multi-payload and targeted weaving scenarios.

- planWeave dispatches an untargeted candidate set through the existing
  coherent payload-batch planner when every candidate classifies as
  firstPayloadWeave (and overwrite is not requested); single-target and
  explicit multi-target behavior unchanged
- prepareVersionExecution recognizes the untargeted all-first-payload
  set after candidate discovery and routes it through the existing
  batch-plan branch as one policy-validated VersionPlan; mixed,
  recursive, and later-payload sets stay on the sequential path
- core tests: reverse-order untargeted batch (fail-on-old: "supports
  exactly one weave candidate; found 2") producing canonical ordering,
  one MeshInventory state + one working update, both payload and Knop
  facts merged; exact-target narrowing regression
- integration test: docs-rooted sidecar with ontology+shacl integrated,
  untargeted executeWeave, versioned MeshInventory advancing ONCE
  (fail-on-old: sequential loop created _s0002 AND _s0003)
- first-payload bite 1 of wa.task.2026.2026-07-03_1332 (brief in that
  note); full deno task ci green

Implemented-By: Codex (codex exec) as Kim
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LHrFYeUefDr227gLuWWuq1
@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change enables untargeted batching of multiple first-payload weave candidates when overwrite mode is disabled. Runtime planning selects these candidates, while unit and integration tests verify ordering, target isolation, generated outputs, and mesh metadata progression.

Changes

First-payload batching

Layer / File(s) Summary
Planning rules and unit coverage
src/core/weave/weave.ts, src/core/weave/weave_test.ts
planWeave accepts untargeted first-payload batches. Tests cover canonical ordering, explicit-target batching, and target isolation.
Runtime batch selection
src/runtime/weave/version_execution.ts
prepareVersionExecution detects untargeted first-payload batches and passes their initial candidates to payload-batch planning.
Integration validation
tests/integration/weave_test.ts
Integration coverage verifies two RDF payloads, generated files and ResourcePages, and mesh metadata progression.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant VersionRequest
  participant prepareVersionExecution
  participant planWeave
  participant MeshOutput
  VersionRequest->>prepareVersionExecution: provide multiple pending payload candidates
  prepareVersionExecution->>planWeave: pass untargeted first-payload batch
  planWeave-->>prepareVersionExecution: return payload batch plan
  prepareVersionExecution->>MeshOutput: create payload files and ResourcePages
  MeshOutput-->>VersionRequest: return updated mesh metadata
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: batching untargeted multi-pending first-payload weaves.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 lane/untargeted-first-payload-batch

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.

djradon added a commit that referenced this pull request Aug 1, 2026
@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@djradon

djradon commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/runtime/weave/version_execution.ts`:
- Around line 413-429: Update the untargeted first-payload path around
untargetedFirstPayloadBatch and batchCandidates to create and verify a
working-file snapshot for initialWeaveableKnops before batch planning. Ensure
the selected candidates are loaded from one consistent payload revision, while
preserving the existing snapshot behavior for explicit payload batches and the
current candidate-selection logic.
🪄 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 Plus

Run ID: 884454da-51c7-4a93-85f2-be34525a5dc2

📥 Commits

Reviewing files that changed from the base of the PR and between 7561725 and d6f87ca.

📒 Files selected for processing (4)
  • src/core/weave/weave.ts
  • src/core/weave/weave_test.ts
  • src/runtime/weave/version_execution.ts
  • tests/integration/weave_test.ts

Comment on lines +413 to +429
const untargetedFirstPayloadBatch = targets.length === 0 &&
isUntargetedFirstPayloadBatch(
meshState.meshBase,
initialWeaveableKnops,
);
const batchCandidates = untargetedFirstPayloadBatch
? initialWeaveableKnops
: payloadBatchCandidates;

if (
payloadBatchCandidates.length > 0 &&
isExplicitPayloadBatch(
meshState.meshBase,
payloadBatchCandidates,
targetByDesignatorPath,
)
batchCandidates.length > 0 &&
(untargetedFirstPayloadBatch ||
isExplicitPayloadBatch(
meshState.meshBase,
batchCandidates,
targetByDesignatorPath,
))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Capture and verify a working-file snapshot for untargeted batches.

When targets is empty, shouldAttemptExplicitPayloadBatch returns false. Lines 413-420 then select initialWeaveableKnops without createPayloadBatchWorkingFileSnapshot or its verification. A payload change during candidate loading can produce a batch from mixed input revisions.

Extend the snapshot flow to the selected untargeted first-payload candidates before batch planning.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/runtime/weave/version_execution.ts` around lines 413 - 429, Update the
untargeted first-payload path around untargetedFirstPayloadBatch and
batchCandidates to create and verify a working-file snapshot for
initialWeaveableKnops before batch planning. Ensure the selected candidates are
loaded from one consistent payload revision, while preserving the existing
snapshot behavior for explicit payload batches and the current
candidate-selection logic.

@djradon
djradon merged commit a26d969 into main Aug 1, 2026
7 checks passed
@djradon

djradon commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Disposition of the snapshot-capture suggestion: deliberate skip, boarded as a residual rather than fixed here.

The explicit-batch double-hash guard exists because the evidenced Stagecraft checkpoint flow supplies requested targets from a service that owns single-writer serialization — the recorded 2026-07-06 decision scoped capture verification to "the requested targets' current working payload files." The untargeted path has no requested set (candidates are discovered), so extending capture there is a new contract decision, not a bug fix — and it was pre-identified as exactly that in this bite's brief ("needs the explicit checkpoint batch's double-hash input-capture guarantee → separate contract decision; report rather than implement"). It is also not a regression: the sequential loop this dispatch replaces never had capture on the untargeted path either. Boarded on the owning task note; revisit if a service ever drives untargeted weave.

🤖 Generated with Claude Code

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