Skip to content

SDK context integrity and merge truth - #652

Merged
unbraind merged 3 commits into
mainfrom
feat/sdk-context-integrity-merge-truth
Jul 23, 2026
Merged

unbraind merged 3 commits into
mainfrom
feat/sdk-context-integrity-merge-truth

Conversation

@unbraind

@unbraind unbraind commented Jul 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • expose notes_count in token-bounded get/show projections while keeping deep/full note payloads backward compatible
  • promote alias-aware relationship edge validation into the public SDK and enforce self-edge policy before CLI create/update persistence
  • classify merge reconciliation by net outcome so append unions and reorderings preserve context without false data-loss warnings
  • document the new SDK and merge-safety contracts, generate the changelog through pm-changelog, and record rich tracker lineage

Why

Project management is context management. Agents need compact reads that disclose omitted context, mutation primitives that prevent invalid graph state, and merge diagnostics that stay loud only when context is genuinely lost.

Tracked work

  • pm-3esl28 — truthful omitted-note counts
  • pm-k9t17l — SDK relationship mutation integrity
  • pm-mmm9o5 — loss-aware merge reconciliation
  • pm-ds3b — rolling SDK reference

Validation

  • pnpm test:coverage — 6,101 tests; 100% statements, branches, functions, and lines
  • pnpm typecheck
  • pnpm lint — ESLint, zero-clone jscpd, static quality, 100% docstrings, package boundaries, and token budgets
  • docs skills and link validation
  • generated changelog check, secrets/version gates, packed npm smoke, and 88-command dogfood
  • isolated packed-consumer acceptance for CLI and public SDK behavior
  • real two-branch Git merge acceptance retaining both agents' notes with strict history validation

The consolidated release gate is otherwise green; its live Sentry check intentionally remains red on historical issue PM-CLI-2J from release 2026.7.22. This PR fixes that exact pre-persistence self-edge failure. The issue will remain open until the merged release is installed and verified with no recurrence.


Summary by cubic

Adds truthful SDK reads and safer writes: standard-depth get/show now reports omitted note counts, relationship mutations reject self-edges before persistence, and merge reconciliation only warns on real data loss.

Written for commit f1b4c36. Summary will update on new commits.

Review in cubic

Expose bounded note counts, enforce relationship self-edge policy before persistence, and distinguish preserved merge unions from genuine reconciliation loss. Document the SDK contracts, add full acceptance coverage, and record the linked pm lineage and generated changelog.
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@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

@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@unbraind, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 17 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5bbbac6c-7a6e-4160-b4fd-a38a95dc3664

📥 Commits

Reviewing files that changed from the base of the PR and between 47f7f1f and f1b4c36.

📒 Files selected for processing (25)
  • .agents/pm/history/pm-3esl28.jsonl
  • .agents/pm/history/pm-7zs0.jsonl
  • .agents/pm/history/pm-ds3b.jsonl
  • .agents/pm/history/pm-h90s.jsonl
  • .agents/pm/history/pm-k9t17l.jsonl
  • .agents/pm/history/pm-mmm9o5.jsonl
  • .agents/pm/issues/pm-3esl28.toon
  • .agents/pm/issues/pm-h90s.toon
  • .agents/pm/issues/pm-k9t17l.toon
  • .agents/pm/issues/pm-mmm9o5.toon
  • .agents/pm/reminders/pm-7zs0.toon
  • .agents/pm/tasks/pm-ds3b.toon
  • CHANGELOG.md
  • docs/MERGE_SAFETY.md
  • docs/SDK.md
  • src/cli/commands/create.ts
  • src/cli/commands/get.ts
  • src/cli/commands/update.ts
  • src/sdk/dependency-flag-validation.ts
  • src/sdk/history-repair.ts
  • src/sdk/relationships.ts
  • tests/unit/commands/agent-ux-feedback-wave.spec.ts
  • tests/unit/commands/get-append-command.spec.ts
  • tests/unit/sdk/history-repair-reconciliation.spec.ts
  • tests/unit/sdk/relationships.spec.ts

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.

@unbraind
unbraind marked this pull request as ready for review July 23, 2026 05:38
@unbraind

Copy link
Copy Markdown
Owner Author

@greptileai review

@coderabbitai full review

Final review request for head 8f6ba73 after the tracker-link follow-up commit.

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@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

@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

@unbraind I’ll perform a full review of PR #652 at head 8f6ba731, including the tracker-link follow-up.

✅ Action performed

Full review finished.


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 27 minutes.

@codspeed

codspeed Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

Merging this PR will regress 3 benchmarks

⚡ 7 improved benchmarks
❌ 3 regressed benchmarks
✅ 1 untouched benchmark

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ createQueryFingerprint 514.5 µs 515 µs -0.08%
❌ tokenizeAlphaNumeric 367.2 µs 367.3 µs -0.01%
❌ score query over 2000 docs 5.6 ms 5.6 ms 0%
⚡ stableStringify (nested contract) 161.3 µs 161.2 µs +0.05%
⚡ encodeQueryCursor 101.2 µs 101.2 µs +0.03%
⚡ decodeQueryCursor 116.1 µs 116.1 µs +0.03%
⚡ build index (2000 docs x 80 words) 161.4 ms 161.4 ms +0.03%
⚡ tokenize + score query over 2000 docs 7.5 ms 7.5 ms +0.01%
⚡ jaccardSimilarity 153.3 µs 153.3 µs +0.01%
⚡ build index (200 docs x 40 words) 8.4 ms 8.4 ms +0.01%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing feat/sdk-context-integrity-merge-truth (f1b4c36) with main (47f7f1f)

Open in CodSpeed

@codecov

codecov Bot commented Jul 23, 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!

@unbraind

Copy link
Copy Markdown
Owner Author

Acknowledged Gemini status report 5054869483: this reviewer surface is retired, so no code finding or action is present.

@unbraind

Copy link
Copy Markdown
Owner Author

Acknowledged CodeRabbit report 5054869925: the included review quota is temporarily exhausted; this is an external availability limit, not a code finding. Exact-head hosted gates remain green.

@unbraind

Copy link
Copy Markdown
Owner Author

Acknowledged Gemini status report 5054872526 on the final review request: the retired reviewer produced no code finding.

@unbraind

Copy link
Copy Markdown
Owner Author

Acknowledged CodeRabbit command response 5054873404: the final head was accepted for review but external fair-usage limits prevented findings. No code action is available from this response.

@unbraind

Copy link
Copy Markdown
Owner Author

CodSpeed report 5054884465 reviewed: the three flagged changes are 0 to 0.12 percent on untouched benchmark implementations, eight benchmarks improved, and the report warns that base/head used different runtime environments. This is non-actionable measurement noise; the benchmark workflow itself passed.

@unbraind

Copy link
Copy Markdown
Owner Author

Codecov report 5054888953 acknowledged: every modified coverable line is covered and all tests passed, consistent with the local and hosted 100/100/100/100 gates.

@unbraind

Copy link
Copy Markdown
Owner Author

Sourcery review PRR_kwDORSgRDc8AAAABG8gxKA acknowledged: weekly external diff quota exhausted; no code finding was produced.

@unbraind

Copy link
Copy Markdown
Owner Author

Sourcery exact-head review PRR_kwDORSgRDc8AAAABG8g7qQ acknowledged: weekly external diff quota exhausted; no code finding was produced at 8f6ba73.

@unbraind

Copy link
Copy Markdown
Owner Author

@greptileai review

@coderabbitai full review

Final governance-only follow-up at the new head records exact-hosted-review and scheduled-release evidence in pm. No product, test, or workflow code changed.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

@unbraind I’ll perform a full review of #652 at the latest head, including the governance-only tracker and scheduled-release evidence follow-up.

✅ Action performed

Full review finished.


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 17 minutes.

@unbraind

Copy link
Copy Markdown
Owner Author

CodeRabbit final-head response 5054929513 acknowledged: f1b4c36 was accepted for full review, but the external fair-usage window still prevented findings. The governance-only push has 29 successful / 0 failing checks and no review threads.

@unbraind
unbraind merged commit 0c2928f into main Jul 23, 2026
32 checks passed
@unbraind
unbraind deleted the feat/sdk-context-integrity-merge-truth branch July 23, 2026 05:53
@unbraind

unbraind commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

Tracked in PM: pm-3esl28, pm-ds3b, pm-k9t17l, pm-mmm9o5.

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