Skip to content

Finish reflection follow-ups and exhaustive validation - #3937

Open
noise64 wants to merge 42 commits into
mainfrom
reflection-leftovers
Open

noise64 wants to merge 42 commits into
mainfrom
reflection-leftovers

Conversation

@noise64

@noise64 noise64 commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor
  • resolves GOL-61, GOL-644, GOL-645, GOL-646, and GOL-653
  • makes MoonBit discovery snapshots opaque and mutation-safe, shares Rust reflected tool schema pools, and preserves malformed-output failures through awaited and pending public paths
  • aligns canonical reflection JSON across the host, TypeScript, Effect, Rust, Scala, and MoonBit: omitted optional record fields decode as absent; wide integers, duration nanoseconds, and quantity mantissas use strict decimal strings; binary values use mimeType and unpadded base64url; unsupported capability, future, and stream leaves project to unsatisfiable reflection JSON Schema
  • extends the versioned 1.0.0 corpus in all six runners with canonical binary MIME, noncanonical base64 rejection, optional constrained text/binary metadata, invalid MIME and unknown-text-field rejection, and plain canonical wide-integer config entries while retaining exact case-ID and embedded-copy drift enforcement
  • tightens the corpus and runners for noncanonical trailing bits, unknown fields, wide-integer JSON Schema bounds, semantic graph assertions, and cyclic MoonBit aliases, and refreshes generated MoonBit interfaces
  • separates config wire formats across the generated Rust, TypeScript/Effect, Scala, and MoonBit bridges: REST create-agent requests use canonical JSON, streaming session starts retain tagged public JSON, and the worker-service session endpoint schema-decodes then canonicalizes config before forwarding
  • adds generated-runtime regressions for option, result, variant, union, tagged/public binary JSON, and the actual create-agent REST config envelope
  • validates binary MIME syntax in Scala and MoonBit packing/unpacking while keeping constrained language and MIME metadata optional
  • updates reflection skills, generated guides, concepts documentation, and the RPC guide while preserving Code-first approach terminology outside reflection comparisons
  • applies declared and primitive-clamped JSON Schema bounds for narrow integers and floats, emits text-language and binary-MIME allowlists as property enums, and adds the exact canonical unpadded Base64URL assertion while retaining contentEncoding: base64url
  • makes invalid-json and constraint-violation reject kinds executable through parse-then-validate seams in all six corpus runners, and rejects missing or unknown kinds during corpus synchronization
  • adds behavioral 1.0.0 corpus coverage for restricted u32, f64, text, and binary schemas; direct canonical Base64URL regressions in every renderer; scoped host and SDK tests; generated-corpus drift checks; and rebuilt TypeScript and Effect template artifact checks

@netlify

netlify Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for golemcloud canceled.

Name Link
🔨 Latest commit f1c84c6
🔍 Latest deploy log https://app.netlify.com/projects/golemcloud/deploys/6ab6c53098c19600083fc3d8

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

📖 Docs preview: https://docs-jfomthmh8-golem-cloud.vercel.app

Built from commit f1c84c655b5e245715a792283be8142dad247630 by docs.yaml.

# Conflicts:
#	sdks/effect/src/internal/reflection/schemaRender.ts
#	sdks/effect/test/schema-ref.test.ts
#	test-components/tool-streaming-moonbit/component/moon.pkg
@noise64
noise64 marked this pull request as ready for review September 24, 2026 14:50
@noise64
noise64 requested a review from a team September 24, 2026 14:50
# Conflicts:
#	cli/golem-cli/tests/app/mod.rs
#	sdks/moonbit/golem_sdk_example1/golem_moonbit_examples/golem_tools.mbt
@noise64
noise64 marked this pull request as draft September 24, 2026 14:52
let __config_json = serde_json::to_value(&__config_value).map_err(|__e| crate::__golem_bridge_runtime::ClientError::InvocationFailed { message: format!("Failed to serialize config value: {__e}") })?;
agent_config.push(golem_client::model::AgentConfigEntryDto {
path: vec![#(#path_segments),*],
value: __config_json.into(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] Use the REST canonical codec for configuration, not the session codec

encode_generated_streamless_value uses the public invocation-session representation, but REST config reaches parse_worker_creation_agent_config in golem-worker-executor/src/worker/agent_config.rs, which decodes it with from_untrusted_json_value. Those representations differ for options, results, variants, and unions, including nested occurrences.

For example, Some("hello") is now sent as {"$option":"some","value":"hello"}, while the REST decoder expects "hello"; None becomes {"$option":"none"} instead of null; and Ok("hello") becomes {"$result":"ok","value":"hello"} instead of {"ok":"hello"}. I reproduced all three failures using the actual encoder and server-side decoder, so agent creation fails for these config values.

The TypeScript generator and Scala/MoonBit REST config encoders make the same substitution. Please encode REST config with its canonical JSON codec and keep the session codec for streaming requests. The new REST config tests cover wide integers, whose representations happen to match; add an option/result (ideally nested) case that feeds the generated config JSON into the server decoder.

@noise64
noise64 marked this pull request as ready for review September 25, 2026 15:33
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.

2 participants