Repository navigation
SDK mutation integrity, stale-work context, and Bun-safe release primitives - #668
Conversation
Deliver SDK-first secret and author guardrails, append-only workspace attribution, stale-work governance, CLI/MCP parity, typed schema migration usage errors, and Bun-safe optional SQLite indexing. Track and verify pm-h90s, pm-pim7, pm-w8q4, pm-cedo0g, and pm-rxqcp9 with focused tests, packed acceptance evidence, and truthful partial-publication diagnostics.
Keep the optional SQLite projection capability-safe under Bun, add direct fallback coverage, and preserve typed schema-migration usage errors without redundant optional handling. Stabilize the real all-package acceptance under full-suite I/O while retaining the global timeout and exact assertions. Regenerate the pm-changelog output and record final tracker, security-fixture, coverage, Sentry, and release-gate evidence for pm-cedo0g, pm-rxqcp9, pm-7x0wqg, and pm-pim7.
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
📝 WalkthroughWalkthroughThis change adds mutation-integrity controls across SDK, CLI, and MCP, including secret scanning, author enforcement, audited acknowledgments, stale-work health advisories, configurable settings, optional SQLite handling, release diagnostics, and associated tests and project records. ChangesMutation integrity and governance
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
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. Comment |
|
@greptileai review |
|
@coderabbitai full review |
✅ Action performedFull 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 3 minutes. |
Merging this PR will regress 3 benchmarks
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | decodeQueryCursor |
114.2 µs | 114.4 µs | -0.15% |
| ❌ | encodeQueryCursor |
101.1 µs | 101.1 µs | -0.02% |
| ❌ | tokenize + score query over 2000 docs |
7.5 ms | 7.5 ms | 0% |
| ⚡ | createQueryFingerprint |
529.1 µs | 513.3 µs | +3.09% |
| ⚡ | stableStringify (nested contract) |
161.5 µs | 161.2 µs | +0.18% |
| ⚡ | jaccardSimilarity |
153.4 µs | 153.4 µs | +0.02% |
| ⚡ | build index (2000 docs x 80 words) |
161.3 ms | 161.3 ms | +0.01% |
| ⚡ | build index (200 docs x 40 words) |
8.4 ms | 8.4 ms | +0.01% |
| ⚡ | tokenizeAlphaNumeric |
367.4 µs | 367.4 µs | 0% |
| ⚡ | score query over 2000 docs |
5.6 ms | 5.6 ms | 0% |
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-mutation-integrity-guardrails (36907aa) with main (db1b711)
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@gemini-code-assist Acknowledged the consumer-service shutdown notice; no code action is available or required for this PR. |
|
@coderabbitai Acknowledged the initial fair-usage deferral. The exact head is unchanged and all hosted checks are green; a fresh full review is requested below after the stated availability window. |
|
@coderabbitai Acknowledged the command-invocation receipt. There were no findings or threads in that cycle; please perform the substantive full review on the unchanged exact head when quota permits. |
|
@codspeed-hq Reviewed the report. It states 0% aggregate degradation and flags a different-runtime comparison; the listed -0.19% to 0% noise affects untouched benchmark primitives, so no code change is justified. The hosted benchmark check passed. |
|
@codecov Reviewed and confirmed: all modified coverable lines are covered, all tests passed, and the exact local aggregate remains 100/100/100/100. |
|
@sourcery-ai Acknowledged the external weekly diff-character quota. No finding was emitted and no code action is possible; repository-owned static, coverage, security, and compatibility checks passed at the exact head. |
|
@coderabbitai full review |
|
@greptileai review |
|
✅ Action performedFull review finished. |
|
✅ Action performedFull review finished. |
✅ Action performedFull 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 59 minutes. |
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 @.agents/pm/history/pm-h90s.jsonl:
- Around line 12-13: The closure metadata contradicts itself about whether the
five acknowledged events are actionable. Use the PM CLI to append a correction,
updating the derived resolution/result wording to state “five acknowledged
events; zero actionable,” and synchronize the derived record without editing the
append-only JSONL history directly.
In `@src/sdk/author-attribution.ts`:
- Around line 297-310: The per-event handling around uniqueEvents must validate
event.item_id with the codebase’s canonical item-ID pattern before constructing
the history path, then move fs.readFile and JSON parsing inside the existing
try/catch so missing or unreadable files produce the same TypeError. Preserve
the current acknowledgment target context in the error message and only build
the path after validation.
In `@src/sdk/governance/stale-work.ts`:
- Around line 118-140: Handle failures from readHistoryEntries within each
item’s map callback so a corrupt or unreadable history file does not reject the
surrounding Promise.all. For the affected item, treat the failure as having no
history timestamp and preserve the existing latest-valid-timestamp behavior for
successful reads.
🪄 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: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 50c8ba1e-b14d-408d-afe6-e43831945353
📒 Files selected for processing (53)
.agents/pm/extensions/.managed-extensions.json.agents/pm/features/pm-pim7.toon.agents/pm/features/pm-w8q4.toon.agents/pm/history/_workspace.jsonl.agents/pm/history/pm-7x0wqg.jsonl.agents/pm/history/pm-9yfo.jsonl.agents/pm/history/pm-cedo0g.jsonl.agents/pm/history/pm-h90s.jsonl.agents/pm/history/pm-pim7.jsonl.agents/pm/history/pm-rxqcp9.jsonl.agents/pm/history/pm-w8q4.jsonl.agents/pm/issues/pm-7x0wqg.toon.agents/pm/issues/pm-cedo0g.toon.agents/pm/issues/pm-h90s.toon.agents/pm/issues/pm-rxqcp9.toon.agents/pm/tasks/pm-9yfo.toon.github/workflows/auto-release.ymlCHANGELOG.mddocs/MUTATION_INTEGRITY.mddocs/README.mdsrc/cli/main.tssrc/cli/migration-gates.tssrc/core/config/nested-settings.tssrc/core/history/history.tssrc/core/history/workspace-history.tssrc/core/shared/constants.tssrc/core/store/item-metadata-query-index.tssrc/core/store/settings-validator.tssrc/core/store/settings.tssrc/mcp/server.tssrc/sdk/author-attribution.tssrc/sdk/governance/health.tssrc/sdk/governance/stale-work.tssrc/sdk/index.tssrc/sdk/mutation-guard.tssrc/sdk/runtime-primitives.tssrc/sdk/test/batch.tssrc/types.tstests/integration/ci-workflow-contract.spec.tstests/unit/cli/migration-gates.spec.tstests/unit/commands/config-key-aliases-search.spec.tstests/unit/commands/health-command.spec.tstests/unit/core/history/workspace-history.spec.tstests/unit/core/item/item-metadata-query-index.spec.tstests/unit/core/store/settings-store.spec.tstests/unit/extensions/extension-command.spec.tstests/unit/sdk/author-attribution.spec.tstests/unit/sdk/execution-diagnostics-primitives.spec.tstests/unit/sdk/mutation-guard-adapters.spec.tstests/unit/sdk/mutation-guard.spec.tstests/unit/sdk/stale-work-health.spec.tstests/unit/sdk/stale-work.spec.tstests/unit/sdk/test-all-author.spec.ts
Validate author-acknowledgment item identifiers before path construction and normalize unreadable history targets to the typed SDK error. Keep stale-work health available when one item history stream is corrupt by falling back to metadata activity. Add direct regressions, clarify append-only disposition metadata through pm, and record review evidence.
|
@coderabbitai full review |
|
@greptileai review |
✅ Action performedFull 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 38 minutes. |
|
@coderabbitai Reviewed the completed unchanged-head review invocation. Its three findings were verified, fixed in 36907aa, replied to inline, and resolved with exact 100/100/100/100 coverage. |
|
@coderabbitai Reviewed the substantive-review receipt; the resulting three actionable threads were all addressed and independently confirmed by your follow-up analysis. |
|
@coderabbitai Acknowledged the later fair-usage notice. It emitted no additional code finding; the last substantive findings are resolved at the current exact head. |
|
@gemini-code-assist Acknowledged the repeated service-sunset notice; no code action is available. |
|
@coderabbitai Acknowledged the final-head fair-usage receipt. It emitted no new finding; all prior threads are resolved and all hosted checks pass. |
|
@coderabbitai The displayed 57.45% docstring warning is not consistent with the repository-owned gate: quality:static ran at this head with min docstring, exported-docstring, and member-docstring coverage each set to 100, and passed. No suppression or threshold reduction was used. |
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
@codspeed-hq Reviewed the updated report. The -0.15% to 0% changes are on untouched pagination/BM25 benchmarks, the report flags different runtime environments, and the hosted performance job passes; this is measurement noise rather than an actionable regression. |
|
Tip For best results, initiate chat on the files or code changes.
|
|
Tip For best results, initiate chat on the files or code changes.
If you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! |
|
Tip For best results, initiate chat on the files or code changes.
If you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! |
|
Tip For best results, initiate chat on the files or code changes.
|
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- package manifests and quality script references ---'
fd -HI '^(package\.json|.*quality.*|.*static.*|.*docstring.*)$' . \
-E node_modules -E dist -E build | sed -n '1,240p'
printf '%s\n' '--- quality:static script definitions ---'
rg -n -C 4 '"quality:static"|quality:static' \
-g 'package.json' -g '!node_modules/**' -g '!dist/**' -g '!build/**' .
printf '%s\n' '--- docstring coverage configuration and thresholds ---'
rg -n -i -C 4 'docstring|exported-docstring|member-docstring|min.*docstring|57\.45' \
-g '!node_modules/**' -g '!dist/**' -g '!build/**' .Length of output: 90933
A displayed 57.45% warning is therefore inconsistent with the authoritative gate and does not apply to this PR head. I’m withdrawing it. ✏️ Learnings added
|
Summary
This broad SDK/CLI change set strengthens the project-management-as-context-management baseline across several related acceptance surfaces:
pm items
Verification
The local Greptile command reported the external free_reviews_limit_reached quota; hosted checks and bot review are required before merge.
Summary by cubic
Adds SDK-first mutation guardrails—author enforcement, redacted secret scanning, and stale-work health—with CLI/MCP parity. Also hardens author-acknowledgment review and keeps the optional SQLite index safe under Bun while returning typed schema migration usage errors.
New Features
mutation_guardsettings:require_attributed_author,secret_guard(off|advise|block), andstale_in_progress_hours.pm healthwithout changing ownership.Bug Fixes
node:sqliteloading with fallback keeps the packed CLI working under Bun; projection stays optional.Written for commit 36907aa. Summary will update on new commits.