Skip to content

docs: document unfolds - #1028

Merged
marcpaterno merged 2 commits into
Framework-R-D:mainfrom
matclim:docs/unfolds
Nov 12, 2026
Merged

marcpaterno merged 2 commits into
Framework-R-D:mainfrom
matclim:docs/unfolds

Conversation

@matclim

@matclim matclim commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

The unfold contract is only visible in the implementation and tests. Add a user-guide page that explains:

Also add a Doxygen description of graph_proxy::unfold, and point api/graph_proxy.rst at phlex::detail::graph_proxy, where the class actually lives, so its documentation is rendered.

Assisted by: Claude Haiku 5.5

Docs: new unfold guide (docs/source/guide/unfolds.rst, new file, +144 lines)

  • Describes the unfold contract:
    • An unfold creates child data cells in a new, lower layer for one parent.
    • Each child gets one data product built from the parent's input products.
    • The parent data cell is not modified.
  • Covers registration:
    • An unfolder class with initial_value(), a predicate, and a generator.
    • An example registers generate and a downstream transform.
    • The generator returns (next value, product).
    • The generator may take the child's data_cell_index as an optional argument.
    • The unfolder needs exactly one constructor. Phlex deduces inputs from constructor parameters.
  • Covers runtime behavior:
    • One node call runs the loop for each parent.
    • concurrency limits how many parents unfold at once.
    • Children are numbered from 0 for each parent.
    • An empty parent has no children, and child-layer algorithms are not called for it.
    • Candidates cannot be skipped after creation. The generator must advance the running value past them.
  • States the current limit: each child receives exactly one product. Returning a tuple of products is not supported yet.
  • Covers input layers:
    • All input selectors must name the same layer.
    • Since v0.4.3, mixed-layer inputs throw std::invalid_argument.
    • Describes a transform-based workaround. The diff output was truncated before this section, so this point rests on the raw summary.
  • Covers where resource<T>{} arguments go. This point also rests on the raw summary, not the truncated diff.

Docs: API comment (phlex/core/graph_proxy.hpp, +19/−1)

  • Expands the Doxygen comment on graph_proxy::unfold:
    • Describes how the unfolder is built from input_family(...) products.
    • Describes the predicate and generator calls.
    • Lists the supported callable forms.
    • Covers child numbering, the same-layer rule, and the concurrency parameter.
  • The declaration and implementation are unchanged. The diff shows only comment lines.

Discrepancies with PR objectives

  • The objectives say the PR points api/graph_proxy.rst to phlex::detail::graph_proxy. The diff does not include that file. It changes only the two files above (163 insertions, 1 deletion).
  • The objectives describe the generator terminology and the unfold to generate rename in the example. The guide's example uses generate, which matches that description.

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The unfold guide and API documentation now describe unfold registration and execution, child-product behavior, concurrency, input-layer constraints, a transform-based workaround, and how resource arguments reach the generator.

Changes: Unfold documentation

Layer / File(s) Summary
Unfold behavior and input contract
docs/source/guide/unfolds.rst, phlex/core/graph_proxy.hpp
The guide and API documentation describe unfold registration, predicate and generator arguments, child numbering, concurrency, input-layer constraints, and resource arguments. The guide also documents a transform-based workaround for mixed-layer inputs.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Possibly related issues

  • Issue 946 asks to separate unfold resource dependencies from unfolder-constructor inputs. This PR documents how resource arguments reach the generator but does not change the API.
  • Issue 955 reports a nested-unfold flushing problem. This PR documents the same-layer input constraint and a transform-based workaround but does not change runtime behavior.

Possibly related PRs

Suggested reviewers: marcpaterno, knoepfel, greenc-fnal

Merge Risk: Minimal · up to 312dc

