Skip to content

test(canvas): cover utils.cn + runtime-names.runtimeDisplayName (0% → 100%) (#1815) - #2148

Merged
HongmingWang-Rabbit merged 1 commit into
stagingfrom
test/canvas-lib-utils-runtime-names-1815
Apr 27, 2026
Merged

test(canvas): cover utils.cn + runtime-names.runtimeDisplayName (0% → 100%) (#1815)#2148
HongmingWang-Rabbit merged 1 commit into
stagingfrom
test/canvas-lib-utils-runtime-names-1815

Conversation

@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor

[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:

  • known runtimes map to display strings
  • unknown runtime falls back to input string verbatim (operator-debuggable)
  • empty string falls back to `"agent"`
  • case-sensitivity pinned (upstream slug is already normalized; pinning the contract guards against a "helpful" lowercase-on-input refactor)

Test plan

  • All 17 cases pass locally (~129ms)
  • No SUT changes
  • CI green

#1815 progress

🤖 Generated with Claude Code

… 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
HongmingWang-Rabbit added this pull request to the merge queue Apr 27, 2026
Merged via the queue into staging with commit d46d558 Apr 27, 2026
15 checks passed
@molecule-ai
molecule-ai Bot deleted the test/canvas-lib-utils-runtime-names-1815 branch May 20, 2026 06:22
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
HongmingWang-Rabbit pushed a commit that referenced this pull request Jun 12, 2026
…n_ suite (#2148 / re-file #2156)' (#2475) from test/2148-registry-auth-real-postgres-v2 into main
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