Skip to content

fix(console): route Models and OKF through consumer GraphQL - #203

Merged
Travis-Gilbert merged 1 commit into
mainfrom
fix/console-models-consumer-door
Aug 17, 2026
Merged

fix(console): route Models and OKF through consumer GraphQL#203
Travis-Gilbert merged 1 commit into
mainfrom
fix/console-models-consumer-door

Conversation

@Travis-Gilbert

@Travis-Gilbert Travis-Gilbert commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • route Console Models and OKF through authenticated consumer HTTP GraphQL instead of Harness MCP GraphQL
  • resolve the authenticated principal before any endpoint or fallback decision
  • allow LocalDevDeclaredModelStore only when the consumer endpoint is unset, only outside production, and only after authenticated tenant resolution
  • fail closed in production and never fall back after a configured upstream failure
  • validate expected GraphQL operation fields, including named 502 handling for malformed OKF responses
  • add a regression gate across the full Models route family and both server adapters

Backend dependency

Depends on Theorem PR https://github.com/Travis-Gilbert/Theorem/pull/515.

The backend PR must merge and deploy before this consumer branch is deployed. Its commonplace-api schema provides the Models and OKF fields used here.

Authentication note

Tenant identity is credential-derived, not supplied as a client GraphQL argument. The configured owner tenant can still use the existing service-key fallback until principal-token issuance is available across the deployment. That broader identity closure remains follow-up plan work and is not represented here as already solved.

Validation

Passed:

  • focused Vitest: 3 files, 18 tests
  • data-door gate tests: 3/3
  • live deny-list scan: 10 files
  • focused ESLint over all changed implementation, test, and gate files
  • git diff --check
  • editor diagnostics
  • final read-only peer review with no blocker

Not run:

  • authenticated canonical-host smoke against https://v2.theoremharness.com
  • consumer deployment probe, because Theorem PR 515 is not merged and deployed yet

Door boundary

Product data now uses commonplace-api HTTP GraphQL. Harness MCP remains available for agent control, planning, coordination, and memory, but is not a Models or OKF data fallback.

Summary by CodeRabbit

  • New Features

    • Added authenticated data API support for Models and OKF operations, including previews, exports, imports, schema declarations, and unpinning.
    • Added local development model storage with starter schemas and tenant/topic isolation.
    • Added clearer handling for authentication, configuration, timeout, connectivity, and upstream API errors.
  • Bug Fixes

    • Improved validation and response handling for Models and OKF requests.
  • Tests

    • Added automated coverage for API routes, local development behavior, error scenarios, and live model data checks.
    • Added safeguards preventing unsupported access paths.

Copilot AI lite review requested due to automatic review settings August 10, 2026 04:59
@ecc-tools

ecc-tools Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The Console now routes OKF and observed-model operations through authenticated consumer GraphQL. It adds a tenant-scoped local development model store, fallback behavior, acceptance tests, an opt-in live smoke test, and a Models data-door validation gate.

Changes

Models consumer GraphQL flow

Layer / File(s) Summary
Consumer GraphQL transport and OKF routing
apps/console/src/lib/server/consumer-graphql-client.ts, apps/console/src/app/api/observed-model/okf/route.ts, apps/console/src/app/api/observed-model/okf/route.test.ts
The authenticated client validates configuration, credentials, expected fields, timeouts, and upstream responses. The OKF route uses GraphQL queries and mutations for preview, export, and import actions.
Local development model storage
apps/console/src/lib/server/local-dev-declared-model-store.ts, apps/console/src/lib/server/local-dev-declared-model-store.test.ts
The server-only store maintains starter models and tenant/topic state. It supports schema declaration, replacement, version supersession, object-type removal, reads, and resets.
Observed-model GraphQL integration and fallback
apps/console/src/lib/server/observed-model-harness.ts, apps/console/src/lib/server/observed-model-harness.test.ts
The harness uses the consumer client with expected response fields. Selected unconfigured non-production reads and mutations use the local store. Tests cover authentication, fallback, errors, and mutation payloads.
Models data-door validation and evidence
apps/console/scripts/check-models-data-door.mjs, apps/console/scripts/check-models-data-door.test.mjs, apps/console/package.json, apps/console/src/lib/server/observed-model.live.test.ts, docs/records/011-console-single-door.md
The data-door script scans Models-related sources for forbidden agent-door and MCP references. Package scripts run the gate and its tests. Live smoke coverage and cutover evidence cover the updated routing.
Estimated code review effort: 4 (Complex) ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant OKFRoute as OKF route
  participant ConsumerClient as executeConsumerGraphql
  participant ConsumerAPI as Consumer GraphQL API
  OKFRoute->>ConsumerClient: Submit OKF query or apply mutation
  ConsumerClient->>ConsumerAPI: Send authenticated tenant-scoped request
  ConsumerAPI-->>ConsumerClient: Return GraphQL response
  ConsumerClient-->>OKFRoute: Return mapped HTTP result
