Repository navigation
GOL-1268: Teach ctx.caller in the home page snippets - #4700
Open
Aditya1404Sal wants to merge 10 commits into
Open
Aditya1404Sal wants to merge 10 commits into
Aditya1404Sal wants to merge 10 commits into
Conversation
✅ Deploy Preview for golemcloud canceled.
|
…nd Scala compile notes
Aditya1404Sal
marked this pull request as ready for review
November 29, 2026 21:25
This branch has not been deployed
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.
Part of GOL-1268: the golem.cloud home page snippets. The docs, skills and templates are in #4691.
On the golem.cloud home page, the Artifacts "Log in" and "Sign in" examples and the Tools "Middleware" example show 1.6 code in all six languages:
s.principal(),Principal.PrincipalSchema,Principalparameters (caller: Principal),golem.Principalfields andctx.Principal(). None of it builds against the 2.0 SDKs.What changes
The 18 snippets (3 features × 6 languages) read the caller the 2.0 way, as the docs in #4691 teach:
ctx.caller.original.ref(aPrincipalRef) with each chart and compares it on read; anyone else gets a 404.ctx.caller.originalto a signed-in user and reads its issuer and subject.InvocationContextparameter that therefundtool declares; the SDK supplies it and keeps it out of the tool's input and client.The comments keep their text and order. Each snippet keeps its number of highlighted lines, some now on the caller lines, and all 18 stay within 68 columns and 31 lines. In Effect, Rust and MoonBit the login snippet's PNG type moved off-screen (it is shown in the "Files" snippet) to make room for the caller lines.
The six compile notes of the repo skill
compiling-homepage-snippetsdescribe the new code, the helpers the checks supply, and the negative controls.Checks
The skill's compile harnesses are local and not committed; they were rebuilt for the three changed features in each language:
After the merge of main
663d3034c7(a76bc49feb), the TypeScript and Effect rows ran again and pass. Main changed no SDK API that the other snippets use.Each negative control plants one wrong caller read into one snippet and requires the build to fail with the expected error:
ctx.caller()in Log in (calleris a property), a wrong argument to the rate limit in Middleware, and the 1.6 fieldsubin Sign in.caller.refin Log in, the 1.6ctx.principalin Middleware, andsubin Sign in.ctx.principal()in Log in, the 1.6 parametercaller: Principalin Sign in, and the 1.6 parameter namecallerin Middleware, which fails as an unknown name.ctx.Principal()in Log in and Middleware, and the 1.6 fieldCaller golem.Principalin Sign in.ctx.principal,caller: Principalandcaller; not run (see below).No control plants
s.principal()or the 1.6 middlewareprincipal. In Rust and Go, aPrincipalparameter or field now fails with the SDK's "Principal and Caller cannot appear …" error. In Rust that control needscargo build: the error is a const panic thatcargo checkdoes not evaluate.MoonBit is partial. With moonc at the release CI's pin (
v0.10.18+6c83a7f62), the display rules, the comment comparison and the Golem codegen (which parses the files and validates the agent, tool and middleware declarations) pass.moon build --target wasmstops inside the SDK: in a fresh checkoutgolem_sdk/async-coreis missing its generated bindings (stream_transfer.mbtfinds noStream), and regenerating them needs the Golem wit-bindgen fork. So the MoonBit snippets are not compiled, and their negative controls were not run.moonbit.mdsays the same.Scala is not compiled. The 3 Scala snippets are edited from the SDK sources, and the display rules and the comment comparison with the TypeScript pass. The compile check did not complete: publishing the in-tree Scala SDK at this branch's base failed in the SDK itself, before the snippets.
coredoes not compile:sdks/scala/core/js/src/main/scala/golem/host/OplogApi.scala:770-771readscomponentIdandagentIdfromJsAgentId, which became a single UUID with the UUIDv8 agent IDs. Main fixes those two lines in #4695. The 3 Scala negative controls were not run.scala.mdsays the same.🤖 Generated with Claude Code