feat: add receipted Linear writes and bounded campaigns - #29
Conversation
|
@coderabbitai review |
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis change adds optional receipted Linear issue/comment writes, bounded campaign state and commands, strict schemas and authority checks, read-only Linear resolvers, packaging updates, documentation, and expanded tests and evaluation scenarios. ChangesLinear writes and campaign delivery
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant ProjectSteward
participant CLI
participant Linear
participant ReceiptStore
ProjectSteward->>CLI: approve bounded write
CLI->>Linear: issue-create or evidence-comment
Linear-->>CLI: provider result
CLI->>ReceiptStore: validate and persist receipt
CLI-->>ProjectSteward: write outcome
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
✅ Action performedReview finished.
|
|
@coderabbitai full review |
✅ Action performedFull review finished. Your included review limit is currently reached under our Fair Usage Limits Policy. Your recent PR review activity is in the 95th percentile or higher among CodeRabbit users, so adaptive limits apply. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 3 seconds. |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 12
🤖 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 `@assets/project-template/.agent-stack/contracts/campaign-state.schema.json`:
- Around line 37-51: Add the missing cross-field conditionals to the schema’s
allOf so active_work_item is only non-null when status is "active"; document
that iterations_completed must not exceed max_iterations in the
iterations_completed property description, since JSON Schema cannot enforce that
comparison. Keep the existing numeric bounds and identifier definition
unchanged.
In `@bin/ultimate-agent-stack.mjs`:
- Around line 5893-5902: Preserve the existing Linear idempotency namespace
across provider changes and writes being disabled/re-enabled by storing it
outside the nullable writes configuration. Update the namespace initialization
around existingIdempotencyNamespace and the related reconfiguration flow so
returning to Linear reuses the persisted valid namespace instead of generating a
new one; document the rotation consequence in docs/OPERATING_MANUAL.md if
persistence is not implemented.
- Around line 5299-5304: Update the comment preflight failure handling in
commandLinearCommentCreate to record a validated failed receipt before throwing
StackError, matching the equivalent commandLinearIssueCreate lookup-preflight
path and preserving the documented audit trail for every attempt. Apply the same
receipt behavior to the related failure branch around the comment preflight
handling at lines 5266-5275, reusing the existing receipt construction and
persistence symbols.
- Around line 4433-4457: Update the resolve-comment validation branch to require
typeof value.provider_id === "string" before PROVIDER_UUID.test, and require
typeof value.issue_id === "string" before validating it with PROVIDER_UUID.test.
Keep the existing found handling and returned objects unchanged.
- Around line 4022-4042: Extract the repeated operation-to-credential
environment ternary into a shared linearOperationCredentialEnv(operation)
helper. Replace all four mappings in the writes capability construction and the
corresponding mapping logic in linearWriteReadiness with calls to this helper,
preserving the existing issue_create and comment operation behavior.
In `@scripts/linear-readonly.mjs`:
- Around line 457-479: Update both issue and comment resolver flows to recognize
Linear responses where data.issue or data.comment is null alongside GraphQL
errors indicating the entity is missing. Return the existing found:false result
with the appropriate provider identifier before the generic errors.length
failure guard, while preserving hard-failure handling for other GraphQL errors
and non-OK responses.
In `@scripts/linear-write.mjs`:
- Around line 299-310: Update the isEntryPoint execution flow around
performLinearWrite’s result so responses with ok: false set process.exitCode to
a nonzero failure code, while successful results retain exit code 0. Preserve
the existing catch handling for thrown errors and continue emitting the JSON
response in both cases.
- Around line 279-291: Update main and performLinearWrite so operationRequest is
evaluated only once and validation failures follow the existing structured
result contract. Prefer passing the resolved request or credential into
performLinearWrite, or move credential resolution entirely into
performLinearWrite, while preserving the normalized {provider, operation, error}
output and avoiding validation throws from main.
In `@test/agent-stack.test.mjs`:
- Around line 2026-2034: Update the receipt assertions in the readdirSync loop
to verify serialized receipts contain neither LINEAR_CREATE_API_KEY nor the
comment credential’s environment name, covering receipts generated through the
evidence_comment path while preserving the existing validation.
In `@test/linear-readonly.test.mjs`:
- Around line 256-258: Replace the individual undefined-field assertions in the
issue resolver tests with deepEqual assertions that require the complete
expected object containing only found, provider_identifier, and title. Apply the
same exact-object validation to the related assertions around the additional
referenced range, preserving the expected values for each case.
In `@test/maintenance.test.mjs`:
- Line 599: Extend the campaignStateSchema assertion near the existing
max_iterations maximum check to also assert its minimum is 1. Keep the
validation contract aligned with the 1..25 bounds enforced by
commandCampaignStart and validateCampaignState.
- Around line 579-582: Update the assertion for linearReceiptedWrites in the
maintenance test to stop matching the brittle “repository ledger is still”
prose; replace it with a regex targeting the durable contract or concept
expressed by that text, while preserving the existing “disabled by default” and
environment-variable assertions.
🪄 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: ASSERTIVE
Plan: Pro Plus
Run ID: 36969035-c0ab-4bcb-a878-54103015e944
📒 Files selected for processing (27)
.codex-plugin/plugin.jsonREADME.mdSTARTER_PROMPT.mdassets/project-template/.agent-stack/contracts/campaign-state.schema.jsonassets/project-template/.agent-stack/contracts/provider-receipt.schema.jsonassets/project-template/.agent-stack/provider-receipts/.gitkeepassets/project-template/AGENTS.mdbin/ultimate-agent-stack.mjsdocs/ADAPTERS.mddocs/ARCHITECTURE.mddocs/OPERATING_MANUAL.mddocs/TRUST.mdevals/scenarios.jsonpackage.jsonscripts/linear-readonly.mjsscripts/linear-write.mjsscripts/packed-smoke.mjsskills/manage-project-work/SKILL.mdskills/manage-project-work/references/linear-receipted-writes.mdskills/manage-project-work/references/work-evidence-contract.mdskills/run-autonomous-delivery/SKILL.mdskills/setup-autonomous-project/SKILL.mdtest/agent-stack.test.mjstest/linear-readonly.test.mjstest/linear-write.test.mjstest/maintenance.test.mjstest/skill-eval.test.mjs
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
issue_createandevidence_commentoperationsVerification
npm run release:check: 129 tests plus behavioral contracts, dry pack, and packed smokegit diff --check: passedAuthority boundaries
No Linear write is automatic. Each enabled operation uses a separate credential, explicit human confirmation, the active Project Steward token, an authority source, deterministic idempotency, and a repository receipt. Native Linear Agent sessions and Agent Auth remain deferred.
Summary by CodeRabbit
New Features
Documentation
Bug Fixes