Skip to content

chore: fix pre-existing main breakages blocking clean overlay composition (#821) - #832

Merged
aarontrowbridge merged 3 commits into
mainfrom
chore/main-composition-fixes
Sep 6, 2026
Merged

chore: fix pre-existing main breakages blocking clean overlay composition (#821)#832
aarontrowbridge merged 3 commits into
mainfrom
chore/main-composition-fixes

Conversation

@aarontrowbridge

Copy link
Copy Markdown
Member

Closes #821. Fixes the two pre-existing breakages that red every overlay composition check on pristine origin/main, verified on a fresh origin/main (6afdb9d) worktree and materialized tree before and after.

Breakage 1 — server-session.ts(497) diff_version type clash

Repro: materialize (canonical v1.18.29 + overlay) → tsgo -b in packages/app:
error TS2741: Property 'diff_version' is missing ... but required in type 'SessionCache'.

Root cause: canonical's server-session.ts builds its store literal without diff_version (v1.18.29 and current upstream HEAD) and passes that draft to dropSessionCaches, which the overlay types with diff_version required. The field is an overlay-only cache-invalidation counter — there is no canonical wire shape to match — so the reconciliation widens the parameter type: diff_version becomes optional on SessionCache and the delete is guarded. The overlay's own global store type (global-sync/types.ts State) still declares it required; only dropSessionCaches' parameter widens.

Verification: the materialized typecheck error set on the fixed branch is byte-identical to the base set minus exactly this one error (19 → 18; the remaining 18 are the known overlay-vs-v1.18.29 API drift on surfaces PR #819 re-homes — out of scope here, no drive-bys).

Breakage 2 — i18n parity failure

Repro: bun test packages/app/src/i18n/parity.test.ts in the materialized tree fails with missing: ["session.exportTrace"] (en.ts has the key — added at the fork pin — none of the 17 non-English app locale dicts do; the ui and desktop domains are clean).

On the issue's 'am' attribution: it traces to PR #819's review notes and does not reproduce — the overlay carries no am dict and its parity test checks the 17 locales it owns; the materialized tree's only parity failure is this missing key across all 17. Restored the key in all 17, following each table's own terminology (br is pt-BR upstream). Inventing overlay am dicts was rejected deliberately: in the composed tree they would overwrite canonical's complete Amharic tables with a smaller fork-era keyset — the opposite of restoring keys.

Also (third pre-existing main breakage, surfaced by the repo's own tooling)

refresh_manifest.mjs / drift_gate.mjs revealed that the committed manifest lags the overlay by the three #774 session-ui files (diff-gutter-extension.ts, editable-diff-view-core.ts, editable-diff-view.tsx — in overlay/, absent from manifest.files), so the drift gate fails on pristine main with "stray files". Commit 1 adopts them via the canonical repair path (refresh_manifest.mjs against the v1.18.29 upstream tree). Flagging it here since it's adjacent to #821's scope but not named by it — happy to split it out if reviewers prefer.

Commits (each green, drift gate PASS at each)

Commit Behavior
948ca66 manifest refresh — adopt the three #774 session-ui overlay files
dc08246 reconcile SessionCache with canonical server-session shape (optional diff_version)
872a521 restore session.exportTrace in the 17 non-English app locales

Verification summary

  • Drift gate: PASS at every commit (579 files, overlay and manifest in sync).
  • Materialized tree (fresh, from this branch): server-session.ts(497) error gone; parity test 4/4 pass.
  • global-sync unit tests: 37 pass, unchanged from base (the 2 bun-test Solid-server module errors are identical on pristine main — environment artifacts, not touched).
  • No collision with sibling PR Re-home the session & device lifecycle base contract onto the app overlay (canonical v1.18.29) #819 (it touches session-list-state/snapshot code on its own branch; this branch touches session-cache.ts, i18n tables, manifest.json only).

… overlay files

The committed manifest lagged the overlay by three files added in #774
(packages/session-ui/src/v2/components/{diff-gutter-extension,
editable-diff-view-core,editable-diff-view}.ts): present in overlay/, absent
from manifest.files — the drift gate fails on pristine main with 'stray files
in overlay/ not in the manifest'. Repair path per #796: recompute the manifest
from the committed overlay against the v1.18.29 upstream tree
(scripts/refresh_manifest.mjs).
… shape

Canonical's server-session.ts builds its store literal without diff_version
(v1.18.29 and current upstream HEAD alike) and passes that draft to
dropSessionCaches — which the overlay types with diff_version REQUIRED, so the
materialized tree fails typecheck at server-session.ts(497):

  error TS2741: Property 'diff_version' is missing ... but required in type 'SessionCache'

The field is an overlay-only cache-invalidation counter (no canonical wire
shape to match), so the reconciliation is to widen the parameter type:
diff_version becomes optional on SessionCache and the delete is guarded.
The overlay's own global store type (global-sync/types.ts State) still
declares diff_version required — only dropSessionCaches' parameter widens.
…ocales

The overlay's i18n parity test fails on pristine main: en.ts carries
"session.exportTrace" (added at the fork pin) but none of the 17 non-English
app locale dicts do — the parity test aborts on the first locale (ar) with
missing: ["session.exportTrace"]. The ui and desktop domains are clean.

Issue #821 attributes this to the 'am' locale; that attribution traces to
PR #819's review notes and does not reproduce: the overlay carries no am
dict and its parity test checks the 17 locales it owns. The reproducible
failure is the missing key across all 17, restored here following each
table's own terminology (br is pt-BR upstream).
@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

@aarontrowbridge
aarontrowbridge marked this pull request as ready for review September 6, 2026 17:27
@aarontrowbridge
aarontrowbridge merged commit faac5bd into main Sep 6, 2026
9 checks passed
jeonghun-jj-lee added a commit that referenced this pull request Sep 12, 2026
The overlay sync in earlier commits wiped amicode-side patches (#929, #832,
#987, OAuth bridge, titlebar interactions) because the fork's local/amicode
branch doesn't carry them yet. Restore the full overlay from main; the
proper sync happens after the fork PR merges into local/amicode.
jeonghun-jj-lee added a commit that referenced this pull request Sep 12, 2026
…) (#1028)

* feat(#1026): Slice 1 — VS Code theme extraction + bridge

Add syntax_theme_bridge.ts: resolves the active VS Code color theme to
either a Shiki built-in name (fast path, ~30 popular themes) or a full
TextMate theme object extracted from the contributing extension's
filesystem. Handles include chains (max depth 5, cycle detection) and
merges editor.tokenColorCustomizations user overrides.

Wire into ChatPanel: postSyntaxTheme() fires on theme change, on
workbench.colorTheme change, and on tokenColorCustomizations change.
Add 'syntax-theme' to both Lane 2 relay allowlists so the message
reaches the framed app.

8 tests covering: built-in matching, custom extraction, include chains,
cycle detection, user override merging, and fallback behavior.

* chore: sync overlay to opencode a9c4bc736a (Shiki syntax highlighting, #1026)

Overlay promotion from opencode fork branch with Slices 2-5:
- shiki-theme-state.ts: reactive theme state for the webview
- shiki-highlight-worker.ts: dedicated Shiki tokenization Web Worker
- shiki-highlight-plugin.ts: CM6 ViewPlugin with Shiki decorations
- editor-core.ts: wired Shiki extension + language-data fallback
- preview-editor.tsx + editable-diff-view: pass lang to baseExtensions
- markdown-shiki.worker.ts: theme-update support
- pierre/worker.ts: active theme for @pierre/diffs pools
- app.tsx: syntax-theme message handler

Plus opencode fork upstream changes included in the full promotion.

* fix(#1026): correct Shiki decoration bugs + sync overlay

Three bugs fixed in the fork:
1. Empty fallback theme: worker init now uses the actual OpenCodeTheme
   (30+ TextMate scope rules) instead of an empty stub
2. Worker URL: uses Vite ?worker&url import pattern matching existing
   markdown-shiki and @pierre/diffs workers
3. Test compat: extracted pure decoration logic to shiki-highlight-
   decorations.ts; editor-core.ts lazy-imports the plugin module

New integration test verifies Shiki produces colored tokens + valid
CM6 decorations for Julia, TypeScript, Python, Rust, Go, YAML, and
Shell (16 tests, all green).

* chore: clean overlay sync from correct upstream base (afc0f1c26a vs 6fa55b660a)

Previous incremental syncs used intermediate fork commits as the base,
causing new Shiki files to be missing from the overlay. Redo as a
full fork-vs-upstream-base delta to get all 18 files correctly.

Fixes: shiki-highlight-plugin.ts, shiki-highlight-worker.ts,
shiki-highlight-decorations.ts, shiki-theme-state.ts and tests now
present in the overlay. The binary was already built from the correct
fork commit (afc0f1c26a) — this fixes only the overlay tracking copy.

* fix(#1026): deliver VS Code syntax theme after iframe boot

The extension previously posted syntax-theme only after a later VS Code
theme/configuration change. A newly opened Preview tab therefore stayed
on the OpenCode fallback palette forever.

Post the resolved syntax theme on the existing app-ready handshake,
when the iframe listener is guaranteed to exist. Restore live refreshes
for colorTheme and tokenColorCustomizations changes, and admit the
message through both Lane 2 relay render paths.

Add regression coverage proving a fresh panel receives dark-plus after
app-ready and both relays contain syntax-theme.

* chore: restore overlay from main — sync deferred to post-fork-merge

The overlay sync in earlier commits wiped amicode-side patches (#929, #832,
#987, OAuth bridge, titlebar interactions) because the fork's local/amicode
branch doesn't carry them yet. Restore the full overlay from main; the
proper sync happens after the fork PR merges into local/amicode.

* chore: restore app-bundle manifest from main

The sync:apply rewrote the manifest to point at the Shiki feature branch
(afc0f1c26a) instead of local/amicode. Restore main's manifest so the
drift gate passes against local/amicode as-is.

* chore: remove leftover Shiki overlay files — overlay now matches main exactly
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.

chore: fix pre-existing main breakages blocking clean overlay composition (server-session diff_version type clash; i18n 'am' locale parity)

1 participant