mainsequence 8.1.22.dev21__py3-none-any.whl → 8.1.23.dev24__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mainsequence-command-center-fastapi
3
- description: Build, contract-test, release, and verify a FastAPI code repository resource that serves the Command Center frontend. Use when a Main Sequence API must implement a wire contract defined by the mainsequence-sdk/command-center-sdk GitHub repository and then move through local testing, code-repository sync, image and resource resolution, FastAPI ResourceRelease creation, and deployed frontend validation.
3
+ description: Build, contract-test, release, and verify a FastAPI code repository resource serving the Command Center frontend, including applications with public OAuth callback or webhook routes. Use when implementing a Command Center wire contract, declaring exact public ingress, or validating the deployed API.
4
4
  ---
5
5
 
6
6
  # Command Center FastAPI Release Lifecycle
@@ -92,7 +92,7 @@ Record:
92
92
  - whether the API uses backend transport or a contract-defined direct
93
93
  development transport
94
94
 
95
- FastAPI releases receive the authenticated human from the Main Sequence
95
+ Authenticated FastAPI routes receive the human caller from the Main Sequence
96
96
  platform through injected request state. No SDK authentication setup is
97
97
  required in repository code:
98
98
 
@@ -111,21 +111,74 @@ def get_me(request: Request) -> dict[str, str | None]:
111
111
  }
112
112
  ```
113
113
 
114
- Route code must not detect local versus deployed execution, parse
115
- authentication headers, or resolve the request user itself. Consume only the
114
+ Protected route code must not detect local versus deployed execution, parse
115
+ authentication headers, or resolve the request user itself. Consume the
116
116
  platform-injected human caller identity:
117
117
 
118
118
  - `request.state.user` contains canonical `uid` and optional `username`
119
119
  - `request.state.user_uid` is the canonical public user UUID
120
120
  - `request.state.user_id` does not exist
121
121
 
122
- This identity is the human making the current HTTP request. It is not the
123
- release creator, deployment owner, runtime workload principal, or runtime
124
- target. Pass request state explicitly to shared services; do not use
125
- `User.get_logged_user()` as a FastAPI entry point. Platform-injected identity is
122
+ On a protected route, this identity is the human making the current HTTP
123
+ request. It is not the release creator, deployment owner, runtime workload
124
+ principal, or runtime target. Pass request state explicitly to shared services;
125
+ do not use `User.get_logged_user()` as a FastAPI entry point. Platform-injected identity is
126
126
  not resource authorization; use `request.state.user_uid` when applying the
127
127
  endpoint's authorization policy.
128
128
 
129
+ ### Public provider callbacks and webhooks
130
+
131
+ An external OAuth redirect or webhook cannot supply a Main Sequence Bearer token.
132
+ For a FastAPI release that needs one, use the platform's exact `public_ingress`
133
+ policy. CORS configuration and an app-declared route alone do not make a path
134
+ public. Ordinary routes remain Bearer authenticated.
135
+
136
+ 1. Implement the provider handler in the FastAPI app loaded by the workflow's
137
+ `source_path`. Declare only its exact `GET` or `POST` method and literal
138
+ root-relative path under the `kind: fastapi` resource's
139
+ `spec.public_ingress`. The policy is not inferred from decorators or OpenAPI.
140
+ Do not include query strings, route parameters, wildcards, or a hostname.
141
+ The default empty list exposes no public paths. In a validated workflow
142
+ resource, the declaration has this shape:
143
+
144
+ ```yaml
145
+ kind: fastapi
146
+ spec:
147
+ source_path: api/provider/main.py
148
+ public_ingress:
149
+ - method: GET
150
+ path: /integrations/provider/oauth/callback/
151
+ - method: POST
152
+ path: /integrations/provider/webhook/
153
+ ```
154
+
155
+ 2. Fetch the exact CodeRepositoryBranch's current workflow template; use its
156
+ advertised version and fields. Validate the proposed workflow file through
157
+ the branch's `validate-workflow` action, then commit the handler and workflow
158
+ file and push the intended branch. Do not set the reserved
159
+ `FASTAPI_PUBLIC_INGRESS` environment value yourself.
160
+ 3. Follow the repository event and DeploymentRun to a ready active revision.
161
+ A validated file or successful push is not proof of public admission. Read
162
+ `resource_release.get` and confirm the pair appears in both desired
163
+ `public_ingress` and active `effective_public_ingress`. Only then append the
164
+ declared path to the backend-returned `public_url` and register that full
165
+ callback or webhook URI with the provider. Do not construct a hostname.
166
+ 4. Send a provider-style request without a Main Sequence Bearer token to the
167
+ exact public pair. Check that an unlisted path or wrong method is denied.
168
+ An admitted request has `request.state.user` and `user_uid` set to `None`
169
+ and `request.state.auth_outcome == "public_ingress"`. The handler must verify
170
+ OAuth state and exchange codes, or verify the webhook signature against the
171
+ original body and reject replays. Public admission supplies no User or
172
+ provider identity. Keep provider secrets and live codes out of workflow YAML,
173
+ logs, and test evidence.
174
+
175
+ An existing release can change its desired policy through the canonical
176
+ `resource_release.update` operation. Adding a pair still requires a later ready
177
+ revision containing the route before it becomes public. Removing a desired pair
178
+ denies it immediately. The platform skill
179
+ `mainsequence://platform/skills/code-repository-workflows` owns the detailed
180
+ automatic deployment procedure and current workflow shape.
181
+
129
182
  ### 2. Implement the provider
