Repository navigation
Caliper v1.3.0
Caliper v1.3.0
The interprocedural surface could not run against real code. This release fixes that, and adds what a library consumer needs to build on it.
Fixed — call-graph tools work on real code
-
They no longer crash the server. Every interprocedural tool —
find_call_sites,find_taint_flow, anything reachingEngine.InterProcedural()— panicked on any real workspace, exiting the MCP server with code 2 rather than returning an error. Thepackages.Configload mode setNeedDepsbut notNeedImports;NeedDepsonly propagates the mode into packages already inImports, andImportsitself is populated byNeedImports. Without it everypkg.Importswas empty, sossautil.AllPackagesnever created the dependency packages andprog.Build()panicked on the first unsatisfied import — which is any package importing so much ascontext. Measured before the fix: 100% of loaded packages had empty.Importsacross four repositories. (#11) -
A program with uncreated dependencies is refused, not built.
prog.Build()spawns a goroutine per package, so its panics cannot be recovered by the caller and take the process down. The precondition is now checked up front and reported as an error naming the missing import. (#11) -
find_call_sitesreturns results. It reportedtotal: 0for every input on every repository.FindCallSitesByPatternmatched the pattern against function declarations while the pattern compiler only accepts expressions, so the match loop was unreachable for every valid input. It now matches call expressions across the corpus — as the tool's own documented$x.Close()example always implied — then enriches the result with call sites the call graph knows about for each resolved callee. Measured after the fix: 138 hits for$x.Close()on protolsp, 229 for$x.String()on protocompile, 384 for$x.Close()on govm, all previously 0. (#18)
Both defects were invisible to the test suite because every interprocedural fixture was import-free (package testpkg with a bare caller/callee pair). Fixtures now import stdlib packages, so this class of regression fails the suite.
Added — for library consumers
-
EngineOptions.Testsincludes each package's test files in the load (defaultfalse). Test files are roughly half the Go source in some repositories and are where intent is documented, so a consumer building a picture of a codebase usually wants them while a linter reporting on shipped code does not. Including tests takes protolsp from 1,560 to 4,057 workspace functions in the call graph, and protoregistry from 743 to 1,269. -
Engine.GeneratedFiles,Engine.IsGeneratedFile,InterProceduralContext.IsGeneratedFuncidentify generated code.EngineOptions.SkipGeneratedfilters AST traversal only — the SSA program and call graph are built from every loaded package and are unaffected by it. That asymmetry was undocumented and is a trap for anything walking the call graph: generated functions are 35% of protolsp's workspace functions and 45% of protoregistry's withSkipGeneratedat itstruedefault. Behaviour is unchanged, now documented and pinned by a test, and filterable by consumers that do not want it.
Build
golangci-lintexcludesSA5011in test files. The guard isif x == nil { t.Fatal(...) }, and the CI runner's staticcheck does not derive thattesting.T.Fatalterminates, so it reported the guarded deref as a nil dereference across 40 sites in 8 files. Scoped to_test.goand that one check.
Install
gh release download v1.3.0 --repo trendvidia/caliper --pattern 'caliper-darwin-arm64'
chmod +x caliper-darwin-arm64Verify with checksums.txt. caliper-* is the MCP server; caliper-analyze-* is the single-shot CLI.