Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8588aa8
WIP: generalize handling of intermediate objects in sourceTreeCalc
aziemchawdhary-gs Jul 11, 2025
5c07077
Clean up
aziemchawdhary-gs Jul 15, 2025
9d03dce
Add test
aziemchawdhary-gs Jul 15, 2025
20daaec
Handle classes when building up property paths to owner
aziemchawdhary-gs Jul 15, 2025
232b8e5
fix
aziemchawdhary-gs May 25, 2026
cb94b11
test: add failing test for allNestedProperties cycle handling
aziemchawdhary-gs May 25, 2026
566d0c5
fix: cycle-safe allNestedProperties via visited path set
aziemchawdhary-gs May 25, 2026
17c7498
test: add failing test for intermediate over association property
aziemchawdhary-gs May 25, 2026
db81b37
fix: buildPropertyPathUptoOwner uses ownerClass() and is depth-bounded
aziemchawdhary-gs May 25, 2026
0dd8ae8
test: add failing test for colliding return types in intermediate nav…
aziemchawdhary-gs May 25, 2026
97f3235
fix: navigation map preserves all properties per return type
aziemchawdhary-gs May 25, 2026
fd9c7e4
refactor: drop redundant rebuild of childPropertiesMap
aziemchawdhary-gs May 25, 2026
e7880c0
test: add failing tests for supertype-rooted property tree handling
aziemchawdhary-gs May 25, 2026
782ec55
fix: findSubTreeWithOwnerOrPropertyTreesFromOwner matches both subtyp…
aziemchawdhary-gs May 25, 2026
2d7aaf7
test: mark testIntermediateOverSubtype as ToFix - intermediate over
aziemchawdhary-gs May 25, 2026
7ef2ed6
fix: fall back to original property tree when no owner-belonging subt…
aziemchawdhary-gs May 25, 2026
b6930eb
docs: document getRootClass shape requirement
aziemchawdhary-gs May 25, 2026
097b541
test: add four targeted regression tests for intermediate handling
aziemchawdhary-gs May 26, 2026
8b6796c
fix: handle OperationSetImplementation root in calculateSourceTree
aziem May 27, 2026
cb3e461
fix: surface clear error when intermediate owner is unreachable
aziem May 27, 2026
9ca1001
fix: process explicit subType subtrees when mapping targets the base …
aziem May 27, 2026
47fdfa7
fix: handle intermediate over supertype-typed slot via inheritance
aziem May 27, 2026
be88842
sourcetree calc docs
aziemchawdhary-gs Jun 15, 2026
e17d9b1
chore: gitignore strip-ai-coauthors.sh
aziemchawdhary-gs Jun 15, 2026
7f4c93c
fix: compare classes by element path in owner-reachability filter
aziem Jun 15, 2026
2904199
fix: accept owner-reachable tree class via inheritance in precondition
aziem Jun 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@
**/legend-engine-language-pure-grammar/src/main/antlr4/org/finos/legend/engine/language/pure/grammar/from/antlr4/core/gen/
/welcome.pure
/legend-engine-core/legend-engine-core-shared/legend-engine-shared-core/src/main/resources/legendExecutionVersion.json
strip-ai-coauthors.sh
1 change: 1 addition & 0 deletions docs/engineering/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ all backends. See [Testing Strategy — PCT](testing/testing-strategy.md#5-pct-p
| [Router & Pure-to-SQL](architecture/router-and-pure-to-sql.md) | Routing strategies, clustering, SQL generation pipeline, dialect extension |
| [ModelJoin](architecture/model-join.md) | Store-agnostic model-level associations: parser, compiler, router, and Relational SQL translation |
| [Pre-Evaluation (preeval)](architecture/preeval.md) | AST simplification pass that runs before the router: constant folding, let inlining, short-circuiting |
| [Source Tree Calculation](architecture/source-tree-calculation.md) | calculateSourceTree pipeline and the new-instance operator pattern: intermediate-class handling, edge cases, design alternatives |

### Guides

Expand Down
1,179 changes: 1,179 additions & 0 deletions docs/engineering/architecture/source-tree-calculation.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,31 @@ function {doc.doc = 'Get all properties on the provided type / class'}
->concatenate($class.qualifiedPropertiesFromAssociations)
}

function {doc.doc = 'Get all properties on the provided class and (transitively) on every class-typed property in its hierarchy. Cycle-safe.'}
meta::pure::functions::meta::allNestedProperties(class:Class<Any>[1]) : AbstractProperty<Any>[*]
{
meta::pure::functions::meta::allNestedProperties($class, ^Map<String, Class<Any>>())
}

function <<access.private>>
meta::pure::functions::meta::allNestedProperties(class:Class<Any>[1], visited:Map<String, Class<Any>>[1]) : AbstractProperty<Any>[*]
{
let key = $class->elementToPath();
if($visited->get($key)->isNotEmpty(),
| [],
| let visitedNext = $visited->put($key, $class);
let properties = $class->allProperties();
let nestedClassTypes = $class->meta::pure::functions::meta::hierarchicalProperties()
->map(p | $p.genericType.rawType->toOne())
->filter(t | $t->instanceOf(Class))
->cast(@Class<Any>)
->removeDuplicates();
$properties->concatenate(
$nestedClassTypes->map(cl | $cl->meta::pure::functions::meta::allNestedProperties($visitedNext))
)->removeDuplicates();
);
}

function {doc.doc = 'Get all nested types present in the property tree of this class or its hierarchy.'}
meta::pure::functions::meta::allNestedPropertyTypes(class : Class<Any>[1]) : Type[*]
{
Expand Down

Large diffs are not rendered by default.

Loading
Loading