Skip to content

Commit e5ad5f7

Browse files
hallelx2claude
andcommitted
ci: fix llmgate replace, MinIO service, and parser lint findings
Three related fixes surfaced by the first CI run: - go.mod: drop the `replace github.com/hallelx2/llmgate => ../llmgate` directive and depend on the now-tagged v0.1.0 from the proxy. CI doesn't have a sibling working copy to replace into. - ci.yml: MinIO can't run as a `services:` container because Actions doesn't expose a way to pass the `server /data` command the image needs. Start it with `docker run` in a step instead, wait for health, then create the bucket with minio/mc. Also switches the image from bitnami/minio (which moved to a paid catalog) to the upstream quay.io/minio/minio. - pkg/parser/markdown.go: fix two pre-existing staticcheck findings that the new lint job surfaced. SA1019: replace the deprecated goldmark Heading.Text(src) with a dedicated headingText helper that walks inline children. S1040: drop a redundant type assertion to ast.Node. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 741f453 commit e5ad5f7

4 files changed

Lines changed: 46 additions & 20 deletions

File tree

.github/workflows/ci.yml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,6 @@ jobs:
6464
--health-interval 5s
6565
--health-timeout 5s
6666
--health-retries 10
67-
minio:
68-
image: bitnami/minio:latest
69-
env:
70-
MINIO_ROOT_USER: minioadmin
71-
MINIO_ROOT_PASSWORD: minioadmin
72-
MINIO_DEFAULT_BUCKETS: vle-test
73-
ports: ["9000:9000"]
74-
options: >-
75-
--health-cmd "curl -f http://localhost:9000/minio/health/live || exit 1"
76-
--health-interval 5s
77-
--health-timeout 5s
78-
--health-retries 20
7967
steps:
8068
- uses: actions/checkout@v6
8169

@@ -85,6 +73,28 @@ jobs:
8573
go-version: "1.25"
8674
cache: true
8775

76+
# MinIO can't run as a `services:` container because GitHub Actions
77+
# doesn't expose a way to pass the required `server /data` command.
78+
# Start it in a step instead, wait for health, create the bucket.
79+
- name: Start MinIO
80+
run: |
81+
docker run -d --name minio \
82+
-p 9000:9000 \
83+
-e MINIO_ROOT_USER=minioadmin \
84+
-e MINIO_ROOT_PASSWORD=minioadmin \
85+
quay.io/minio/minio:latest server /data
86+
for i in {1..30}; do
87+
if curl -sf http://localhost:9000/minio/health/live > /dev/null; then
88+
echo "MinIO ready"
89+
break
90+
fi
91+
echo "waiting for MinIO ($i)..."
92+
sleep 2
93+
done
94+
docker run --rm --network host \
95+
-e MC_HOST_local=http://minioadmin:minioadmin@localhost:9000 \
96+
quay.io/minio/mc mb -p local/vle-test
97+
8898
- name: Run integration tests
8999
env:
90100
TEST_DATABASE_URL: postgres://vle:vle@localhost:5432/vle_test?sslmode=disable

go.mod

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/aws/smithy-go v1.25.0
1111
github.com/go-chi/chi/v5 v5.2.5
1212
github.com/google/uuid v1.6.0
13-
github.com/hallelx2/llmgate v0.0.0-00010101000000-000000000000
13+
github.com/hallelx2/llmgate v0.1.0
1414
github.com/jackc/pgx/v5 v5.9.2
1515
github.com/ledongthuc/pdf v0.0.0-20250511090121-5959a4027728
1616
github.com/riverqueue/river v0.35.0
@@ -21,11 +21,6 @@ require (
2121
gopkg.in/yaml.v3 v3.0.1
2222
)
2323

24-
// Local development: point llmgate at the sibling working copy until
25-
// the first tagged release is published. Remove this once llmgate has
26-
// a real version.
27-
replace github.com/hallelx2/llmgate => ../llmgate
28-
2924
require (
3025
cloud.google.com/go v0.116.0 // indirect
3126
cloud.google.com/go/ai v0.7.0 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ github.com/googleapis/enterprise-certificate-proxy v0.3.4 h1:XYIDZApgAnrN1c855gT
8080
github.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA=
8181
github.com/googleapis/gax-go/v2 v2.14.1 h1:hb0FFeiPaQskmvakKu5EbCbpntQn48jyHuvrkurSS/Q=
8282
github.com/googleapis/gax-go/v2 v2.14.1/go.mod h1:Hb/NubMaVM88SrNkvl8X/o8XWwDJEPqouaLeN2IUxoA=
83+
github.com/hallelx2/llmgate v0.1.0 h1:cU4o016k33d8ugCwGc4xO+XAO2OaNCa+mVv4koxq7Mc=
84+
github.com/hallelx2/llmgate v0.1.0/go.mod h1:MK2Ol/5CIweTQ2/9eSiTJ5g/KSSuobNZL9TD3s57JxY=
8385
github.com/jackc/pgerrcode v0.0.0-20240316143900-6e2875d9b438 h1:Dj0L5fhJ9F82ZJyVOmBx6msDp/kfd1t9GRfny/mfJA0=
8486
github.com/jackc/pgerrcode v0.0.0-20240316143900-6e2875d9b438/go.mod h1:a/s9Lp5W7n/DD0VrVoyJ00FbP2ytTPDVOivvn2bMlds=
8587
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=

pkg/parser/markdown.go

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func (m *Markdown) Parse(_ context.Context, r io.Reader) (*ParsedDoc, error) {
6060
// anything else, append its rendered text to the current bucket.
6161
for n := doc.FirstChild(); n != nil; n = n.NextSibling() {
6262
if h, ok := n.(*ast.Heading); ok {
63-
title := strings.TrimSpace(string(h.Text(src)))
63+
title := strings.TrimSpace(headingText(h, src))
6464
current = &flat{level: h.Level, title: title}
6565
flats = append(flats, current)
6666
continue
@@ -148,9 +148,28 @@ func appendNodeText(buf *strings.Builder, n ast.Node, src []byte) {
148148

149149
// Paragraph-ish block boundaries: add a blank line after block nodes
150150
// so the flattened text still reads.
151-
if _, ok := n.(ast.Node); ok && n.Type() == ast.TypeBlock {
151+
if n.Type() == ast.TypeBlock {
152152
if !bytes.HasSuffix([]byte(buf.String()), []byte("\n\n")) {
153153
buf.WriteString("\n\n")
154154
}
155155
}
156156
}
157+
158+
// headingText extracts the flattened text of a heading by walking its
159+
// inline children. Replaces the deprecated Heading.Text(src) API.
160+
func headingText(h *ast.Heading, src []byte) string {
161+
var buf bytes.Buffer
162+
for c := h.FirstChild(); c != nil; c = c.NextSibling() {
163+
if t, ok := c.(*ast.Text); ok {
164+
buf.Write(t.Segment.Value(src))
165+
continue
166+
}
167+
// Recurse for wrapping inlines (emphasis, links, code spans, etc.)
168+
for gc := c.FirstChild(); gc != nil; gc = gc.NextSibling() {
169+
if t, ok := gc.(*ast.Text); ok {
170+
buf.Write(t.Segment.Value(src))
171+
}
172+
}
173+
}
174+
return buf.String()
175+
}

0 commit comments

Comments
 (0)