Skip to content

Add reply draft creation and deletion operations - #57

Open
jr-lillard wants to merge 11 commits into
basecamp:mainfrom
jr-lillard:feat/reply-drafts
Open

Add reply draft creation and deletion operations#57
jr-lillard wants to merge 11 commits into
basecamp:mainfrom
jr-lillard:feat/reply-drafts

Conversation

@jr-lillard

@jr-lillard jr-lillard commented Jul 15, 2026

Copy link
Copy Markdown

Summary

  • Model browser-compatible CreateReplyDraft and DeleteDraft operations in Smithy and regenerate the Go SDK
  • Preserve redirect Location responses, keep suffixless draft routes distinct from .json send routes, and route immediate replies through generated transport
  • Expose SDK-backed create/delete draft services with unit and conformance coverage
  • Harden the explicit route-coverage scope so missing, duplicate, empty, or invalid operations fail closed

Relationship to #31

This branch includes the exact patch from #31 as its first isolated commit because reply-draft handling depends on the corrected comma-separated addressed fields. That commit preserves authorship by @cpinto and is included only as a prerequisite; #31 should still be reviewed and merged independently. If #31 lands first, I will rebase this branch and drop the duplicate commit.

Test plan

  • make check
  • Smithy/OpenAPI/generated-code freshness checks pass
  • Go unit tests pass
  • 83/83 conformance tests pass

Summary by cubic

Add browser-compatible reply draft save/delete with form encoding, capture Location without following redirects on form posts (default http.Client only), keep draft form routes distinct from .json send routes, validate and normalize draft Location URLs, and handle draft edit locations.

  • New Features

    • Modeled CreateReplyDraft and DeleteDraft in Smithy as form-encoded (Rails _method for delete) and regenerated the Go client.
    • Exposed EntriesService.CreateReplyDraft and EntriesService.DeleteDraft; form requests do not auto-follow redirects with the default http.Client, so callers can read Location (custom doers and non-form requests keep their behavior).
    • EntriesService.CreateReplyDraft returns ReplyDraft with ID, Location, and EditURL; accepts /entries/drafts/{id} or /entries/drafts/{id}/edit, validates the draft Location route, and strips empty query strings.
    • Added conformance tests for reply save/discard covering form fields, CSRF, method override, and Location.
  • Refactors

    • Router and route table preserve .json paths; suffixless draft routes remain distinct from .json send routes, and aliases (e.g., /topics/sent) beat parameter matches.
    • Route coverage is scoped and freshness-checked; missing/duplicate/invalid ops fail closed and exclusions cannot be blank.
    • Hardened validation: conformance runner validates request bodies and propagates partial read/close errors; drift-check normalizes form method variants; OpenAPI enhancer writes via safe temp files.
    • Immediate replies route through the generated JSON transport; recipient fields use comma-separated strings.
    • New client preserves the supplied *http.Client instance; redirect suppression only applies when the doer is the default http.Client.

Written for commit 66c3588. Summary will update on new commits.

Review in cubic

cpinto and others added 3 commits July 15, 2026 08:13
Imported from basecamp#31 as an isolated prerequisite so this commit can be skipped when rebasing after that pull request lands.
Add Smithy form traits and generated transport for saving and deleting reply drafts. Keep suffixless draft routes distinct from JSON send routes and make the explicit route-coverage scope fail closed.
Expose SDK-backed create and delete draft workflows, preserve redirect Locations, route immediate replies through generated JSON transport, and cover the browser form contracts in unit and conformance tests.
Copilot AI review requested due to automatic review settings July 15, 2026 14:46
@github-actions github-actions Bot added the enhancement New feature or request label Jul 15, 2026
@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

Spec Change Impact

Model output did not match expected format. Raw output truncated below.

```markdown
## Spec Change Impact

### Summary of Changes:
- **Operations Added:**
  - `CreateReplyDraft`:
    - Endpoint: `POST /entries/{entryId}/replies`
    - Description: Added support for creating reply drafts. Specifies form-urlencoded payload with sensitive fields. Includes support for various recipient address types (directly, copied, blind-copied) and a `Location` response header for the saved draft.
  - `DeleteDraft`:
    - Endpoint: `POST with _method=DELETE /messages/{messageId}`
    - Description: Added support for deleting editable message drafts via form-based method override with a `status` field.

- **Types Added:**
  - `CreateReplyDraftRequestContent`: Wire format for creating reply drafts (includes fields like `acting_sender_id`, `entry[status]`, `message[content]`, etc.).
  - `DeleteDraftRequestContent`: Wire format for deleting drafts (`_method`, `

Copilot AI 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.

Pull request overview

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

This PR models HEY’s browser-compatible reply-draft create/delete flows in Smithy/OpenAPI and regenerates the Go SDK so drafts can be created/discarded via form-encoded transport while preserving redirect Location headers and keeping suffixless draft routes distinct from .json send routes.

Changes:

  • Add Smithy/OpenAPI support for CreateReplyDraft (form-encoded) and DeleteDraft (POST + Rails _method=delete override) and regenerate Go client types.
  • Update Go routing to keep .json and suffixless routes distinct while providing .json alias matching and improved literal-vs-parameter resolution.
  • Introduce scoped, fail-closed route coverage generation/verification and add unit + conformance tests for draft create/delete semantics (form encoding, CSRF handling, redirect preservation).

