Skip to content

Add interlinearizer project storage and createProject command#33

Open
alex-rawlings-yyc wants to merge 49 commits into
mainfrom
create-interlinearizer-project
Open

Add interlinearizer project storage and createProject command#33
alex-rawlings-yyc wants to merge 49 commits into
mainfrom
create-interlinearizer-project

Conversation

@alex-rawlings-yyc
Copy link
Copy Markdown
Contributor

@alex-rawlings-yyc alex-rawlings-yyc commented Apr 29, 2026


This change is Reviewable

Summary by CodeRabbit

  • New Features

    • Interlinear project UX: create, select, view/edit metadata, delete; persisted active project across tabs; project-related top‑menu actions and modals; continuous‑scroll toggle and improved WebView state handling.
  • Bug Fixes / Reliability

    • Safer project storage with serialized writes, concurrency protection, clearer error handling and user notifications.
  • Tests

    • Expanded test coverage for storage, commands, modals, loader, parsers, UI flows and failure cases.
  • Documentation

    • Updated localized UI strings and expanded architecture/usage guidance.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • ✅ Review completed - (🔄 Check again to review again)
📝 Walkthrough

Walkthrough

Adds project persistence with serialized queues, new JSON-RPC project commands, modal UIs plus a ProjectModals coordinator persisted in WebView state, type/model updates (Token.ref, link-based analysis), expanded mocks/Jest config, Tailwind modal utilities, and extensive tests.

Changes

Interlinearizer project storage, host commands, types, UI, mocks, and tests