130
183
 
131
184
  Keep Command Center contract-bearing route code focused on transport and
@@ -203,6 +256,7 @@ Verify that:
203
256
  - resource discovery found that path at the exact deployed commit
204
257
  - Django resolved and built the exact image for the workflow event
205
258
  - the resulting release kind is `fastapi`
259
+ - any declared `public_ingress` pair matches a mounted FastAPI handler
206
260
  - compute and spot settings are intentional
207
261
 
208
262
  Enable automatic deployment in the repository workflow when the route paths,
@@ -211,11 +265,13 @@ events to promote exact images.
211
265
 
212
266
  ### 6. Verify the deployed API
213
267
 
214
- Request runtime access for the deployed FastAPI `ResourceRelease` through
215
- Django and wait for Django's ready result. Use the returned access bundle for
216
- the deployed checks:
268
+ Request runtime access for protected routes on the deployed FastAPI
269
+ `ResourceRelease` through Django and wait for Django's ready result. Use the
270
+ returned access bundle for authenticated checks. For declared public routes,
271
+ use the provider URI without a Main Sequence Bearer token:
217
272
 
218
- 1. verify authentication behavior
273
+ 1. verify protected-route authentication and, when configured, exact
274
+ unauthenticated public-ingress method/path behavior
219
275
  2. execute representative contract-bearing requests
220
276
  3. validate returned JSON against the same repository-pinned schemas
221
277
  4. exercise the consuming Command Center frontend flow
@@ -235,6 +291,9 @@ Report:
235
291
  - Git commit, code repository image UID, code repository resource UID, and release identity
236
292
  - deployed contract validation and Command Center frontend result
237
293
  - whether automatic deployment is enabled and why
294
+ - for public provider routes, the declared method/path pairs, observed
295
+ `effective_public_ingress`, backend-returned provider URI, and unauthenticated
296
+ positive and negative request results
238
297
 
239
298
  The Command Center-facing release is complete only when the frontend consumes
240
299
  the deployed contract-bearing responses and they pass the contracts from the
@@ -620,14 +620,12 @@ class CodeRepositoryBranch(BasePydanticModel, BaseObjectOrm):
620
620
  idempotency_key: str,
621
621
  timeout: int | float | tuple[float, float] | None = None,
622
622
  ) -> GitHubIssueMutationResult:
623
- """Create an issue for the process-frozen branch without branch selectors."""
623
+ """Create an issue for this branch, subject to backend authorization."""
624
624
 
625
625
  from .github_issues import _create_github_issue_for_branch
626
626
 
