Skip to the content.

LexiShift Chrome Extension: Technical Notes

Status: active mixed reference Role: Mixed Last updated: 2026-03-21 Purpose: module-level technical reference for current extension behavior plus known gaps and ongoing areas Source-of-truth: mixed as-is + known-gaps reference; verify live runtime behavior in extension_system_map.md, apps/chrome-extension/manifest.json, apps/chrome-extension/options/core/bootstrap/controller_graph.js, and the linked source modules.

This doc mixes current runtime notes with known gaps and forward-looking sections. Use extension_system_map.md first when you need the shortest current-behavior path.

Recommended read order

How To Use This Doc

Current Runtime Reference

Overview

Top-level extension directories

Module layout

Manifest ordering

Settings flow

Options UI tools (extension)

Share envelope compatibility

SRS settings (extension)

Replacement pipeline (content script)

  1. Load and normalize settings from storage.
  2. Normalize rules.
  3. If SRS is enabled, load the fixed test dataset and select active lemmas.
  4. Filter rules to those whose replacement is in the active lemma set.
  5. Build a trie of word tokens from the filtered rules.
  6. Collect all text nodes using a TreeWalker.
  7. For each node:
    • Skip if empty, whitespace-only, in editable fields, excluded tags, or already replaced.
    • Tokenize and find longest matches via the trie.
    • Optionally filter matches:
      • maxOnePerTextBlock: keep only the first match in the text node.
      • allowAdjacentReplacements=false: skip back-to-back word matches.
      • maxReplacementsPerPage: stop replacing when page budget is exhausted.
      • maxReplacementsPerLemmaPerPage: skip lemmas that reached per-page cap.
    • Replace the node with a fragment containing spans and text nodes.
    • For Japanese targets, replacement display uses selected primary script when rule metadata includes script forms.
    • For morphology-tagged rules, display can use metadata.morphology.target_surface while canonical lemma remains rule.replacement for gating/feedback keys.
    • Each replacement span is tagged with data-origin (srs or ruleset).
  8. Track processed nodes in a WeakMap to avoid repeated replacements.

SRS gating behavior (extension)

Helper set-planning flow (options)

Profile switch behavior:

Helper cache scoping:

Profile media scoping:

SRS feedback UX (extension)

Exposure tracking (extension)

Observer strategy

Debug tooling

Settings added for replacement behavior

Known Gap To Preserve Explicitly

Known issue (not fixed yet)