Skip to content

refactor(frame): canonicalize createEmptyMap in @variscout/core#96

Merged
jukka-matti merged 1 commit into
mainfrom
phase-2/pr-1-tech-debt-hygiene
Apr 27, 2026
Merged

refactor(frame): canonicalize createEmptyMap in @variscout/core#96
jukka-matti merged 1 commit into
mainfrom
phase-2/pr-1-tech-debt-hygiene

Conversation

@jukka-matti
Copy link
Copy Markdown
Owner

Summary

  • Phase 2 PR chore(deps): bump pnpm/action-setup from 4.1.0 to 4.4.0 #1: extracts the byte-identical createEmptyMap helper from PWA + Azure FrameView into @variscout/core/frame.
  • Pure refactor — zero behavior change. ProcessMap construction now has a single home as Phase 2 of the Layered Process View grows.
  • Tightens 3 files: removes 24 LOC of duplication, adds 16 LOC factory + 24 LOC unit tests.

Why

PR #95 (V1) shipped two identical 10-line createEmptyMap implementations in apps/pwa/src/components/views/FrameView.tsx and apps/azure/src/components/editor/FrameView.tsx. Recorded as a V1 follow-up. Canonicalizing now means PR #2 (PWA parity for ProcessHubCurrentStatePanel) and PR #3 (snapshot-mode wiring) inherit one source of truth.

Plan reference: ~/.claude/plans/lets-create-a-plan-proud-island.md

Changes

  • packages/core/src/frame/factories.ts (new): createEmptyMap() factory.
  • packages/core/src/frame/__tests__/factories.test.ts (new): 3 tests — shape, ISO timestamps, instance independence.
  • packages/core/src/frame/index.ts: export createEmptyMap.
  • apps/pwa/src/components/views/FrameView.tsx: import from core, drop local helper.
  • apps/azure/src/components/editor/FrameView.tsx: import from core, drop local helper.

Verification

  • pnpm --filter @variscout/core exec vitest run — 137 files / 2805 tests pass (incl. 3 new).
  • pnpm --filter @variscout/pwa exec vitest run — 17 files / 124 tests pass.
  • pnpm --filter @variscout/azure-app exec vitest run — 64 files / 924 tests pass.
  • pnpm --filter @variscout/ui build — clean tsc + vite build.
  • bash scripts/pr-ready-check.sh — all checks green.

Test plan

  • Core unit tests cover factory shape and timestamp behavior.
  • Both apps continue to render an empty FrameView when processContext.processMap is undefined (covered by existing FrameView tests in both packages).
  • No new public API surface added at the app boundary; identical typed signature.

Out of scope

  • setState-in-render warning in apps/pwa/src/App.tsx AppMain — preexisting tech debt; needs dev-server reproduction before fix; deferred.
  • Ocean-spec dedup between ProcessMapBase and LayeredProcessView — folded into PR chore(deps): bump @microsoft/teams-js from 2.49.0 to 2.50.0 #4 where snapshot-mode makes the ownership obvious.

🤖 Generated with Claude Code

Both PWA and Azure FrameView shipped byte-identical 10-line
createEmptyMap helpers. Move the factory to @variscout/core/frame so
ProcessMap construction has a single home as Phase 2 of the Layered
Process View grows. Pure refactor — zero behavior change. Adds 3
unit tests covering shape, timestamp, and instance independence.

Phase 2 PR #1 of N (per ~/.claude/plans/lets-create-a-plan-proud-island.md).

Co-Authored-By: ruflo <ruv@ruv.net>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mean-beoynd-lite-pwa Ready Ready Preview, Comment Apr 27, 2026 4:57pm
variscout_website Ready Ready Preview, Comment Apr 27, 2026 4:57pm

@jukka-matti jukka-matti merged commit 9455e7d into main Apr 27, 2026
3 checks passed
@jukka-matti jukka-matti deleted the phase-2/pr-1-tech-debt-hygiene branch April 27, 2026 16:58
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