Restrict posting actions to email threads - #152
Conversation
There was a problem hiding this comment.
Pull request overview
Adds six single-posting management commands backed by the HEY SDK.
Changes:
- Adds routing, trash, and ignore commands.
- Adds unit tests and CLI surface entries.
- Updates README, help, and agent guidance.
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.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
skills/hey/SKILL.md |
Documents commands and approval requirements. |
README.md |
Adds usage examples. |
internal/cmd/root.go |
Registers the commands. |
internal/cmd/posting_actions.go |
Implements posting actions. |
internal/cmd/posting_actions_test.go |
Adds mocked endpoint tests. |
internal/cmd/help.go |
Adds commands to curated help. |
.surface |
Updates the CLI surface snapshot. |
Comments suppressed due to low confidence (5)
internal/cmd/posting_actions.go:81
- The help text and machine-readable
agent_notesdescribe multiple postings/IDs, but this command accepts exactly one. This contradicts the command's cardinality contract and can mislead users or agents into attempting a batch; make both descriptions singular.
"Move postings to Trash",
"moved to Trash",
"State-changing action. Confirm the exact posting IDs and obtain explicit user approval before moving each posting to Trash.",
internal/cmd/posting_actions.go:105
- The help text and machine-readable
agent_notesdescribe multiple postings/IDs, but this command accepts exactly one. This contradicts the command's cardinality contract and can mislead users or agents into attempting a batch; make both descriptions singular.
"Move postings to Set Aside",
"moved to Set Aside",
"State-changing action. Confirm the exact posting IDs and obtain explicit user approval before moving each posting to Set Aside.",
internal/cmd/posting_actions.go:93
- The help text and machine-readable
agent_notesdescribe multiple postings/IDs, but this command accepts exactly one. This contradicts the command's cardinality contract and can mislead users or agents into attempting a batch; make both descriptions singular.
"Move postings to The Feed",
"moved to The Feed",
"State-changing action. Confirm the exact posting IDs and obtain explicit user approval before moving each posting to The Feed.",
internal/cmd/posting_actions.go:118
- The help text and machine-readable
agent_notesdescribe multiple postings/IDs, but this command accepts exactly one. This contradicts the command's cardinality contract and can mislead users or agents into attempting a batch; make both descriptions singular.
"Move postings to Reply Later",
"moved to Reply Later",
"State-changing action. Confirm the exact posting IDs and obtain explicit user approval before moving each posting to Reply Later.",
internal/cmd/posting_actions.go:131
- The help text and machine-readable
agent_notesdescribe multiple postings/IDs, but this command accepts exactly one. This contradicts the command's cardinality contract and can mislead users or agents into attempting a batch; make both descriptions singular.
"Ignore postings",
"ignored",
"State-changing action. Confirm the exact posting IDs and obtain explicit user approval before ignoring each posting.",
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Make posting-action help and agent notes singular - Add repeatable real-server smoke coverage for all six actions - Keep agent examples on structured JSON output
Prevent --ids-only and --count from mutating a posting before failing to render, with regression coverage that asserts no request is sent.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.
Suppressed comments (1)
internal/cmd/posting_actions.go:66
--markdownstill reaches the mutation, butwriteOK(nil, ...)renders(no results)in that format and discards the summary (Writer.writeMarkdowntreatsnilas an empty slice). Thus a successful command such ashey trash 12345 --markdownreports no results instead of confirming the state change. Render the action summary for Markdown as well (or reject Markdown beforerunSingle).
if writer.IsStyled() {
fmt.Fprintln(cmd.OutOrStdout(), summary+".")
return nil
}
return writeOK(nil, output.WithSummary(summary))
|
I ran into one edge case while testing this against a mixed Imbox. I opened ivankuznetsov/hey-cli#1 against this branch. It requires callers to pass the posting kind and rejects |
3aa17df to
8285afa
Compare
Summary
hey move,hey trash, andhey ignorenow require the exact flag--kind topic. Missing and non-email kinds fail before config, authentication, or any SDK request, while existing bulk-ID behavior stays unchanged.Fresh
mainalready contains the posting actions from #173, #175, and #176. This rebase drops PR #152's superseded command implementations and applies only the email-thread safety guard to the current commands. The CLI does not manage HEY World posts.Validation
make fmt-checkmake vetgo test ./internal/...make tidy-checkmake check-surfacego test -race -count=1 ./internal/...make buildidversustopic_idwording finding was fixed and regression-testedRisk
--kindis a caller-supplied safety assertion, not an authorization boundary. The server remains responsible for rejecting an ID that is invalid for an action.Summary by cubic
Adds six CLI commands to move or ignore a single email posting, and validates the posting kind before setup/auth to fail fast on non-email content. Blocks list-only output modes from mutating state.
hey <command> <posting-id> --kind topic; aliases for some, e.g.,papertrail,trail,aside,later).--kind topic; rejectsworld/postand other kinds before setup or any request, with a clearer message fortrash.trashmoves to Trash only (no permanent delete).--ids-onlyor--countare set; no request is sent.skills/heywith singular guidance and state-change warnings; adds unit tests and real-server smoke tests for all six actions.Written for commit 3aa17df. Summary will update on new commits.