Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

docs(oauth): pin the discovery contract-test mirrors to their producers (R1-L5)

Diego Zacariasa798d5edc332
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index 8e97d3837..7ef3d48ad 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.651",
+ "version": "0.1.652",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.651",
+ "version": "0.1.652",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/grok-provider-attempt-contract": "file:../packages/grok-provider-attempt-contract",
diff --git a/control-api/package.json b/control-api/package.json
index 2cdde3af5..74a6b4932 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.651",
+ "version": "0.1.652",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --git a/control-api/src/oauth/discovery.ts b/control-api/src/oauth/discovery.ts
index 38e0a9c6b..8f26b4e07 100644
--- a/control-api/src/oauth/discovery.ts
+++ b/control-api/src/oauth/discovery.ts
@@ -501,6 +501,11 @@ async function resolvePrm(
* `hasPreRegisteredClient` reflects operator config (a pre-registered Secret),
* defaulting to false — the C1 pilots (Notion/Canva/Linear/Sentry) have none and
* resolve to CIMD.
+ *
+ * Mirror: control-ui hand-copies this projection (the `detected` shape the remoteMcp
+ * route builds from this result) in test/fixtures/__tests__/remoteMcpDiscovery.contract.test.ts
+ * (projectDetected), because control-api is not importable there. A shape change here
+ * must be reflected in that copy or its fixtures certify a stale shape.
*/
export async function discoverRemoteOAuth(
mcpUrl: string,
@@ -857,6 +862,11 @@ function definedStringArray(value: unknown): string[] | undefined {
* fail-closed `deriveQuirks` rule (D4). Fields with no standard metadata
* (tokenRequestFormat, scopeSeparator, sendScope, includeResponseType,
* extraAuthorizeParams, refreshEndpoint) are never suggested here.
+ *
+ * Mirror: control-ui hand-copies this projection in
+ * test/fixtures/__tests__/genericDiscoveryPrefill.contract.test.ts (projectPrefill),
+ * because control-api is not importable there. A shape change here must be reflected
+ * in that copy or its fixtures certify a stale shape.
*/
export function buildGenericDiscoveryPrefill(result: AsDiscoveryResult): GenericDiscoveryPrefill {
const as = result.as
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 6865a96cc..b9eb2419e 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.656",
+ "version": "0.1.657",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.656",
+ "version": "0.1.657",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/frontend-components": "file:../packages/frontend-components",
diff --git a/control-ui/package.json b/control-ui/package.json
index 7b96cf2d8..d2758c14a 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.656",
+ "version": "0.1.657",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --git a/control-ui/test/fixtures/__tests__/genericDiscoveryPrefill.contract.test.ts b/control-ui/test/fixtures/__tests__/genericDiscoveryPrefill.contract.test.ts
index a28a80bcf..05f84b168 100644
--- a/control-ui/test/fixtures/__tests__/genericDiscoveryPrefill.contract.test.ts
+++ b/control-ui/test/fixtures/__tests__/genericDiscoveryPrefill.contract.test.ts
@@ -8,6 +8,12 @@ import { GENERIC_PREFILL_CASES } from '../genericDiscoveryPrefill'
* asserts each hand-derived `GenericDiscoveryPrefill` fixture equals it. A fixture value
* that drifts from the real server bytes fails here, so the fixtures cannot silently
* encode an invented shape (T1).
+ *
+ * DRIFT LIMIT: projectPrefill is a HAND MIRROR of buildGenericDiscoveryPrefill
+ * (control-api/src/oauth/discovery.ts). control-api is not importable from
+ * control-ui, so a change there does NOT fail this test on its own — it only catches
+ * fixture-vs-copy drift. Any edit to buildGenericDiscoveryPrefill must be reflected
+ * here. The producer carries the reverse pointer.
*/
function projectPrefill(prmJson: string, asJson: string): GenericDiscoveryPrefill {
const prm = JSON.parse(prmJson) as Record<string, unknown>
diff --git a/control-ui/test/fixtures/__tests__/remoteMcpDiscovery.contract.test.ts b/control-ui/test/fixtures/__tests__/remoteMcpDiscovery.contract.test.ts
index a564d5f98..e108e26bc 100644
--- a/control-ui/test/fixtures/__tests__/remoteMcpDiscovery.contract.test.ts
+++ b/control-ui/test/fixtures/__tests__/remoteMcpDiscovery.contract.test.ts
@@ -31,6 +31,14 @@ import {
* route) from the verbatim raw probe bytes and asserts each hand-derived
* `detected` fixture equals it. A fixture value that drifts from the real server
* bytes fails here, so the fixtures cannot silently encode an invented shape.
+ *
+ * DRIFT LIMIT: projectDetected is a HAND MIRROR of the producer logic
+ * (`discoverRemoteOAuth` + `selectRegistrationMode`/`deriveQuirks` in
+ * control-api/src/oauth/discovery.ts, shaped into `detected` by the remoteMcp.ts
+ * route). control-api is not importable from control-ui, so a change to that logic
+ * does NOT fail this test on its own — it only catches fixture-vs-copy drift. Any
+ * edit to the producer projection must be reflected here, or these fixtures certify
+ * a stale shape. The producer carries the reverse pointer.
*/
function projectDetected(prmJson: string, asJson: string): RemoteDetected {
const prm = JSON.parse(prmJson) as Record<string, unknown>