Skip to content

feat(model): store concept translator registrations - #1002

Open
marcpaterno wants to merge 4 commits into
stack/concept-registry/03-concept-registryfrom
stack/concept-registry/04-conversion-records
Open

marcpaterno wants to merge 4 commits into
stack/concept-registry/03-concept-registryfrom
stack/concept-registry/04-conversion-records

Conversation

@marcpaterno

@marcpaterno marcpaterno commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Summary

PR 4 of the five-PR concept-registry stack; review against
stack/concept-registry/03-concept-registry.

Extend the experimental concept model with conversion registration records
between its concrete data-product types.

concept.translators[(source_type, target_type)]
  translator name
  type-erased callable (std::any)
  result storage: owned | borrowed

register -> require distinct types, both in the concept, and unused ordered pair
find     -> return registration or nullptr
A -> B and B -> A are separate registrations
  • Add result_storage, translator_registration, add_translator, and
    find_translator.
  • Reject same-type, nonmember-type, and duplicate ordered-pair registrations.
  • Preserve the owned/borrowed declaration: a borrowed result refers to input
    storage, so its caller must keep the source alive.
  • Keep concept equality based on name and concrete types; callable records do
    not participate. Duplicate-name registry insertion still merges concrete
    types only, not conversion records.

This is record storage and retrieval, not automatic translation. Callable types
are not checked against the declared pair, and storage lifetime declarations are
not enforced. No graph execution, discovery, or input-metadata change is included.

Evidence

  • Before: Concepts record membership but no conversion functions.
    After: data_product_concept passes 36 assertions in 15 cases, covering
    retrieval/invocation, storage declarations, ordered and reverse pairs, and
    rejection of invalid or duplicate registrations.
  • The callable round-trip test explicitly documents that its callable direction
    differs from the declared pair: it demonstrates retrieval/invocation, not
    signature validation.
  • Full configured build and all 119 boundary CTests passed.
  • All three changed files passed existing hooks and whitespace checks.

Local macOS/AppleClang evidence, not CI or sanitizer approval. The before/after
describes the API delta; it is not a claim of a failing parent suite.

Merge Danger

Door: Two-way

Additive in-memory registration APIs; no persisted-format change or automatic
execution path. Later callers must be removed or adapted if this is reverted.

Blast Radius: Model

Incorrect callable types can survive registration and fail when retrieved or
used. Declaring a result borrowed does not retain its source; using it after
source release can dangle. Graph translators do not consume these records.


Stack created with GitHub Stacks CLI • Give Feedback 💬

  • Code: Added result_storage and translator_registration to store translator names, type-erased callables, and owned-or-borrowed result declarations.
  • Code: Added add_translator and find_translator. Registration rejects identical types, types outside the concept, and duplicate ordered pairs. Reverse-direction pairs are separate registrations.
  • Code: Concept equality compares only the name and concrete types. Translator callables are stored, not invoked automatically; their signatures and borrowed-result lifetimes are not checked or enforced.
  • Tests: Added coverage for lookup, callable retrieval, storage declarations, ordered pairs, and invalid or duplicate registrations.
  • Validation: The supplied report says 36 assertions across 15 cases passed, along with 119 boundary CTests and existing hooks and whitespace checks on local macOS/AppleClang. CI and sanitizer results were not supplied.
  • Review: Current review severity counts are unavailable.

@marcpaterno
marcpaterno added this pull request to stack #1004 October 21, 2026 17:45
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 85feb6ee-2b3c-4212-ab96-073b7f2f79b1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The change adds translator registration and lookup to data_product_concept. Registrations use ordered concrete-type pairs and record a name, callable, and result-storage mode. Registration validates the types and rejects duplicate pairs. Tests cover lookup, storage modes, and error cases.

Changes: Translator Registration

Layer / File(s) Summary
Translator registration contract
phlex/model/data_product_concept.hpp
Adds result_storage and translator_registration, plus APIs to register and find translators. The concept stores registrations by ordered type pair. Equality compares the concept name and concrete types, excluding translators.
Registration and lookup implementation
phlex/model/data_product_concept.cpp
Registration rejects identical types, types outside the concept, and duplicate pairs. Lookup returns the registration or nullptr.
Translator registration tests
test/data_product_concept_test.cpp
Adds translator fixtures and tests for lookup, callable and storage metadata, ordered pairs, invalid registrations, and duplicate registration. Updates existing concrete-type tests to use the new fixtures.

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

Change: Feature

Possibly related PRs

Suggested reviewers: knoepfel

Merge Risk: Minimal · previous review 7c02e

No merge-blocking issue was established; the change is ready for normal merge checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% 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. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed 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 "feat(model): store concept translator registrations" matches the main change. The changeset adds translator registration records to data_product_concept, keyed by ordered concrete type pair…
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: Title check

Explanation

