Skip to content

scip-python 0.6.6: SymbolInformation missing for @dataclass class symbols and stdlib symbols, causing scip expt-convert to hard-fail #223

Description

@lichv7

Summary

scip-python 0.6.6 (latest) does not generate SymbolInformation for @dataclass class symbols themselves (only for their fields/methods), nor for many standard library symbols. When scip expt-convert (v0.8.1) encounters a definition occurrence with an enclosing range for one of these missing symbols, it hard-errors with "has definition occurrence, but no SymbolInformation" and aborts the entire conversion, making the index unusable.

Reproduction

Minimal two-file project:

pyproject.toml

[project]
name = "scip-final-repro"
version = "0.1.0"

contracts.py

"""File A: defines a @dataclass with self-validation in __post_init__."""
from __future__ import annotations

from dataclasses import dataclass
from numbers import Real
import math


def _validate(value: object) -> None:
    if not isinstance(value, Foo):
        raise ValueError("must be Foo")
    if not isinstance(value.x, Real) or not math.isfinite(value.x):
        raise ValueError("x must be finite real")


@dataclass(frozen=True)
class Foo:
    x: float

    def __post_init__(self) -> None:
        _validate(self)

consumer.py

"""File B: imports and uses Foo from file A."""
from __future__ import annotations

from contracts import Foo


def make_foo(x: float) -> Foo:
    return Foo(x=x)

Steps

scip-python index . --output index.scip --quiet
scip expt-convert --output index.db index.scip

Observed

In the generated index.scip:

  1. Foo# (the class symbol itself) has 8 occurrences in contracts.py, but SymbolInformation is only generated for 3 sub-symbols (Foo#x, Foo#__post_init__, Foo#__post_init__().(self)). The class-level Foo# symbol is missing from doc.symbols.

  2. Foo# in consumer.py has 4 occurrences but zero SymbolInformation entries — cross-file references are completely missing symbol metadata.

  3. Standard library symbols also missing SymbolInformation:

    • dataclasses/dataclass()
    • math/isfinite()
    • numbers/Real#
    • math/__init__:

Converter behavior

For this minimal repro, scip expt-convert succeeds (exit 0) because the missing symbols don't have enclosing ranges. However, in a large project (477 Python files, 160K occurrences), some missing symbols do have enclosing ranges, triggering the hard error in convert.go:395:

return fmt.Errorf("symbol %q has definition occurrence, but no SymbolInformation", occ.Symbol)

This aborts the entire conversion, producing only a 36KB partial database instead of the expected ~13MB.

Expected behavior

scip-python should generate SymbolInformation for:

  1. @dataclass class symbols themselves (not just their fields/methods)
  2. Standard library symbols referenced in the indexed code

Environment

  • scip-python: 0.6.6 (latest on npm)
  • scip converter: v0.8.1
  • Python: 3.12.13
  • Node.js: v22.22.3
  • macOS: Darwin x86_64

Related issues

Workaround

We've written a patch script that parses the .scip protobuf, detects all symbols with occurrences but no SymbolInformation, and inserts minimal placeholder SymbolInformation entries before running expt-convert. This produces a complete ~13MB database and scip-cli analyze works correctly on the patched index.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions