Skip to content

Sync metadata with the draft spec - #14

Merged
pjones merged 7 commits into
trunkfrom
pjones/meta-updates
Aug 6, 2026
Merged

pjones merged 7 commits into
trunkfrom
pjones/meta-updates

Conversation

@pjones

@pjones pjones commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Update the test files and code to match the current draft spec.

Summary by CodeRabbit

  • New Features
    • Added centralized archive file management with file listing, lookup, and Parquet access.
    • Added column mappings, including names, paths, accessions, and units.
    • Added root-aware schema groups and complete field path reporting.
    • Improved spectrum and spectra loading through shared archive management.
  • Bug Fixes
    • Improved errors for missing metadata, invalid queries, and unavailable nested fields.
    • Corrected handling of root-level fields and array index capacity.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change introduces Util::Manager for archive file lookup and Parquet access. It makes schema files and groups file-aware, adds root-group handling, and updates spectrum metadata loading, field execution, diagnostics, and tests.

Changes

Metadata manager and schema refactor

Layer / File(s) Summary
File-aware schema construction
include/mzpeak/schema/*, src/schema/*, src/util/parquet.cpp, test/files/small.dir/mzpeak_index.json, test/group_test.cpp
Schema::File now stores column mappings and exposes accessors. Schema::Group builds root-aware fields from file metadata. Parquet schema parsing registers non-empty root groups and skips list groups.
Archive manager and index integration
include/mzpeak/index.h, include/mzpeak/util/manager.h, src/util/manager.cpp, src/index.cpp, bin/mzp-inspect.cpp, meson.build, test/index_test.cpp
Util::Manager loads mzpeak_index.json, finds files, and opens Parquet readers. Index delegates file operations to the manager. Inspection code uses the new lookup and accessor APIs.
Manager-backed spectrum loading
include/mzpeak/spectra.h, include/mzpeak/spectrum.h, include/mzpeak/metadata/spectrum.h, src/spectra.cpp, src/spectrum.cpp, src/metadata/spectrum.cpp, src/metadata/table.cpp
Spectra and Spectrum use the shared manager. Spectrum metadata loads from spectra_metadata.parquet, caches MS level, and constructs metadata tables from owned Parquet readers.
Root-field execution and validation
src/util/executor.cpp, src/util/query.cpp, src/data/*, test/array_index_test.cpp, test/executor_test.cpp, test/parquet_test.cpp, test/planner_test.cpp, test/spectra_test.cpp
Root fields use absolute indexes, nested-field errors use full paths, and tests use manager-backed Parquet access with updated root schema names and metadata assertions.

Sequence Diagram(s)

sequenceDiagram
  participant Index
  participant UtilManager
  participant Archive
  participant Parquet
  Index->>UtilManager: find_file(name)
  UtilManager->>Archive: access indexed file
  UtilManager->>Parquet: open file
  Parquet-->>Index: return reader
Loading

Possibly related PRs

  • OpenMS/mzpeak#7: Both changes update index, schema groups, Parquet access, and metadata handling.
  • OpenMS/mzpeak#11: Both changes modify the Spectrum construction and decoding pipeline.
  • OpenMS/mzpeak#12: Both changes modify Schema::Group field handling and data-type APIs.

Poem

A rabbit hops through files in rows,
Finds Parquet where the index shows.
Root fields bloom with paths made clear,
MS levels rest beside the ear.
Manager keeps the paths in tune.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the pull request's primary objective of aligning metadata handling and tests with the current draft specification.
Docstring Coverage ✅ Passed Docstring coverage is 87.30% which is sufficient. The required threshold is 80.00%.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pjones/meta-updates

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
include/mzpeak/index.h (1)

11-12: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Include each standard-library declaration used by a public header.

The C++ standard does not guarantee the current transitive includes. Add direct includes so consumers can include each public header first.

  • include/mzpeak/index.h#L11-L12: add #include <string_view> for Index::find.
  • include/mzpeak/util/manager.h#L11-L15: add #include <string_view> and #include <vector> for the public manager declarations.
Proposed fix
--- a/include/mzpeak/index.h
+++ b/include/mzpeak/index.h
 `#include` <memory>
+#include <string_view>
 `#include` <vector>

--- a/include/mzpeak/util/manager.h
+++ b/include/mzpeak/util/manager.h
 `#include` <memory>
+#include <string_view>
+#include <vector>

Verify this with a compile-only public-header self-containment target on each supported compiler.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@include/mzpeak/index.h` around lines 11 - 12, Make the public headers
self-contained by adding <string_view> to include/mzpeak/index.h for
Index::find, and adding <string_view> plus <vector> to
include/mzpeak/util/manager.h for its public declarations. Verify both headers
with a compile-only self-containment target on every supported compiler.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/metadata/table.cpp`:
- Around line 59-60: Update the exception message in the schema validation path
to include a space between the group name and “group,” so missing “root” reports
“root group” instead of “rootgroup.”

In `@src/schema/group.cpp`:
- Around line 154-192: Update the nested-list handling around the link lambda
and field_type_from_parquet so list leaf fields such as
scan_windows.scan_window_lower_limit and scan_windows.scan_window_upper_limit
are represented or have their CV metadata populated during parsing. Ensure each
nested leaf is matched against file.columns() using its full path, and add
coverage resolving both CV accessions.
- Around line 137-146: Update Parquet::Impl::parse_schema to advance the offset
by every preceding leaf column, including root-level primitive fields, before
constructing each nested Group via Group::Group and make_fields. Ensure nested
fields receive non-colliding absolute indexes, and add coverage for a schema
mixing a top-level primitive column before a nested struct.

In `@src/util/parquet.cpp`:
- Around line 69-77: Update the error-message construction in the open-failure
and reader-build-failure paths to use file_.file_name() instead of the
moved-from file.file_name(). Preserve the existing message format and
ParquetError behavior.

---

Nitpick comments:
In `@include/mzpeak/index.h`:
- Around line 11-12: Make the public headers self-contained by adding
<string_view> to include/mzpeak/index.h for Index::find, and adding
<string_view> plus <vector> to include/mzpeak/util/manager.h for its public
declarations. Verify both headers with a compile-only self-containment target on
every supported compiler.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 136f2e11-70a1-455b-8682-73fd365f6537

📥 Commits

Reviewing files that changed from the base of the PR and between 36452ba and 037f75a.

⛔ Files ignored due to path filters (9)
  • test/files/small.dir/chromatograms_data.parquet is excluded by !**/*.parquet
  • test/files/small.dir/chromatograms_metadata.parquet is excluded by !**/*.parquet
  • test/files/small.dir/chromatograms_metadata_precursors.parquet is excluded by !**/*.parquet
  • test/files/small.dir/chromatograms_metadata_selected_ions.parquet is excluded by !**/*.parquet
  • test/files/small.dir/spectra_data.parquet is excluded by !**/*.parquet
  • test/files/small.dir/spectra_metadata.parquet is excluded by !**/*.parquet
  • test/files/small.dir/spectra_metadata_precursors.parquet is excluded by !**/*.parquet
  • test/files/small.dir/spectra_metadata_scans.parquet is excluded by !**/*.parquet
  • test/files/small.dir/spectra_metadata_selected_ions.parquet is excluded by !**/*.parquet
