Skip to content

SDK lossless mutations, structured recovery, and snapshot lease safety - #961

Merged
unbraind merged 7 commits into
mainfrom
feat/sdk-lossless-mutations-structured-recovery
Aug 10, 2026
Merged

unbraind merged 7 commits into
mainfrom
feat/sdk-lossless-mutations-structured-recovery

Conversation

@unbraind

@unbraind unbraind commented Aug 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • make dependency mutations fail fast across SDK, CLI, bulk, and MCP paths while preserving explicit forward-reference and external-reference intent
  • make acceptance-criteria repairs atomic and lossless, with replacement/removal conflict contracts and deterministic receipts
  • keep legacy type coercion inside structured JSON output and harden workspace snapshot restore lease renewal
  • refresh generated SDK/CLI contracts, tests, agent documentation, and pinned GitHub Actions in one review tranche

PM lineage

Verification

  • full test suite: 468 files, 7141 tests passed
  • coverage: 100% statements, branches, functions, and lines
  • lint/static quality: ESLint, zero jscpd clones, 100% docstrings, package boundaries, SDK surface, token/context/tracker gates
  • security/docs: secret scan and docs-skills gate passed
  • manual clean-directory acceptance: dependency validation and opt-in, external targets, atomic criteria repair, JSON success/failure envelopes, snapshot preview and restore
  • grouped Actions update: PR chore(deps): bump the github-actions group across 1 directory with 5 updates #958 exact head had all CI, coverage, security, docs, and analysis checks green before incorporation

Review notes

The generated public-surface acknowledgement is intentional: the typed SDK now exposes explicit unresolved-dependency control and richer structured error details. Existing implicit dangling local edges now fail closed unless callers opt in.

Summary by Sourcery

Enforce lossless, fail-fast mutation contracts for acceptance criteria and dependencies across SDK, CLI, bulk, and MCP flows, while tightening workspace snapshot lock renewal and refreshing public contracts, docs, and CI tooling.

New Features:

  • Add explicit allowUnresolvedDeps options and validation that resolves local dependency targets up front, returning structured dependency_target_unresolved warnings when opt-in unresolved edges are intentional.
  • Expose richer structured mutation receipts, including acceptance_criteria_replaced warnings and type_coercion warnings, through SDK and CLI outputs.

Bug Fixes:

  • Prevent workspace snapshot restores from losing their writer lease by serializing and hardening lock heartbeat renewals.

Enhancements:

  • Make acceptance-criteria mutations atomic and lossless by rejecting unmatched removals with structured errors and disallowing conflicting replacement-plus-additive edits, including in bulk update-many flows.
  • Propagate dependency target validation and mutation option constraints consistently through update-many planning, dry-run behavior, and SDK/CLI tool schemas.
  • Retain legacy type synonym coercion strictly as structured JSON warning data instead of emitting stderr notes, improving agent-facing reliability.

CI:

  • Bump pinned pnpm and CodSpeed GitHub Actions and CodeQL actions to newer versions across CI, benchmarking, release, docs, and security workflows.

Documentation:

  • Update SDK, agent, and command documentation to describe lossless acceptance-criteria behavior, dependency target resolution requirements, and new unresolved-dependency controls.
  • Refresh PM lineage references to include lossless mutation contracts work items.

Tests:

  • Add comprehensive lossless mutation contract tests for acceptance criteria, dependency validation, type coercion, and bulk dry-run alignment, and update existing command, SDK, and integration tests to cover new options and behaviors.
  • Adjust test helpers and fixtures to default to allow-unresolved-deps where appropriate and to assert new warning tokens and error codes.

Summary by cubic

