Skip to content

Extract NoteMetadataModule out of PageHashingModule - #835

Merged
allenporter merged 2 commits into
mainfrom
feat/note-metadata-processor-module
Nov 26, 2026
Merged

allenporter merged 2 commits into
mainfrom
feat/note-metadata-processor-module

Conversation

@allenporter

Copy link
Copy Markdown
Owner

Implements Step 3 of ADR 0004 (preparing for #501).

Summary

  • New NoteMetadataModule (TaskType.NOTE_METADATA, TaskScope.FILE) in supernote/server/components/note_metadata/processor.py:
    • Contributes to ProcessorService via note_metadata's processor platform (depends_on = (TaskType.PAGE_HASHING,), supports_standalone_images = False).
    • Performs incremental page ink detection (has_ink, has_drawables), persists NoteMetadataDO, NotePageMetadataDO, and NoteTitleDO (in reading order with stale title crop cleanup), and emits legacy <PAGEID>-less page diff metrics.
    • Implements cleanup_file() scoped by (user_id, file_id) to remove metadata rows and {file_id}/titles/* cache blobs on file purge.
  • Slimmed PageHashingModule in supernote/server/components/processor/page_hashing.py:
    • Focused strictly on page-level change detection (parse_metadata only, NotePageContentDO sync, checkpoint invalidation, NotePagesDeltaEvent, and orphan page PNG cleanup).
  • Updated transcript dependency graph:
    • TranscriptComponent.dependencies now includes "note_metadata", and OcrModule.depends_on = (TaskType.PNG_CONVERSION, TaskType.NOTE_METADATA) so NotePageMetadataDO and NoteTitleDO are guaranteed to be populated before OCR runs (while standalone images skip NOTE_METADATA cleanly).
  • System Panel UI & Docs:
    • Added NOTE_METADATA (Note Metadata) to TASK_TYPE_LABELS and STAGE_ORDER in supernote/server/static/js/components/SystemPanel.js.
    • Updated docs/architecture/components.md and processor/model docstrings.

Verification

  • ./script/lint (ruff, ty, tsc, biome, codespell, yamllint) passes.
  • uv run --no-sync pytest -q -n 8 passes, including dedicated unit tests in tests/server/components/note_metadata/test_processor.py and processor backfill/isolation tests in tests/server/components/processor/test_service.py.

@github-actions github-actions Bot added documentation Improvements or additions to documentation and guides enhancement User-facing feature or API capability web-ui Frontend SPA and Web UI components ai OCR, summarization, embeddings, prompts, vocabulary, and AI backends labels Nov 26, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.26168% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.54%. Comparing base (b18c09a) to head (14281f6).

Files with missing lines Patch % Lines
...rnote/server/components/note_metadata/processor.py 96.07% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #835      +/-   ##
==========================================
- Coverage   95.56%   95.54%   -0.02%     
==========================================
  Files         255      256       +1     
  Lines       27810    27907      +97     
==========================================
+ Hits        26577    26665      +88     
- Misses       1233     1242       +9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@allenporter
allenporter merged commit dc616e3 into main Nov 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai OCR, summarization, embeddings, prompts, vocabulary, and AI backends documentation Improvements or additions to documentation and guides enhancement User-facing feature or API capability web-ui Frontend SPA and Web UI components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants