Skip to content

Commit 85ae674

Browse files
rustyconoverclaude
andcommitted
orchard_hosted: pass_claims returns the whole verified claim set
pass_claims is now the fixture function of the SDK-neutral hosted-mode conformance harness (vgi test/hosted/), which every SDK implements the same way: main.pass_claims(x BIGINT) -> VARCHAR, each row the JSON object {"principal", "domain", "claims"}. Returning the claim set as verified, rather than a hand-picked subset, lets the harness check every contract claim (federated_iss/_sub, iat, nbf, jti were missing) and gives the other SDKs one rule to copy: serialize the auth context claims. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 7e83f1a commit 85ae674

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

‎vgi/_test_fixtures/orchard_hosted.py‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,19 @@
2020
from vgi.scalar_function import ScalarFunction
2121
from vgi.worker import Worker
2222

23-
#: The Pass claims ``pass_claims`` returns, when present.
24-
PASS_CLAIM_NAMES = ("sub", "kind", "email", "email_verified", "name", "org_id", "org_name", "client_id", "exp")
25-
2623

2724
class PassClaimsFunction(ScalarFunction):
28-
"""Return the caller's verified Pass claims as a JSON object.
25+
"""Return the caller's identity and verified Pass claims as JSON.
26+
27+
This is the fixture function of the SDK-neutral hosted-mode conformance
28+
harness (the extension repo's ``test/hosted/README.md``), which every
29+
SDK's hosted fixture worker implements the same way:
30+
``main.pass_claims(x BIGINT) -> VARCHAR``, one output row per input row,
31+
each row the JSON object ``{"principal": <principal>, "domain": <auth
32+
domain>, "claims": <the verified claim set>}``.
2933
3034
Claims keep their JSON types: ``email_verified`` is a boolean and ``exp``
31-
a number, so the test can tell a real boolean from the string ``"true"``.
35+
a number, so the harness can tell a real boolean from the string ``"true"``.
3236
3337
SQL: ``SELECT pass_claims(1)``
3438
"""
@@ -44,10 +48,9 @@ def compute(
4448
x: Annotated[pa.Int64Array, Param(doc="dummy input")],
4549
auth: Annotated[AuthContext, Auth()],
4650
) -> Annotated[pa.StringArray, Returns()]:
47-
"""Return selected claims plus the principal and auth domain."""
48-
claims = {name: auth.claims[name] for name in PASS_CLAIM_NAMES if name in auth.claims}
51+
"""Return the verified claims plus the principal and auth domain."""
4952
payload = json.dumps(
50-
{"principal": auth.principal, "domain": auth.domain, "claims": claims},
53+
{"principal": auth.principal, "domain": auth.domain, "claims": dict(auth.claims)},
5154
sort_keys=True,
5255
)
5356
return pa.array([payload] * len(x))

0 commit comments

Comments
 (0)