Reviewed changes

Copilot reviewed 24 out of 25 changed files in this pull request and generated no comments.

Show a summary per file
File Description
spec/route-coverage.json Adds coverage entries for reply-draft creation and draft deletion routes.
spec/route-coverage-scope.json Introduces an explicit allowlist + overrides for route coverage generation.
spec/hey.smithy Models CreateReplyDraft and DeleteDraft operations + supporting shapes/traits usage.
spec/hey-traits.smithy Adds form-url-encoded + form-method-override Smithy traits for downstream OpenAPI tooling.
spec/excluded-routes.json Removes the /messages/{id} DELETE exclusion now that it’s modeled for draft deletion.
scripts/generate-url-routes Preserves .json in generated patterns so .json vs suffixless routes remain distinguishable.
scripts/generate-route-coverage Generates route coverage from OpenAPI with scoped allowlist, overrides, and strict validation.
scripts/enhance-openapi-go-types.sh Converts scoped form operations to application/x-www-form-urlencoded and propagates sensitivity markers.
scripts/check-service-drift.sh Improves normalization so drift checks handle WithFormdataBody* generated variants.
openapi.json Adds the two operations, form requestBodies, and related schemas/metadata extensions.
Makefile Adds route-coverage and route-coverage-check; wires freshness check into check-mvp.
go/templates/imports.tmpl Adds sort import needed for new form-normalization helper.
go/templates/client.tmpl Adds redirect-capturing doer for form requests + Rails array form-key normalization during form marshaling.
go/pkg/hey/url.go Updates router matching to consider .json vs suffixless routes and prefer literal routes over param routes, with alias support.
go/pkg/hey/url-routes.json Regenerates the embedded route table preserving .json patterns and adding new operations.
go/pkg/hey/url_test.go Adds routing tests ensuring .json send routes remain distinct and aliases resolve correctly.
go/pkg/hey/services_test.go Updates addressed-field expectations and adds unit tests for create/delete draft services + Location parsing.
go/pkg/hey/messages.go Fixes addressed fields to be comma-separated strings in JSON payloads.
go/pkg/hey/entries.go Routes CreateReply through generated transport; adds CreateReplyDraft and DeleteDraft service methods.
go/pkg/hey/client.go Wraps generated client HTTP transport to avoid following redirects for form requests (preserving Location).
go/pkg/generated/client.gen.go Regenerates Go client with new operations, form bodies, metadata, and helper logic.
conformance/tests/reply-drafts.json Adds conformance coverage for reply draft creation (form encoding + headers + Location).
conformance/tests/draft-deletion.json Adds conformance coverage for draft deletion (method override + CSRF header + redirect preservation).
conformance/runner/go/main.go Records request bodies and adds assertions for request headers/forms and response headers; wires new operations into executor.
behavior-model.json Adds behavior metadata entries for CreateReplyDraft and DeleteDraft.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

All reported issues were addressed across 25 files

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

Re-trigger cubic

Comment thread spec/route-coverage-scope.json
Comment thread scripts/enhance-openapi-go-types.sh
Comment thread scripts/generate-route-coverage Outdated
Comment thread Makefile
Comment thread conformance/tests/draft-deletion.json
Comment thread scripts/check-service-drift.sh
Comment thread go/pkg/hey/client.go Outdated
Copilot AI review requested due to automatic review settings July 15, 2026 15:27

Copilot AI 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.

Pull request overview

Copilot reviewed 23 out of 24 changed files in this pull request and generated no new comments.

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

All reported issues were addressed across 8 files (changes from recent commits).

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

Re-trigger cubic

Comment thread scripts/generate-route-coverage
Copilot AI review requested due to automatic review settings July 15, 2026 15:44

Copilot AI 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.

Pull request overview

Copilot reviewed 23 out of 24 changed files in this pull request and generated 2 comments.

Comment thread Makefile Outdated
Comment thread conformance/runner/go/main.go
Copilot AI review requested due to automatic review settings July 15, 2026 15:58

Copilot AI 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.

Pull request overview

Copilot reviewed 24 out of 25 changed files in this pull request and generated 2 comments.

Comment thread go/templates/client.tmpl
Comment thread go/templates/client.tmpl Outdated
Copilot AI review requested due to automatic review settings July 15, 2026 16:12

Copilot AI 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.

Pull request overview

Copilot reviewed 24 out of 25 changed files in this pull request and generated 1 comment.

Comment thread go/templates/client.tmpl
Copilot AI review requested due to automatic review settings July 15, 2026 16:30

Copilot AI 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.

Pull request overview

Copilot reviewed 24 out of 26 changed files in this pull request and generated 1 comment.

Comment thread go/pkg/hey/entries.go Outdated
Copilot AI review requested due to automatic review settings July 15, 2026 16:43

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

All reported issues were addressed across 2 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread go/pkg/hey/entries.go

Copilot AI 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.

Pull request overview

Copilot reviewed 24 out of 26 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 15, 2026 16:49

Copilot AI 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.

Pull request overview

Copilot reviewed 24 out of 26 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 15, 2026 16:55

Copilot AI 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.

Pull request overview

Copilot reviewed 24 out of 26 changed files in this pull request and generated no new comments.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants