fix: populate global_symbols.relationships in expt-convert - #465
Open
phuongddx wants to merge 2 commits into
Open
fix: populate global_symbols.relationships in expt-convert#465phuongddx wants to merge 2 commits into
phuongddx wants to merge 2 commits into
Conversation
Currently failing: insertGlobalSymbols never writes the relationships column, so the value is NULL for every symbol.
The relationships column was declared in the schema but never written, so every symbol reported no relationships while queries still succeeded -- making type-hierarchy features silently impossible to build on the SQLite output. Serialized like chunks.occurrences: a zstd-compressed wrapper message. Symbols without relationships bind NULL rather than an empty frame. Refs scip-code#464
phuongddx
force-pushed
the
fix/convert-populate-relationships
branch
from
July 26, 2026 16:47
474be9a to
6175171
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the
relationshipshalf of #464:global_symbols.relationshipsis declared in theexpt-convertschema but never written, so it isNULLfor every row in every generated database.Because the column exists and queries against it succeed, the omission is silently lossy — a consumer cannot distinguish "this symbol has no relationships" from "the converter never stored any."
relationshipsis the only source for implementation and type-definition edges, so type-hierarchy features built on the SQLite output cannot work at all, and the failure is easy to misattribute to the language indexer that produced the.scip.Change
insertGlobalSymbols()now serializesSymbolInformation.relationshipsinto the existing column. The blob is framed exactly likechunks.occurrencesinChunk.toDBFormat— a zstd-compressedproto.Marshalof a wrapper message (SymbolInformationhere,Documentthere) — so the encoding stays consistent within the file and remains self-describing.Symbols with no relationships bind SQL
NULLrather than a compressed empty message. That matters becauseinsertGlobalSymbolsis also called with synthetic&scip.SymbolInformation{Symbol: occ.Symbol}values for occurrence-only symbols; storing an empty frame for those would make "absent" and "present but empty" indistinguishable.No schema change and no
scip.protochange, so no regenerated bindings.Testing
TestConvert_SmokeTest's fixture gains a symbol with anis_implementationrelationship, and acheckRelationshipshelper joins the existing table of checks. It decompresses and unmarshals the stored blob, asserts a full round-trip of the relationship data, and asserts that symbols without relationships storeNULL. The subtest fails onmain("map[]" should have 1 item(s), but has 0) and passes with this change; the other subtests are unaffected.Verified end-to-end on a real
scip-typescriptindex of a class implementing an interface:The stored edges match the example in
scip.proto's ownRelationshipdocumentation —Dog#→Animal#withis_implementation, andDog#sound()→Animal#sound()with bothis_implementationandis_reference.I also decoded the blobs from an independent (non-Go) consumer that expects
zstd(SymbolInformation)framing, and they read cleanly — which is some corroboration that this framing is what downstream readers of this schema already assume.Not included:
signature#464 also notes that
global_symbols.signatureis never populated. I left it alone deliberately: the column is namedsignature, butSymbolInformationhas no such field — the nearest isSignature signature_documentation = 7. Mapping one onto the other looks like a maintainer decision rather than something to guess at here. Happy to add it in a follow-up, or in this PR, given a preference.