627
- operation = "CodeRepositoryBranch.create_github_issue"
628
- branch_uid = self._resolved_github_issue_branch_uid(operation)
629
627
  return _create_github_issue_for_branch(
630
- branch_uid=branch_uid,
628
+ branch_uid=self.uid,
631
629
  title=title,
632
630
  body=body,
633
631
  idempotency_key=idempotency_key,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mainsequence
3
- Version: 8.1.22.dev21
3
+ Version: 8.1.23.dev24
4
4
  Summary: Main Sequence SDK
5
5
  Author-email: Main Sequence GmbH <dev@main-sequence.io>
6
6
  License-Expression: LicenseRef-MainSequence-Proprietary
@@ -1,6 +1,6 @@
1
1
  agent_scaffold/AGENTS.md,sha256=j5SVtoatkVknA8OSk75yRbCW2NTUBMpMIPnP0CI_Fi8,5840
2
2
  agent_scaffold/skills/a2a_sdk_execution/SKILL.md,sha256=NKtcXibE8TxZzKzz1KzJ2cVZ_EeuJJkb660U6wLvZ3s,11809
3
- agent_scaffold/skills/application_surfaces/api_surfaces/SKILL.md,sha256=HU-1VNC5n1aNMglgnw8iHbrRJAm3ovMuplQsc2uP2Kw,10633
3
+ agent_scaffold/skills/application_surfaces/api_surfaces/SKILL.md,sha256=d5rNM770cO2_iHlHuGrGmT-81w1QTb1zx6_z-Ni6IhE,13899
4
4
  agent_scaffold/skills/data_access/exploration/SKILL.md,sha256=2sw01_1F5fJw_iPGaiNCZP_pvjfp1b8hlc6OOiXFYNI,9313
5
5
  agent_scaffold/skills/data_publishing/meta_table_migrations/SKILL.md,sha256=_gHP3Rcbzxk8JbinVZcj6PAxNt6I3ALOSPgL1Jxh0Cg,7815
6
6
  agent_scaffold/skills/data_publishing/meta_tables/SKILL.md,sha256=gUrul2roVs0jAEpKHLlR74CsqlA9LjLkZzjwLcOEE0Y,21702
@@ -43,7 +43,7 @@ mainsequence/client/compute_validation.py,sha256=ByeX0CkIE7qq06ggZFfN92U3Qp2e9cv
43
43
  mainsequence/client/dtype_codec.py,sha256=0ydXPw0dWTVtUzmXoT6ilr2TM_vNC3WTiy3I8QI1ni8,16522
44
44
  mainsequence/client/exceptions.py,sha256=xx2L4l3OMNsTybbYkiTKK398ahnutEascM0It35tGr0,3815
45
45
  mainsequence/client/github_issues.py,sha256=pSTUw3UPrmE6wqnpoJctartTaNSq6iu6PQRrd8hip6I,14568
46
- mainsequence/client/models_foundry.py,sha256=rGaMjjQcpm7ieOnTpHN3KCPBspLfM-Yj8H1FBZw8jps,42524
46
+ mainsequence/client/models_foundry.py,sha256=4h_FG1mbJvKvGAcxhw5BYSOHh5_i9sPnd0Ixla2xu6g,42383
47
47
  mainsequence/client/models_helpers.py,sha256=GR1DDSeUDk8VpZYVROB_wMKb6WwfgjSs883Aqht92kc,45105
48
48
  mainsequence/client/models_user.py,sha256=l7t7q1nSa2kbLZ7dHbAjSpuRY8e9kWEjC8u3MK4Qfzw,41317
49
49
  mainsequence/client/observability.py,sha256=tDoy2NDcDrjeXFAHuxaylaMy2-NOuoN_arFdIOMppro,15842
@@ -84,9 +84,9 @@ mainsequence/meta_tables/time_index_table_updates/namespacing.py,sha256=obJfMnjL
84
84
  mainsequence/meta_tables/time_index_table_updates/runner.py,sha256=853p_iXJ835pI8pX3519HSdTw93Bqqd3JxHOfm3S6yg,34412
85
85
  mainsequence/meta_tables/time_index_table_updates/updaters.py,sha256=-6zJgi1sDRCyIyVxLwTfb2RLLZS4LC0syNJHnJRAtgU,31404
86
86
  mainsequence/meta_tables/time_index_table_updates/utils.py,sha256=O1iKp2tzCkqxyCblI6MKxez6XV180w87VszxDO9OfAE,621
87
- mainsequence-8.1.22.dev21.dist-info/licenses/LICENSE,sha256=fXoCKgEuZXmP84_QDXpvO18QHze_6AAhd-zvZBUjJxQ,4524
88
- mainsequence-8.1.22.dev21.dist-info/METADATA,sha256=A8CuQGB3JuFmvV6cyuugmwLAdKeIV3O8M8ZACaNk22A,7384
89
- mainsequence-8.1.22.dev21.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
90
- mainsequence-8.1.22.dev21.dist-info/entry_points.txt,sha256=XGAOq3-mF2lWWpeRJvoaWyMarRcK167mH1g124aGdUs,88
91
- mainsequence-8.1.22.dev21.dist-info/top_level.txt,sha256=BFeblM_Q9q0cUWBvTxnfWcWQEHtf5XZi9nOS-Gdfwus,28
92
- mainsequence-8.1.22.dev21.dist-info/RECORD,,
87
+ mainsequence-8.1.23.dev24.dist-info/licenses/LICENSE,sha256=fXoCKgEuZXmP84_QDXpvO18QHze_6AAhd-zvZBUjJxQ,4524
88
+ mainsequence-8.1.23.dev24.dist-info/METADATA,sha256=LslkAITjJv9-9xP1_2ZofJ3tadXJy-ah9cE4t53a5Ng,7384
89
+ mainsequence-8.1.23.dev24.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
90
+ mainsequence-8.1.23.dev24.dist-info/entry_points.txt,sha256=XGAOq3-mF2lWWpeRJvoaWyMarRcK167mH1g124aGdUs,88
91
+ mainsequence-8.1.23.dev24.dist-info/top_level.txt,sha256=BFeblM_Q9q0cUWBvTxnfWcWQEHtf5XZi9nOS-Gdfwus,28
92
+ mainsequence-8.1.23.dev24.dist-info/RECORD,,