Skip to content

ui(data-mode): migrate legacy harness storage to v2 - #1040

Merged
ndizazzo merged 3 commits into
mainfrom
codex/issue-633-data-mode-migration
Jul 22, 2026
Merged

ui(data-mode): migrate legacy harness storage to v2#1040
ndizazzo merged 3 commits into
mainfrom
codex/issue-633-data-mode-migration

Conversation

@ndizazzo

@ndizazzo ndizazzo commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • bump the app-owned data-mode storage key from v1 to v2 so legacy harness defaults are not mistaken for explicit user choices
  • seed v2 from the current environment default only during a valid app-key upgrade, retain v1 for downgrade compatibility, and avoid repeated writes
  • repair malformed current state without reviving stale legacy data, preserve in-memory startup when storage writes fail, and leave host-owned keys untouched
  • update E2E storage setup to target v2 and add migration/error/idempotency regression coverage

Closes #633

Validation

  • focused DataModeProvider tests: 11 passed
  • pnpm run lint
  • pnpm run typecheck
  • full UI unit suite: 958 passed, 3 skipped
  • UI production build
  • just website-build
  • just test-all (all 10 phases, including 1,700 host-runtime tests and Playwright smoke tests)

Notes

The first full gate encountered one load-sensitive timeout in an unrelated mesh-visualization test; that test passed immediately in isolation. A subsequent full run passed the complete UI suite. The next run exposed missing website dependencies in the fresh worktree; after installing the lockfile dependencies, the website build and a final complete just test-all both passed.

Summary by CodeRabbit

  • New Features

    • Added versioned “data mode” persistence with automatic upgrade from prior stored settings, ensuring a smooth transition to the current default.
  • Bug Fixes

    • Improved handling of malformed stored values and storage-write failures, including preserving legacy selections.
    • Avoids redundant localStorage updates when the selected mode hasn’t changed.
  • Tests

    • Updated e2e smoke and parity tests to use the shared data-mode storage key.
    • Expanded unit test coverage for migration, fallback behavior, and error scenarios.
  • Chores

    • Updated TypeScript path aliasing to support e2e imports.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bdec5fe3-8df1-4915-b8d3-51c95a93d265

📥 Commits

Reviewing files that changed from the base of the PR and between f77be7e and 0610556.

📒 Files selected for processing (8)
  • crates/mesh-llm-ui/e2e/configuration/schema-controls.spec.ts
  • crates/mesh-llm-ui/e2e/plugins/web-ui-exemplar.live.spec.ts
  • crates/mesh-llm-ui/e2e/smoke/chat-mobile.spec.ts
  • crates/mesh-llm-ui/e2e/smoke/live-parity.spec.ts
  • crates/mesh-llm-ui/e2e/support/data-mode.ts
  • crates/mesh-llm-ui/src/lib/data-mode/DataModeContext.test.tsx
  • crates/mesh-llm-ui/src/lib/data-mode/DataModeContext.tsx
  • crates/mesh-llm-ui/tsconfig.json
🚧 Files skipped from review as they are similar to previous changes (6)
  • crates/mesh-llm-ui/e2e/smoke/live-parity.spec.ts
  • crates/mesh-llm-ui/e2e/plugins/web-ui-exemplar.live.spec.ts
  • crates/mesh-llm-ui/e2e/configuration/schema-controls.spec.ts
  • crates/mesh-llm-ui/e2e/smoke/chat-mobile.spec.ts
  • crates/mesh-llm-ui/src/lib/data-mode/DataModeContext.test.tsx
  • crates/mesh-llm-ui/src/lib/data-mode/DataModeContext.tsx

📝 Walkthrough

Walkthrough

The data-mode storage key changes from v1 to v2. Runtime logic migrates recognized legacy state, preserves v1 data, avoids redundant writes, and excludes host-owned keys. Unit and E2E tests now validate v2 behavior and share the versioned key.

Changes

Data mode migration