Layer / File(s) Summary
Public types & data-model
src/types/interlinearizer.d.ts
Redefines analysis/project model: adds InterlinearProject, Token.ref, TokenSnapshot/MorphemeLink, link-based TextAnalysis arrays, and interlinearizer.createProject handler type.
Storage service + concurrency
src/services/projectStorage.ts
New persistence layer with per-index and per-project serialized queues, create/get/list/getProjectsForSource/updateProjectMetadata/deleteProject, ENOENT handling, rollback on index failures, and resetQueuesForTesting.
Host command implementations & registration
src/main.ts
Captures executionToken during activate(), implements JSON-RPC commands delegating to projectStorage (createProject, getProjectsForSource, updateProjectMetadata, deleteProject), registers modal no-op commands, and stores disposables.
Modal components & coordinator
src/components/SelectInterlinearProjectModal.tsx, src/components/CreateProjectModal.tsx, src/components/ProjectMetadataModal.tsx, src/components/ProjectModals.tsx
Modal UIs fetch/dispatch host commands, validate/parse JSON, guard duplicate submissions, persist/merge activeProject in WebView state, and coordinate create/select/metadata flows.
Loader & web-view wiring
src/components/InterlinearizerLoader.tsx, src/interlinearizer.web-view.tsx
Loader accepts useWebViewState, persists activeProject, filters menu items (hiding View Info when no active project), routes toolbar commands to modals; web-view forwards useWebViewState.
Token identity & tokenizer updates
src/parsers/papi/bookTokenizer.ts, src/components/*, src/__tests__/*
Token identity moved id→ref across tokenizer, components, and tests; rendering keys updated to use token.ref.
Mocks & Jest config
__mocks__/papi-backend.ts, __mocks__/papi-frontend.ts, __mocks__/papi-frontend-react.ts, __mocks__/lucide-react.tsx, __mocks__/platform-bible-*.tsx, jest.config.ts
Expanded backend mock to expose storage.readUserData/writeUserData/deleteUserData and notifications.send (plus __mock* handles), added frontend minimal papi + useData hook mock, lucide-react icon mock, and restoreMocks:true + moduleNameMapper entry.
Modal & coordinator tests
src/__tests__/components/*Modal.test.tsx, src/__tests__/components/ProjectModals.test.tsx, src/__tests__/components/InterlinearizerLoader.test.tsx
Extensive RTL suites validating rendering, input parsing, command dispatch, success/failure paths, notifications, anti-double-submit, activeProject persistence, and modal navigation.
Storage tests
src/__tests__/services/projectStorage.test.ts
Comprehensive unit tests for create/get/list/update/delete, index maintenance, rollback semantics, concurrency serialization, and error propagation.
Localization, menus, styling, docs
contributions/localizedStrings.json, contributions/menus.json, src/tailwind.css, AGENTS.md
Adds interlinearizer UI strings and menu topMenu entries for project actions, Tailwind modal utilities, and updated architecture/testing documentation.

Sequence Diagram (high-level)

sequenceDiagram
  participant WebView as WebView UI
  participant Loader as InterlinearizerLoader
  participant Host as Extension Host (main.ts)
  participant Storage as projectStorage
  participant Backend as `@papi/backend`
  WebView->>Loader: open/select/create project
  Loader->>Host: sendCommand('interlinearizer.getProjectsForSource', sourceId)
  Host->>Storage: getProjectsForSource(token, sourceId)
  Storage->>Backend: storage.readUserData(key)
  Backend-->>Storage: project JSON / ENOENT
  Storage-->>Host: projects JSON
  Host-->>Loader: JSON string result
  Loader->>WebView: render list
  WebView->>Loader: createProject -> sendCommand('interlinearizer.createProject', args)
  Loader->>Host: sendCommand('interlinearizer.createProject', args)
  Host->>Storage: createProject(token, ...)
  Storage->>Backend: storage.writeUserData(projectKey, JSON)
  Storage->>Backend: storage.readUserData(indexKey) & storage.writeUserData(indexKey)
  Backend-->>Storage: success / error
  Storage-->>Host: created project
  Host-->>Loader: JSON string (or undefined)
  Loader->>WebView: update UI, persist activeProject via useWebViewState
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

🟥High

Suggested reviewers

  • imnasnainaec
  • jasonleenaylor

Poem

"🐰 I hopped through files and seeded queues today,
saved projects safe so none would run astray,
mocks snug as carrots, tests snug in a row,
refs now steady where old ids used to go,
rejoice — the modals open, ready to play."

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch create-interlinearizer-project

@alex-rawlings-yyc alex-rawlings-yyc linked an issue Apr 29, 2026 that may be closed by this pull request
@alex-rawlings-yyc alex-rawlings-yyc self-assigned this Apr 29, 2026
@alex-rawlings-yyc alex-rawlings-yyc force-pushed the create-interlinearizer-project branch from e2e2f8a to 3da254f Compare April 30, 2026 18:03
@alex-rawlings-yyc alex-rawlings-yyc marked this pull request as ready for review May 5, 2026 18:25
coderabbitai[bot]

This comment was marked as resolved.

alex-rawlings-yyc

This comment was marked as outdated.

alex-rawlings-yyc

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as resolved.

alex-rawlings-yyc

This comment was marked as outdated.

@alex-rawlings-yyc

This comment was marked as resolved.

@coderabbitai

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as resolved.

alex-rawlings-yyc

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as resolved.

alex-rawlings-yyc

This comment was marked as outdated.

alex-rawlings-yyc

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as resolved.

imnasnainaec

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

alex-rawlings-yyc

This comment was marked as resolved.

alex-rawlings-yyc

This comment was marked as outdated.

@alex-rawlings-yyc

This comment was marked as resolved.

@coderabbitai

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as resolved.

alex-rawlings-yyc

This comment was marked as outdated.

alex-rawlings-yyc

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as resolved.

Comment thread src/types/interlinearizer.d.ts Outdated
alex-rawlings-yyc

This comment was marked as outdated.

alex-rawlings-yyc and others added 29 commits May 19, 2026 16:51
Co-authored-by: alex-rawlings-yyc <alex.rawlings@wycliffe.ca>
…ations on error, disable metadata modal buttons when submitting
- Add ProjectModals component to own modal state (select/create/metadata) and their transitions, removing this responsibility from InterlinearizerLoader
- Add ProjectModals.test.tsx with full coverage of modal visibility and transition flows
- Strengthen isPlatformError mock to require platformErrorVersion to be a valid number, not just present
- Handle SyntaxError in CreateProjectModal.handleSubmit with a user-visible notification instead of silently failing
- Add test for invalid JSON response in CreateProjectModal
- Add test for non-string description field in SelectInterlinearProjectModal
- Mark isSubmittingRef guard branches with v8 ignore in modals
…Select`, add function to reset storage queues for testing
* Simplify interlinear model: remove InterlinearAlignment/InterlinearText, add ActiveProject

* Fix model gaps for lossless LCM / PT9 / BT Extension import

* Make `analysisLanguages` required

* Add comments about mapping of BT Extension's `sideNum`

* Update docs/schema

* Further refinement; please see updated description

* Suggested model tweak

* Model idea: Split linking out from analyses

---------

Co-authored-by: D. Ror. <imnasnainaec@gmail.com>
Update components, storage, main, and types to match the model introduced in #63: rename commands, fix return types, update JSDoc, and adjust tests throughout.
…e relevant to prevent silent deletion, docstring audit
@alex-rawlings-yyc alex-rawlings-yyc force-pushed the create-interlinearizer-project branch from 16a7848 to 054405e Compare May 19, 2026 22:59
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.

Create new interlinearizer project

2 participants