📒 Files selected for processing (35)
  • bin/mzp-inspect.cpp
  • include/mzpeak/index.h
  • include/mzpeak/metadata/spectrum.h
  • include/mzpeak/schema/file.h
  • include/mzpeak/schema/group.h
  • include/mzpeak/spectra.h
  • include/mzpeak/spectrum.h
  • include/mzpeak/util/manager.h
  • meson.build
  • src/data/array_index.cpp
  • src/data/signals.cpp
  • src/index.cpp
  • src/metadata/spectrum.cpp
  • src/metadata/table.cpp
  • src/schema/file.cpp
  • src/schema/group.cpp
  • src/spectra.cpp
  • src/spectrum.cpp
  • src/util/executor.cpp
  • src/util/manager.cpp
  • src/util/parquet.cpp
  • src/util/query.cpp
  • test/array_index_test.cpp
  • test/executor_test.cpp
  • test/files/Example_Processed.img.mzpeak
  • test/files/has_uv.mzpeak
  • test/files/small.chunked.mzpeak
  • test/files/small.dir/mzpeak_index.json
  • test/files/small.mzpeak
  • test/files/small.numpress.mzpeak
  • test/group_test.cpp
  • test/index_test.cpp
  • test/parquet_test.cpp
  • test/planner_test.cpp
  • test/spectra_test.cpp

Comment thread src/metadata/table.cpp Outdated
Comment thread src/schema/group.cpp
Comment thread src/schema/group.cpp
Comment thread src/util/parquet.cpp Outdated
pjones added 4 commits August 6, 2026 11:31
Since we need to load metadata Parquet files on demand we need a way
to pass around an object that knows how to do that.  I thought about
doing it with the top-level `Index` class but that would create some
circular dependencies and be a bit messy.
Also refactor the Schema::File struct to be a class.
The entry was removed but I never updated the allocation line.
@pjones
pjones force-pushed the pjones/meta-updates branch from 037f75a to 6195f0a Compare August 6, 2026 09:40
@pjones
pjones merged commit 2e37bda into trunk Aug 6, 2026
2 checks passed
@pjones
pjones deleted the pjones/meta-updates branch August 6, 2026 09:44
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.

1 participant