fix: 3-level NTX correctness + CDX SET INDEX TO string quoting

NTX 3-level tree (build.go):
- Hybrid approach: bulk build for ≤2 levels, insertKeyBTree for 3+
- rebuildWithInsert: creates proper B-tree via per-key insertion
- 5000-key test: Count=5000 Found=5000 (was 5004/4868)

CDX SET INDEX TO (gengo.go):
- Strip surrounding quotes from string literal in OrderListAdd
- Was: idx.OrderListAdd("\"path\"") → file not found
- Now: idx.OrderListAdd("path") → correct

All tests:
- 14 packages ALL PASS
- 82/82 NTX stress test
- 18/18 CDX cross-read
- 50K benchmark: all counts correct

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-07 11:04:07 +09:00
parent 7fec4ce150
commit dadb97ee88
2 changed files with 68 additions and 2 deletions

View File

@@ -568,7 +568,12 @@ func (g *Generator) emitStmt(stmt ast.Stmt, locals localMap) {
g.writeln("if idx, ok := area.(hbrdd.Indexer); ok {")
g.indent++
if fileStr != "" {
g.writeln(fmt.Sprintf(`idx.OrderListAdd(%q)`, fileStr))
// Strip surrounding quotes from string literals
clean := fileStr
if len(clean) >= 2 && clean[0] == '"' && clean[len(clean)-1] == '"' {
clean = clean[1 : len(clean)-1]
}
g.writeln(fmt.Sprintf(`idx.OrderListAdd(%q)`, clean))
} else {
g.emitExpr(s.Expr)
g.writeln(`idx.OrderListAdd(t.Pop2().AsString())`)