Skip to content

Commit b1d14e3

Browse files
authored
Remove retired earmark and unused phoenix_storybook dependencies (#4886)
* Migrate off retired earmark markdown dependency (#4878) Replace the direct earmark dependency with mdex for rendering AI assistant message content. earmark is retired and unmaintained; mix hex.audit flags it. mdex node structs cannot hold arbitrary HTML attributes, so per-element Tailwind classes are now injected into the rendered HTML instead of via AST manipulation. Raw HTML passthrough and the raw-content fallback are preserved, and the language- prefix on code blocks is stripped to keep earmark's previous output. earmark remains a dev-only transitive dependency of phoenix_storybook 0.9.2 until that is upgraded to 1.2+ (which requires Phoenix 1.8). * Remove unused phoenix_storybook dependency (#4846) phoenix_storybook 0.9.2 carried three open advisories flagged by mix deps.audit (critical RCE, atom-table DoS, PubSub topic injection). It was dev-only with no production exposure, and storybook was dormant: only three demo stories existed and nothing had changed since the 2023 prototype. Remove the package rather than upgrade to 1.1.0. Drop the dep and its dev routes, delete the backend module, stories, and assets, and strip the esbuild/tailwind/live-reload config. Clear the storybook advisory IDs from the CI deps.audit ignore list, leaving only the cowlib advisory (no patch available yet). Remove now-orphaned lock entries via mix deps.unlock --unused. * update changelog * Keep MDEx's native language- class on code blocks MDEx emits the standard `<code class="language-javascript">` for fenced code blocks. We were rewriting it back to Earmark's old bare `<code class="javascript">`, but nothing consumes that class (no syntax highlighter is wired up, and the markdown CSS targets `pre code` by element), so keep MDEx's conventional output instead. * Enable GFM extensions for MDEx markdown rendering The earmark→mdex migration left MDEx running as plain CommonMark, which silently dropped the GFM features earmark rendered by default. Assistant replies containing markdown tables showed as raw pipe text, strikethrough and bare-URL autolinks stopped working. Enable the table, strikethrough, autolink, and tasklist extensions to restore the prior rendering, and add a regression test covering them.
1 parent 3c86ddf commit b1d14e3

20 files changed

Lines changed: 156 additions & 316 deletions

File tree

.circleci/config.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,8 @@ jobs:
188188
command: |
189189
# GHSA-g2wm-735q-3f56: cowlib cookie encoder CRLF injection (low);
190190
# no patched release available yet.
191-
# GHSA-55hg-8qxv-qj4p / GHSA-833p-95jq-929q / GHSA-mrhx-6pw9-q5fh:
192-
# phoenix_storybook advisories. Dev-only dep, not compiled into
193-
# prod and storybook routes are dev-only. Tracked for removal.
194191
sudo -u lightning mix deps.audit \
195-
--ignore-advisory-ids GHSA-g2wm-735q-3f56,GHSA-55hg-8qxv-qj4p,GHSA-833p-95jq-929q,GHSA-mrhx-6pw9-q5fh \
192+
--ignore-advisory-ids GHSA-g2wm-735q-3f56 \
196193
|| echo "deps.audit" >> /tmp/lint_failed
197194
- run:
198195
name: "Check for retired Hex packages"

.formatter.exs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
inputs: [
55
"*.{heex,ex,exs}",
66
"priv/*/seeds.exs",
7-
"{config,lib,test}/**/*.{heex,ex,exs}",
8-
"storybook/**/*.exs"
7+
"{config,lib,test}/**/*.{heex,ex,exs}"
98
],
109
subdirectories: ["priv/*/migrations"],
1110
line_length: 81

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ and this project adheres to
2525

2626
### Changed
2727

28+
- Migrated off the retired `earmark` markdown dependency in favour of `mdex`.
29+
[#4878](https://github.com/OpenFn/lightning/issues/4878)
30+
- Removed the unused dev-only `phoenix_storybook` dependency, clearing its
31+
advisories from the `mix deps.audit` ignore list.
32+
[#4846](https://github.com/OpenFn/lightning/issues/4846)
2833
- Bump worker to 1.27.0
2934

3035
### Fixed

RUNNINGLOCAL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ LOCAL_ADAPTORS=true mix phx.server
183183
```
184184

185185
Each path in `OPENFN_ADAPTORS_REPO` must contain a `packages` subdirectory.
186-
Paths that are missing or unreadable are logged and skipped, so the rest of
187-
the list still loads.
186+
Paths that are missing or unreadable are logged and skipped, so the rest of the
187+
list still loads.
188188

189189
### Problems with Apple Silicon
190190

assets/css/storybook.css

Lines changed: 0 additions & 11 deletions
This file was deleted.

assets/js/storybook.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

codecov.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ ignore:
1717
- "lib/lightning/release.ex"
1818
- "lib/lightning/sentry_event_filter.ex"
1919
- "test/support/**"
20-
- "storybook/**"
2120

2221
# Phoenix declarative scaffolding — boot-only or pure DSL
2322
- "lib/lightning_web.ex"

config/config.exs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ config :esbuild,
102102
--external:/fonts/*
103103
--external:/images/*
104104
js/app.js
105-
js/storybook.js
106105
js/editor/Editor.tsx
107106
js/react/components/DataclipViewer.tsx
108107
js/react/components/CollectionPreviewViewer.tsx
@@ -145,13 +144,6 @@ config :tailwind,
145144
--output=priv/static/assets/app.css
146145
),
147146
cd: Path.expand("..", __DIR__)
148-
],
149-
storybook: [
150-
args: ~w(
151-
--input=assets/css/storybook.css
152-
--output=priv/static/assets/storybook.css
153-
),
154-
cd: Path.expand("..", __DIR__)
155147
]
156148

157149
# Configures Elixir's Logger

config/dev.exs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ config :lightning, LightningWeb.Endpoint,
3333
# Start the esbuild watcher by calling Esbuild.install_and_run(:default, args)
3434
esbuild:
3535
{Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]},
36-
tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]},
37-
storybook_tailwind: {Tailwind, :install_and_run, [:storybook, ~w(--watch)]}
36+
tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]}
3837
]
3938

4039
config :lightning,
@@ -112,8 +111,7 @@ config :lightning, LightningWeb.Endpoint,
112111
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
113112
~r"priv/gettext/.*(po)$",
114113
~r"lib/lightning_web/(live|components|views)/.*(ex|heex)$",
115-
~r"lib/lightning_web/templates/.*(eex)$",
116-
~r"storybook/.*(exs)$"
114+
~r"lib/lightning_web/templates/.*(eex)$"
117115
]
118116
]
119117

coveralls.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"lib/lightning/release.ex",
55
"lib/lightning/sentry_event_filter.ex",
66
"lib/mix/tasks/install_runtime.ex",
7-
"test/support/*",
8-
"storybook/*"
7+
"test/support/*"
98
]
109
}

0 commit comments

Comments
 (0)