Files
zeekay d025eaf7ea name the person a call spends for, and the host that served it
A spend row could say what a call cost and not who caused it. The credential
that placed the call was written into the user column, so an application —
a program, which cannot owe anyone money — read as the customer. Over half a
month's inference arrived attributed to a service account, and the query for
unattributed spend found nothing, because by that column every row had an owner.

bind is now the one place a record learns its principal, replacing a name
written at each of 35 emit sites. Only a person is named: a person's credential
names itself and no header can move it, a machine is recorded as the agent and
names whoever the identity boundary authenticated before it, and a machine
naming nobody leaves the column empty and says so. Attribution stays separate
from settlement — naming a person never moves money.

Alongside it the row gained the host that answered, the credential ref, and the
conversation. Provider is our label for a route; origin is the address the bytes
went to. Two columns can disagree, and that disagreement is the measurement —
a customer sees the label, and we can still see who served it.

The schema was stated in three places said to be kept in lockstep by comment,
and four columns were declared, documented, populated on the record, and written
by nothing. Empty is indistinguishable from unused, so they read as no-data.
The write order is now one list the statement derives from, and tests fail on
a column that is declared and never written.
2026-08-13 13:20:08 -07:00

55 lines
1.9 KiB
Go

// Copyright 2023-2026 Hanzo AI Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package object
import (
"net/url"
"strings"
)
// Origin is the host that answered — the hostname of the provider's ProviderUrl.
//
// A provider's NAME is our own label for a route, and a label outlives the thing
// it names: rename the vendor, repoint the URL, and the ledger keeps writing the
// old word forever with nothing on the row able to disagree. The URL is the
// address the bytes actually went to, so a row carrying both can be asked whether
// they still agree, and the answer is a measurement rather than a belief.
//
// Only the host is kept. The path and the key are route detail; the host is the
// party on the other end, which is the question a spend row has to answer.
//
// Empty when a provider declares no URL — a family served from deployment config
// has no address to name here, and saying nothing is the honest form of that.
func (p *Provider) Origin() string {
if p == nil {
return ""
}
raw := strings.TrimSpace(p.ProviderUrl)
if raw == "" {
return ""
}
// A bare host:port parses as a path, not an authority. Give it the scheme the
// Ollama normalization in provider.go already gives it, so "localhost:11434"
// answers with a host instead of an empty string.
if !strings.Contains(raw, "://") {
raw = "http://" + raw
}
u, err := url.Parse(raw)
if err != nil {
return ""
}
return u.Hostname()
}