Layer / File(s) Summary
Versioned storage migration
crates/mesh-llm-ui/src/lib/data-mode/DataModeContext.tsx
The active key uses v2, the v1 key remains available for migration, reads seed v2 from the fallback when appropriate, and writes skip unchanged values.
Migration and validation
crates/mesh-llm-ui/src/lib/data-mode/DataModeContext.test.tsx
Tests cover legacy migration, existing valid v2 values, malformed values, storage failures, host-owned keys, and mock cleanup.
Shared E2E v2 initialization
crates/mesh-llm-ui/e2e/support/data-mode.ts, crates/mesh-llm-ui/e2e/**/*.spec.ts, crates/mesh-llm-ui/tsconfig.json
E2E tests share the v2 storage key, initialization writes use it, and the @e2e/* path alias is configured.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant E2ETest
  participant DataModeProvider
  participant readStoredDataMode
  participant localStorage
  E2ETest->>localStorage: initialize v2 data-mode state
  DataModeProvider->>readStoredDataMode: read fallback and persistence settings
  readStoredDataMode->>localStorage: read v2 and legacy v1 values
  readStoredDataMode->>localStorage: seed v2 from fallback when legacy state is recognized
  readStoredDataMode-->>DataModeProvider: return selected data mode
Loading

Suggested reviewers: i386

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly captures the main change: migrating legacy data-mode storage to the v2 key.
Linked Issues check ✅ Passed The PR bumps the data-mode storage key to v2, ignores legacy v1 state on read, and adds tests for migration and error cases.
Out of Scope Changes check ✅ Passed The tsconfig alias and E2E storage-key updates support the migration and test imports, with no unrelated feature work evident.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/issue-633-data-mode-migration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request is currently a draft. Reviews will not take place until the PR is marked as ready for review.

@ndizazzo
ndizazzo marked this pull request as ready for review July 21, 2026 18:12
@github-actions
github-actions Bot requested a review from i386 July 21, 2026 18:12

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
crates/mesh-llm-ui/e2e/configuration/schema-controls.spec.ts (1)

4-4: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the data-mode storage key literal into a shared e2e constant.

The mesh-llm-ui-preview:data-mode:v2 string is independently defined or hardcoded in four separate spec files; this PR had to edit all four in lockstep to bump v1→v2, which is exactly the kind of drift risk a shared constant avoids for the next version bump.

  • crates/mesh-llm-ui/e2e/configuration/schema-controls.spec.ts#L4-L4: import the key from a shared e2e helper module instead of a local const.
  • crates/mesh-llm-ui/e2e/plugins/web-ui-exemplar.live.spec.ts#L99-L99: pass the key via addInitScript args from the shared constant (as the other specs do) instead of hardcoding the literal inline.
  • crates/mesh-llm-ui/e2e/smoke/chat-mobile.spec.ts#L3-L3: import the key from the same shared helper module.
  • crates/mesh-llm-ui/e2e/smoke/live-parity.spec.ts#L3-L3: import the key from the same shared helper module.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/mesh-llm-ui/e2e/configuration/schema-controls.spec.ts` at line 4,
Centralize the data-mode storage key in a shared e2e helper constant, then
update all four specs to reuse it: import the constant in
schema-controls.spec.ts, chat-mobile.spec.ts, and live-parity.spec.ts instead of
local literals, and pass it through addInitScript arguments in
web-ui-exemplar.live.spec.ts instead of hardcoding the key.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@crates/mesh-llm-ui/e2e/configuration/schema-controls.spec.ts`:
- Line 4: Centralize the data-mode storage key in a shared e2e helper constant,
then update all four specs to reuse it: import the constant in
schema-controls.spec.ts, chat-mobile.spec.ts, and live-parity.spec.ts instead of
local literals, and pass it through addInitScript arguments in
web-ui-exemplar.live.spec.ts instead of hardcoding the key.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1660a7c2-2f30-4ffd-a653-1aebbb03f904

📥 Commits

Reviewing files that changed from the base of the PR and between a6c7ddb and f77be7e.

📒 Files selected for processing (6)
  • crates/mesh-llm-ui/e2e/configuration/schema-controls.spec.ts
  • crates/mesh-llm-ui/e2e/plugins/web-ui-exemplar.live.spec.ts
  • crates/mesh-llm-ui/e2e/smoke/chat-mobile.spec.ts
  • crates/mesh-llm-ui/e2e/smoke/live-parity.spec.ts
  • crates/mesh-llm-ui/src/lib/data-mode/DataModeContext.test.tsx
  • crates/mesh-llm-ui/src/lib/data-mode/DataModeContext.tsx

@ndizazzo

Copy link
Copy Markdown
Collaborator Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ndizazzo
ndizazzo force-pushed the codex/issue-633-data-mode-migration branch from 6979b09 to 0610556 Compare July 22, 2026 01:25
@ndizazzo
ndizazzo merged commit a1649da into main Jul 22, 2026
22 checks passed
@ndizazzo
ndizazzo deleted the codex/issue-633-data-mode-migration branch July 22, 2026 02:54
michaelneale added a commit that referenced this pull request Jul 22, 2026
…ngram

* origin/main:
  Add GLM DSA correctness trace reporting (#1033)
  Add GLM DSA package contract validation (#1032)
  Add direct quant layer package tooling (#1031)
  Lock split topology placement (#1050)
  fix nightly stability Qwen thinking
  ui(data-mode): migrate legacy harness storage to v2 (#1040)
  fix: Windows Vulkan runtime dependencies (#1046)
  test: validate MI300 runtime selection and placement (#1045)
  fix: support ROCm RDNA APU kernels safely (#1044)
  fix: ROCm GPU enumeration (#1039)
  Document public packaging installation channels
  Fix Windows autoupdate import (#1030)
  Update llama.cpp upstream pin
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.

ui(data-mode): bump storage key version to migrate pre-fix users off 'harness'

1 participant