Skip to content

Commit 942e9b9

Browse files
dmealingclaude
andcommitted
feat(ai,java): admit @responseRef (template.prompt) + template.* entity-child; un-ledger ai-trace fixtures
Ports the metamodel slice of the AI-trace vertical to Java (the carve-out's Java half, ADR-0024): @responseRef registered on template.prompt only (matching TS promptOverlayAttrs), template.* admitted as object children, @responseRef carved out of the cross-port registry manifest via a new TS_PILOT_VOCAB exclusion (mirrors TS TsPilotVocab). Also maps the canonical cross-port provider name 'metaobjects-template' to Java's template-types provider in the conformance harness alias table (TS/C#/Python expose it under that name; the fixtures' providers.json requires it). ai-trace-prompt-nested + ai-trace-sti now load + canonical-serialize cross-port-clean in Java; un-ledgered. registry-conformance stays green. (The carve-out is fully closed only when all 4 non-TS ports register @responseRef — atomic flip of expected-registry.json later.) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 65c06b5 commit 942e9b9

6 files changed

Lines changed: 41 additions & 6 deletions

File tree

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
{
22
"language": "java",
33
"_comment": "FR-013 (@readOnly), FR-014 (TPH discriminator), and FR-015 (@parameterRef) VALIDATION passes shipped in the Java port (ValidationPhase.validateFieldReadOnly / validateDiscriminator / validateSourceParameterRef). 9 of 11 fixtures now pass byte-identically. The two remaining entries are BOTH manifestations of one pre-existing Java subtype-field-override gap (orthogonal to the validation fan-out), deferred until the Java loader's field-override provenance/serializer reconciliation: (1) error-field-readonly-downgrade — the validation fires the correct ERR_READONLY_DOWNGRADE with a single error, but the envelope source for a subtype field that OVERRIDES an inherited field is a MergedSource pointing at the base declaration (children[0]) rather than the subtype's authored json source (children[1]); Java clones+stamps MergedSource on extends-overrides, and Contributor carries no per-contributor jsonPath, so the subtype's authored path is not recoverable post-merge (the TS/Python reference models keep the override's plain JsonSource). (2) field-readonly-upgrade-on-subtype — a positive fixture that fails on canonical serialization of the same subtype @readOnly override (same root cause).",
4-
"_comment_ai_pilot": "ai-trace-prompt-nested exercises the AI #1b prompt-derived-trace vertical, a deliberate TS pilot (cross-language LLM-call trace persistence). It places a template.prompt CHILD under object.entity and uses @responseRef on template.prompt. Neither is yet cross-port: Java's MetaObject child rules do not admit template.* children, and @responseRef is carved out of the cross-port registry manifest (TsPilotVocab). Under strict ADR-0023 load this happy-path fixture reports ERR_UNKNOWN here. Ledgered until the AI vertical is promoted from the TS pilot to all five ports. The sibling fixture ai-llm-call-extends (plain entity + extends) passes cross-port and is NOT ledgered. ai-trace-sti is the same TS pilot in its shared-table STI (#1c) authoring shape: a TPH base PromptTrace (@discriminator) over abstract LlmCallBase, with concrete subtypes ClassifyCall/SummarizeCall each carrying @discriminatorValue plus a nested template.prompt (@textRef/@payloadRef/@responseRef). Same cross-port gap (template.* child under object.entity + @responseRef TsPilotVocab); ledgered until the AI vertical is promoted to all five ports.",
4+
"_comment_ai_pilot": "ai-trace-* fixtures now pass in Java (@responseRef + template.* child admitted)",
55
"fixtures": [
66
"error-field-readonly-downgrade",
7-
"field-readonly-upgrade-on-subtype",
8-
"ai-trace-prompt-nested",
9-
"ai-trace-sti"
7+
"field-readonly-upgrade-on-subtype"
108
]
119
}

server/java/metadata/src/main/java/com/metaobjects/object/MetaObject.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ public static void registerTypes(MetaDataRegistry registry) {
142142

143143
// OBJECTS CAN CONTAIN SOURCES (source.rdb and future subtypes)
144144
def.optionalChild("source", "*", "*");
145+
146+
// OBJECTS CAN CONTAIN TEMPLATES (template.prompt/output/toolcall) — FR-004 AI-trace
147+
// (a nested template.prompt under object.entity drives typed LLM-call trace derivation).
148+
def.optionalChild("template", "*", "*");
145149
});
146150

147151
if (log != null) {

server/java/metadata/src/main/java/com/metaobjects/registry/RegistryManifest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,11 @@ public enum ExclusionReason {
229229
/** The {@code metadata.base} per-port inheritance anchor (deferred inheritsFrom facet). */
230230
INHERITANCE_ANCHOR,
231231
/** TS-web-presentation-only facet (the generic {@code view.*} controls). */
232-
PRESENTATION_ONLY
232+
PRESENTATION_ONLY,
233+
/** A TS-pilot-only attr not yet promoted to all five ports (e.g. @responseRef —
234+
* the AI prompt-derived-trace vertical). Registered for load, carved out of the
235+
* cross-port manifest until the vertical ships in every port. Mirrors TS TsPilotVocab. */
236+
TS_PILOT_VOCAB
233237
}
234238

235239
/**
@@ -258,7 +262,8 @@ public enum ExclusionReason {
258262
com.metaobjects.object.MetaObject.ATTR_IS_INTERFACE, ExclusionReason.STRUCTURAL_KEYWORD,
259263
com.metaobjects.object.MetaObject.ATTR_OBJECT, ExclusionReason.NATIVE_BINDING,
260264
com.metaobjects.object.AbstractObjectRepresentation.ATTR_OBJECT_ADAPTER, ExclusionReason.NATIVE_BINDING,
261-
MetaData.ATTR_DESCRIPTION, ExclusionReason.COMMON_ATTR_DUP);
265+
MetaData.ATTR_DESCRIPTION, ExclusionReason.COMMON_ATTR_DUP,
266+
com.metaobjects.template.TemplateConstants.ATTR_RESPONSE_REF, ExclusionReason.TS_PILOT_VOCAB);
262267

263268
/**
264269
* Classify a per-type attr: an {@link ExclusionReason} (carved out) or

server/java/metadata/src/main/java/com/metaobjects/template/PromptTemplate.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public static void registerTypes(MetaDataRegistry registry) {
3939
.ofType(StringAttribute.SUBTYPE_STRING).asArray();
4040
def.optionalAttributeWithConstraints(ATTR_MODEL)
4141
.ofType(StringAttribute.SUBTYPE_STRING).asSingle();
42+
def.optionalAttributeWithConstraints(ATTR_RESPONSE_REF)
43+
.ofType(StringAttribute.SUBTYPE_STRING).asSingle();
4244
});
4345
}
4446

@@ -68,4 +70,11 @@ public String getModel() {
6870
? getMetaAttr(ATTR_MODEL, false).getValueAsString()
6971
: null;
7072
}
73+
74+
/** Returns the raw value of {@code @responseRef}, or {@code null} if absent. */
75+
public String getResponseRef() {
76+
return hasMetaAttr(ATTR_RESPONSE_REF, false)
77+
? getMetaAttr(ATTR_RESPONSE_REF, false).getValueAsString()
78+
: null;
79+
}
7180
}

server/java/metadata/src/main/java/com/metaobjects/template/TemplateConstants.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ private TemplateConstants() {}
7878
public static final String ATTR_REQUIRED_SLOTS = "requiredSlots";
7979
public static final String ATTR_MODEL = "model";
8080

81+
/**
82+
* {@code @responseRef} — optional single-valued string on {@code template.prompt}
83+
* ONLY (the AI prompt-derived-trace vertical; mirrors TS {@code promptOverlayAttrs}).
84+
* Names a nested template whose payload VO shapes the LLM-call trace's typed
85+
* response column. NOT on the shared template base (so it is absent from
86+
* {@code template.output}). A TS-pilot vocab carved out of the cross-port
87+
* registry manifest until promoted to all five ports.
88+
*/
89+
public static final String ATTR_RESPONSE_REF = "responseRef";
90+
8191
// --- Toolcall-specific attributes (template.toolcall only — ADR-0011) ---
8292
//
8393
// Vendor-agnostic in core; vendor wire details (retry semantics, fallback

server/java/metadata/src/test/java/com/metaobjects/conformance/ConformanceTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,15 @@ public class ConformanceTest {
146146
// physical RDB attributes (@column / @dbType / @dbColumnType / ...).
147147
"metaobjects-db", List.of(
148148
"database-extensions"
149+
),
150+
// The corpus's "metaobjects-template" provider (TS/C#/Python expose it
151+
// under this canonical name — template.* / @responseRef / @xmlText, the
152+
// AI prompt-construction vocab) maps to Java's TemplateTypesMetaDataProvider
153+
// (id "template-types"). Java also folds template-types into the
154+
// "metaobjects-core-types" alias; the two checks are independent set
155+
// memberships, so a fixture listing both still resolves.
156+
"metaobjects-template", List.of(
157+
"template-types"
149158
)
150159
);
151160

0 commit comments

Comments
 (0)