Files
zeekayandHanzo Dev 8efed70ea2 fix(six): one word, one body, one shape across the three SDKs
Thirteen places where this SDK and the other two answered the same question
differently. Every one is now what the served handler reads, or what HIP-0044
says where the handler is silent.

Measured against the server, not inferred:

- search speaks kinds, not doctype addresses. `/v1/search` matches `doctypes`
  against kb.page, kb.memory and kb.source EXACTLY and silently drops anything
  else (knowledge/subsystem.go, sanitizeDocTypes), so Opts{Kinds: ["page"]} —
  the word the contract uses — was narrowing the query to nothing at all. The
  kind maps to the address on the way out and back on the way in, and a doctype
  from another corpus passes through untouched. kb.Doctype and kb.Kind are the
  one place either spelling appears.
- kb.Put lets the store decide whether a document exists. kb.page is autonamed
  `field:slug`, so a page IS its name and carries one whether it exists or not:
  reading a present name as "it exists" left no way to create a page — the PUT
  404s forever and a POST with no slug is refused for the missing field. The PUT
  goes first and a 404 is followed by the POST.
- A write body is field data and nothing else. The framework validates against
  DocType.Fields and drops what it does not declare, and `name` is not a field
  of any of the three: a page is named from `slug`, a memory and a source are
  hash-named. `url` belongs to a source. An empty field is left out so the
  doctype names the required one that is missing.
- kb.Filter takes Order, and Links takes a project. `/v1/framework/{doctype}`
  serves order_by and `/v1/knowledge/graph` serves ?project=; only one SDK had
  either.
- Import takes (format, data, project). Two values and an option are not an
  aggregate, so kb.Export is gone.
- policy_denied and entitlement_required do not exist. Neither string appears
  anywhere in hanzoai/cloud, so a 403 read as denied on one of them would hand
  an unauthenticated caller a cure for a refusal nobody made. The 403 refusal
  set is insufficient_balance and spend_cap_exceeded, the two cloud emits.
- A 402 with no readable body carries no code. payment_required is a real code
  — it is the `error` member of every cloud.Refusal — so writing it where the
  body said nothing made the spend gate's refusal and an unparseable body the
  same value.

And where the shape had drifted from what a reader needs:

- Money counts minor units, not cents: hundredths for USD, whole yen for JPY,
  thousandths for KWD, and "cents" is false for two of those three.
- Balance.Reserved, not Held. The wire says `holds`; `held` is an arm of an
  answer, and one word for two facts is what the naming rule prevents.
- Vocabulary.Rules, because it is a list. The wire member stays `rule`.
- audit.List reports the server's own count. A per-page count under a Request
  filter is not "what the filter matched across every page", and All now counts
  what the server sent against that total rather than what survived a narrowing
  the server never made — so a request filter stops scanning the whole trail.
- A client with no credential fails at the first call, not silently. It used to
  present nothing and let the gateway answer 403, which reads as "your org may
  not do that" rather than "this process never said who it is".

HIP-0044 is amended where the code was right and the document was not: the
authz body spelling, Allowance.spent as a boolean, the wire's `holds`, put's
method choice, Fact's three read-only members, and the name of the fourth
outcome.

go build, go vet, go test ./... and gofmt -l . all clean.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-10 16:24:40 -07:00
..