Merged
Conversation
acd2055 to
b221b26
Compare
b221b26 to
32a83ba
Compare
eskenazit
requested changes
Apr 7, 2026
bdf0a0a to
0803db9
Compare
Contributor
Author
|
@eskenazit I've rebased from #287 , that might work well |
0803db9 to
4f501ca
Compare
ec1bed6 to
4196ced
Compare
Contributor
Author
|
@eskenazit I've enhanced this PR to support mocks at the aggregates level. Downgraded JUnit to version 5 due to VS Code detection issue and minor JaCoCo upgrade. |
eskenazit
requested changes
Apr 10, 2026
eskenazit
reviewed
Apr 10, 2026
eskenazit
reviewed
Apr 10, 2026
eskenazit
reviewed
Apr 10, 2026
src/test/java/io/naftiko/engine/aggregates/AggregateRefResolverTest.java
Show resolved
Hide resolved
2ae9600 to
55cfb30
Compare
…ution Introduce aggregates[] on Capability for defining reusable domain functions - Schema: Aggregate, AggregateFunction, Semantics definitions; ref on McpTool and ExposedOperation - Engine: AggregateRefResolver merges ref fields and derives MCP hints from semantics - Spectral: aggregate-semantics-consistency rule detects contradictions between semantics, MCP hints, and REST methods - Tests: 25 unit + 11 integration + 3 Spectral tests - Docs: Specification-Schema, FAQ, design-guidelines, AGENTS.md, SKILL.md, wrap-api-as-mcp Closes #191 chore: organize test fixtures into subdirectories feat: add aggregates with DDD-inspired domain functions and ref resolution Introduce aggregates[] on Capability for defining reusable domain functions - Schema: Aggregate, AggregateFunction, Semantics definitions; ref on McpTool and ExposedOperation - Engine: AggregateRefResolver merges ref fields and derives MCP hints from semantics - Spectral: aggregate-semantics-consistency rule detects contradictions between semantics, MCP hints, and REST methods - Tests: 25 unit + 11 integration + 3 Spectral tests - Docs: Specification-Schema, FAQ, design-guidelines, AGENTS.md, SKILL.md, wrap-api-as-mcp Closes #191 chore: organize test fixtures into subdirectories
Disambiguate ConsumedOutputParameter (name + JsonPath value starting with $) from aggregate mock functions (name + static/template value) so the deserializer routes each to the correct field (setMapping vs setValue). Add shared mock integration test proving MCP and REST adapters produce identical payloads from a single aggregate function mock definition.
- Add Aggregate, AggregateFunction, FunctionResult engine classes - Adapters delegate to AggregateFunction at runtime instead of copying fields - AggregateRefResolver now only validates refs and derives MCP hints - Move utility classes to engine/util (Resolver, Converter, etc.) - Move aggregate classes to engine/aggregates - Move ConsumesImportResolver to engine/consumes
4549370 to
20a0ea8
Compare
…_modules fix: use correct schema version in forecast-aggregate example fix: use correct schema version in test fixtures feat: add MockOutputParameter to schema for mock aggregate functions
20a0ea8 to
1137888
Compare
Contributor
Author
|
@eskenazit As discussed, I have reworked the implementation to have an engine implementation of aggregates |
eskenazit
approved these changes
Apr 10, 2026
Contributor
eskenazit
left a comment
There was a problem hiding this comment.
Seems way more solid with delegated instances than with copies ! =)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
Closes #191
What does this PR do?
Introduces
aggregates[]on the Capability object, enabling DDD-inspired domain functions that can be defined once and referenced from multiple adapters (MCP tools, REST operations) viaref.Schema:
Aggregate,AggregateFunction,Semanticsrefproperty onMcpToolandExposedOperation(thirdanyOfbranch alongside simple/orchestrated)nameanddescriptionare optional when usingref(inherited from the function)Engine:
AggregateRefResolvermerges inherited fields from the referenced function (name, description, call, with, steps, inputParameters, outputParameters) — explicit fields override inherited oneshintsfrom functionsemantics(safe → readOnly/destructive, idempotent → idempotent), with explicit hints overriding derived valuesSpectral:
naftiko-aggregate-function-descriptionrule: warns when a function lacks a descriptionnaftiko-aggregate-semantics-consistencyrule (custom JS function): detects contradictions between function semantics and MCP tool hints (e.g. safe=true + destructive=true) or REST methods (e.g. safe=true + DELETE)Documentation:
Built on top of #239 (MCP tool hints).
Tests
AggregateRefResolverTest): function map indexing, ref lookup, MCP tool merge (name, description, call, inputParams), REST operation merge, deriveHints (6 scenarios), mergeHints (3 scenarios), resolve pipelineAggregateIntegrationTest): end-to-end YAML → engine → output for ref resolution, parameter inheritance, hints derivation, overrides, backward compatibility, unknown ref fail-fastNaftikoSpectralRulesetTest): semantics-hints contradiction detection, REST method contradiction, consistent-document no-warnaggregate-basic.yaml,aggregate-hints-override.yaml,aggregate-invalid-ref.yaml, plus 2 Spectral fixturesChecklist
mainAgent Context (optional)