Skip to content

Mark a respelled copy's morpheme breakdown stale (#381) - #393

Open
alex-rawlings-yyc wants to merge 3 commits into
mainfrom
feat/381-stale-breakdown
Open

alex-rawlings-yyc wants to merge 3 commits into
mainfrom
feat/381-stale-breakdown

Conversation

@alex-rawlings-yyc

@alex-rawlings-yyc alex-rawlings-yyc commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Closes #381. Part of #349.

Applying a stale analysis to a word spelled differently copied a breakdown of several morphemes with its forms unchanged, so reciev-ed showed under "received" as if it fit. The copy's breakdown is now marked stale and keeps its morpheme glosses and lexicon links. It shows in stale styling in the word's box, the catalog, the merge panel and suggestion rows, and screen-reader labels say it was split from a different spelling.

The mark belongs to the analysis rather than each occurrence, since the forms are wrong wherever it is used, and it is not part of analysis identity. Done on the unchanged forms keeps the breakdown and clears the mark for every word using it; while the forms are unchanged, the editor says what Done will do. Re-splitting or removing the breakdown also clears it, in the view or the catalog. A re-split in the view forks a shared analysis as before, so the other words keep the mark. Suggestions still offer a stale-marked analysis, and accepting one links it as it stands.

When an edit makes two analyses identical, the survivor stays stale only if both were. A merge's breakdown is stale when it is taken unedited from a stale analysis.

Checked in the running app.


This change is Reviewable

Summary by CodeRabbit

  • New Features
    • Breakdown labels now identify morpheme splits based on a different spelling in the analysis catalog, editor, and suggestions.
    • Stale breakdowns are visually highlighted, with a hint explaining that choosing Done keeps the existing breakdown.
  • Bug Fixes
    • Confirming an unchanged breakdown clears its stale status while retaining its forms; editing or deleting a breakdown also clears the status.
    • Merging analyses now preserves stale status when the breakdown remains unchanged.

@alex-rawlings-yyc alex-rawlings-yyc self-assigned this Oct 2, 2026
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: e742b7c4-a6d7-4ec4-a2c9-7db6452425ff

📥 Commits

Reviewing files that changed from the base of the PR and between bbfdd21 and f1e5e9a.

📒 Files selected for processing (30)
  • contributions/localizedStrings.json
  • src/__tests__/components/AnalysisCatalogPanel.test.tsx
  • src/__tests__/components/AnalysisStore.test.tsx
  • src/__tests__/components/CatalogMergeModal.test.tsx
  • src/__tests__/components/MorphemeBox.test.tsx
  • src/__tests__/components/MorphemeEditor.test.tsx
  • src/__tests__/components/TokenChip.suggestions.test.tsx
  • src/__tests__/components/TokenChip.test.tsx
  • src/__tests__/store/analysisSlice.test.ts
  • src/__tests__/utils/analysis-query.test.ts
  • src/__tests__/utils/merge-content.test.ts
  • src/__tests__/utils/suggestion-engine.test.ts
  • src/components/AnalysisCatalogPanel.tsx
  • src/components/AnalysisStore.tsx
  • src/components/CatalogMergeModal.tsx
  • src/components/CatalogRowEditor.tsx
  • src/components/CatalogRowView.tsx
  • src/components/MorphemeBox.tsx
  • src/components/MorphemeEditor.tsx
  • src/components/PhraseStripContext.tsx
  • src/components/SuggestionDropdown.tsx
  • src/components/TokenChip.tsx
  • src/components/__mocks__/AnalysisStore.tsx
  • src/hooks/usePhraseStripSetup.ts
  • src/store/analysisSlice.ts
  • src/types/interlinearizer.d.ts
  • src/utils/analysis-identity.ts
  • src/utils/analysis-query.ts
  • src/utils/merge-content.ts
  • src/utils/suggestion-engine.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change marks copied multi-morpheme breakdowns stale when analyses are reapplied to respelled text. Stale state flows through catalog rows, merges, and suggestions. Editors style stale breakdowns and allow unchanged forms to be confirmed. Re-splitting or deleting a breakdown also clears its stale mark.

