feat(types): publish all 15 meta-tool definitions; conformance sees enums and embedded shapes (ent#933) - #126
Conversation
…nums and embedded shapes (ent#933) Core-side sync of the published contract with the managed runtime, after the ent#932 runtime reconciliation landed: - SHARED_META_TOOL_DEFINITIONS now publishes the full 15-tool surface (was 3: the invoice/notify/pay demo tools). codespar_wallet and codespar_kyc — which had no published definition at all — are included, with property sets, types, and required arrays mirroring the runtime. - codespar_pay aligned with the ent#932 decision: method vocabulary is pix/card/boleto/wire as a structured enum (no sepa/usdc/ted), and the recipient property publishes the runtime's dual string-or-bank-account- object capability. Managed-only extras (boleto_quote, DICT lifecycle, expected_amount_minor) stay out of the shared baseline by design. - Closed vocabularies now live in structured `enum` arrays (and embedded shapes in nested `properties`), mirrored into contract.enums, so a conformance test compares them structurally instead of trusting prose. - New meta-tool-definition-conformance.ts: definitionViolations() checks contract/schema drift, enum well-formedness, enum-vs-prose agreement, and ghost rails (sepa/ted banned everywhere; usdc only enum-owned or in a codespar_crypto_pay redirect sentence). sharedDefinitionConformanceReasons() is the cross-runtime comparator: the historical structural check plus enum honoring (extend, never shrink), embedded-shape matching, and a retired-rail sweep of runtime prose. Tripwire tests prove each check fails on the exact drift the ent#933 audit found, with positive controls for the allowed cases. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BtvPxidmzsA22yoVJSWdba
…/nanoid/qs Unblocks the CI security-audit step, red on every PR since the new advisories landed (same failure on PR #124's run; main's last CI run predates them). Lockfile-only, all within existing semver ranges; turbo build 18/18 and test 36/36 green after the bump. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BtvPxidmzsA22yoVJSWdba
|
ATENÇÃO LANE DE REVISÃO: tratar como changes_needed. Revisão de alto nível (high effort) rodada em paralelo pela sessão dispatcher; achados 1-3 PROVADOS POR EXECUÇÃO contra os schemas do runtime em origin/main. Oito achados; o 4 e o 8 seguram o merge, o 1-3 esvaziam o propósito do PR. BLOCKER 4 — contrato autocontraditório em recipient (meta-tool-definitions.ts:219): publicado como type string com descrição mandando passar OBJETO ('do not JSON-stringify it'). Cliente que valida schema (MCP estrito, OpenAI strict mode, gateway ajv) rejeita exatamente o uso correto — a capability manchete que este PR existe pra publicar morre nos clientes bem-comportados — e o check de igualdade de tipo do comparator agora OBRIGA todo runtime a manter a mentira. Fix: expressar a união de verdade (evoluir MetaToolInputProperty para oneOf/type múltiplo, com o runtime junto) ou publicar recipient como object com os campos nomeados e um campo alternativo para a forma string; o que não pode é type e prosa se contradizerem. BLOCKER 8 — lockfile bumpa dependências alheias num PR de types (hono 4.12.32→4.13.5, fast-uri, ip-address, qs, nanoid 3.3.16→3.3.18). O precedente é o outage de 02/09 (nanoid, CI verde, 15h fora). Regenerar o lock sem os floating updates, ou separar num chore próprio revisado. Esvaziam o propósito (provados por execução):
Também aplicar: 5. duas fontes de verdade DENTRO do próprio packages/types (MANAGE_CONNECTIONS_CONTRACT diz closed set de 3 actions; a definition publica 7) sem teste cruzando META_TOOL_CONTRACTS x SHARED_META_TOOL_DEFINITIONS — adicionar o teste de consistência + corrigir o comentário; 6. checagem de shape aninhado é unidirecional (extra aninhado do runtime não é policiado — o drift publicado-sem-implementação se esconde um nível abaixo); 7. sentence splitter do usdc-redirect quebra em 'e.g.' (falso fail) e não quebra em '!'/'?' (falso pass) — usar segmentação melhor ou janela por token. Positivo confirmado pra ninguém re-litigar: as 15 definitions passam definitionViolations com zero violações, o runtime de origin/main passa o comparator nas 15, sem colisão de exports, Python sem vocabulário espelhado, e sem version bump é o processo normal do repo. Convertendo em DRAFT até 4 e 8 saírem; ao resolver, gh pr ready 126 e fluxo normal. 🤖 Generated with Claude Code |
…aries (ent#933 review)
Adversarial-review fix on top of the 15-definition publish: the typed
wire shapes in types.ts still carried the pre-#932 vocabularies, so the
same package contradicted its own definitions —
- PayArgs.method advertised "wallet" (charge's vocabulary — never a pay
rail) and hid "wire"; now pix/card/boleto/wire per the ent#932 enum.
- PayArgs.recipient was string-only; now string | PayBankAccountRecipient
({bank, account, branch, tax_id, name, account_type?}), the runtime's
manual Pix cash-out object form the definition publishes. Also adds the
mandateId + linha_digitavel fields MetaPayArgs carries.
- KycArgs.check_type hid onboarding / onboarding-business / status (the
account-provisioning rails); now all seven, plus the verification_id /
document_number / consumer_id fields the definition publishes.
- ChargeArgs.method (TS) and ChargeMethod (Python) hid "wallet", which
the runtime's charge coercer accepts and the published enum names.
New pin tests make the drift mechanical: Record<Union, true> literals
fail typecheck when a TS union gains/loses a value, and fail at runtime
when the published enum drifts from the same keys — both directions, for
pay/charge/kyc/ship/ledger/issue/shop, plus a field-for-field pin of the
bank-account recipient object against the published prose.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BtvPxidmzsA22yoVJSWdba
|
Revisão adversarial (protocolo): APROVADO com um fix adicionado na branch. Verificado contra o runtime em codespar-enterprise origin/main:
Fix adicionado (commit 6d050b3): os wire-shape types do MESMO pacote contradiziam as definições recém-publicadas — PayArgs.method anunciava "wallet" (vocabulário do charge, nunca um rail do pay) e escondia "wire"; PayArgs.recipient era string-only (sem o objeto bank-account do cash-out manual); KycArgs.check_type escondia onboarding/onboarding-business/status; ChargeArgs/ChargeMethod escondiam "wallet". Alinhados + testes de pin bidirecionais (Record<Union, true> vs enum publicado) para pay/charge/kyc/ship/ledger/issue/shop. CI: ci/gitleaks/smoke/3 validates verdes. Os 4 validate-example vermelhos são ambientais e pré-existentes — provado pelo PR de controle #127 (empty commit, tree idêntico ao main): os MESMOS 4 jobs falham no tree de main hoje (imagem externa ghcr.io/codespar/codespar:main não fica saudável), e o ci de main também falha no audit que o bump de lockfile deste PR conserta. Mergeando conforme o protocolo. |
Core-side item of codespar/codespar-enterprise#933 (drift triplo between the runtime schema and @codespar/types). Built on the final runtime schemas at enterprise origin/main, after ent#932 / enterprise PR #943 landed.
What changed
1.
@codespar/typesaligned with the runtimecodespar_paymethod vocabulary is the ent#932 decision —pix, card, boleto, wireas a structuredenum;sepa/usdc/tedare gone from the published surface (usdc redirects tocodespar_crypto_payin prose, per the runtime).recipientpublishes the runtime's dual capability: a Pix key string OR a bank-account object for manual Pix cash-out (the capability the audit found homologated but unpublished), with a test pinning it.boleto_quote, the DICT claim lifecycle,expected_amount_minor) stay out of the shared baseline by design — they are the enterprise conformance test's allowlisted extras.2.
SHARED_META_TOOL_DEFINITIONSpublishes the full 15-tool surface (was 3)All fifteen agent-facing tools, including
codespar_wallet(cash-in B.5) andcodespar_kyc(B.1), which previously had no published definition at all. Property sets, per-property types, and required arrays mirror the runtime exactly, so the enterprise conformance loop passes over all 15 on the next types bump. Provider-routing prose was kept runtime-agnostic (definitions carry no routing).3. Conformance now sees enums and embedded shapes — prose can no longer hide drift
enumarrays, mirrored intocontract.enums; embedded object shapes (e.g.counterparty.country) into nestedproperties.meta-tool-definition-conformance.ts:definitionViolations()— contract/schema drift, enum well-formedness, enum-vs-prose agreement (every enum value must be visible in the property description), and a ghost-rail sweep (sepa/tedbanned in all published prose;usdconly enum-owned or inside acodespar_crypto_payredirect sentence).sharedDefinitionConformanceReasons()— the cross-runtime comparator: the historical structural check plus shared-enum honoring (a runtime may extend a vocabulary, never shrink it, and its prose may not hide a shared value), embedded-shape matching, and a retired-rail sweep over runtime prose (this is what would have flagged the pre-#932 TED advertisement living in the runtime'srecipientdescription).pix, card, usdc, boleto, sepa, wireprose) and prove each check fails on it, with positive controls for the allowed cases.Verification
packages/types:tsc --noEmitclean;vitest run142/142.turbo run build18/18,turbo run test36/36.\bsepa\b/\bted\b: clean, so the comparator is adoptable enterprise-side without false positives.Out of scope (left on ent#933)
@codespar/typespin and (optionally) adoptingsharedDefinitionConformanceReasonsinmeta-tool-conformance.test.ts.pay.mdxdocs (repo web) and the checkout coercer accepting card/boleto that die inno_eligible_providers(flagged in the ent#933 adendo).Part of codespar/codespar-enterprise#933.
Generated with Claude Code
https://claude.ai/code/session_01BtvPxidmzsA22yoVJSWdba