Skip to content

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

Open
marcpaterno wants to merge 5 commits into
mainfrom
stack/concept-registry/04-conversion-records
Open

marcpaterno wants to merge 5 commits into
mainfrom
stack/concept-registry/04-conversion-records

Conversation

@marcpaterno

@marcpaterno marcpaterno commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Summary

PR 4 of the concept-registry stack. Review against main; the preceding change merged in #1068.

concept.translators[(source_type, target_type)]
  translator name
  unchecked std::any intended to hold a conversion callable
  result storage: owned | borrowed

add_translator  -> require distinct member types and an unused ordered pair
find_translator -> return registration or nullptr
A -> B and B -> A are separate registrations

Concept equality still compares only name and concrete types. Duplicate-name registry insertion merges concrete types, not translator records.

This PR stores and retrieves registrations. It does not check whether the payload is callable or matches the declared pair, enforce storage lifetimes, or wire the records into graph execution. Discovery and input metadata are unchanged.

Evidence

  • Before: Concepts record concrete-type membership but no conversion registrations. After: Tests cover lookup and invocation, storage declarations, independent reverse pairs, and rejection of same-type, nonmember-type, and duplicate registrations.
  • The round-trip test invokes a callable stored under the opposite direction. It demonstrates retrieval and invocation, not signature validation.
  • At d423ab52, git diff --check passed against main. The test source contains 17 test cases and 41 assertion sites; these are source counts, not runtime results. The build, CTests, and hooks were not rerun at this revision for this update.

Merge Danger

Door: Two-way

Additive in-memory APIs with no persisted-format change. Reverting after downstream adoption would require removing or adapting callers.

Blast Radius: Model

A missing or incorrectly typed callable can fail when retrieved or used. A borrowed result refers to input storage; callers must keep the source alive for as long as they use the result.


Stack created with GitHub Stacks CLI • Give Feedback 💬

@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: 29ac6b30-152b-4d61-9499-054a95d7afb7

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

Check name Status Explanation
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.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.

Finishing Touches

Generate unit tests (beta)

  • 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

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##             main    #1002      +/-   ##
==========================================
+ Coverage   91.45%   91.63%   +0.17%     
==========================================
  Files         185      185              
  Lines        6073     6106      +33     
  Branches      973      979       +6     
==========================================
+ Hits         5554     5595      +41     
+ Misses        331      325       -6     
+ Partials      188      186       -2     
Flag Coverage Δ
amd64 91.63% <100.00%> (+0.17%) ⬆️
arm64 91.63% <100.00%> (+0.17%) ⬆️

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 5a73c5c...8f3aeb8. 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 4 times, most recently from 7e9140e to cb2f7aa Compare November 4, 2026 16:18
@marcpaterno
marcpaterno force-pushed the stack/concept-registry/04-conversion-records branch 3 times, most recently from fee70d4 to 2010772 Compare November 12, 2026 19:59
Base automatically changed from stack/concept-registry/03-concept-registry to main November 12, 2026 20:14
@knoepfel
knoepfel force-pushed the stack/concept-registry/04-conversion-records branch from 2010772 to 73800a5 Compare November 12, 2026 20:14
@marcpaterno
marcpaterno force-pushed the stack/concept-registry/04-conversion-records branch from 73800a5 to 2da3a40 Compare November 14, 2026 16:04
@marcpaterno
marcpaterno removed this pull request from stack #1004 November 14, 2026 16:12
@marcpaterno
marcpaterno changed the base branch from main to stack/concept-registry/03a-constrain-identifier-string November 14, 2026 16:12
@marcpaterno
marcpaterno added this pull request to stack #1069 November 14, 2026 16:12
@marcpaterno
marcpaterno force-pushed the stack/concept-registry/04-conversion-records branch 12 times, most recently from 756fb02 to 746982a Compare November 20, 2026 22:20
Base automatically changed from stack/concept-registry/03a-constrain-identifier-string to main November 20, 2026 22:34
@knoepfel
knoepfel force-pushed the stack/concept-registry/04-conversion-records branch from 746982a to d423ab5 Compare November 20, 2026 22:34
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.
The get_concept_for_type method has already been removed from
data_product_concept_registry, so its test cases are removed with it.
@marcpaterno
marcpaterno force-pushed the stack/concept-registry/04-conversion-records branch from d423ab5 to 8f3aeb8 Compare November 24, 2026 18:20

This branch has not been deployed

No deployments
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