Skip to content

fix(writeback): salvage pr-reviewer fixes orphaned by #244's merge#247

Merged
kjgbot merged 1 commit into
mainfrom
fix/244-bot-salvage
Jun 6, 2026
Merged

fix(writeback): salvage pr-reviewer fixes orphaned by #244's merge#247
kjgbot merged 1 commit into
mainfrom
fix/244-bot-salvage

Conversation

@kjgbot

@kjgbot kjgbot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

User description

Summary

agent-relay-code[bot] pushed 963ba4e ("apply pr-reviewer fixes for #244") to the #244 branch ~5 minutes after the squash merge, orphaning five real catches on a dead branch. This PR cherry-picks that commit onto current main (reconciled with #246's comments), drops the bot's bookkeeping churn (trajectory files, package-lock noise), and keeps everything substantive. Bot authorship preserved on the commit.

The five catches (each with its own test, all the bot's)

  1. SDK export gapSweepWritebackDraftsInput/Response and AckWritebackDraftDisposition were added to types.ts in fix(writeback): draft rename-at-ack + classification-exempt residue sweep (#242) #244 but never exported from index.ts, making them unreachable to package consumers.
  2. ⚠️ Operationally important: ack handler silently defaulted missing success to false — an ack body without the field dead-lettered the op. In production this would have made the rename-at-ack faucet look broken (acks "failing") while the bug was in the handler contract. Now 400s, which aligns the implementation with the OpenAPI spec's required: [success]. (TestWritebackAckRejectsMissingSuccess)
  3. CLI sweep: token-claim workspace fallbackrelayfile writeback sweep-drafts now resolves the workspace from the token claims via the pre-existing resolveWorkspaceIDWithToken when no positional arg/local catalog record exists — exactly the rw_7ccfea89 ops case the sweep is staged for. (TestWritebackSweepDraftsUsesTokenWorkspaceWithoutPositionalArg)
  4. Nil-ProviderIndex guard in reconcileAckedDraftLocked — workspaces from legacy snapshots could panic on index write. (TestAckWithExternalIDInitializesLegacyNilProviderIndex)
  5. Sweep patterns containing path separators rejected — basename globs with / or \ are invalid input, not silent non-matches. (TestSweepRejectsPatternsWithPathSeparators)

Plus the writeback usage error now mentions sweep-drafts.

Verification

  • go vet ./... clean; go test ./internal/relayfile/ ./internal/httpapi/ ./cmd/relayfile-cli/ green
  • SDK tsc --noEmit clean; vitest 188/188 (bot's new type-surface tests included)
  • Dropped from the orphan: .trajectories/* bookkeeping, package-lock.json version-drift churn

🤖 Generated with Claude Code


CodeAnt-AI Description

Fix writeback sweep and ack handling, and expose the related SDK types

What Changed

  • Writeback draft sweeping can now use the workspace from the provided token when no workspace is passed on the command line.
  • The writeback ack endpoint now rejects missing or invalid success values instead of treating them as a failed ack, and legacy workspaces with no provider index no longer fail during ack reconciliation.
  • Draft sweep patterns with / or \ are now rejected as invalid input instead of being treated as silent non-matches.
  • The SDK now exports the writeback ack and draft-sweep types so they can be used by package consumers.
  • The writeback command help now lists sweep-drafts as a valid subcommand.

Impact

✅ Fewer writeback ack failures
✅ Easier draft sweeping from token-based workflows
✅ Clearer invalid pattern errors

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Release note (for the upcoming cut)

Catch (2) is a corrective behavioral break: ack bodies omitting success (or sending a non-boolean) now receive 400 instead of being silently treated as success: false. Any out-of-tree caller relying on the implicit default was already broken — their acks were dead-lettering ops — but the 400 is new surface and belongs in the release notes for the #244+#246+#247 cut. (Flagged by claude-mount-cleanup in review.)

@codeant-ai

codeant-ai Bot commented Jun 6, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.

@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@kjgbot, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 11 minutes and 34 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: df8251ae-58d1-49ea-ab6f-6617e7a43717

📥 Commits

Reviewing files that changed from the base of the PR and between e9cec99 and 89f9f65.

📒 Files selected for processing (9)
  • cmd/relayfile-cli/main.go
  • cmd/relayfile-cli/writeback_sweep.go
  • cmd/relayfile-cli/writeback_sweep_test.go
  • internal/httpapi/server.go
  • internal/httpapi/server_test.go
  • internal/relayfile/draft_reconcile.go
  • internal/relayfile/draft_reconcile_test.go
  • packages/sdk/typescript/src/index.ts
  • packages/sdk/typescript/src/types.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/244-bot-salvage

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 and usage tips.

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Jun 6, 2026

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates the writeback and sweep-drafts functionality across the CLI, server, and TypeScript SDK. Key changes include adding the sweep-drafts subcommand, refactoring workspace resolution to use token-based IDs, enforcing boolean validation on the success field in writeback ACKs, preventing path separators in sweep patterns, and safely initializing nil provider indexes. There are no review comments, so no additional feedback is provided.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

Relayfile Eval Review

Run: .relayfile/evals/runs/2026-06-06T09-29-22-598Z-HEAD-provider
Mode: provider
Git SHA: a2b2b58

Passed: 4 | Needs human: 0 | Reviewable: 0 | Missing output: 0 | Failed: 0 | Skipped: 0

Human Review Cases

No reviewable human-review cases captured Relayfile output.

@kjgbot

kjgbot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

Review verdict: APPROVE (bound to 89f9f65)

Reviewer: claude-mount-cleanup (channel verdict first per run rules; head re-verified; cherry-picked bot commit reviewed as third-party code with authorship preserved).

All five salvaged catches verified — each real, each tested, zero scope creep:

  1. SDK exportsAckWritebackDraftDisposition + SweepWritebackDrafts* reachable from index.ts with a type-level test (closes fix(writeback): draft rename-at-ack + classification-exempt residue sweep (#242) #244's unconsumable-API gap).
  2. Ack success required — missing/non-bool → 400, op stays pending (test asserts both). Kills the silent default-false→dead-letter path, aligns with the OpenAPI required:[success]. Release-note item: out-of-tree callers omitting success now 400 (they were already broken — their acks dead-lettered ops).
  3. CLI token-claim workspace fallbackresolveWorkspaceIDWithToken; test pins the borrowed-token/no-catalog shape (exactly the staged rw_7ccfea89 sweep scenario).
  4. nil-ProviderIndex guard + legacy-snapshot test — closes a panic class.
  5. Path-separator pattern rejection — loud ErrInvalidInput over silently-never-matching; contract tightening with test.

Independently verified at 89f9f65: go vet + the three touched Go suites green; SDK tsc clean + vitest all-pass (181/181 in my worktree).

Merge on full CI green + head still 89f9f65.

🤖 Generated with Claude Code

@codeant-ai

codeant-ai Bot commented Jun 6, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

@cubic-dev-ai cubic-dev-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.

1 issue found across 9 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="cmd/relayfile-cli/writeback_sweep.go">

<violation number="1" location="cmd/relayfile-cli/writeback_sweep.go:74">
P2: `sweep-drafts` no longer resolves positional `RelayWorkspaceID` values from catalog records, causing a regression for legacy workspace identifiers.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

}
creds, err := loadCredentials()
tokenValue := resolveToken(*tokenOverride, creds)
workspaceID, err := resolveWorkspaceIDWithToken(firstArg(fs), tokenValue)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: sweep-drafts no longer resolves positional RelayWorkspaceID values from catalog records, causing a regression for legacy workspace identifiers.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At cmd/relayfile-cli/writeback_sweep.go, line 74:

<comment>`sweep-drafts` no longer resolves positional `RelayWorkspaceID` values from catalog records, causing a regression for legacy workspace identifiers.</comment>

<file context>
@@ -66,15 +66,16 @@ func runWritebackSweepDrafts(args []string, stdout io.Writer) error {
 	}
-	creds, err := loadCredentials()
+	tokenValue := resolveToken(*tokenOverride, creds)
+	workspaceID, err := resolveWorkspaceIDWithToken(firstArg(fs), tokenValue)
 	if err != nil {
 		return err
</file context>

@kjgbot kjgbot merged commit 9c3d894 into main Jun 6, 2026
9 checks passed
@kjgbot kjgbot deleted the fix/244-bot-salvage branch June 6, 2026 09:33
@agent-relay-code

Copy link
Copy Markdown
Contributor

Fixed the valid bot finding from cubic: sweep-drafts now resolves catalog RelayWorkspaceID values through the shared workspace resolver instead of sending the legacy ID directly in the API path.

Changed:

Verification run locally:

  • go test ./cmd/relayfile-cli ./internal/httpapi ./internal/relayfile
  • go vet ./cmd/relayfile-cli ./internal/httpapi ./internal/relayfile
  • scripts/check-contract-surface.sh
  • npm run test --workspace=packages/sdk/typescript -- types.test.ts client.test.ts writeback-consumer.test.ts
  • npm run typecheck --workspace=packages/sdk/typescript

@agent-relay-code

Copy link
Copy Markdown
Contributor

pr-reviewer applied fixes — committed and pushed e0f846f to this PR. The notes below describe what changed.

Fixed the valid bot finding from cubic: sweep-drafts now resolves catalog RelayWorkspaceID values through the shared workspace resolver instead of sending the legacy ID directly in the API path.

Changed:

Verification run locally:

  • go test ./cmd/relayfile-cli ./internal/httpapi ./internal/relayfile
  • go vet ./cmd/relayfile-cli ./internal/httpapi ./internal/relayfile
  • scripts/check-contract-surface.sh
  • npm run test --workspace=packages/sdk/typescript -- types.test.ts client.test.ts writeback-consumer.test.ts
  • npm run typecheck --workspace=packages/sdk/typescript

@agent-relay-code

Copy link
Copy Markdown
Contributor

Reviewed PR #247 and made one additional fix: writeback sweep-drafts --token <JWT> now uses the explicit token’s workspace when no positional workspace is supplied, avoiding a request path/token workspace mismatch when RELAYFILE_WORKSPACE is set. Added a regression test in cmd/relayfile-cli/writeback_sweep_test.go.

Validation run:

  • go test ./cmd/relayfile-cli -run 'TestWriteback(SweepDrafts|MissingSubcommand)'
  • go test ./internal/relayfile -run 'Test(AckWithExternalID|AckRename|Sweep|DraftBasename)'
  • go test ./internal/httpapi -run 'TestWriteback(Ack|SweepDrafts)'
  • scripts/check-contract-surface.sh
  • npm test -- --run src/types.test.ts src/client.test.ts
  • npm run typecheck
  • go test ./...

All passed. npm install was needed because vitest was missing locally; npm reported existing audit findings, but they are outside this PR surface.

@agent-relay-code

Copy link
Copy Markdown
Contributor

⚠️ pr-reviewer push failed (exit 1) — fixes were not applied to the PR. The notes below are advisory and were not pushed.

Reviewed PR #247 and made one additional fix: writeback sweep-drafts --token <JWT> now uses the explicit token’s workspace when no positional workspace is supplied, avoiding a request path/token workspace mismatch when RELAYFILE_WORKSPACE is set. Added a regression test in cmd/relayfile-cli/writeback_sweep_test.go.

Validation run:

  • go test ./cmd/relayfile-cli -run 'TestWriteback(SweepDrafts|MissingSubcommand)'
  • go test ./internal/relayfile -run 'Test(AckWithExternalID|AckRename|Sweep|DraftBasename)'
  • go test ./internal/httpapi -run 'TestWriteback(Ack|SweepDrafts)'
  • scripts/check-contract-surface.sh
  • npm test -- --run src/types.test.ts src/client.test.ts
  • npm run typecheck
  • go test ./...

All passed. npm install was needed because vitest was missing locally; npm reported existing audit findings, but they are outside this PR surface.

@agent-relay-code

Copy link
Copy Markdown
Contributor

Fixed one validated issue in the PR: writeback sweep-drafts --server ... --token ... now works in a clean environment without saved credentials, while preserving the existing login-required error when no token is available. Added a regression test that executes the generated request against a local HTTP fixture.

Validated stale bot findings in the checkout: SDK test exclusion and BulkWriteResponse.correlationId are already present, and the referenced mountfuse/core issues are already resolved.

Local checks run:

  • go test ./cmd/relayfile-cli ./internal/httpapi ./internal/relayfile
  • scripts/check-contract-surface.sh
  • npm --prefix packages/sdk/typescript test -- --run src/types.test.ts src/client.test.ts
  • npm --prefix packages/sdk/typescript run typecheck

@agent-relay-code

Copy link
Copy Markdown
Contributor

⚠️ pr-reviewer push failed (exit 1) — fixes were not applied to the PR. The notes below are advisory and were not pushed.

Fixed one validated issue in the PR: writeback sweep-drafts --server ... --token ... now works in a clean environment without saved credentials, while preserving the existing login-required error when no token is available. Added a regression test that executes the generated request against a local HTTP fixture.

Validated stale bot findings in the checkout: SDK test exclusion and BulkWriteResponse.correlationId are already present, and the referenced mountfuse/core issues are already resolved.

Local checks run:

  • go test ./cmd/relayfile-cli ./internal/httpapi ./internal/relayfile
  • scripts/check-contract-surface.sh
  • npm --prefix packages/sdk/typescript test -- --run src/types.test.ts src/client.test.ts
  • npm --prefix packages/sdk/typescript run typecheck

@agent-relay-code

Copy link
Copy Markdown
Contributor

Reviewed PR #247 and fixed one validated CLI breakage: writeback sweep-drafts --server ... --token ... no longer fails just because saved credentials are missing. It now allows missing credentials only when both server and token sources are explicit, and I added a regression test in cmd/relayfile-cli/writeback_sweep_test.go.

Validation run locally:

  • go test ./cmd/relayfile-cli ./internal/relayfile ./internal/httpapi
  • scripts/check-contract-surface.sh
  • npm run test --workspace=packages/sdk/typescript -- --run src/types.test.ts src/client.test.ts
  • npm run typecheck --workspace=packages/sdk/typescript
  • npm ci --dry-run

@agent-relay-code

Copy link
Copy Markdown
Contributor

⚠️ pr-reviewer push failed (exit 1) — fixes were not applied to the PR. The notes below are advisory and were not pushed.

Reviewed PR #247 and fixed one validated CLI breakage: writeback sweep-drafts --server ... --token ... no longer fails just because saved credentials are missing. It now allows missing credentials only when both server and token sources are explicit, and I added a regression test in cmd/relayfile-cli/writeback_sweep_test.go.

Validation run locally:

  • go test ./cmd/relayfile-cli ./internal/relayfile ./internal/httpapi
  • scripts/check-contract-surface.sh
  • npm run test --workspace=packages/sdk/typescript -- --run src/types.test.ts src/client.test.ts
  • npm run typecheck --workspace=packages/sdk/typescript
  • npm ci --dry-run

@agent-relay-code

Copy link
Copy Markdown
Contributor

Reviewed PR #247 and fixed one real CLI breakage: writeback sweep-drafts --server ... --token ... no longer requires a saved credential file when the token override can supply the workspace. Added a regression test in cmd/relayfile-cli/writeback_sweep_test.go.

Validated stale bot findings against the current checkout; the referenced SDK/package and mountfuse/core issues were already resolved or no longer applied.

Verification run:

  • go test ./cmd/relayfile-cli ./internal/httpapi ./internal/relayfile
  • scripts/check-contract-surface.sh
  • npm run typecheck --workspace=packages/sdk/typescript
  • npm run build --workspace=packages/sdk/typescript
  • npm run test --workspace=packages/sdk/typescript -- types.test.ts client.test.ts writeback-consumer.test.ts

@agent-relay-code

Copy link
Copy Markdown
Contributor

⚠️ pr-reviewer push failed (exit 1) — fixes were not applied to the PR. The notes below are advisory and were not pushed.

Reviewed PR #247 and fixed one real CLI breakage: writeback sweep-drafts --server ... --token ... no longer requires a saved credential file when the token override can supply the workspace. Added a regression test in cmd/relayfile-cli/writeback_sweep_test.go.

Validated stale bot findings against the current checkout; the referenced SDK/package and mountfuse/core issues were already resolved or no longer applied.

Verification run:

  • go test ./cmd/relayfile-cli ./internal/httpapi ./internal/relayfile
  • scripts/check-contract-surface.sh
  • npm run typecheck --workspace=packages/sdk/typescript
  • npm run build --workspace=packages/sdk/typescript
  • npm run test --workspace=packages/sdk/typescript -- types.test.ts client.test.ts writeback-consumer.test.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant