{"modulePath":"github.com/codefit-cli/codefit","version":"v0.2.9","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package surfaceindex\n\nPackage surfaceindex projects a findings.SurfaceItem list into the light shape both codefit-scan-all's DBSection and the standalone codefit-scan-db serve by default (design D1). It is a pure leaf: it imports only internal/core/findings, and nothing outside internal/mcp imports it — the adapter is the single consumer, mirroring internal/core/coverage's Index()/Resolve() shape for the same reason (one projection, two callers, no response-shaping logic drifting into the thin MCP layer).\n\nEvery item is indexed; nothing is withheld here (design D4 — there is no ranking axis across 18 disjoint db surface categories with no severity field, so there is nothing to withhold BY). Full detail is served only on request, by id, through Resolve — the same relation codefit-scan-endpoint has to codefit-scan-all (ADR 0008/0054), reused rather than reinvented.\n\n## Functions\n\n```go\nfunc Resolve(items []findings.SurfaceItem, ids []string) (found []findings.SurfaceItem, unrecognized []string)\n```\nResolve returns the FULL findings.SurfaceItem for each requested id, plus the ids that matched nothing. An unmatched id is NAMED, never silently dropped (design D3): codefit is stateless and cannot tell \"this id never existed\" from \"the schema moved between calls and it is gone\" — an empty success would hide that distinction the caller needs to reason about.\n\n## Types\n\n```go\ntype Entry struct {\n\tID              string          `json:\"id\"`\n\tCategory        string          `json:\"category\"`\n\tFile            string          `json:\"file\"`\n\tLine            int             `json:\"line\"`\n\tFingerprint     string          `json:\"fingerprint,omitempty\"`\n\tStructuralFacts map[string]bool `json:\"structural_facts,omitempty\"`\n}\n```\nEntry is the light projection of a findings.SurfaceItem that every index carries, for every item, always (design D4 — nothing is withheld here).\n\nWhat stays, and why (spec \"index entry shape\"): Fingerprint stays because codefit-baseline-accept takes fingerprints directly — detail-only would force an extra round trip before a named item could be accepted. StructuralFacts stays because it is the only filterable axis across 18 disjoint db surface categories with no severity field; without it, fetching everything is the only way to learn more than a category name.\n\nWhat is dropped, and why: Snippet, StructuralSignals, ReasonToReview and IndirectCall are prose/detail fields — exactly the ~85% of a db surface item's serialized weight that this projection exists to keep out of the default response (measurement #1679). They are served only through Resolve, by id.\n\n```go\nfunc Index(items []findings.SurfaceItem) ([]Entry, int)\n```\nIndex projects every item into its light Entry form and returns the count of items indexed, taken from the input slice's own length — computed independently of how the entries slice below is built, so a future edit that truncates the returned entries can never also, silently, shrink the count that is supposed to catch it (the mutation this package is mutation-tested against: see the M3 conservation test in internal/mcp, anchored to the db sensor's own population, never to a response's own index — the trap recorded in the coverage-chain archive, obs #1664).\n\n","path":"github.com/codefit-cli/codefit/internal/core/surfaceindex","name":"surfaceindex","synopsis":"Package surfaceindex projects a findings.SurfaceItem list into the light shape both codefit-scan-all's DBSection and the standalone codefit-scan-db serve by default (design D1).","isRedistributable":true}
