Skip to content

Commit 336309c

Browse files
aksOpsclaude
andcommitted
ci: fix go-ci + go-parity workflows
Two unrelated CI failures on PR #130, both fixed: 1. staticcheck 2024.1.1 errors with "internal error in importing internal/byteorder (unsupported version: 2)" against Go 1.25's stdlib. Bump pin to 2025.1.1. 2. Java parity job called `graph -f json` without enriching to Neo4j first; the H2 cache alone isn't enough — graph reads from Neo4j under the serving profile. Now we run `enrich -Dspring.profiles.active=serving` between index and graph, then invoke graph from inside the fixture directory so the Neo4j path resolves relative to where enrich wrote it. Drive-by: staticcheck 2025.1.1 surfaced legitimate dead code that 2024.1.1 was missing: - containsInfra (internal/flow/builders.go) — unused helper, removed - edgeColumns (internal/graph/bulk.go) — unused var, removed - runtimeEdgeKinds (internal/query/service.go) — unused var, removed - fileReadCounter (intelligence/extractor/enricher_test.go) — unused test type, removed - allUnsupported (intelligence/query/planner_test.go) — unused helper, removed - Two append-from-loop simplifications (internal/flow/builders.go) - parity/open_ro.go marked with //go:build parity so staticcheck honors the build tag and doesn't flag the function as unused Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 24200e9 commit 336309c

8 files changed

Lines changed: 25 additions & 46 deletions

File tree

.github/workflows/go-ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ jobs:
3535
run: go test ./... -race -count=1
3636
- name: staticcheck
3737
run: |
38-
go install honnef.co/go/tools/cmd/staticcheck@2024.1.1
38+
# staticcheck must understand the Go toolchain version that built
39+
# the binaries above. 2024.1.1 errors with "internal error in
40+
# importing internal/byteorder (unsupported version: 2)" against
41+
# Go 1.25's stdlib. 2025.1.1 is the first release that handles it.
42+
go install honnef.co/go/tools/cmd/staticcheck@2025.1.1
3943
"$(go env GOPATH)/bin/staticcheck" ./...
4044
- name: gosec
4145
run: |

.github/workflows/go-parity.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,27 @@ jobs:
4242
cp -r go/testdata/fixture-minimal /tmp/fm-java
4343
- name: Run Java index on fixture
4444
run: java -jar target/code-iq-*-cli.jar index /tmp/fm-java
45+
- name: Run Java enrich on fixture
46+
run: |
47+
# `graph -f json` reads from Neo4j (serving profile), not H2. Need
48+
# to enrich the H2 cache into Neo4j first or the export prints
49+
# "No graph data found. Run 'codeiq analyze' first."
50+
java -Dspring.profiles.active=serving -jar target/code-iq-*-cli.jar enrich /tmp/fm-java
4551
- name: Normalize Java output via Java helper
4652
run: |
4753
# The Java cache is H2, not SQLite — parity-normalize (Go-side)
4854
# cannot read it directly. Instead, use the Java side's `graph`
49-
# command to emit JSON, then a small jq filter to produce the
50-
# same canonical shape the Go normalizer emits. This jq script
51-
# lives at parity/java-normalize.jq (committed in this PR).
52-
java -jar target/code-iq-*-cli.jar graph /tmp/fm-java -f json \
55+
# command to emit JSON (requires serving profile to access Neo4j),
56+
# then a small jq filter to produce the same canonical shape the
57+
# Go normalizer emits. The jq script lives at
58+
# parity/java-normalize.jq (committed in this PR).
59+
# Run from the fixture dir so the Neo4j path is resolved relative
60+
# to where `enrich` wrote it.
61+
cd /tmp/fm-java
62+
java -Dspring.profiles.active=serving \
63+
-jar "$GITHUB_WORKSPACE"/target/code-iq-*-cli.jar graph . -f json \
5364
> /tmp/java-raw.json
54-
jq -f go/parity/java-normalize.jq /tmp/java-raw.json \
65+
jq -f "$GITHUB_WORKSPACE"/go/parity/java-normalize.jq /tmp/java-raw.json \
5566
> /tmp/java-normalized.json
5667
- name: Run Go parity test
5768
working-directory: go

go/internal/flow/builders.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ func isCINode(id string) bool {
2626
return strings.Contains(id, "gha:") || strings.Contains(id, "gitlab:")
2727
}
2828

