Tests: internal/infra/inference
internal/infra/inference · 72 tests
Each test is named for the property it holds, and runs against a real deployment: there is no mock of the database and no arm that skips when it is absent. The sentence is the test's name read back; the name is what go test -run takes.
config_test.go
- No message content leaves for an unlisted host —
TestNoMessageContentLeavesForAnUnlistedHost. ── The egress guard ────────────────────────────────────────────────────────────────────────── Extraction sends a customer's message text to a model. - A trailing slash on the endpoint is trimmed —
TestATrailingSlashOnTheEndpointIsTrimmed. A trailing slash on the endpoint must not produce a doubled one in the path. - Plaintext is permitted only to this machine —
TestPlaintextIsPermittedOnlyToThisMachine. Plaintext is permitted to the machine the process is on, and to nothing else. - The allowlist is host and port rather than AURL —
TestTheAllowlistIsHostAndPortRatherThanAURL. The allowlist is matched on host and port, so an entry carrying a scheme matches nothing. - Embedding can go somewhere else and still has to be listed —
TestEmbeddingCanGoSomewhereElseAndStillHasToBeListed - One provider needs one endpoint —
TestOneProviderNeedsOneEndpoint. One provider is the ordinary case and needs one set of variables. - A second endpoint obeys every rule the first one does —
TestASecondEndpointObeysEveryRuleTheFirstOneDoes. A second endpoint on a host nobody listed is refused for the same reason the first one is: it is an egress of exactly the data this product exists to hold, and the list is what makes permitting it a deliberate act.
corpus_test.go
- The extraction corpus —
TestTheExtractionCorpus
embedder_test.go
- Vectors come back against the input they are for —
TestVectorsComeBackAgainstTheInputTheyAreFor. The order is a promise. - An embedding reply that cannot be trusted is refused —
TestAnEmbeddingReplyThatCannotBeTrustedIsRefused. Every way the reply can leave a caller matching a vector onto the wrong thing. - An unconfigured embedder refuses rather than returning zeros —
TestAnUnconfiguredEmbedderRefusesRatherThanReturningZeros. A deployment that extracts and never embeds is a working deployment. - An empty input is not sent —
TestAnEmptyInputIsNotSent. An empty surface embeds to whatever the model does with nothing, which is a vector that matches things for no reason. - Similarity is an angle rather than a length —
TestSimilarityIsAnAngleRatherThanALength. Normalised, because a dot product used without normalising rewards long vectors, and whether a model returns normalised vectors is a property of the model rather than of the interface. - A meaningless comparison is an error rather than zero —
TestAMeaninglessComparisonIsAnErrorRatherThanZero. A comparison that is meaningless says so rather than returning zero, which would read as "unrelated" — and a caller thresholding on it would quietly treat every mismatch as a rejection.
embeddingbounds_test.go
- Embedding rejects a zero direction before returning vectors —
TestEmbeddingRejectsAZeroDirectionBeforeReturningVectors - Cosine rejects non finite components instead of returning na n —
TestCosineRejectsNonFiniteComponentsInsteadOfReturningNaN - Embedding input limits refuse before network and admit boundaries —
TestEmbeddingInputLimitsRefuseBeforeNetworkAndAdmitBoundaries - Embedding dimension bounds and finite extreme cosines —
TestEmbeddingDimensionBoundsAndFiniteExtremeCosines - Embedding reply overflow is not accepted as a valid prefix —
TestEmbeddingReplyOverflowIsNotAcceptedAsAValidPrefix. A complete JSON value followed by whitespace is still a valid prefix.
embeddingconfig_test.go
- Embedding only configuration binds its own allowed endpoint —
TestEmbeddingOnlyConfigurationBindsItsOwnAllowedEndpoint. A read-only service validates only the endpoint it uses, without borrowing a different provider's credential or weakening the generation process's independent validation.
golden_capture_test.go
- Capture golden —
TestCaptureGolden. Regenerates the golden after a DELIBERATE wording change, run with CAPTURE=1.
identity_test.go
- Extraction identity changes with model origin prompt and implementation but never keys —
TestExtractionIdentityChangesWithModelOriginPromptAndImplementationButNeverKeys - Report identity changes with model origin prompt and implementation but never keys —
TestReportIdentityChangesWithModelOriginPromptAndImplementationButNeverKeys. A report's identity moves with the model, the origin, the prompt and the compiled code that composes and parses — and with nothing else.
live_test.go
- A real models claims are all citable —
TestARealModelsClaimsAreAllCitable. ── What extraction refused is kept, against a model free to paraphrase ─────────────────────── The unit tests prove the span rule holds for proposals a stub was told to produce.
livedescription_test.go
- Whether a described entity separates where an assembled one did not —
TestWhetherADescribedEntitySeparatesWhereAnAssembledOneDidNot
liveneighbourhood_test.go
- Whether an entitys neighbourhood is what distinguishes it —
TestWhetherAnEntitysNeighbourhoodIsWhatDistinguishesIt
livereport_test.go
- A live report says what the material said and nothing else —
TestALiveReportSaysWhatTheMaterialSaidAndNothingElse
liveresolution_test.go
- What a semantic surface resolves and what it would merge —
TestWhatASemanticSurfaceResolvesAndWhatItWouldMerge
livespeaker_test.go
- Live speakers are bound across languages and corrections —
TestLiveSpeakersAreBoundAcrossLanguagesAndCorrections. This runs the production vocabulary gate and formation path, not only the model's proposal parser.
livesurfacecontract_test.go
- Each embedding surface wins only its own retrieval question —
TestEachEmbeddingSurfaceWinsOnlyItsOwnRetrievalQuestion
livethemes_test.go
- Whether a thematic question finds the right subject —
TestWhetherAThematicQuestionFindsTheRightSubject
parse_test.go
- A replied document is found behind a prefix the model invented —
TestARepliedDocumentIsFoundBehindAPrefixTheModelInvented. The exact reply that made a correct extraction fail. - A claim without its envelope is an error rather than an empty result —
TestAClaimWithoutItsEnvelopeIsAnErrorRatherThanAnEmptyResult. A single claim emitted without its envelope must NOT be read as "nothing was asserted". - An empty claim list is a result and not a failure —
TestAnEmptyClaimListIsAResultAndNotAFailure. An empty list means the message asserts nothing, which is the ordinary case and must stay distinguishable from a reply that could not be read. - Commentary after the document is ignored —
TestCommentaryAfterTheDocumentIsIgnored. Prose after the document does not fail the parse, because the decoder reads one value and stops. - A fenced document is still read —
TestAFencedDocumentIsStillRead. A fenced document still works, which is the case that was already handled and must not regress. - A reply with no envelope is an error —
TestAReplyWithNoEnvelopeIsAnError. A reply with no envelope anywhere is an error, not an empty result. - The error quotes the reply without letting it run away —
TestTheErrorQuotesTheReplyWithoutLettingItRunAway. The error carries the reply, bounded.
prompt_test.go
- The message is fenced with a value it could not contain —
TestTheMessageIsFencedWithAValueItCouldNotContain. ── Directive framing, the part that needs no ruling ────────────────────────────────────────── A message arrives as data inside a fence the message could not have contained. - The fence is not reused between calls —
TestTheFenceIsNotReusedBetweenCalls. The fence is different every time, so it cannot be learned from one call and used in the next. - A fence that occurs in the content is regenerated —
TestAFenceThatOccursInTheContentIsRegenerated. A fence that somehow occurs in the content is regenerated rather than used. - Every instruction precedes the content —
TestEveryInstructionPrecedesTheContent. The instructions end before the content begins.
promptfile_test.go
- The composed prompt is byte identical to the text it replaced —
TestTheComposedPromptIsByteIdenticalToTheTextItReplaced - The vocabulary is rendered where the file marks it —
TestTheVocabularyIsRenderedWhereTheFileMarksIt. The vocabulary is rendered from the table, in the table's order, and nowhere else. - A file missing a section is refused —
TestAFileMissingASectionIsRefused. ── What the file is not allowed to do ──────────────────────────────────────────────────────── The file holds wording. - An empty section is refused —
TestAnEmptySectionIsRefused. A section present and blank is the same defect as a section absent, and is easier to produce by accident — a paragraph deleted from a file that still parses. - The vocabulary is marked exactly once —
TestTheVocabularyIsMarkedExactlyOnce. None means the model is told the vocabulary is closed and never shown it, so every extraction is unmapped. - The request uses the model contract from the file —
TestTheRequestUsesTheModelContractFromTheFile. The request carries what the file says it carries. - A file that is not YAML is refused —
TestAFileThatIsNotYAMLIsRefused - A contract without a response format is refused —
TestAContractWithoutAResponseFormatIsRefused
redirect_test.go
- A model endpoint cannot redirect content to a host nobody listed —
TestAModelEndpointCannotRedirectContentToAHostNobodyListed. ── The allowlist names where content goes, not where it goes first ─────────────────────────── A listed endpoint that answers with a redirect is asking for the request body — message content, a report's facts, a history to summarise — to be sent again to a host nobody listed.
reporter_test.go
- A report request carries the contract and the material —
TestAReportRequestCarriesTheContractAndTheMaterial - A model that refuses is a refusal rather than an empty report —
TestAModelThatRefusesIsARefusalRatherThanAnEmptyReport - An enormous reply does not decide how much memory is spent —
TestAnEnormousReplyDoesNotDecideHowMuchMemoryIsSpent. A reply is read up to a bound, because a remote system does not decide how much memory this process spends on one answer. - A cancelled report stops —
TestACancelledReportStops. A cancelled request stops rather than running to completion somewhere nobody is waiting. - Report input distinguishes equal speaker names without changing quotes —
TestReportInputDistinguishesEqualSpeakerNamesWithoutChangingQuotes
reportprompt_test.go
- A report prompt missing a section is refused —
TestAReportPromptMissingASectionIsRefused. The file holds wording. - A blank report section is refused —
TestABlankReportSectionIsRefused. A section present and blank is the same defect as one absent, and easier to produce by accident. - A report prompt without a response format is refused —
TestAReportPromptWithoutAResponseFormatIsRefused - Reports are not a creative task —
TestReportsAreNotACreativeTask. Two rebuilds of one community should say the same thing about what survived. - The report boundary is the last thing the model is told —
TestTheReportBoundaryIsTheLastThingTheModelIsTold. The boundary is last, because its job is to be the final word before somebody else's text arrives. - The fence is absent from every part of the material —
TestTheFenceIsAbsentFromEveryPartOfTheMaterial. The material is fenced with a value it cannot contain, chosen after the material was assembled — including the material inside child reports, which is text from a model that read somebody's quotes. - The same context renders the same material —
TestTheSameContextRendersTheSameMaterial. Two renderings of one context are identical, so two rebuilds of a community ask the same question. - A report is found inside whatever the model sent —
TestAReportIsFoundInsideWhateverTheModelSent. A model in JSON mode still wraps its answer in prose or a code fence often enough that a plain Unmarshal turns a good report into a failure. - A reply with no report is an error rather than an empty report —
TestAReplyWithNoReportIsAnErrorRatherThanAnEmptyReport. An object that is not a report is skipped rather than returned as a report with everything empty — which would then be refused for having no title, reporting the wrong problem. - The decode error does not quote the whole reply —
TestTheDecodeErrorDoesNotQuoteTheWholeReply. The error carries a bounded amount of the reply, because the reply can contain somebody's words.
reportrevision_test.go
- Report source revisions never enter model material —
TestReportSourceRevisionsNeverEnterModelMaterial. Source revisions authorize persistence; adding them must not change what leaves for inference.
summariser_test.go
- The compaction prompt loads and ends on the boundary —
TestTheCompactionPromptLoadsAndEndsOnTheBoundary. The compaction prompt loads with the report prompt's loader, and its system prompt ends on the data boundary: whatever the material says, the last instruction the model reads is that the material is data. - Material is rendered fenced and in order —
TestMaterialIsRenderedFencedAndInOrder. The material is rendered fenced, oldest first, with who said what; the fence is chosen against every byte of the material so the material cannot close it. - The summary is located in the reply and an empty one is refused —
TestTheSummaryIsLocatedInTheReplyAndAnEmptyOneIsRefused. The reply is located inside whatever the model wrapped it in, and an empty summary is refused: a segment that says nothing would stand in for turns and lose them. - The summariser asks the model under the files contract —
TestTheSummariserAsksTheModelUnderTheFilesContract. The request carries the file's model contract and the fenced material, and the provider's answer becomes the summary; a provider that fails is an error, not an empty segment.
timeout_test.go
- The model client timeout follows the configured budget —
TestTheModelClientTimeoutFollowsTheConfiguredBudget. The client's own timeout must follow the configured budget: if it stayed at a lower constant, the deadline that fired would not be the one the operator set, and the failure would misreport it.