Loading

Possibly related issues

  • Travis-Gilbert/Theorem issue 389 — The change replaces obsolete harness MCP and direct GraphQL routing with authenticated consumer GraphQL calls.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: routing Console Models and OKF through consumer GraphQL.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/console-models-consumer-door

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR moves the Console “Models” and OKF data paths off Harness MCP GraphQL and onto the authenticated CommonPlace consumer HTTP GraphQL endpoint, adding a local-dev-only stand-in when the consumer endpoint is unconfigured and strengthening guardrails via tests and a new deny-list gate.

Changes:

  • Add an authenticated consumer GraphQL transport (executeConsumerGraphql) with expected-field validation and standardized failure reasons.
  • Route observed/declared model reads + mutations and OKF bundle operations through the consumer GraphQL transport, with a non-production local fallback only when the consumer endpoint is unconfigured.
  • Add regression coverage (Vitest + live smoke) and a Models data-door gate that rejects agent-door imports/endpoint references across the Models route family.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docs/records/011-console-single-door.md Updates the single-door record to include Models/OKF routing and the new Models deny-list gate.
apps/console/src/lib/server/observed-model.live.test.ts Adds an opt-in live smoke test for the deployed Models route.
apps/console/src/lib/server/observed-model-harness.ts Switches Models GraphQL adapter from harness transport to consumer HTTP GraphQL + local-dev fallback.
apps/console/src/lib/server/observed-model-harness.test.ts Adds acceptance tests for Models transport behavior, fallback, and response validation.
apps/console/src/lib/server/local-dev-declared-model-store.ts Introduces an in-memory LocalDevDeclaredModelStore stand-in for unconfigured consumer endpoints (non-prod only).
apps/console/src/lib/server/local-dev-declared-model-store.test.ts Adds unit tests for the LocalDevDeclaredModelStore behavior and tenant/topic isolation.
apps/console/src/lib/server/consumer-graphql-client.ts Adds shared authenticated consumer GraphQL HTTP client with required-field validation.
apps/console/src/app/api/observed-model/okf/route.ts Routes OKF preview/export/import through consumer GraphQL fields (okfModel, okfModelApply).
apps/console/src/app/api/observed-model/okf/route.test.ts Adds acceptance tests for OKF route behavior and invalid-response handling.
apps/console/scripts/check-models-data-door.test.mjs Adds node:test coverage for the Models data-door gate (positive + deliberate-failure cases).
apps/console/scripts/check-models-data-door.mjs Adds a gate script to forbid agent-door references within the Models route family + adapters.
apps/console/package.json Wires the new Models data-door gate into test and gates.
Suppressed comments (1)

