Skip to content

Fall back to parent neume's facs when a neume component has none - #1010

Open
CThierrin wants to merge 2 commits into
mainfrom
fix/liber-usualis-neume-component-facs-fallback
Open

CThierrin wants to merge 2 commits into
mainfrom
fix/liber-usualis-neume-component-facs-fallback

Conversation

@CThierrin

@CThierrin CThierrin commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

The Liber Usualis corpus encodes @FACS on the enclosing element (one bounding box per neume figure) rather than on each individual . _get_element_zone only ever checked the itself, so every neume component in that corpus silently fell back to the (-1,-1,-1,-1) "not found" sentinel. Search results consume those coordinates directly for both the result thumbnail image and Diva's click-to-focus, so both were broken for every result on this manuscript.

Verified the fix resolves all 338,745 neume components across the full 2318-file Liber Usualis corpus (previously all -1,-1,-1,-1), with zero parse errors and no change to manuscripts that already encode facs per-component (existing fixture/tests unaffected).

Summary by CodeRabbit

  • Bug Fixes

    • Improved chant notation rendering when neume components inherit positioning from their enclosing neume.
    • Prevented missing-coordinate placeholders when component-level positioning data is unavailable.
    • Preserved individual component positioning wherever it is provided.
  • Tests

    • Added coverage for manuscripts using neume-level positioning data.

The Liber Usualis corpus encodes @FACS on the enclosing <neume>
element (one bounding box per neume figure) rather than on each
individual <nc> -- valid MEI5, just a different convention from
encodings that give every note its own zone. _get_element_zone only
ever checked the <nc> itself, so every neume component in that corpus
silently fell back to the (-1,-1,-1,-1) "not found" sentinel. Search
results consume those coordinates directly for both the result
thumbnail image and Diva's click-to-focus, so both were broken for
every result on this manuscript.

Verified the fix resolves all 338,745 neume components across the
full 2318-file Liber Usualis corpus (previously all -1,-1,-1,-1), with
zero parse errors and no change to manuscripts that already encode
facs per-component (existing fixture/tests unaffected).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e19513ef-349b-44cc-ad60-73568ad60dc5

📥 Commits

Reviewing files that changed from the base of the PR and between b648886 and 618fc58.

📒 Files selected for processing (2)
  • app/public/cantusdata/test/core/helpers/mei_processing/test_mei_files/991961/LU-1961_0123.mei
  • app/public/cantusdata/test/core/helpers/mei_processing/test_mei_parser.py

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


📝 Walkthrough

Walkthrough

The MEI parser now inherits a parent neume’s zone when a component lacks its own facs reference. A new MEI fixture and regression test verify the resulting component bounding boxes.

Changes

Neume zone resolution

Layer / File(s) Summary
Parser bounding-box resolution
app/public/cantusdata/helpers/mei_processing/mei_parser.py
The parser checks a component zone first, then the enclosing neume zone. It retains the empty bounding box when neither zone provides coordinates.
MEI fixture and regression coverage
app/public/cantusdata/test/core/helpers/mei_processing/test_mei_files/991961/LU-1961_0123.mei, app/public/cantusdata/test/core/helpers/mei_processing/test_mei_parser.py
The fixture adds facsimile zones and six systems of neume notation. The regression test verifies inherited component coordinates and rejects the (-1, -1, -1, -1) sentinel.

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

Merge Risk: ⚪ Minimal · up to 618fc

This change restores existing manuscript coordinates for neume components that inherit their enclosing neume’s bounding box, while preserving component-level coordinates. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. (1 skipped: 1… 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 and concisely describes the main change: using the parent neume's facs when a component has no facs reference.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/liber-usualis-neume-component-facs-fallback

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.

@CThierrin

Copy link
Copy Markdown
Contributor Author

Resolves Issues #1006 and #1009

@etosphere
etosphere self-requested a review August 27, 2026 21:31

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.

Based on the naming convention in #987, the filename should be LU-1961_0123.mei‎.

"mei_processing",
"test_mei_files",
"991961",
"0123_corr - mei5.mei",

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.

Also change the filename to LU-1961_0123.mei here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks

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.

2 participants