Skip to content

Store semantic metadata lazily - #124

Merged
GermanHeim merged 1 commit into
mainfrom
lazy-metadata
Oct 28, 2026
Merged

GermanHeim merged 1 commit into
mainfrom
lazy-metadata

Conversation

@GermanHeim

Copy link
Copy Markdown
Member

Description

This PR stores semantic metadata lazily.

Checklist

  • I have updated the documentation accordingly
  • I have added tests that cover my changes
  • I have run cargo fmt and cargo clippy to ensure code quality
  • All default tests pass (cargo test)

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ea18ec41-9626-4202-a072-4ad1f69bc5df
Commits

Reviewing files that changed from the base of the PR and between 32c5219 and 3cecf57.

Files selected for processing: 16
  • crates/oximo-core/src/display.rs
  • crates/oximo-core/src/model.rs
  • crates/oximo-core/src/model/constraints.rs
  • crates/oximo-core/src/model/dependencies.rs
  • crates/oximo-core/src/model/indexed.rs
  • crates/oximo-core/src/model/semantic.rs
  • crates/oximo-core/src/model/semantic/positions.rs
  • crates/oximo-core/src/model/semantic/storage.rs
  • crates/oximo-core/src/model/semantic/views.rs
  • crates/oximo-core/src/model/tests.rs
  • crates/oximo-core/src/model/variables.rs
  • crates/oximo-core/src/reformulation/indicator.rs
  • crates/oximo-core/src/reformulation/sos.rs
  • crates/oximo-core/src/semantic/view.rs
  • crates/oximo-core/src/shared.rs
  • crates/oximo-core/tests/function_representation.rs
Files with no reviewable changes: 1
  • crates/oximo-core/src/model/indexed.rs

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

Walkthrough

The model now initializes several registries and artifacts on first access. Semantic entries and native positions use contiguous runs and sparse overrides. Constraint registration, semantic views, objective handling, and reformulation access now account for optional storage.

Changes: Model metadata and semantic storage

Layer / File(s) Summary
Lazy cells and objective lifecycle
crates/oximo-core/src/shared.rs, crates/oximo-core/src/model.rs, crates/oximo-core/src/display.rs, crates/oximo-core/src/model/tests.rs, crates/oximo-core/tests/function_representation.rs
LazySharedCell provides optional shared storage with lazy initialization and revision tracking. Model objective state uses a scalar-kind signature and a lazy semantic-objective cache. Added tests cover cache reads, updates, and fork behavior.
Run-based semantic storage
crates/oximo-core/src/model/semantic/positions.rs, crates/oximo-core/src/model/semantic/storage.rs
Semantic entries and native positions are stored as contiguous runs with sparse overrides. Iterators support seeking and forward and reverse traversal. Provenance changes use per-constraint overrides.
Optional metadata access and registration
crates/oximo-core/src/model/constraints.rs, crates/oximo-core/src/model/dependencies.rs, crates/oximo-core/src/model/indexed.rs, crates/oximo-core/src/model/semantic.rs, crates/oximo-core/src/model/semantic/views.rs, crates/oximo-core/src/model/variables.rs, crates/oximo-core/src/reformulation/*, crates/oximo-core/src/semantic/view.rs, crates/oximo-core/src/model/tests.rs
Registration defers semantic writer creation, and access paths handle absent registries, views, and reformulation history. Added tests cover lazy metadata and view iteration.

Priority: Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Refactor

Possibly related PRs

  • oximo-rs/oximo#118: Adds parameter dependency traversal for semantic objectives, constraints, and inactive scalar views; this PR updates those access paths for optional lazy storage.
Merge Risk: Minimal · up to 3cecf

No actionable issue remains from the reviewed changes; the PR is mergeable after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 52.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the primary change: storing semantic metadata lazily.
Description check Passed The description states the main change and includes the core checklist items with reported completion. It omits the Changes Made and Related Issues sections, but the description is sufficiently comple…
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: Description check

Explanation

The description states the main change and includes the core checklist items with reported completion. It omits the Changes Made and Related Issues sections, but the description is sufficiently complete for this change.

Full details: Docstring Coverage

Explanation

Docstring coverage is 52.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 44 functions across 15 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@codecov

codecov Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.77049% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/oximo-core/src/model/semantic/storage.rs 97.90% 5 Missing ⚠️
crates/oximo-core/src/model/constraints.rs 94.73% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@GermanHeim
GermanHeim merged commit 58d15d1 into main Oct 28, 2026
17 checks passed
@GermanHeim
GermanHeim deleted the lazy-metadata branch October 28, 2026 12:40
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