test(canvas): cover utils.cn + runtime-names.runtimeDisplayName (0% → 100%) (#1815) - #2148
Merged
HongmingWang-Rabbit merged 1 commit intoApr 27, 2026
Conversation
… 100%) (#1815) [Molecule-Platform-Evolvement-Manager] Closes two of the 0%-coverage files surfaced by the baseline run in PR #2147 (vitest coverage instrumentation). Both files are tiny utility helpers with high-touch read paths. ## utils.cn (8 cases) Wraps `twMerge(clsx(inputs))` — every conditionally-styled component flows through here. The load-bearing case is the **last-wins Tailwind dedup**: `cn("p-2", "p-4")` → "p-4". A regression that lost twMerge would silently double-apply utilities (cosmetically broken, breaks `:where()` rules + theme overrides). Cases: - single class unchanged - multiple positional classes joined - array input flattening (clsx) - object syntax with truthy/falsy keys - last-wins dedup on conflicting Tailwind utilities (the regression-locked guarantee) - non-conflicting utilities both survive (p-2 + m-4) - mixed input shapes (string + array + object + string) - nullish / empty inputs don't throw ## runtime-names.runtimeDisplayName (4 it.each cases + 3 it()) Friendly-name lookup that surfaces the workspace runtime in the chat indicator, details tab, and a few component labels. Cases: - known runtimes map to display strings (claude-code → Claude Code, langgraph → LangGraph, etc.) - unknown runtime falls back to input string verbatim (a NEW runtime not yet in the lookup still renders something operator-debuggable rather than a generic placeholder) - empty string falls back to "agent" (final default) - case-sensitivity pinned: "Claude-Code" / "LANGGRAPH" miss the lookup. The upstream slug is already normalized lowercase, so a future refactor that lowercases input "for safety" would silently change behavior — pinning the contract here. ## Test plan - [x] All 17 cases pass locally (~129ms) - [x] No SUT changes — pure additive coverage - [ ] CI green ## #1815 progress - [x] Step 1+2: coverage instrumentation + script (#2147) - [x] 0%-file gaps utils.ts + runtime-names.ts (this PR) - [ ] More 0%/low-coverage files: lib/canvas-actions.ts (25%), store/classNames.ts (17%) — separate PRs - [ ] Step 3b: thresholds + CI gate once baseline catches up 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
HongmingWang-Rabbit
enabled auto-merge
April 27, 2026 06:45
HongmingWang-Rabbit
requested a review
from hongmingwang-moleculeai
as a code owner
April 27, 2026 06:45
This was referenced Apr 27, 2026
HongmingWang-Rabbit
pushed a commit
that referenced
this pull request
Jun 12, 2026
…ce_auth_tokens + org_api_tokens (#2148) The table-presence guard in .gitea/workflows/handlers-postgres-integration.yml hard-fails the integration job if a load-bearing table is missing after migration replay. The previous list covered delegations / workspaces / activity_logs / pending_uploads / workspace_schedules, but the registry-auth TestIntegration_ suite (#2156 / #2148) also requires workspace_auth_tokens (migration 020) and org_api_tokens (migration 035). Without this guard, a silently-skipped migration 020 or 035 (the surrounding apply-all-or-skip loop suppresses migration failures) would let the auth tests run against missing tables and falsely green. This change makes the guard catch that class of regression. This is the CR2 action item flagged in the #2156 WIP body: 'consider adding workspace_auth_tokens + org_api_tokens to that sanity list so a skipped auth-table migration fails loud instead of skipping silently.' Closes the guard gap for #2148 independently of the #2156 test-suite WIP (cleanly-separable; the WIP test work remains the devops-engineer's lane).
HongmingWang-Rabbit
pushed a commit
that referenced
this pull request
Jun 12, 2026
…-file #2156) Re-files the stalled WIP #2156 (originally by molecule-code-reviewer) on current main, de-duplicating against #2449 which already merged the handlers-postgres table-presence guard. Coverage (10 tests, //go:build integration, INTEGRATION_DB_URL): 1. RegistryRowState (4 tests) — register/heartbeat #73 tombstone guard: - RegisterDoesNotResurrectRemoved - RegisterUpsertsLiveWorkspaceToOnline - HeartbeatDoesNotResurrectRemoved - HeartbeatUpdatesLiveWorkspace 2. WSAuth (3 tests) — cross-tenant token binding: - TokenBoundToIssuingWorkspace - TokenOfRemovedWorkspaceRejected - RevokeAllForWorkspaceKillsToken 3. CanCommunicate (1 test) — parent_id hierarchy isolation: - HierarchyAndCrossTenantIsolation 4. OrgToken (2 tests) — revoke/validate row-state: - RevokeStopsValidation - ListExcludesRevoked Also widens detect-changes handlers-postgres profile to include internal/registry/ + internal/orgtoken/ so regressions in those packages trigger the integration gate. Closes #2148 Refs #2156
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[Molecule-Platform-Evolvement-Manager]
Closes two of the 0%-coverage files surfaced by the baseline run in #2147.
utils.cn (8 cases)
Wraps `twMerge(clsx(inputs))` — every conditionally-styled component flows through here. Load-bearing case is last-wins Tailwind dedup: `cn("p-2", "p-4")` → "p-4". A regression losing twMerge would silently double-apply utilities (breaks `:where()` rules + theme overrides).
runtime-names.runtimeDisplayName (4 `it.each` + 3 `it`)
Friendly-name lookup for the workspace runtime (used in chat indicator + details tab + component labels). Cases:
Test plan
#1815 progress
🤖 Generated with Claude Code