apps/console/src/lib/server/local-dev-declared-model-store.ts:299

  • unpinLocalDevDeclared filters relations using relation.id !== declaredId, but declaredId is an object type id (e.g. ot:...) while relation ids are rel:..., so this condition is redundant and misleading. Filtering on objectTypeId / targetObjectTypeId is sufficient.
  const relations = bucket.declared.relations.filter(
    (relation) =>
      relation.id !== declaredId
      && relation.objectTypeId !== declaredId
      && relation.targetObjectTypeId !== declaredId,

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +231 to +242
const prior = bucket.declared.objectTypes.find((type) => type.key === key);
const objectTypes = prior
? bucket.declared.objectTypes.map((type) => (type.id === prior.id ? { ...objectType, id: prior.id } : type))
: [...bucket.declared.objectTypes, objectType];
const resolvedId = prior?.id ?? objectTypeId;
const nextFields = [
...bucket.declared.fields.filter((field) => field.objectTypeId !== resolvedId),
...fields.map((field) => ({ ...field, objectTypeId: resolvedId, id: `f:${key}:${field.key}` })),
];
const nextObjectTypes = objectTypes.map((type) =>
type.id === resolvedId ? { ...objectType, id: resolvedId } : type,
);
| Models via data API | `observed-model-harness.ts` uses the authenticated consumer HTTP GraphQL client; authenticated `LocalDevDeclaredModelStore` substitution is allowed only outside production when no consumer endpoint is configured |
| OKF via data API | `/api/observed-model/okf` calls consumer `okfModel` and `okfModelApply` fields |
| Models deny-list | `gate:models-data-door` rejects agent-door imports and endpoint references across the Models route family and its consumer transport adapter |
| One data URL | Railway console: `CONSOLE_DATA_API_URL` reference to commonplace-api; `THEOREM_NODE_URL` and `THEOREM_GRAPHQL_URL` removed |

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (5)
apps/console/src/lib/server/local-dev-declared-model-store.ts (1)

284-300: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

unpinLocalDevDeclared ignores field and relation identifiers.

The filters treat declaredId as an object type id for objectTypes and fields. If a caller passes a field id such as f:customer:email, no field is removed, but lines 301-328 still bump the version and supersede the prior version. The harness unpinDeclared path then reports status: 'applied' for an unpin that changed nothing.

Add a field-id branch, or return the unchanged model without a version bump when declaredId matches nothing.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/console/src/lib/server/local-dev-declared-model-store.ts` around lines
284 - 300, The unpinLocalDevDeclared function must handle field and relation IDs
instead of always treating declaredId as an object type ID. Add matching logic
for field and relation identifiers, or return the unchanged model without
version/supersession updates when no object type, field, or relation matches;
ensure unpinDeclared reports no applied change for unknown IDs.
apps/console/src/lib/server/local-dev-declared-model-store.test.ts (1)

31-50: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for a repeated declaration of the same name.

The suite does not declare the same nameSingular twice. That case exposes the unreachable prior branch reported in apps/console/src/lib/server/local-dev-declared-model-store.ts lines 203-242, where the second declaration creates shipment_2. Add a test that asserts the intended behavior after the store fix.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/console/src/lib/server/local-dev-declared-model-store.test.ts` around
lines 31 - 50, Extend the test suite around declareLocalSchema with a repeated
declaration using the same nameSingular, such as shipment, after the initial
declaration in the existing test. Assert the intended result for the second
declaration, including the generated shipment_2 key and its declared status, so
the prior-branch behavior in declareLocalSchema is covered.
apps/console/src/lib/server/observed-model-harness.test.ts (1)

208-236: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for the mutation local development fallback.

The suite tests the unconfigured fallback only for readObservedModels. The new fallback branches in unpinDeclared (lines 844-861) and declareSchema (lines 878-890) of apps/console/src/lib/server/observed-model-harness.ts are not exercised. Add two tests with CONSOLE_DATA_API_URL unset that assert each mutation returns the local store result and that fetch is not called.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/console/src/lib/server/observed-model-harness.test.ts` around lines 208
- 236, Add separate tests for unpinDeclared and declareSchema with
CONSOLE_DATA_API_URL unset, covering their local-development fallback branches.
Assert each mutation returns the expected local store result and that fetch is
not called, alongside the existing observed-model harness tests.
apps/console/src/lib/server/consumer-graphql-client.ts (1)

110-120: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low value

Consider rejecting null expected fields.

hasOwnProperty accepts an explicit null value. A GraphQL error envelope with partial data, for example {"data":{"okfModel":null},"errors":[...]}, is already caught by the errors check. However, an upstream that returns {"data":{"okfModel":null}} with no errors passes validation. The OKF route then returns a null JSON body with status 200.

♻️ Proposed stricter field validation
     const missingField = expectedFields.find(
-      (field) => !Object.prototype.hasOwnProperty.call(payload.data, field),
+      (field) => payload.data?.[field] === undefined || payload.data[field] === null,
     );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/console/src/lib/server/consumer-graphql-client.ts` around lines 110 -
120, Update the expected-field validation in the response-checking function
around missingField so a field is considered invalid when it is absent or its
value is null. Preserve the existing 502 response, error prefix, and
upstream_error reason for either case, while continuing to accept present
non-null values.
apps/console/src/lib/server/observed-model-harness.ts (1)

825-829: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

pinObserved has no local development fallback, unlike unpinDeclared and declareSchema.

When the consumer endpoint is unset outside production, readObservedModels, readDeclaredModel, unpinDeclared, and declareSchema return local store results. pinObserved returns observed_model_graphql_unconfigured with status 404. restoreDeclaredModel, proposeSchemaChange, and compileDeclaredModel behave the same way. A developer can therefore declare and unpin object types locally but cannot pin an observed type.

Either add the fallback for pinObserved, or document which Models operations require a configured consumer endpoint.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/console/src/lib/server/observed-model-harness.ts` around lines 825 -
829, Update the pinObserved handler to detect an unset consumer endpoint outside
production and return the corresponding local-store result, matching the
fallback behavior used by unpinDeclared and declareSchema. Keep the
configured-endpoint path using executeGraphql with PIN_MUTATION unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/console/src/lib/server/local-dev-declared-model-store.ts`:
- Around line 203-242: Redefinition currently generates suffixed duplicate keys
because prior lookup occurs only after uniqueKey; in
apps/console/src/lib/server/local-dev-declared-model-store.ts:203-242, resolve
the existing object type using the raw slug before calling uniqueKey, then
remove the redundant prior lookup and no-op nextObjectTypes remap while
preserving the existing object type ID and fields on redeclaration. In
apps/console/src/lib/server/local-dev-declared-model-store.test.ts:31-50, add
coverage declaring the same nameSingular twice and assert the expected single
object type count and stable key.

In `@docs/records/011-console-single-door.md`:
- Line 66: The “One data URL” row incorrectly claims THEOREM_GRAPHQL_URL was
removed; update the row to limit that claim to the Models and OKF cutover or
explicitly state that Proactivity and Filing CommonPlace GraphQL flows still
require THEOREM_GRAPHQL_URL. Ensure those flows use THEOREM_GRAPHQL_URL and
never fall back to CONSOLE_HARNESS_URL.

---

Nitpick comments:
In `@apps/console/src/lib/server/consumer-graphql-client.ts`:
- Around line 110-120: Update the expected-field validation in the
response-checking function around missingField so a field is considered invalid
when it is absent or its value is null. Preserve the existing 502 response,
error prefix, and upstream_error reason for either case, while continuing to
accept present non-null values.

In `@apps/console/src/lib/server/local-dev-declared-model-store.test.ts`:
- Around line 31-50: Extend the test suite around declareLocalSchema with a
repeated declaration using the same nameSingular, such as shipment, after the
initial declaration in the existing test. Assert the intended result for the
second declaration, including the generated shipment_2 key and its declared
status, so the prior-branch behavior in declareLocalSchema is covered.

In `@apps/console/src/lib/server/local-dev-declared-model-store.ts`:
- Around line 284-300: The unpinLocalDevDeclared function must handle field and
relation IDs instead of always treating declaredId as an object type ID. Add
matching logic for field and relation identifiers, or return the unchanged model
without version/supersession updates when no object type, field, or relation
matches; ensure unpinDeclared reports no applied change for unknown IDs.

In `@apps/console/src/lib/server/observed-model-harness.test.ts`:
- Around line 208-236: Add separate tests for unpinDeclared and declareSchema
with CONSOLE_DATA_API_URL unset, covering their local-development fallback
branches. Assert each mutation returns the expected local store result and that
fetch is not called, alongside the existing observed-model harness tests.

In `@apps/console/src/lib/server/observed-model-harness.ts`:
- Around line 825-829: Update the pinObserved handler to detect an unset
consumer endpoint outside production and return the corresponding local-store
result, matching the fallback behavior used by unpinDeclared and declareSchema.
Keep the configured-endpoint path using executeGraphql with PIN_MUTATION
unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ef984433-0a95-4348-920d-42b277aa1994

📥 Commits

Reviewing files that changed from the base of the PR and between 1a76920 and 4085b76.

📒 Files selected for processing (12)
  • apps/console/package.json
  • apps/console/scripts/check-models-data-door.mjs
  • apps/console/scripts/check-models-data-door.test.mjs
  • apps/console/src/app/api/observed-model/okf/route.test.ts
  • apps/console/src/app/api/observed-model/okf/route.ts
  • apps/console/src/lib/server/consumer-graphql-client.ts
  • apps/console/src/lib/server/local-dev-declared-model-store.test.ts
  • apps/console/src/lib/server/local-dev-declared-model-store.ts
  • apps/console/src/lib/server/observed-model-harness.test.ts
  • apps/console/src/lib/server/observed-model-harness.ts
  • apps/console/src/lib/server/observed-model.live.test.ts
  • docs/records/011-console-single-door.md

Comment on lines +203 to +242
const key = uniqueKey(bucket.declared, slugify(input.nameSingular || input.labelSingular));
const objectTypeId = `ot:${key}`;
const contentAnchor = `local:${key}:v${bucket.versionSeq + 1}`;
const objectType: ObjectTypeMetadata = {
id: objectTypeId,
key,
label: input.labelSingular || input.nameSingular || key,
description: input.description,
nodeLabel: input.nodeLabel || input.labelSingular || key,
enforcement: input.enforcement,
nameSingular: input.nameSingular || key,
namePlural: input.namePlural || `${key}s`,
labelIdentifierField: input.labelIdentifierField || input.fields[0]?.key || 'id',
system: input.system,
contentAnchor,
provider: { kind: 'declared-record' },
};
const fields: FieldMetadata[] = input.fields.map((field) => ({
id: `f:${key}:${field.key}`,
objectTypeId,
key: field.key,
label: field.label,
...(field.description ? { description: field.description } : {}),
fieldType: field.fieldType,
required: field.required,
system: field.system,
}));

const prior = bucket.declared.objectTypes.find((type) => type.key === key);
const objectTypes = prior
? bucket.declared.objectTypes.map((type) => (type.id === prior.id ? { ...objectType, id: prior.id } : type))
: [...bucket.declared.objectTypes, objectType];
const resolvedId = prior?.id ?? objectTypeId;
const nextFields = [
...bucket.declared.fields.filter((field) => field.objectTypeId !== resolvedId),
...fields.map((field) => ({ ...field, objectTypeId: resolvedId, id: `f:${key}:${field.key}` })),
];
const nextObjectTypes = objectTypes.map((type) =>
type.id === resolvedId ? { ...objectType, id: resolvedId } : type,
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Re-declaration semantics in the local store are undefined and untested. uniqueKey on line 203 always returns a key that no object type uses, so the prior upsert branch on line 231 is unreachable and a repeated declaration creates a suffixed duplicate such as shipment_2.

  • apps/console/src/lib/server/local-dev-declared-model-store.ts#L203-L242: resolve the prior object type by the raw slug before calling uniqueKey, then remove the redundant prior lookup and the no-op nextObjectTypes remap.
  • apps/console/src/lib/server/local-dev-declared-model-store.test.ts#L31-L50: add a test that declares the same nameSingular twice and asserts the intended object type count and key.
📍 Affects 2 files
  • apps/console/src/lib/server/local-dev-declared-model-store.ts#L203-L242 (this comment)
  • apps/console/src/lib/server/local-dev-declared-model-store.test.ts#L31-L50
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/console/src/lib/server/local-dev-declared-model-store.ts` around lines
203 - 242, Redefinition currently generates suffixed duplicate keys because
prior lookup occurs only after uniqueKey; in
apps/console/src/lib/server/local-dev-declared-model-store.ts:203-242, resolve
the existing object type using the raw slug before calling uniqueKey, then
remove the redundant prior lookup and no-op nextObjectTypes remap while
preserving the existing object type ID and fields on redeclaration. In
apps/console/src/lib/server/local-dev-declared-model-store.test.ts:31-50, add
coverage declaring the same nameSingular twice and assert the expected single
object type count and stable key.

| Models via data API | `observed-model-harness.ts` uses the authenticated consumer HTTP GraphQL client; authenticated `LocalDevDeclaredModelStore` substitution is allowed only outside production when no consumer endpoint is configured |
| OKF via data API | `/api/observed-model/okf` calls consumer `okfModel` and `okfModelApply` fields |
| Models deny-list | `gate:models-data-door` rejects agent-door imports and endpoint references across the Models route family and its consumer transport adapter |
| One data URL | Railway console: `CONSOLE_DATA_API_URL` reference to commonplace-api; `THEOREM_NODE_URL` and `THEOREM_GRAPHQL_URL` removed |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Correct the THEOREM_GRAPHQL_URL claim.

Limit this row to the Models and OKF cutover, or state which flows still require THEOREM_GRAPHQL_URL. The current text says that the variable was removed, but Proactivity and Filing GraphQL requests must use it.

As per coding guidelines, use THEOREM_GRAPHQL_URL for Proactivity and Filing CommonPlace GraphQL requests. Never fall back to CONSOLE_HARNESS_URL.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/records/011-console-single-door.md` at line 66, The “One data URL” row
incorrectly claims THEOREM_GRAPHQL_URL was removed; update the row to limit that
claim to the Models and OKF cutover or explicitly state that Proactivity and
Filing CommonPlace GraphQL flows still require THEOREM_GRAPHQL_URL. Ensure those
flows use THEOREM_GRAPHQL_URL and never fall back to CONSOLE_HARNESS_URL.

Source: Coding guidelines

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4085b76b51

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

} {
const bucket = ensureBucket(topicId, tenant);
const objectTypes = bucket.declared.objectTypes.filter((type) => type.id !== declaredId);
const fields = bucket.declared.fields.filter((field) => field.objectTypeId !== declaredId);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove fields by their own ID when unpinning

When the consumer endpoint is unset outside production, the declared-fields UI submits field.id to this local fallback, but this predicate compares only field.objectTypeId with that ID. The field therefore remains in the registry even though the route returns an applied receipt and advances the schema version; filter by field.id as well while retaining the object-type cascade.

AGENTS.md reference: apps/console/AGENTS.md:L107-L107

Useful? React with 👍 / 👎.

readonly declared: DeclaredModel;
} {
const bucket = ensureBucket(topicId, tenant);
const key = uniqueKey(bucket.declared, slugify(input.nameSingular || input.labelSingular));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update the existing object during local field edits

When the consumer endpoint is unset outside production, applyFieldEdit rebuilds the declaration with the existing nameSingular and expectedContentAnchor, but this call always uniquifies a matching key, such as changing customer to customer_2. Every field edit therefore adds a second object type while leaving the original field unchanged despite reporting success; resolve an existing type before generating a unique key and replace that type's fields.

AGENTS.md reference: apps/console/AGENTS.md:L107-L107

Useful? React with 👍 / 👎.

RESTORE_MUTATION,
{ versionId },
'mutate',
['restoreDeclaredModel'],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore versions through the local development store

When the consumer endpoint is unset outside production, model reads expose the local store's version history and the UI enables its restore actions, but this operation has no equivalent local fallback and immediately returns the unconfigured 404. After any local declaration or unpin, users can select and compare those local versions but every Restore action fails; either restore the selected snapshot in LocalDevDeclaredModelStore or stop presenting its versions as restorable.

AGENTS.md reference: apps/console/AGENTS.md:L107-L107

Useful? React with 👍 / 👎.

@Travis-Gilbert
Travis-Gilbert merged commit 02e1087 into main Aug 17, 2026
6 of 10 checks passed
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.

2 participants