Skip to content

Project deployment rules and error codes from Go - #512

Merged
SaladDay merged 1 commit into
mainfrom
refactor/go-rule-projections
Oct 7, 2026
Merged

SaladDay merged 1 commit into
mainfrom
refactor/go-rule-projections

Conversation

@SaladDay

@SaladDay SaladDay commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

AGENTS.md says each rule has one authored definition, and other languages either generate it or check it against shared fixtures. The repository already does this in two ways: cmd/specification-contract, which projects Go to Python, and the node-diagnostics fixture. This change extends those two mechanisms to rules that TypeScript copied by hand. Two of those copies had drifted. This is T2a in the architecture audit.

  • Deployment contract.
    • specification-contract -write now also generates packages/agents-client/src/deployment-contract.ts: the resource bounds, the Runtime release patterns and the minimum disk size. The existing freshness test covers both outputs.
    • The hand copies in Web are deleted (runtime-release.ts, the inline bounds and patterns, and the numbers in the wizard help text).
    • Drift fixed: Web now requires oac-runtime@sha256:<64 hex> for microsandbox_ref, as Core does. It used to accept any image name.
  • Core error codes.
    • The single list is services/core/internal/api/testdata/core-errors.json (43 codes).
    • TestCoreErrorCatalog checks both directions. Every listed code must have a Go producer. Every literal code passed to the /core/v1 error writers must be listed, documented in wire-semantics.md, or excluded with a reason.
    • The core-errors.md tables (en and zh) and both Web locale message sets must equal the list exactly.
    • Ten codes that Core already produced but never documented or localized are added. sandbox_admin_not_configured, which had no producer, is deleted.
  • Model-provider protocol names.
    • modelprovider.Protocols() is the source, and the Harness catalog generator projects it into harness-catalog.ts.
    • Five TS copies now import it.
    • Drift fixed: core-error.ts was missing chat_completions.

Behaviour

  • Web localizes the 10 newly catalogued codes.
  • Web rejects a non-oac-runtime microsandbox_ref.
  • An allowed_protocols detail that includes chat_completions now gets the localized message.

Checks

  • specification-contract -write and make check-harness-catalog (no diff).
  • go build ./... and go vet ./....
  • Go tests for specification-contract, sandbox, api, modelprovider, harnessconfig and harness-catalog.
  • tsc for agents-client and Web, plus vitest (739 client tests, 384 Web tests).
  • Website translation test and check-names.py.

Net: code +54 lines (the generator wiring and 20 new locale messages); tests and fixture +192.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

The TypeScript client now reads the deployment bounds and Runtime release patterns from a projection that specification-contract generates from sandbox/deployment_contract.go, so Web accepts only Core's oac-runtime microsandbox reference. The Harness catalog generator projects the model-provider protocol names from internal/modelprovider, so every client copy includes chat_completions.

A shared catalog fixture lists every error code a /core/v1 or console caller can receive outside the wire vocabulary of wire-semantics.md. A Go test requires a producer for each listed code, an exact match with core-errors.md, and a catalog entry for every other code Core's error writers produce unless it never reaches an administration caller. Web tests require both locales to localize exactly those codes. The ten administration codes that were missing are now catalogued, documented and localized; the unproduced sandbox_admin_not_configured message is deleted, and the client-only sandbox_configuration_unconfirmed code is a named client constant.
@SaladDay
SaladDay merged commit 19d6d81 into main Oct 7, 2026
25 checks passed
@SaladDay
SaladDay deleted the refactor/go-rule-projections branch October 7, 2026 17:45
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