Changes

Stale Morpheme Breakdown Handling

Layer / File(s) Summary
Stale state lifecycle
src/types/interlinearizer.d.ts, src/store/analysisSlice.ts, src/utils/analysis-identity.ts, src/__tests__/store/analysisSlice.test.ts
The analysis model and store track stale breakdowns. Reapplying a multi-morpheme analysis marks the copied breakdown stale. Confirmation, edits, and deletion clear the mark.
Catalog and merge propagation
src/utils/analysis-query.ts, src/utils/merge-content.ts, src/components/AnalysisCatalogPanel.tsx, src/__tests__/utils/*, src/__tests__/components/AnalysisCatalogPanel.test.tsx
Catalog rows carry the stale mark. Merge content preserves it for an unchanged stale donor breakdown, and the merge action forwards it.
Stale styling and confirmation
src/components/MorphemeBox.tsx, src/components/MorphemeEditor.tsx, src/components/CatalogRowEditor.tsx, src/components/CatalogRowView.tsx, src/components/CatalogMergeModal.tsx, src/components/AnalysisStore.tsx, src/components/TokenChip.tsx, src/components/PhraseStripContext.tsx, src/hooks/usePhraseStripSetup.ts, contributions/localizedStrings.json, src/components/__mocks__/AnalysisStore.tsx, src/__tests__/components/*
Catalog and token editors style stale breakdowns and show localized hints. An unchanged breakdown can be confirmed; edits save through the existing edit path.
Stale suggestion breakdowns
src/utils/suggestion-engine.ts, src/components/SuggestionDropdown.tsx, src/components/TokenChip.tsx, contributions/localizedStrings.json, src/__tests__/utils/suggestion-engine.test.ts, src/__tests__/components/TokenChip.suggestions.test.tsx
Suggestion entries carry stale state. Suggestion rows style stale breakdowns and use a stale-specific accessible label.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  actor Reader
  participant AnalysisStore
  participant AnalysisSlice
  participant TokenChip
  participant MorphemeEditor
  Reader->>AnalysisStore: Reapply stale analysis
  AnalysisStore->>AnalysisSlice: Apply reapplication
  AnalysisSlice-->>TokenChip: Stale approved analysis ID
  TokenChip->>MorphemeEditor: Provide confirmation callback
  Reader->>MorphemeEditor: Choose Done without editing
  MorphemeEditor->>AnalysisStore: Confirm analysis morphemes
  AnalysisStore->>AnalysisSlice: Dispatch confirmation and save analysis
  AnalysisSlice-->>TokenChip: Clear stale mark
Loading

Suggested reviewers: imnasnainaec

Merge Risk: ⚪ Minimal · up to f1e5e

The stale-breakdown change appears ready to merge after normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #381 is addressed. TokenAnalysis.morphemesStale stores review state outside analysis identity. Reapplication marks copied multi-morpheme breakdowns stale and preserves morpheme data. Confirmat…
Out of Scope Changes check ✅ Passed The changed production files support issue #381. They implement stale-state storage, propagation, merge handling, accessible labels, and stale styling. The added localization and automated tests suppo…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 26 functions across 29 files. (1 skipped: …
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: marking a morpheme breakdown stale when it belongs to a respelled copy.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@alex-rawlings-yyc

Copy link
Copy Markdown
Contributor Author
1-strip-stale-breakdown 2-editor-stale-hint 3-suggestion-stale-breakdown 4-catalog-row-stale-breakdown 5-catalog-editor-stale-hint 6-merge-stale-breakdown

@alex-rawlings-yyc
alex-rawlings-yyc marked this pull request as ready for review October 2, 2026 19:11
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.

Mark a respelled copy's morpheme breakdown stale

1 participant