This change adds documentation for unfolds and does not alter runtime behavior, so it carries no merge risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "docs: document unfolds" matches the main change: the PR adds an unfold user guide page (docs/source/guide/unfolds.rst) and expands the graph_proxy::unfold Doxygen comment. It names the chan…
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 "docs: document unfolds" matches the main change: the PR adds an unfold user guide page (docs/source/guide/unfolds.rst) and expands the graph_proxy::unfold Doxygen comment. It names the change type and the subject. It does not mention the same-layer input restriction or the generator rename, but it does not need to cover every detail.

Finishing Touches

Generate unit tests (beta)

  • 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

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: 6b4cff06-d347-41fc-94dd-db7048e2c11f
Commits

Reviewing files that changed from the base of the PR and between 96cf8a9 and 312dc59.

Files selected for processing: 2

  • docs/source/guide/unfolds.rst
  • phlex/core/graph_proxy.hpp

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: 8

  • 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: CodeRabbit
  • GitHub Check: coverage (arm64)
  • GitHub Check: coverage (amd64)
  • GitHub Check: clang-tidy-check
  • GitHub Check: build
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/core/graph_proxy.hpp
Additional comments: 2

docs/source/guide/unfolds.rst: 1

1-144: LGTM!

phlex/core/graph_proxy.hpp: 1

100-118: LGTM!

@codecov

codecov Bot commented Nov 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##             main    #1028      +/-   ##
==========================================
- Coverage   89.65%   89.50%   -0.16%     
==========================================
  Files         177      177              
  Lines        5996     5996              
  Branches      994      994              
==========================================
- Hits         5376     5367       -9     
- Misses        392      399       +7     
- Partials      228      230       +2     
Flag Coverage Δ
amd64 89.50% <ø> (-0.16%) ⬇️
arm64 89.50% <ø> (-0.16%) ⬇️

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

Files with missing lines Coverage Δ
phlex/core/graph_proxy.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 ce771e1...c1f76ce. Read the comment docs.

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

Comment thread docs/source/guide/unfolds.rst Resolved
Comment thread docs/source/guide/unfolds.rst Resolved
Comment thread docs/source/guide/unfolds.rst Resolved
Comment thread docs/source/guide/unfolds.rst Resolved
Comment thread docs/source/guide/unfolds.rst Resolved

@marcpaterno marcpaterno left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for contributing the documentation!

This is quite helpful. I have added a few suggestions for small clarifications for you to consider.

matclim and others added 2 commits November 12, 2026 15:38
The unfold contract is only visible in the implementation and tests.  Add
a user-guide page that explains:

- the unfolder class, initial_value(), and the predicate/unfold loop,
  including the accepted callable forms and the optional child
  data_cell_index argument
- per-parent calls, child numbering, empty parents, and why there is no
  way to skip a candidate
- that all input selectors must name the same layer (rejected since
  v0.4.3, see issue Framework-R-D#955) and the transform-then-unfold workaround
- where resource<T>{} arguments go (issue Framework-R-D#946)

Also add a Doxygen description of graph_proxy::unfold, and point
api/graph_proxy.rst at phlex::detail::graph_proxy, where the class
actually lives, so its documentation is rendered.

Assisted by: Claude Haiku 5.5
Address review comments:
- Describe an unfold as generating a family of child data cells and
  populating them with products created from the parent's inputs; the
  parent data cell is not modified.
- Use the design document's term "generator" for the callable that
  creates each child's product, instead of "unfold function", in the
  guide and in the graph_proxy::unfold Doxygen comment.  Rename the
  example's member function from unfold to generate to match.
- State that each child currently receives exactly one data product:
  the design allows several, but the generator's result is unpacked as
  a (next value, product) pair, so returning a tuple of products is not
  supported yet.
@matclim

matclim commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I’ve addressed your comments. The terminology now follows the design document: the page uses predicate and generator for the two operators, and keeps unfolder for the class, matching the Unfolder template parameter.

@marcpaterno marcpaterno left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, @matclim

@marcpaterno
marcpaterno merged commit 7f05281 into Framework-R-D:main Nov 12, 2026
52 checks passed
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.

3 participants