The title "feat(model): store concept translator registrations" matches the main change. The changeset adds translator registration records to data_product_concept, keyed by ordered concrete type pairs, with validation and lookup via find_translator. The title is short, specific, and in conventional commit style. It names the scope (model) and the primary change (storing translator registrations), so a teammate scanning history would understand the main point.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% 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 3 functions across 3 files.

Resolution

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

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

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
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 5a0e5b1b-a13f-4a17-9513-108469ee9383
Commits

Reviewing files that changed from the base of the PR and between f613d3e and 7c02e20.

Files selected for processing: 3
  • phlex/model/data_product_concept.cpp
  • phlex/model/data_product_concept.hpp
  • test/data_product_concept_test.cpp

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

Recent review details
Context from checks skipped due to timeout: 14
  • GitHub Check: clang-format-check
  • GitHub Check: build (gcc, none, arm64, ubuntu-24.04-arm)
  • GitHub Check: build (gcc, none, amd64, ubuntu-24.04)
  • GitHub Check: Analyze cpp with CodeQL
  • GitHub Check: build (gcc, none, arm64, ubuntu-24.04-arm)
  • GitHub Check: build (gcc, none, amd64, ubuntu-24.04)
  • GitHub Check: Analyze cpp with CodeQL
  • GitHub Check: coverage (arm64)
  • GitHub Check: coverage (amd64)
  • GitHub Check: CodeRabbit
  • GitHub Check: coverage (arm64)
  • GitHub Check: coverage (amd64)
  • GitHub Check: clang-tidy-check
  • GitHub Check: setup
Additional context used
Code guidelines: 1
AGENTS.md — auto-discovered
Path-based instructions: 1
Source excerpt: **Authoritative sources**: `.clang-format` and `.clang-tidy` are the ground truth for formatting and naming.

CodeRabbit inference engine (AGENTS.md)

Files:

  • phlex/model/data_product_concept.cpp
  • test/data_product_concept_test.cpp
  • phlex/model/data_product_concept.hpp

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@                              Coverage Diff                               @@
##           stack/concept-registry/03-concept-registry    #1002      +/-   ##
==============================================================================
+ Coverage                                       90.42%   90.54%   +0.12%     
==============================================================================
  Files                                             181      181              
  Lines                                            5877     5910      +33     
  Branches                                          926      932       +6     
==============================================================================
+ Hits                                             5314     5351      +37     
+ Misses                                            363      361       -2     
+ Partials                                          200      198       -2     
Flag Coverage Δ
amd64 90.54% <100.00%> (+0.12%) ⬆️
arm64 90.54% <100.00%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
phlex/model/data_product_concept.cpp 100.00% <100.00%> (ø)
phlex/model/data_product_concept.hpp 100.00% <ø> (ø)

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 39f0de2...cb2f7aa. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@marcpaterno
marcpaterno force-pushed the stack/concept-registry/04-conversion-records branch from 2f108b1 to 67942f7 Compare October 22, 2026 15:46
@marcpaterno
marcpaterno force-pushed the stack/concept-registry/04-conversion-records branch 3 times, most recently from 71e72a8 to c25209d Compare October 28, 2026 16:26
@marcpaterno
marcpaterno force-pushed the stack/concept-registry/04-conversion-records branch 2 times, most recently from f8c0211 to 7c02e20 Compare November 2, 2026 21:48
@marcpaterno
marcpaterno force-pushed the stack/concept-registry/04-conversion-records branch from 7c02e20 to 26a1b83 Compare November 2, 2026 21:59
@knoepfel
knoepfel force-pushed the stack/concept-registry/04-conversion-records branch from 26a1b83 to 58c272d Compare November 3, 2026 16:06
@marcpaterno
marcpaterno force-pushed the stack/concept-registry/04-conversion-records branch from 58c272d to 6e1c96f Compare November 3, 2026 16:17
@marcpaterno
marcpaterno force-pushed the stack/concept-registry/04-conversion-records branch 3 times, most recently from 2029a72 to 7e9140e Compare November 4, 2026 15:17
Add result storage metadata and type-erased conversion functions to data
product concepts, with validation for concrete types, identical types, and
duplicate ordered pairs.

Add tests covering registration lookup, conversion round-tripping, storage
semantics, and validation failures.
- Add missing <any> and <cstdint> includes
- Set std::uint8_t as the underlying type of result_storage
- Use designated initializers for translator_registration
- Separate the registry source's own header include group
Replace the concept factory helper with add_both_types, which populates a
caller-owned concept because data_product_concept is neither movable nor
assignable. Use the soa_vertices and aos_vertices types in the
add_concrete_types self-insertion test, and make the translator input const.
- Split the unknown-type case into sections for an empty registry and a
  registry whose concepts all lack the queried type.
- Add a non-matching distractor concept to the multi-concept lookup test so
  an implementation that returns an arbitrary concept fails. Require a
  non-null result and check that it contains the queried type and is not
  the distractor.
@marcpaterno
marcpaterno force-pushed the stack/concept-registry/04-conversion-records branch from 7e9140e to cb2f7aa Compare November 4, 2026 16:18
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