Makes SDK/CLI mutations lossless and predictable: unresolved local dependencies fail fast by default (opt-in allowed), acceptance-criteria edits are atomic, snapshot restore leases are safer, and outputs use clear, structured JSON. Also publishes structured mutation error codes with emitting-command mapping, enforces schema guardrails, updates docs/contracts/CHANGELOG, and pins GitHub Actions to newer SHAs.

  • New Features

    • Dependency validation: reject unresolved local targets across SDK/CLI/MCP/bulk; opt in with --allow-unresolved-deps (or allowUnresolvedDeps). External refs with source_kind=external bypass lookup. Deterministic dependency ordering; structured unresolved_targets in error context.
    • Acceptance criteria: unmatched removals fail with acceptance_criteria_remove_unmatched; list-level conflicts surface acceptance_criteria_mutation_conflict (mapped to update and update-many). CLI schema disallows mixing --acceptance-criteria with --add-ac/--remove-ac. Deterministic receipts.
    • Structured output: type coercion and diagnostics stay inside JSON envelopes; PmCliErrorContext adds unmatched and unresolved_targets.
    • Snapshot restore: deterministic lease renewal/refresh and cleanup to prevent orphaned work.
    • Contracts/docs/changelog: regenerate error-code catalog (with emitting-command mapping) and aggregate contract fixture; update SDK/CLI docs and CHANGELOG. CI pins updated to latest SHAs for pnpm/action-setup, github/codeql-action/*, and CodSpeedHQ/action.
  • Migration

    • Local dependency edges now fail closed unless you pass --allow-unresolved-deps (CLI) or set allowUnresolvedDeps (SDK). Prefer source_kind=external for cross-workspace targets.
    • Do not mix --acceptance-criteria with --add-ac/--remove-ac on update/update-many. Use remove+add for one-entry repairs; unmatched removals error with structured guidance.
    • JSON consumers should read structured fields (warnings and error context), including explicit dependency and acceptance-criteria receipts and new error codes.

Written for commit 30e7b22. Summary will update on new commits.

Review in cubic

unbraind and others added 3 commits August 10, 2026 10:26
Fail fast on unresolved local dependency targets across SDK, CLI, bulk, and MCP paths while preserving explicit forward-reference and external-reference escape hatches. Make acceptance-criteria repairs atomic, move type coercion into structured receipts, harden snapshot lease renewal, refresh generated contracts, and add full behavioral coverage and operator documentation.

Tracks pm-x3dq0l, pm-lppm6y, pm-embm6t, and pm-usq49n; also records pm-obh6lo dependency integration evidence.
…updates

Bumps the github-actions group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [pnpm/action-setup](https://github.com/pnpm/action-setup) | `6.0.9` | `6.0.10` |
| [github/codeql-action/init](https://github.com/github/codeql-action) | `4.37.4` | `4.37.6` |
| [github/codeql-action/analyze](https://github.com/github/codeql-action) | `4.37.4` | `4.37.6` |
| [CodSpeedHQ/action](https://github.com/codspeedhq/action) | `5.0.1` | `5.0.3` |
| [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) | `4.37.4` | `4.37.6` |



Updates `pnpm/action-setup` from 6.0.9 to 6.0.10
- [Release notes](https://github.com/pnpm/action-setup/releases)
- [Commits](pnpm/action-setup@0ebf471...0977fd9)

Updates `github/codeql-action/init` from 4.37.4 to 4.37.6
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@f205ea1...5595cca)

Updates `github/codeql-action/analyze` from 4.37.4 to 4.37.6
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@f205ea1...5595cca)

Updates `CodSpeedHQ/action` from 5.0.1 to 5.0.3
- [Release notes](https://github.com/codspeedhq/action/releases)
- [Changelog](https://github.com/CodSpeedHQ/action/blob/main/CHANGELOG.md)
- [Commits](CodSpeedHQ/action@8847237...4296e51)

Updates `github/codeql-action/upload-sarif` from 4.37.4 to 4.37.6
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@f205ea1...5595cca)

---
updated-dependencies:
- dependency-name: CodSpeedHQ/action
  dependency-version: 5.0.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.37.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action/init
  dependency-version: 4.37.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action/upload-sarif
  dependency-version: 4.37.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: pnpm/action-setup
  dependency-version: 6.0.10
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Attach every updated workflow and the security/docs/transport verification command to pm-obh6lo so the Dependabot changes remain traceable when incorporated into the broad SDK branch.

@sourcery-ai sourcery-ai 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.

Sorry @unbraind, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@sourcery-ai

sourcery-ai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implements lossless acceptance-criteria and dependency-mutation contracts across SDK/CLI/create/update/update-many, adds explicit unresolved-dependency and type-coercion signaling, hardens workspace snapshot lock renewal, and refreshes tests/docs/tooling to align with the new behavior.

Sequence diagram for dependency target validation on update mutations

sequenceDiagram
  actor User
  participant Cli
  participant UpdateCommand as runUpdate
  participant DepValidation as assertDependencyTargetsResolvable
  participant Store as locateItem

  User->>Cli: pm update --dep ... [--allow-unresolved-deps]
  Cli->>UpdateCommand: runUpdate(options)
  UpdateCommand->>DepValidation: assertDependencyTargetsResolvable({ pmRoot, dependencies, idPrefix, itemFormat, typeToFolder, allowUnresolvedDeps })

  loop each local dependency id
    DepValidation->>Store: locateItem(pmRoot, id, idPrefix, itemFormat, typeToFolder)
    Store-->>DepValidation: located|null
  end

  alt all targets located
    DepValidation-->>UpdateCommand: []
  else some missing and allowUnresolvedDeps == true
    DepValidation-->>UpdateCommand: ["dependency_target_unresolved:<id>", ...]
  else some missing and allowUnresolvedDeps != true
    DepValidation-->>UpdateCommand: throw PmCliError(code=dependency_target_not_found)
  end

  UpdateCommand-->>Cli: result with aggregated warnings
Loading

Sequence diagram for workspace snapshot restore heartbeat lease renewal

sequenceDiagram
  actor User
  participant Restore as restoreWorkspaceSnapshotWithRecovery
  participant Heartbeat as WorkspaceLockHeartbeat
  participant FS as renew

  User->>Restore: restoreWorkspaceSnapshotWithRecovery(lockPath, lockTtlSeconds)
  Restore->>Heartbeat: new WorkspaceLockHeartbeat(lockPath, intervalMs)
  Restore->>Heartbeat: start()
  Heartbeat->>Heartbeat: scheduleRenewal()
  Heartbeat->>FS: renew()
  FS-->>Heartbeat: read lock file and validate ownership

  Restore->>Heartbeat: refreshNow()
  Heartbeat->>Heartbeat: scheduleRenewal()
  Heartbeat->>FS: renew()
  FS-->>Heartbeat: read lock file and validate ownership
  Heartbeat->>Heartbeat: assertHealthy()

  alt ownership lost
    Heartbeat-->>Restore: throw PmCliError
  else ownership retained
    Heartbeat-->>Restore: lease renewed
  end

  Restore-->>User: snapshot restored or recovery error
Loading

File-Level Changes

Change Details Files
Make acceptance-criteria mutations lossless and atomic with explicit conflict and replacement signaling across single-item and bulk updates.
  • Refactor acceptance-criteria planning in update-many to throw on unmatched removals and treat additive mutations as all-or-nothing.
  • Remove per-row warning accumulation for unmatched acceptance-criteria removals and instead reject dry-run and apply when selectors do not match.
  • Introduce acceptance_criteria_mutation_conflict and acceptance_criteria_remove_unmatched error codes and wire them through update and update-many flows.
  • Emit acceptance_criteria_replaced:: warnings when whole-value replacement changes criteria, and document the contract in SDK and CLI docs.
src/sdk/lifecycle/update-many.ts
src/sdk/lifecycle/update.ts
src/sdk/generated-error-code-catalog.ts
docs/SDK.md
docs/COMMANDS.md
docs/AGENT_GUIDE.md
tests/unit/commands/update-command.spec.ts
tests/unit/commands/update-many-command.spec.ts
tests/unit/commands/lossless-mutation-contracts.spec.ts
Enforce dependency target resolution before mutations, with opt-in unresolved mode and structured warnings, across SDK, CLI, bulk, and MCP paths.
  • Add assertDependencyTargetsResolvable to resolve local dependency targets via locateItem, fail fast on missing targets, or emit dependency_target_unresolved: warnings when allowUnresolvedDeps is set.
  • Thread allowUnresolvedDeps through create, update, and update-many options, CLI normalization, tool schemas, and commander contracts, including mutuallyExclusive constraints in tool action schemas.
  • Aggregate dependency target warnings into mutation results (create/update/update-many) and update tests and fixtures to opt into unresolved mode where dangling deps are intentional.
  • Document the dependency validation contract and allow-unresolved-deps behavior for both CLI and SDK consumers, and add dedicated lossless-mutation/dependency contract tests.
src/sdk/dependency-flag-validation.ts
src/sdk/lifecycle/create.ts
src/sdk/lifecycle/update.ts
src/sdk/lifecycle/update-many.ts
src/sdk/cli-contracts/commander-mutation-options.ts
src/sdk/cli-contracts/registration-helpers.ts
src/sdk/cli-contracts/tool-schema.ts
src/sdk/cli-contracts/tool-parameter-tables.ts
src/sdk/cli-contracts/flag-contracts.ts
src/sdk/cli-contracts/tool-option-contracts.ts
docs/SDK.md
docs/COMMANDS.md
docs/AGENT_GUIDE.md
tests/unit/commands/create-command.spec.ts
tests/unit/commands/update-command.spec.ts
tests/unit/commands/update-many-command.spec.ts
tests/integration/cli.integration.spec.ts
tests/integration/dependency-alias.integration.spec.ts
tests/unit/commands/deps-command.spec.ts
tests/unit/commands/validate-command.spec.ts
tests/unit/commands/templates-command.spec.ts
tests/unit/sdk/graph/run.spec.ts
tests/unit/commands/context-command.spec.ts
tests/unit/commands/reindex-command.spec.ts
tests/integration/mcp-dynamic-package-actions.spec.ts
tests/helpers/itemFactory.ts
tests/unit/commands/lossless-mutation-contracts.spec.ts
src/sdk/generated-error-code-catalog.ts
src/core/shared/errors.ts
Keep type-coercion and other validation notes in structured JSON warnings instead of stderr, and align create-mode behavior with the lossless contracts.
  • Change type synonym resolution in resolveCreateTypeSelection to accumulate type_coercion:: warnings instead of printing notes to stderr.
  • Propagate type-selection warnings into create validation warnings, and adjust strict create-mode tests to assert structured error envelopes rather than human-oriented notes.
  • Add contract tests ensuring type coercion appears only in JSON warnings and that strict mode failures return parseable structured errors without stdout noise.
src/sdk/lifecycle/create.ts
docs/SDK.md
tests/unit/commands/create-command.spec.ts
tests/unit/commands/lossless-mutation-contracts.spec.ts
Harden workspace snapshot restore lease renewal with serialized heartbeat refresh and explicit refreshNow, and adjust snapshot tests accordingly.
  • Refactor WorkspaceLockHeartbeat to centralize renewal sequencing in scheduleRenewal, track first failure, and expose refreshNow for one-shot lease extension and health assertion.
  • Invoke heartbeat.refreshNow during snapshot restore setup and during atomic operation retries to guarantee a fresh, owned lease before staging or swapping.
  • Update workspace snapshot tests to exercise heartbeat-based locking directly instead of relying on large payload restores to keep the lease alive.
src/sdk/workspace-snapshot.ts
tests/unit/sdk/workspace-snapshot.spec.ts
Refresh generated SDK/CLI contracts, public surface, docs tracking, and CI tooling versions to match the new mutation and dependency behavior.
  • Update SDK public-surface and contract fixtures to expose allowUnresolvedDeps, new warnings, and error codes.
  • Extend CLI flag/option contracts and tool parameter metadata for allow-unresolved-deps and the refined acceptance-criteria semantics.
  • Add pm lineage references for lossless mutation contracts in COMMANDS.md and new PM issue/history artifacts for the related work.
  • Bump pinned versions of pnpm/action-setup, CodeQL, CodSpeed, and related GitHub Actions workflows for CI, docs, nightly, release, and scorecard pipelines.
sdk/public-surface.json
tests/fixtures/contracts/full.json
docs/COMMANDS.md
docs/AGENT_GUIDE.md
.agents/pm/issues/pm-x3dq0l.toon
.agents/pm/issues/pm-lppm6y.toon
.agents/pm/issues/pm-embm6t.toon
.agents/pm/issues/pm-usq49n.toon
.agents/pm/chores/pm-obh6lo.toon
.agents/pm/history/pm-x3dq0l.jsonl
.agents/pm/history/pm-lppm6y.jsonl
.agents/pm/history/pm-embm6t.jsonl
.agents/pm/history/pm-usq49n.jsonl
.agents/pm/history/pm-obh6lo.jsonl
.github/workflows/ci.yml
.github/workflows/codeql.yml
.github/workflows/codspeed.yml
.github/workflows/auto-release.yml
.github/workflows/docs.yml
.github/workflows/nightly.yml
.github/workflows/release.yml
.github/workflows/scorecard.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added opt-in support for unresolved dependency references, with structured warnings and validation across single and bulk operations.
    • Added clearer structured diagnostics for JSON, NDJSON, CLI, SDK, and MCP outputs.
    • Added atomic acceptance-criteria updates, exact-match removal errors, and replacement conflict validation.
    • Improved workspace snapshot restore reliability during lease renewal.
  • Bug Fixes

    • Updated pinned workflow actions to current revisions for improved security and maintenance.
  • Documentation

    • Expanded command and SDK guidance for dependency handling and acceptance-criteria mutations.

Walkthrough

The PR adds dependency-target validation, atomic acceptance-criteria mutation rules, structured warnings and errors, workspace lease refresh handling, refreshed GitHub Actions pins, and related tests, documentation, contract fixtures, and project-management records.

Changes

Mutation contracts and dependency validation

Layer / File(s) Summary
Public contracts and error metadata
src/core/shared/errors.ts, src/sdk/cli-contracts/*, sdk/public-surface.json, src/sdk/generated-error-code-catalog.ts, tests/fixtures/contracts/full.json, docs/*
The CLI and SDK expose allowUnresolvedDeps. Acceptance-criteria replacement and incremental edits are mutually exclusive. Unmatched removals now produce structured atomic failures.
Dependency checks and mutation execution
src/sdk/dependency-flag-validation.ts, src/sdk/lifecycle/create.ts, src/sdk/lifecycle/update.ts, src/sdk/lifecycle/update-many.ts
Create, update, and bulk update validate local dependency targets. Explicitly allowed unresolved targets produce warnings. Mutation results include structured warnings and errors.
Regression and contract coverage
tests/unit/commands/*, tests/integration/*, tests/helpers/itemFactory.ts
Tests cover dependency resolution, unresolved and external targets, atomic criteria changes, bulk parity, replacement conflicts, and structured output. Test fixtures enable unresolved dependencies where required.

Workspace lease renewal

Layer / File(s) Summary
Heartbeat scheduling and restore integration
src/sdk/workspace-snapshot.ts, tests/unit/sdk/workspace-snapshot.spec.ts
WorkspaceLockHeartbeat now serializes renewals and exposes refreshNow(). Restore refreshes the lease immediately after heartbeat startup and after activation. The test focuses on renewal after TTL expiry and competing-lock rejection.

Pinned GitHub Actions

Layer / File(s) Summary
Action SHA refresh and verification records
.github/workflows/*, .agents/pm/chores/*, .agents/pm/history/pm-obh6lo.jsonl
Pinned revisions for pnpm setup, CodeQL, and CodSpeed actions were updated across eight workflows. The project record stores affected workflows and validation evidence.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MutationCommand
  participant Lifecycle
  participant DependencyValidator
  participant WorkspaceLookup
  MutationCommand->>Lifecycle: submit create or update options
  Lifecycle->>DependencyValidator: validate dependency targets
  DependencyValidator->>WorkspaceLookup: resolve local target IDs
  WorkspaceLookup-->>DependencyValidator: target results
  DependencyValidator-->>Lifecycle: warnings or structured error
  Lifecycle-->>MutationCommand: mutation result
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 52.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description check ✅ Passed The description clearly covers the dependency, acceptance-criteria, structured-output, snapshot-lease, documentation, test, and CI changes.
Title check ✅ Passed The title concisely identifies the main SDK mutation, structured recovery, and snapshot lease changes.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

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.

@codspeed

codspeed Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 1.78%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 10 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ createQueryFingerprint 1.5 ms 1.4 ms +1.78%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing feat/sdk-lossless-mutations-structured-recovery (30e7b22) with main (229fd3f)

Open in CodSpeed

@codecov

codecov Bot commented Aug 10, 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!

Regenerate the aggregate contract fixture after hosted static CI identified missing dependency and acceptance-criteria error catalog entries. Record the exact CI disposition and generated artifact linkage on the active PM lineage.
@unbraind

Copy link
Copy Markdown
Owner Author

@greptileai review

@coderabbitai full review

Exact-head update 6054f45 regenerates the canonical aggregate contract fixture after hosted static CI identified missing structured error catalog entries. Please review the full PR at this head.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

@unbraind I will perform a full review of PR #961 at commit 6054f45af. I will verify the regenerated aggregate contract fixture and the complete change set.

⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 53 minutes.

@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: 6

🤖 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/sdk/dependency-flag-validation.ts`:
- Around line 89-92: Update the target sorting in the resolutions flow around
the unresolved dependency collection to use a deterministic code-unit comparator
instead of localeCompare. Preserve deduplication and ensure the resulting order
is reused consistently for warning tokens, unresolved_targets, and
recovery.missing structured output.

In `@src/sdk/generated-error-code-catalog.ts`:
- Around line 10-22: Update the catalog source entry for
acceptance_criteria_mutation_conflict to include update-many in
emitting_commands, then regenerate generated-error-code-catalog.ts. Preserve the
existing update declaration and ensure catalog consumers expose both mutation
commands.

In `@src/sdk/workspace-snapshot.ts`:
- Around line 875-879: Move the heartbeatStopped = false assignment before await
heartbeat.refreshNow() in the heartbeat restart callback, ensuring the outer
cleanup invokes heartbeat.stop() even when refreshNow() rejects.

In `@tests/fixtures/contracts/full.json`:
- Around line 19746-19748: The shared acceptanceCriteria description is
incorrectly additive for all actions. Update the acceptanceCriteria description
handling in the tool-parameter table/schema generation so update and update-many
mention removeAc/addAc atomic repairs, while create and plan use wording that
does not imply those unsupported fields.

In `@tests/helpers/itemFactory.ts`:
- Line 76: Update the item factory helper around the args construction to make
unresolved dependencies opt-in via an explicit test override. Remove the
unconditional "--allow-unresolved-deps" entry from the base arguments, and
append it only when that override is enabled, preserving default
dependency-target validation for all other tests.

In `@tests/unit/sdk/workspace-snapshot.spec.ts`:
- Around line 259-272: Update the heartbeat refresh test around
heartbeat.start() to create an expired lock fixture deterministically, without
starting the periodic scheduler; invoke only heartbeat.refreshNow(), then verify
competing acquisition is rejected. Replace the resulting deterministic-test
evidence through the pm CLI, appending to the PM history rather than editing
.agents/pm/history/*.jsonl or generated projections directly.
🪄 Autofix

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: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6ad313ce-1f2d-450d-8b44-b6e3a5069233

📥 Commits

Reviewing files that changed from the base of the PR and between 229fd3f and e612397.

📒 Files selected for processing (53)
  • .agents/pm/chores/pm-obh6lo.toon
  • .agents/pm/history/pm-embm6t.jsonl
  • .agents/pm/history/pm-lppm6y.jsonl
  • .agents/pm/history/pm-obh6lo.jsonl
  • .agents/pm/history/pm-usq49n.jsonl
  • .agents/pm/history/pm-x3dq0l.jsonl
  • .agents/pm/issues/pm-embm6t.toon
  • .agents/pm/issues/pm-lppm6y.toon
  • .agents/pm/issues/pm-usq49n.toon
  • .agents/pm/issues/pm-x3dq0l.toon
  • .github/workflows/auto-release.yml
  • .github/workflows/ci.yml
  • .github/workflows/codeql.yml
  • .github/workflows/codspeed.yml
  • .github/workflows/docs.yml
  • .github/workflows/nightly.yml
  • .github/workflows/release.yml
  • .github/workflows/scorecard.yml
  • docs/AGENT_GUIDE.md
  • docs/COMMANDS.md
  • docs/SDK.md
  • sdk/public-surface.json
  • src/core/shared/errors.ts
  • src/sdk/cli-contracts/commander-mutation-options.ts
  • src/sdk/cli-contracts/flag-contracts.ts
  • src/sdk/cli-contracts/registration-helpers.ts
  • src/sdk/cli-contracts/tool-option-contracts.ts
  • src/sdk/cli-contracts/tool-parameter-tables.ts
  • src/sdk/cli-contracts/tool-schema.ts
  • src/sdk/dependency-flag-validation.ts
  • src/sdk/generated-error-code-catalog.ts
  • src/sdk/lifecycle/create.ts
  • src/sdk/lifecycle/update-many.ts
  • src/sdk/lifecycle/update.ts
  • src/sdk/workspace-snapshot.ts
  • tests/fixtures/contracts/full.json
  • tests/helpers/itemFactory.ts
  • tests/integration/cli.integration.spec.ts
  • tests/integration/dependency-alias.integration.spec.ts
  • tests/integration/mcp-dynamic-package-actions.spec.ts
  • tests/unit/commands/context-command.spec.ts
  • tests/unit/commands/create-command.spec.ts
  • tests/unit/commands/deps-command.spec.ts
  • tests/unit/commands/list-command.spec.ts
  • tests/unit/commands/lossless-mutation-contracts.spec.ts
  • tests/unit/commands/next-command.spec.ts
  • tests/unit/commands/reindex-command.spec.ts
  • tests/unit/commands/templates-command.spec.ts
  • tests/unit/commands/update-command.spec.ts
  • tests/unit/commands/update-many-command.spec.ts
  • tests/unit/commands/validate-command.spec.ts
  • tests/unit/sdk/graph/run.spec.ts
  • tests/unit/sdk/workspace-snapshot.spec.ts

Comment thread src/sdk/dependency-flag-validation.ts Resolved
Comment thread src/sdk/generated-error-code-catalog.ts Resolved
Comment thread src/sdk/workspace-snapshot.ts Resolved
Comment thread tests/fixtures/contracts/full.json Resolved
Comment thread tests/helpers/itemFactory.ts Resolved
Use locale-independent dependency ordering, attribute criteria conflicts to bulk updates, scope criteria guidance per action, preserve default validation in test factories, and make snapshot activation cleanup plus refresh-only lease tests deterministic.

Verified with focused 71-test review suite, generated-contract checks, lint/static gates, and 7141 tests at exact 100/100/100/100 coverage.
@unbraind

Copy link
Copy Markdown
Owner Author

@greptileai review

@coderabbitai full review

All six prior thread findings are implemented, replied to, reacted to, and resolved at exact head ac47bef. Focused review tests pass 71/71 and full coverage passes 7141/7141 at 100/100/100/100. Please perform a fresh full-head review.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

@unbraind I will perform a fresh full review of PR #961 at head ac47bef47. I will review the complete change set and verify the resolved findings against the current code.

⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 35 minutes.

@unbraind

Copy link
Copy Markdown
Owner Author

Disposition for Sourcery guide #961 (comment): acknowledged as an accurate architecture map. Its sequence diagrams match the implemented dependency validation and lease-renewal paths; it raised no code finding. Sourcery review availability is separately rate-limited and is not counted as approval.

@unbraind

Copy link
Copy Markdown
Owner Author

Disposition for CodeRabbit summary #961 (comment): all six actionable findings from review 4895007964 were verified, implemented at ac47bef, individually replied to and up-voted, and all six threads are resolved. The exact head passes hosted static, type, compatibility, smoke, coverage, security, benchmark, and platform gates.

@unbraind

Copy link
Copy Markdown
Owner Author

Disposition for CodSpeed report #961 (comment): acknowledged as useful exact-head evidence. The reported pagination benchmark improves 1.6%, ten benchmarks are unchanged, and independent repository SDK and CLI timing gates pass.

@unbraind

Copy link
Copy Markdown
Owner Author

Disposition for Codecov report #961 (comment): acknowledged. Codecov confirms all modified coverable lines and tests are green; the independent full local run is 7141/7141 with exactly 100% statements, branches, functions, and lines.

@unbraind

Copy link
Copy Markdown
Owner Author

Disposition for CodeRabbit re-request #961 (comment): the requested 6054f45 review was rate-limited, so it is recorded as unavailable rather than approval. The subsequent actionable review was fully addressed, and a later exact-head request was made after those fixes.

@unbraind

Copy link
Copy Markdown
Owner Author

Disposition for final CodeRabbit re-request #961 (comment): the fresh ac47bef review was rate-limited for 35 minutes, beyond the requested bounded review window. No provider approval is inferred; exact-head hosted gates, the thread-aware inventory, six resolved findings, and independent 100/100/100/100 coverage are the merge evidence.

@unbraind

Copy link
Copy Markdown
Owner Author

Review-object disposition inventory: Sourcery review 4894936728 is an unavailable weekly-limit response, not approval. CodeRabbit review 4895007964 supplied six actionable findings; every finding was implemented, reacted to, replied to, and resolved. Follow-up CodeRabbit review objects 4895107701, 4895107866, 4895108314, 4895108776, 4895108792, and 4895108846 acknowledge those six thread replies; each review and its corresponding inline acknowledgement has been up-voted, and exact head ac47bef is fully green.

Close and release the five actively delivered items with exact-head review and verification evidence, leave no item in progress, and regenerate CHANGELOG.md exclusively through pm-changelog 2026.8.7.
@unbraind

Copy link
Copy Markdown
Owner Author

@greptileai review

@coderabbitai full review

Final exact-head update 2befdf4 contains only canonical pm close/release history and CHANGELOG.md generated by pm-changelog 2026.8.7. All five delivered items are closed and no item remains in progress. Please review this final head.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

@unbraind I will perform a fresh full review of PR #961 at exact head 2befdf4c5. I will review the complete final change set, including the canonical PM history and generated CHANGELOG.md.

⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 25 minutes.

Populate resolution on all four delivered issues and full expected/actual/resolution evidence on the Actions chore, restoring the validate-resolution ratchet to its declared ceiling without weakening governance.
@unbraind

Copy link
Copy Markdown
Owner Author

@greptileai review

@coderabbitai full review

Final governance correction at head 30e7b22 populates typed resolution evidence on the delivered items after the hosted tracker ratchet identified the omission. The ratchet now passes at its original ceiling; no gate was weakened. Please review this final head.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

@unbraind I will perform a fresh full review of PR #961 at head 30e7b2264. I will review the complete change set, including the typed resolution evidence and the tracker-ratchet correction.

⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 19 minutes.

@unbraind

Copy link
Copy Markdown
Owner Author

Final CodeRabbit availability disposition: the 2befdf4 closeout review and the 30e7b226 typed-resolution review were both rate-limited. Each status is acknowledged and up-voted, but neither is treated as approval. The earlier full review produced six findings that are all fixed and resolved; the final exact head has no code changes beyond those reviewed fixes, all hosted checks are green, and the tracker ratchet specifically passes at its original ceiling.

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