Skip to content

feat(code): cloud functions — list / qualifiers / invoke / event-sample / runs - #46

Merged
Domantas merged 2 commits into
mainfrom
audit/code
Oct 12, 2026
Merged

Domantas merged 2 commits into
mainfrom
audit/code

Conversation

@Domantas

Copy link
Copy Markdown
Contributor

What changed

  • hub.code (sync and async): the five Code-function routes of the gateway contract — get_code_functions (GET /{version}/code/functions), get_code_function_qualifiers (GET …/qualifiers), invoke_code_function (POST …/invoke), get_code_function_event_sample (GET …/event-sample), get_code_function_runs (GET …/runs). Written in the generated style (**request → query for GET, JSON body for POST).
  • norbix_python.functions: parse_function_event(raw) → FunctionEvent (a wrapper over the decoded envelope, specVersion "1"), typed context (run_as.access_token, hub_url, api_url, …), the views as_database_record_change(), as_user_change(), as_file_change(), as_payment(), as_scheduled_task(), as_ai_usage(), payload(), and client_options() → the Norbix / AsyncNorbix constructor kwargs for the run-as user. Exported from the package. No DTO is hand-written: the generated types stay in references/hub_dtos.py.
  • Docs: docs/hub/code.md (new; index row), README "Cloud functions".

Tests

  • uv run pytest: 1094 passed (was 1066; +28: five routes × sync / async + surface, seven envelope samples, refusals, a client built from an event).
  • uv run ruff check ., uv run mypy src: clean.
  • No dependency change (uv.lock untouched).

Context

  • Gateway contract: docs/architecture/Code.Functions.md §3.3, §3.4, §4, §5.1, §7 (branch audit/code); task gateway docs/tasks/code-functions.md (branch audit/code).
  • Expected release: minor (1.1.1 → 1.2.0).

🤖 Generated with Claude Code

Domantas and others added 2 commits October 12, 2026 13:52
…velope types, Fake provider

references/hub_dtos.py refreshed in place with x python (BaseUrl swapped to the
campaign gateway's ephemeral port, header restored): the five code/functions
requests, the CodeFunction* envelope types, FunctionRefDto,
TriggerActionCodeDto.function_ref, CodeProvider.Fake, FakeCodeIntegration*.
AiScopeDto and OAuthAuthorizeDecisionRequest drop out — the gateway no longer
has them. references/api_dtos.py kept: the Api metadata no longer exports the
18 JsonSchemaFieldDto subclasses. hub/code.py has no methods for the new
routes: scripts/generate_endpoints.py is not on disk.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…le / runs

The five Code-function routes of the gateway contract (Code.Functions.md
§3.3, §3.4, §5.1) on `hub.code`, sync and async: `get_code_functions`,
`get_code_function_qualifiers`, `invoke_code_function`,
`get_code_function_event_sample`, `get_code_function_runs`.

`norbix_python.functions`: `parse_function_event(raw)` reads the envelope a
cloud function receives (`CodeFunctionEventDto`, specVersion "1") into a
`FunctionEvent` — a wrapper over the decoded dict with a typed `context`
(`run_as.access_token`, `hub_url`, `api_url`, …), the views
`as_database_record_change()`, `as_user_change()`, `as_file_change()`,
`as_payment()`, `as_scheduled_task()`, `as_ai_usage()`, `payload()`, and
`client_options()` → the `Norbix` constructor kwargs for the run-as user.
No DTO is re-declared; the generated types stay in `references/hub_dtos.py`.

Tests: the five routes (verb, path, query, body; sync + async), one envelope
sample per source, bad specVersion / non-object refusals, a client built from
an event calling the envelope's deployment. Docs: `docs/hub/code.md`, README
"Cloud functions".

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@Domantas
Domantas merged commit 32b22a9 into main Oct 12, 2026
9 checks passed
@Domantas
Domantas deleted the audit/code branch October 12, 2026 11:14
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.

1 participant