29-
// containsInfra reports whether the node's ID contains the supplied
30-
// substring (case-insensitive for "dockerfile" matches).
31-
func containsInfra(id, needle string) bool {
32-
return strings.Contains(id, needle)
33-
}
34-
3529
// buildOverview is the high-level architecture view with 4 subgraphs:
3630
// CI/CD, Infrastructure, Application, Security.
3731
//
@@ -74,12 +68,8 @@ func buildOverview(snap *Snapshot) *Diagram {
7468

7569
// --- Infrastructure subgraph ---
7670
var infraNodesRaw []*model.CodeNode
77-
for _, n := range snap.FindByKind(model.NodeInfraResource) {
78-
infraNodesRaw = append(infraNodesRaw, n)
79-
}
80-
for _, n := range snap.FindByKind(model.NodeAzureResource) {
81-
infraNodesRaw = append(infraNodesRaw, n)
82-
}
71+
infraNodesRaw = append(infraNodesRaw, snap.FindByKind(model.NodeInfraResource)...)
72+
infraNodesRaw = append(infraNodesRaw, snap.FindByKind(model.NodeAzureResource)...)
8373

8474
if len(infraNodesRaw) > 0 {
8575
var k8s, docker, terraform []*model.CodeNode

go/internal/graph/bulk.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,6 @@ func stringProp(p map[string]any, key string) string {
127127
return ""
128128
}
129129

130-
// edgeColumns is the column order written to each rel-table staging CSV.
131-
// MUST match the per-kind REL table DDL in schema.go: the FROM/TO node
132-
// primary keys come first (Kuzu COPY convention for rel tables), followed
133-
// by the user columns id, confidence, source, props.
134-
var edgeColumns = []string{"from", "to", "id", "confidence", "source", "props"}
135-
136130
// BulkLoadEdges groups edges by Kind and issues one COPY FROM per rel
137131
// table. A mixed-kind batch is split internally — callers don't need to
138132
// pre-partition. Empty input is a no-op.

go/internal/intelligence/extractor/enricher_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@ func (f *fakeExtractor) Extract(ctx Context, node *model.CodeNode) Result {
4747
return r
4848
}
4949

50-
// fileReadCounter wraps os.ReadFile by spying on filesystem reads. We track
51-
// distinct paths to assert read-once.
52-
type fileReadCounter struct {
53-
reads map[string]int
54-
}
55-
5650
func TestEnricher_DispatchesPerLanguageAndAppendsEdges(t *testing.T) {
5751
dir := t.TempDir()
5852
javaPath := "src/Foo.java"

go/internal/intelligence/query/planner_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ func allLexical() CapabilityMatrix {
2323
return out
2424
}
2525

26-
// allUnsupported returns a CapabilityMatrix where every dimension is UNSUPPORTED.
27-
func allUnsupported() CapabilityMatrix {
28-
out := make(CapabilityMatrix, len(allDimensions))
29-
for _, d := range allDimensions {
30-
out[d] = LevelUnsupported
31-
}
32-
return out
33-
}
3426

3527
// fixed returns a planner whose capability provider always returns m, regardless
3628
// of language. Lets each test isolate routing logic from the per-language tables.

go/internal/query/service.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@ type Service struct {
2828
// NewService constructs a Service bound to the given graph.Store.
2929
func NewService(store *graph.Store) *Service { return &Service{store: store} }
3030

31-
// runtimeEdgeKinds enumerates the "consumer-direction" edges that count a
32-
// caller as a consumer for findConsumers. Matches the plan-spec list.
33-
// Returned as a Cypher rel-pattern alternation, e.g. `r:CALLS|PRODUCES|...`.
34-
var runtimeEdgeKinds = []string{
35-
"CALLS", "PRODUCES", "CONSUMES", "QUERIES", "CONNECTS_TO",
36-
"PUBLISHES", "LISTENS", "SENDS_TO", "RECEIVES_FROM",
37-
}
38-
3931
// FindConsumers returns nodes m where m -[consumes|listens]-> target.
4032
// Mirrors QueryService.findConsumers + GraphStore.findConsumers on the Java
4133
// side; the runtime-edge set is the consumer-direction subset.

go/parity/open_ro.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//go:build parity
2+
13
package parity
24

35
import "github.com/randomcodespace/codeiq/go/internal/cache"

0 commit comments

Comments
 (0)