Skip to content

Add provider-neutral link previews and Slack adapter#154

Merged
HamptonMakes merged 2 commits into
mainfrom
hampton/open-source-slack-adapter
Jul 18, 2026
Merged

Add provider-neutral link previews and Slack adapter#154
HamptonMakes merged 2 commits into
mainfrom
hampton/open-source-slack-adapter

Conversation

@HamptonMakes

Copy link
Copy Markdown
Collaborator

Why

CoPlan links should render useful previews in Slack and other providers without coupling core plan metadata to a Square-specific client. A valid CoPlan plan URL is intentionally the preview capability, including for brainstorm plans.

What

  • Add a provider-neutral CoPlan::LinkPreview DTO and strict same-origin URL resolver to the engine
  • Add an optional open-source coplan-slack Rails engine with signed Events API handling, async unfurls, Block Kit rendering, and retry classification
  • Reuse the neutral preview builder for server-rendered Open Graph metadata
  • Document host configuration, Slack scopes, domain registration, and ingress responsibilities

Risk Assessment

Medium — this adds a new optional public webhook surface, but it is disabled without configuration, verifies Slack signatures and timestamps over the raw body, and only resolves same-origin CoPlan URLs without outbound fetching. Preview resolution deliberately bypasses viewer policy for every plan status.

References

  • CoPlan design
  • Focused specs: 22 examples, 0 failures
  • RuboCop: 20 files, no offenses
  • Full suite before merging current main: 1,151 examples, 0 failures
  • Current main adds a Mermaid system spec that fails in isolation on this branch (spec/system/comment_ux_spec.rb:198); unrelated to this diff

Generated with Amp

…lack-adapter

* origin/main:
  Open the status menu from the plan's status badge (#146)
  COPLAN-35: Keep Mermaid comments clickable (#148)
  Style the attachments upload control (#147)
@HamptonMakes
HamptonMakes marked this pull request as ready for review July 18, 2026 16:49

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dac5576858

ℹ️ 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".

plan_id = plan_id_from(supplied.path, base.path)
return unless plan_id

plan = Plan.includes(:created_by_user, :plan_type, :current_plan_version).find_by(id: plan_id)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid unfurling private brainstorm drafts

When someone posts a brainstorm plan URL into any Slack channel, this global lookup returns the plan and the unfurl renders its title plus summary/content excerpt, even though CoPlan::Plan.visible_to documents brainstorms as private drafts that should not leak through lists/counts/folders. Because Slack requests are not tied to a CoPlan user, this should either skip private statuses or perform an explicit visibility check before building the preview.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yup! That's fine!

@HamptonMakes
HamptonMakes merged commit cfdb27a into main Jul 18, 2026
3 of 5 checks passed
@HamptonMakes
HamptonMakes deleted the hampton/open-source-slack-adapter branch July 18, 2026 18:33
HamptonMakes added a commit that referenced this pull request Jul 20, 2026
…resh

Prefer this branch's visibility model while genuinely adopting main's new
features:

- LinkPreviews/Slack unfurls (#154): adopted; context now speaks the
  visibility language — Private/Archived flagged, published unmarked,
  never "Draft". plan_og_description delegates to the same builder.
- Mermaid comment anchors (#148/#149/#151): adopted; mermaid-settled
  re-highlighting wired into our no-tabs plan page, anchors-updated
  re-anchoring wired into our headless comment nav. Clicking a comment
  mark inside a diagram now opens its thread popover instead of the
  lightbox (showModal force-hides popovers).
- Landing refresh + agent-instructions view (#140): adopted; step copy
  and mock badge updated to the born-published model (type badge, no
  status badge).
- Status badge menu (#146): superseded — visibility is the only state,
  toggled by the header eye; status_menu_controller removed.
- Attachments dropzone (#147): superseded by our add-modal dropzone;
  spec selectors reconciled.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant