Skip to main content

internal/api

github.com/ensera-ai/taisce/internal/api · 28 files · 5453 lines · 155 tests · source

Package api is the wire boundary: the journey over HTTP rather than through Go packages.

Everything the spine does already exists and is reachable only by importing a package. The adapters are the product and they are not written in Go, so a contract they can bind to is the difference between a demonstrated design and a usable one.

What this package is allowed to decide

Transport, and nothing else. It parses, authorises, calls, and renders. Every correctness argument — the span rule, the closed vocabulary, the role policy, the residual count — lives below it and stays there. A handler that made one of those decisions would be a second place the rule exists, and the one that drifts is whichever is not the one with the test named after it.

Where it sits

Imports: internal/credential, internal/domain, internal/entitycandidate, internal/infra/pg, internal/notify, internal/passage, internal/recall, internal/reportcandidate

Imported by: cmd/taisce

Files

FileLinesDeclarationsWhat it is for
admission.go12110Admission bounds this process's HTTP work.
api.go121451Carries the package documentation.
artifacts.go11610
assertions.go482The credential supplies project and authorship.
auth_audit.go764refusedAuthBudget bounds anonymous ledger writes per server, without keeping an attacker-keyed map.
authorization.go512authorized runs after authentication, project checks and admission, but before parsing a body or executing memory work.
citation.go512
contexts.go1106contextRequest asks for one subject's history under a budget: the newest turns verbatim, the rest as the segments the compaction pass wrote.
contract.go37312Carries the package documentation.
corrections.go492Attribution comes from the credential and retained target; the body cannot replace either.
entities.go1087entityPurgeRequest withdraws an entity the extractor should not have made.
entitycandidates.go603
feedback.go1065feedbackListRequest narrows the queue.
health.go685Readiness permits one dependency check at a time and caches either result for one second.
manage.go64647Carries the package documentation.
mcp.go28214Carries the package documentation.
messages.go603
notifications.go13813notificationEndpointListRequest takes nothing: the credential decides the project, as it does everywhere else on this surface.
passages.go623
portal.go63939Carries the package documentation.
portalactions.go27217portalAction is one thing the portal can do, and what it costs to be wrong about it.
portalactivity.go23316portalRange is one window the overview offers.
records.go825Keep client-supplied IDs, subjects and database error text out of both audit and diagnostics.
reportcandidates.go603
request.go1416decode validates the complete wire representation before populating a request.
retractions.go482The actor is the authenticated credential, never a body field.
semantic.go1436semanticSurfaces composes the three retrievers the API already serves separately into what recall consults after exact anchoring.
subjects.go968

155 tests hold this package's behaviour; the list is named for what each one proves.

Files it carries

Not Go, and part of what the package is: embedded, rendered or read at build time.