feat(shortcut): add Relayfile adapter and webhook catalog - #259
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Warning Review limit reached
Next review available in: 21 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (22)
📝 WalkthroughWalkthroughAdded the ChangesShortcut adapter
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Shortcut
participant normalizeShortcutWebhook
participant ShortcutPathMapper
participant DigestHandler
Shortcut->>normalizeShortcutWebhook: webhook payload and headers
normalizeShortcutWebhook->>normalizeShortcutWebhook: validate and normalize actions
normalizeShortcutWebhook->>ShortcutPathMapper: normalize entity type
ShortcutPathMapper-->>normalizeShortcutWebhook: Shortcut object type
normalizeShortcutWebhook->>DigestHandler: normalized event
DigestHandler-->>normalizeShortcutWebhook: digest description and terminal state
Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 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 `@packages/shortcut/package.json`:
- Line 33: Update the Node compatibility contract for the test script in
packages/shortcut/package.json: either raise the declared engine minimum to Node
18.18 or later so --import tsx is supported, or revise the test command to work
on Node 18.0–18.17 without globally using --import. Keep npm test functional
across every version declared as supported.
In `@packages/shortcut/src/emit-auxiliary-files.ts`:
- Around line 48-58: The Shortcut emitter in emitAuxiliaryFiles must generate
deterministic, collision-safe Story aliases for by-id, by-state, by-assignee,
by-creator, by-priority, and other natural lookup keys, while preserving
materialized canonical record bodies. Update
packages/shortcut/src/emit-auxiliary-files.ts lines 48-58 accordingly; document
every emitted alias subtree and that aliases mirror canonical records in
packages/shortcut/src/layout-prompt.ts lines 7-9.
- Around line 74-75: Update deleteJson so a missing client.deleteFile is
reported as a failure rather than returning successfully. Record an error in the
provided EmitAuxiliaryFilesResult for the specific path, ensuring both canonical
and alias delete paths remain visible as failures instead of being silently
ignored.
In `@packages/shortcut/src/path-mapper.ts`:
- Around line 61-63: The shortcutByIdAliasPath function must generate aliases
using the shared slugifyAlias and aliasCollisionSuffix utilities in the required
slug__id format, including collision-safe suffixes for IDs that normalize to the
same slug. In packages/shortcut/src/path-mapper.ts lines 61-63, update alias
construction accordingly; in packages/shortcut/src/shortcut.test.ts lines 39-50,
add a collision test verifying both generated aliases resolve to their
respective canonical records.
- Around line 52-58: Reserve the generated “_index” filename from canonical
record IDs: update computeShortcutPath and the ID/writeback handling in
packages/shortcut/src/path-mapper.ts (lines 52-58) and
packages/shortcut/src/resources.ts (lines 10-17) to reject or exclude that
reserved value before creating or accepting canonical paths. Add coverage in
packages/shortcut/src/shortcut.test.ts (lines 39-50) confirming reserved IDs
cannot resolve to canonical record paths.
In `@packages/shortcut/src/shortcut.test.ts`:
- Around line 23-50: Add typed parsers for canonical and by-ID Shortcut paths,
then extend the “Shortcut adapter” tests with Story and Epic compose→parse
equality cases using encoded IDs. Verify each parser recovers the correct object
type and ID from paths produced by the corresponding compose helpers, covering
both canonical and alias paths as applicable.
In `@packages/shortcut/src/webhook-normalizer.ts`:
- Around line 41-57: Update normalizeShortcutWebhook in
packages/shortcut/src/webhook-normalizer.ts:41-57 to use an explicit supported
event table, reject unsupported entity_type/action pairs, and keep terminal
actions classified as non-delete actions. Update
packages/shortcut/shortcut.mapping.yaml:1-7 to declare every event emitted by
that table via supportedEvents(). Extend
packages/shortcut/src/shortcut.test.ts:24-37 to cover each supported event and
verify unsupported pairs fail normalization.
🪄 Autofix
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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0b9c6575-17f2-4538-a99f-4945d44037db
⛔ Files ignored due to path filters (3)
package-lock.jsonis excluded by!**/package-lock.jsonpackages/core/src/triggers/catalog.generated.jsonis excluded by!**/*.generated.*packages/core/src/triggers/catalog.generated.tsis excluded by!**/*.generated.*
📒 Files selected for processing (14)
packages/shortcut/package.jsonpackages/shortcut/shortcut.mapping.yamlpackages/shortcut/src/digest.tspackages/shortcut/src/emit-auxiliary-files.tspackages/shortcut/src/index.tspackages/shortcut/src/layout-prompt.tspackages/shortcut/src/path-mapper.tspackages/shortcut/src/resources.tspackages/shortcut/src/shortcut.test.tspackages/shortcut/src/sync-bucketing.tspackages/shortcut/src/types.tspackages/shortcut/src/webhook-normalizer.tspackages/shortcut/tsconfig.jsonturbo.json
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3ea9803c48
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
All reported issues were addressed across 17 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
Expanded Shortcut coverage is now pushed in commit 3ea5049.
Cloud install remains dependent on publishing/installing |
There was a problem hiding this comment.
All reported issues were addressed across 7 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
|
Addressed the review feedback and refreshed the generated artifacts. Changes pushed:
Validation:
|
|
Note on the older Cubic custom-field finding: it is stale against the current branch. |
There was a problem hiding this comment.
Actionable comments posted: 14
🤖 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 `@packages/shortcut/discovery/shortcut/.adapter.md`:
- Around line 5-16: Rename the “Read-only mounts” section to describe canonical
resource mounts, then document each listed resource’s actual write capability
based on the edit, create, and delete operations defined in the adapter
documentation. Ensure read-only status is retained only for resources without
write operations.
In `@packages/shortcut/discovery/shortcut/custom-fields/.create.example.json`:
- Around line 1-8: Remove the custom-fields create example and create-only
documentation, and update the custom-fields resource metadata and discovery
generator so it is classified as update/delete-only without a createExample or
non-canonical create filename handling. In
packages/shortcut/discovery/shortcut/custom-fields/.schema.json, make field_type
readOnly and define values.items as update enum objects with id, value,
color_key, and enabled fields, while leaving values itself optional. Apply the
schema change at packages/shortcut/discovery/shortcut/custom-fields/.schema.json
lines 78-89; the create example at
packages/shortcut/discovery/shortcut/custom-fields/.create.example.json lines
1-8 must be removed.
In `@packages/shortcut/discovery/shortcut/groups/.schema.json`:
- Around line 5-7: Add mention_name as a writable string property in
packages/shortcut/discovery/shortcut/groups/.schema.json, include it alongside
name in required, and add a representative value to the create example in
packages/shortcut/discovery/shortcut/groups/.create.example.json; update the
Group creation schema and example consistently across the affected sites.
In `@packages/shortcut/discovery/shortcut/iterations/.schema.json`:
- Around line 5-7: Update the schema’s required field list to include both
start_date and end_date alongside name, ensuring iteration creation requires all
three fields.
In `@packages/shortcut/discovery/shortcut/members/.create.example.json`:
- Around line 1-4: Remove the unsupported Member create contract from
packages/shortcut/discovery/shortcut/members/.create.example.json (lines 1-4)
and packages/shortcut/discovery/shortcut/members/.schema.json (lines 74-82).
Update the Shortcut Group schema, create example, and adapter documentation to
require mention_name, and replace Milestone deadline with supported override
fields or remove Milestone creation if its endpoint is deprecated.
In `@packages/shortcut/discovery/shortcut/milestones/.create.example.json`:
- Around line 2-4: Remove the unsupported deadline field from the Milestone
create contract: delete it from
packages/shortcut/discovery/shortcut/milestones/.create.example.json lines 2-4
and remove its schema definition from
packages/shortcut/discovery/shortcut/milestones/.schema.json lines 82-86. Only
retain it if the adapter explicitly maps deadline to a supported Shortcut
provider field.
In `@packages/shortcut/discovery/shortcut/projects/.schema.json`:
- Around line 5-7: Add team_id to the Project write schema’s properties as an
integer and include it in the required fields alongside name. Update
.create.example.json to provide a valid integer team_id while preserving the
existing example structure.
In `@packages/shortcut/src/digest.ts`:
- Around line 19-23: Add cancellation rules to the terminal-state verb
configuration used by terminalStateVerb(), matching both “canceled” and
“cancelled” states and producing the appropriate cancellation past-tense text.
Add a digest test covering an update payload with a canceled state, ensuring it
is classified as terminal rather than falling back to the generic update action.
In `@packages/shortcut/src/emit-auxiliary-files.ts`:
- Around line 101-102: Update the collision handling around findCollidingAliases
and the alias-generation logic at lines 195-213 to derive collision membership
from persisted resource state rather than only the current records batch,
keeping suffix decisions deterministic across partial emissions and sync runs.
Add coverage that emits two records with the same alias and then re-emits one
unchanged record, verifying its suffix-qualified alias path remains stable.
- Around line 189-191: Update the collisionState branch in the auxiliary-file
cleanup logic to return both the unsuffixed alias path and the single
collision-suffixed path directly, rather than applying collisionVariant to the
already suffixed result. Ensure each cleanup alias resolves to the same record
as its canonical path, and add regression coverage for update and delete
transitions from unique to colliding values.
In `@packages/shortcut/src/shortcut.test.ts`:
- Around line 144-164: Extend the collision-safety test in “keeps index rows and
aliases collision-safe across webhook-sized updates” to assert deterministic
collision-suffixed paths for both records in the by-title and by-state alias
subtrees, using the existing story alias path helpers. Keep the current
by-assignee assertions and verify the expected paths before and after the
update.
- Around line 61-69: Add round-trip assertions in the existing test around the
canonical, by-id, and by-title checks, using shortcutByStateAliasPath() and
shortcutByAssigneeAliasPath() to compose paths and parseShortcutPath() to verify
the expected state and assignee alias results for each object type and ID.
In `@scripts/writeback-discovery-data.mjs`:
- Around line 527-537: Replace the `new.json` create paths in the Shortcut
resource declarations with the corresponding resource-directory paths, and
update the discovery helper’s path handling if needed so directory-based
creation remains valid without treating `new.json` as reserved. Regenerate the
discovery files after updating the declarations.
- Line 536: Update the Shortcut story create endpoint definition at
scripts/writeback-discovery-data.mjs:536 so name remains required and the
request schema adds typed integer workflow_state_id and project_id properties
with an object-level oneOf requiring exactly one; include one placement field in
the example. Regenerate the corresponding documentation at
packages/shortcut/discovery/shortcut/.adapter.md:179-191, example at
packages/shortcut/discovery/shortcut/stories/.create.example.json:1-5, and
schema entries at packages/shortcut/discovery/shortcut/stories/.schema.json:5-7
and 74-85, then run npm run test:writeback-discovery.
🪄 Autofix
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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 802b1779-b7e9-46ff-a74a-26371917b44b
⛔ Files ignored due to path filters (7)
packages/core/src/inbound/catalog.generated.jsonis excluded by!**/*.generated.*packages/core/src/inbound/catalog.generated.tsis excluded by!**/*.generated.*packages/core/src/scope-keys/adapters-without-known-scope-keys.generated.jsonis excluded by!**/*.generated.*packages/core/src/scope-keys/catalog.generated.tsis excluded by!**/*.generated.*packages/core/src/writeback-paths/catalog.generated.jsonis excluded by!**/*.generated.*packages/core/src/writeback-paths/catalog.generated.tsis excluded by!**/*.generated.*packages/relay-helpers/src/generated/clients.tsis excluded by!**/generated/**
📒 Files selected for processing (38)
docs/writeback-spec-coverage.mdpackages/core/tests/inbound/catalog-generator.test.tspackages/shortcut/discovery/shortcut/.adapter.mdpackages/shortcut/discovery/shortcut/categories/.create.example.jsonpackages/shortcut/discovery/shortcut/categories/.schema.jsonpackages/shortcut/discovery/shortcut/custom-fields/.create.example.jsonpackages/shortcut/discovery/shortcut/custom-fields/.schema.jsonpackages/shortcut/discovery/shortcut/epics/.create.example.jsonpackages/shortcut/discovery/shortcut/epics/.schema.jsonpackages/shortcut/discovery/shortcut/groups/.create.example.jsonpackages/shortcut/discovery/shortcut/groups/.schema.jsonpackages/shortcut/discovery/shortcut/iterations/.create.example.jsonpackages/shortcut/discovery/shortcut/iterations/.schema.jsonpackages/shortcut/discovery/shortcut/labels/.create.example.jsonpackages/shortcut/discovery/shortcut/labels/.schema.jsonpackages/shortcut/discovery/shortcut/members/.create.example.jsonpackages/shortcut/discovery/shortcut/members/.schema.jsonpackages/shortcut/discovery/shortcut/milestones/.create.example.jsonpackages/shortcut/discovery/shortcut/milestones/.schema.jsonpackages/shortcut/discovery/shortcut/projects/.create.example.jsonpackages/shortcut/discovery/shortcut/projects/.schema.jsonpackages/shortcut/discovery/shortcut/stories/.create.example.jsonpackages/shortcut/discovery/shortcut/stories/.schema.jsonpackages/shortcut/discovery/shortcut/workflows/.create.example.jsonpackages/shortcut/discovery/shortcut/workflows/.schema.jsonpackages/shortcut/package.jsonpackages/shortcut/src/digest.tspackages/shortcut/src/emit-auxiliary-files.tspackages/shortcut/src/inbound.tspackages/shortcut/src/index.tspackages/shortcut/src/layout-prompt.tspackages/shortcut/src/path-mapper.tspackages/shortcut/src/resources.tspackages/shortcut/src/shortcut.test.tspackages/shortcut/src/webhook-normalizer.tsscripts/resolve-publish-targets.mjsscripts/writeback-discovery-data.mjsscripts/writeback-discovery-normalizer.mjs
🚧 Files skipped from review as they are similar to previous changes (4)
- packages/shortcut/src/index.ts
- packages/shortcut/src/resources.ts
- packages/shortcut/src/layout-prompt.ts
- packages/shortcut/package.json
There was a problem hiding this comment.
All reported issues were addressed across 45 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
|
Follow-up pushed in Addressed the remaining review findings:
Validation: full API contract reference: https://developer.shortcut.com/api/rest/v3 |
There was a problem hiding this comment.
All reported issues were addressed across 24 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
|
Final review follow-up pushed in
Validation: full local |
|
Two review points are intentionally retained as-is after verification:
|
Summary
Validation
npm run build --workspace=packages/shortcutnpm test --workspace=packages/shortcutnode --import tsx packages/core/src/cli.ts triggers check --repo-root .npm test(repository checks reach the full Turbo catalog build; the unrelated webhook-server build is blocked by missinghonoand@hono/node-serverin this checkout)