Commit 2051693
authored
engine: rename pageindex→treewalk + auto strategy default (HAL-106) (#35)
* engine: rename pageindex strategy to treewalk (HAL-106)
Strip the borrowed PageIndex name — treewalk is now the native identifier
for Vectorless's tree-navigation strategy across the strategy id, Go types,
config keys, the /v1/answer/treewalk endpoint, and all tests. Pure rename;
go build, go vet, and package tests all green.
Remaining HAL-106 sub-tasks: promote treewalk to default strategy, dedup
the agentic overlap, and fold the dedicated endpoint into /v1/answer.
* engine: add auto strategy as the default (HAL-106)
Smart default selection: route small documents (total leaf content within
the call budget) to single-pass for one fast cheap call, and larger or more
complex documents to treewalk for agentic navigation. New AutoStrategy in
pkg/retrieval with unit tests; wired into config (default value + validation)
and both binaries' strategy builders + the selectable-strategy set.
go build, go vet, and package tests all green.
* engine: address PR #35 review (auto page-fallback, nil-safety, finish rename)
Addresses the Copilot + CodeRabbit review on #35:
- auto: non-paged docs (no PageStart/PageEnd — Markdown/HTML/DOCX/TXT) now route
to single-pass, never treewalk (which navigates by page range) + nil-safe
pick/Select/SelectWithCost so a misconfigured Auto can't panic.
- complete the rename in non-Go files: openapi.yaml + config.example*.yaml
(incl. the uppercase env-var refs) — zero pageindex remains anywhere.
- query.go: list 'auto' in the strategy-override doc comment.
- config_test: exercise 'auto' as a valid Validate() strategy.
- tests: non-paged fallback + nil-safety.
Out of scope (filed separately): treewalk SSE streams reasoning regardless of
IncludeReasoning (pre-existing behaviour, not introduced here).
* engine: green the CI baseline (HAL-116) — race fix, dep + toolchain bump, lint
- toc_builder: fix the data race in verifyTitlesConcurrent — each goroutine
now accumulates a local Usage and folds it under the mutex, instead of
sharing &localUse across errgroup goroutines (concurrent usage.add writes).
- deps: golang.org/x/net v0.53.0 -> v0.55.0 (GO-2026-5030); add toolchain
go1.25.11 + pin CI go-version (stdlib GO-2026-5039 / GO-2026-5037).
- lint: //lint:ignore U1000 the four staged helpers with reasons; drop the
genuinely-unused idempotencyCache.mu field.
These CI failures were pre-existing (surfaced on PR #35, not caused by the
rename). go build + staticcheck green locally; -race verified in CI.
Closes HAL-116.
* engine: fix the pdftable parser data race + golangci //nolint (HAL-116)
- pkg/parser: serialize pdftable.OpenBytes behind a package mutex (openPDFBytes).
pdftable mutates package-level state on open and is not concurrency-safe; the
-race detector flagged concurrent opens (real in prod — ingest workers parse
in parallel). Stopgap; the proper fix belongs in pdftable (Foundational Libs).
- convert the unused-helper suppressions from staticcheck //lint:ignore to
golangci-lint //nolint:unused,staticcheck (CI lint uses golangci-lint).
go build + go vet + parser tests green.
* engine: green the CI lint baseline — errcheck / ineffassign / staticcheck (HAL-117)
Completes the errcheck/ineffassign cleanup across the repo, including the
renamed files (treewalk.go / answer_treewalk.go) the off-main pass couldn't reach:
- errcheck: _, _ = fmt.Fprintf on the SSE writers; unchecked returns handled
across cmd/benchmark, handlers, connecthandler, parser, storage, queue, db, ingest.
- ineffassign: drop the ineffectual 'written += remaining' before break in
treewalk_strategy.
- staticcheck: real TLS-disabled assertion (was an empty branch) in config_test;
De Morgan's rewrite in retrieval_test; drop embedded-field selector in decompose_test.
- misspell: ignore-rule for 'strat' (our 'strategy' abbreviation) in .golangci.yml.
- formatting normalized via the golangci formatters.
golangci-lint run: 0 issues. go build + unit tests green. Closes HAL-117.
* engine: remove dead funcs + guard pdftable ExtractTables race (HAL-116/117)
- lint: the CI 'lint' job runs BOTH golangci-lint and standalone staticcheck
(honnef), and the latter reads //lint:ignore, not golangci's //nolint. Rather
than juggle two directive formats, delete the 4 genuinely-unused funcs
(treeWalkTraceTokenFromCitations, originMatches, isTimeout, isEncryptedPDFError)
— both linters agree they're dead. (Re-add with callers when HAL-73/HAL-112 land.)
- race: pdftable.ExtractTables also mutates package-level state — a second pdftable
race distinct from OpenBytes; serialize it on the same mutex. Stopgap; the root
fix is HAL-118 (make pdftable concurrency-safe).
golangci-lint + standalone staticcheck: 0 issues. go build + unit tests green.
* engine: go mod tidy — blank line before toolchain directive (HAL-116)
The ubuntu-only 'Verify go.mod/go.sum are tidy' CI step requires the canonical
format go mod tidy emits: a blank line between the 'go' and 'toolchain'
directives. My earlier manual insertion of the toolchain line omitted it.1 parent f150e5b commit 2051693
59 files changed
Lines changed: 1256 additions & 970 deletions
File tree
- .github/workflows
- cmd
- benchmark
- engine
- server
- internal
- api
- config
- connecthandler
- handler
- middleware
- pkg
- cache
- config
- db
- ingest
- parser
- queue
- retrieval
- storage
- tree
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
33 | 38 | | |
34 | 39 | | |
35 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
92 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
| 137 | + | |
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
| 249 | + | |
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
| 258 | + | |
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
| 209 | + | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
| 212 | + | |
213 | 213 | | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
397 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
398 | 400 | | |
399 | 401 | | |
400 | 402 | | |
401 | 403 | | |
402 | 404 | | |
403 | | - | |
| 405 | + | |
404 | 406 | | |
405 | | - | |
406 | | - | |
| 407 | + | |
| 408 | + | |
407 | 409 | | |
408 | 410 | | |
409 | 411 | | |
410 | 412 | | |
411 | 413 | | |
412 | 414 | | |
413 | | - | |
414 | | - | |
| 415 | + | |
| 416 | + | |
415 | 417 | | |
416 | | - | |
417 | | - | |
| 418 | + | |
| 419 | + | |
418 | 420 | | |
419 | | - | |
420 | | - | |
| 421 | + | |
| 422 | + | |
421 | 423 | | |
422 | | - | |
423 | | - | |
| 424 | + | |
| 425 | + | |
424 | 426 | | |
425 | | - | |
| 427 | + | |
426 | 428 | | |
427 | 429 | | |
428 | 430 | | |
| |||
437 | 439 | | |
438 | 440 | | |
439 | 441 | | |
440 | | - | |
| 442 | + | |
441 | 443 | | |
442 | 444 | | |
443 | 445 | | |
444 | 446 | | |
445 | 447 | | |
446 | 448 | | |
447 | | - | |
| 449 | + | |
448 | 450 | | |
449 | 451 | | |
450 | 452 | | |
| |||
454 | 456 | | |
455 | 457 | | |
456 | 458 | | |
457 | | - | |
| 459 | + | |
458 | 460 | | |
459 | 461 | | |
460 | 462 | | |
| |||
0 commit comments