Skip to content

Redis Client: guard against new classes the host may not carry - #25

Merged
DianaSensei merged 1 commit into
app/redis-client/mainfrom
claude/miniapp-css-audit-redis-client
Sep 22, 2026
Merged

DianaSensei merged 1 commit into
app/redis-client/mainfrom
claude/miniapp-css-audit-redis-client

Conversation

@DianaSensei

Copy link
Copy Markdown
Owner

Follow-up to #20, which fixed four classes but left nothing stopping the next one.

Why this is needed

This plugin ships no CSS and is styled entirely by the host's compiled Tailwind sheet, which never scans this repo. A class written only here resolves purely by coincidence.

Only container-manager had the offline guard. This adds it here.

What I found while writing it

The host has carried a safelist all along: src/styles/externalPluginClassnamesSafelist.ts — a snapshot of plugin class names extracted once when these tools left that repo, kept purely as scannable text so Tailwind emits them.

It is not broken. It is stale, exactly as its own comment predicted:

Regenerate by re-running the extraction one-off in the migration PR description if the plugin source changes meaningfully after this point (no automated re-sync …)

Plugin code moved on after that extraction and nothing re-synced it. That is precisely why min-h-16, mx-5 and align-top had no rule, while max-w-[9rem] and grid-cols-[3rem_minmax(0,1fr)_6.5rem_5.5rem] — both in the snapshot — did. The apparent arbitrariness of which classes survived has a cause: a date.

This change

ui/hostCssClasses.test.ts, run by npm test. Gates arbitrary-value sizing and layout classes — the half no host-side safelist can ever enumerate.

The allowlist holds the five this plugin already uses:

grid-cols-[1fr_auto]  w-[5px]  w-[3px]  left-[2px]  left-[1px]

Four of them also appear behind group-hover: variants on the resize handle, which an inline style cannot express. Each is documented as a dependency on a file nobody regenerates — not a guarantee — and the list is marked as not meant to grow.

Verification

  • npm run typecheck — clean
  • npx vitest run — 37 tests pass
  • npm run build — bundle builds
  • scripts/check-host-classes.mjs clean against a build of the currently released host

🤖 Generated with Claude Code

https://claude.ai/code/session_017Nz2ELEkkMQzn6N429NkFy


Generated by Claude Code

#20 fixed four classes that had no rule in the host's compiled stylesheet.
Nothing stops the next one: this plugin ships no CSS and is styled by the
host's sheet, which never scans this repo, so any class written only here
resolves purely by coincidence.

Adds ui/hostCssClasses.test.ts — the same guard container-manager has — run
by npm test. It gates arbitrary-value sizing and layout classes, which is
the half no host-side safelist can ever cover.

The allowlist holds the five this plugin already uses. They resolve today
only because the host carries externalPluginClassnamesSafelist.ts, a
snapshot taken once when these tools left that repo, whose own comment says
it has "no automated re-sync" — so an entry there is a dependency on a file
nobody regenerates, not a guarantee. Four of the five
(w-[5px], w-[3px], left-[2px], left-[1px]) also appear behind group-hover:
variants on the resize handle, which an inline style cannot express; the
list is documented as not meant to grow.

Verified: typecheck clean, 37 tests pass, build clean, and
scripts/check-host-classes.mjs clean against a build of the currently
released host.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Nz2ELEkkMQzn6N429NkFy
@DianaSensei
DianaSensei force-pushed the claude/miniapp-css-audit-redis-client branch from ff64b2f to fae5315 Compare September 22, 2026 08:39

Copy link
Copy Markdown
Owner Author

The earlier red run on this branch was my mistake, now fixed and force-pushed.

What happened: the first commit carried two files that do not belong to this plugin — plugins/kafka-explorer/ui/hostCssClasses.test.ts and plugins/rabbit-client/ui/hostCssClasses.test.ts. They were left in my working tree by an earlier pass over all three plugins, and a git add -A swept them in. lint:manifests walks every directory under plugins/, so it then looked for manifests those two folders do not have on this branch:

✗ plugins/kafka-explorer/manifest.plugin.json: ENOENT
✗ plugins/rabbit-client/manifest.plugin.json: ENOENT
Manifest lint failed.

Why I did not catch it: I verified with typecheck, vitest and build, but not lint:manifests, which CI also runs. The test count was the tell and I read past it — 37 tests instead of 31, because three guard files were running, not one.

The branch now contains only plugins/redis-client/ui/hostCssClasses.test.ts, and I re-ran the full set CI runs — lint:manifests, typecheck, test, build — in a clean clone rather than my own working tree, which was itself polluted and gave misleading local results. All four pass, here and on the other three branches.


Generated by Claude Code

@DianaSensei
DianaSensei merged commit 44e84e6 into app/redis-client/main Sep 22, 2026
4 checks passed
@DianaSensei
DianaSensei deleted the claude/miniapp-css-audit-redis-client branch September 22, 2026 08:41
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