Skip to content

feat: overnight agent fixes — 27 commits across engine, lattice, writeback, vfs#95

Merged
jamestexas merged 28 commits intomainfrom
feat/overnight-agent-fixes
Mar 15, 2026
Merged

feat: overnight agent fixes — 27 commits across engine, lattice, writeback, vfs#95
jamestexas merged 28 commits intomainfrom
feat/overnight-agent-fixes

Conversation

@jamestexas
Copy link
Copy Markdown
Contributor

Summary

Autonomous rosary-dispatched agents made 27 commits overnight:

Refactors (13):

  • Extract toNodeID helper, consolidate skip-dir logic, inline resolveNode wrapper
  • Replace interface{} with any, filepath.Walk → WalkDir
  • Extract shared lspLocation type, move handler init to factory

Logging (8):

  • Replace all fmt.Printf with log.Printf across engine, sqlite_graph, ingest, infer, cmd

Features (3):

  • TOML tree-sitter walker
  • Page-level diff for hot-swap flushes
  • Python/TypeScript write-back formatters

Fixes (3):

  • Surface insert errors from AddNode
  • Log schema inference errors
  • Check sitter.NewQuery error

Test plan

  • task test passes (all existing tests)
  • Manual test: mount a TOML file, verify projection
  • Manual test: Python/TS write-back formatting

Generated with rosary autonomous dispatch

ReadFile, ParseCtx, and InferFromTreeSitter errors were silently
swallowed via blank identifiers. Now logged with log.Printf so users
can diagnose inference failures. On read/parse errors, the walk
continues to the next .go file instead of stopping immediately.
AddNode previously logged and swallowed insert/commit/begin errors,
making partial data loss undetectable by callers. Now stores the first
error encountered and returns it from Close(). Also skips incrementing
the batch counter on failed inserts.

Removes duplicate idx_parent_name index creation in Close() — the index
is already created in NewSQLiteWriter during schema init.
If the query fails to compile (e.g. grammar mismatch after upgrade),
Lint now returns the error instead of silently returning zero diagnostics.
Wire ruff/black for Python (.py/.pyi) and prettier for
TypeScript/JavaScript (.ts/.tsx/.js/.jsx) into FormatBuffer.
External tools are discovered via PATH and failures gracefully
fall back to the original buffer, matching existing Go/HCL behavior.
…ommand

The mount command had its own inline 150-line directory inference
implementation that duplicated inferDirSchema() from cmd/infer.go.
The inline version lacked preset schema support and was out of sync
with the serve command which already used inferDirSchema().

Replace the inline code with a single call to inferDirSchema(), which
handles multi-language detection, preset schemas for known languages
(go, python, rust, terraform, sql), and FCA inference for the rest.
- --verify mode blocked on `read -r` because VERIFY was set but never
  checked — now branches correctly into demo/verify/interactive flows
- Add go.mod to the synthetic test repo so agents can `go build`
- Fix indentation in the demo block epilogue
Read the inactive buffer before writing and compare page-by-page using
the SQLite page size from the DB header. Only changed pages are written,
avoiding a full-DB copy on every flush. Zero-fill in the remainder is
also skipped for pages that are already zero.
Register the TOML grammar from smacker/go-tree-sitter/toml in
DetectLanguageFromExt, GetLanguage, and the engine dispatch switch.
Add a preset schema (toml.json) that projects tables and array tables.
…arning

Use standard log package consistent with the rest of the codebase
instead of writing directly to stdout.
Carriage-return progress lines break CI/CD log output. Use log.Printf
which writes clean timestamped lines to stderr instead.
Go 1.18+ modernization — `any` is the predeclared alias for `interface{}`.
Consistent with the rest of the codebase—progress messages now go
through the standard logger instead of bare fmt writes.
Both FUSE (root.go) and NFS (graphfs.go) backends duplicated handler
construction and held direct references to PromptHandler, QueryHandler,
and DiagnosticsHandler. This couples backends to concrete handler types
and forces changes in two places for any new virtual directory.

NewDefaultResolver builds the standard handler chain in one place.
Configuration methods (SetPromptContent, EnableQuery, SetWritable) on
Resolver replace direct handler field access.
Decouple CLI status/progress output from fmt (stdout) to log (stderr).
Quiet mode now also sets log.SetOutput(io.Discard) for full suppression.
Preserved fmt for user-facing data output (version, list table), fmt.Errorf,
and fmt.Sprintf.
Add stripProjectFileContent() to materializeVirtuals pipeline that NULLs
out the record column and zeros the size for _project_files/ file nodes.
This prevents raw project files from bloating the output DB — directory
structure and metadata are preserved for browsing, but full content is
not carried into the leyline-loaded database.
PrintMemUsage now accepts testing.TB and uses tb.Logf so output is
captured by go test and only shown with -v flag.
filepath.WalkDir with fs.DirEntry avoids redundant os.Lstat calls
on every entry since the DirEntry already carries the file type.
Scan progress messages used fmt.Printf with carriage returns,
inconsistent with the rest of the file which uses log.Printf.
…Loc/refLoc structs

loadLSPDefs and loadLSPRefs had identical struct definitions and
scan/group/marshal logic. Extract a shared lspLocation type and
loadLSPLocations helper; both callers now delegate to it.
resolveNode was a one-liner delegating to fs.graph.GetNode with no
additional logic. Inline the call at both call sites (Lstat, ReadDir)
and remove the wrapper method.
Add childSeen map to Engine struct to track parent→child relationships.
Both processNode and ingestRawFileUnder now use map lookups instead of
linear scans over parent.Children for dedup checks.

Fixes: mache-4lb
Make sortedKeys generic over the value type so it accepts map[string]int
directly, eliminating the boolMap conversion that allocated a second map
just to extract keys.
Move the duplicated hidden-dir + build-artifact skip check into a single
exported ShouldSkipDir in internal/ingest (next to ShouldSkipFile).
Replace inline duplicates in engine.go, gitignore.go, cmd/infer.go, and
cmd/utils.go with calls to the shared function.
…onversion

Replace 7 identical `strings.TrimPrefix(filepath.ToSlash(p), "/")` patterns
with a single `toNodeID` helper function.
…kDir consistency

Arena page-diff:
- Skip page-level diff for small DBs (<=1MB) — full write is faster on SSDs
- Reuse single zeroPage allocation instead of per-page make()
- Replace byte-by-byte isZeroPage with bytes.Count (SIMD-optimized)
- Extract defaultSQLitePageSize const from magic 4096

Formatter safety:
- Add 10s timeout via exec.CommandContext to prevent hung formatters
- Prefix relative paths with "./" to prevent --flag injection in prettier

Engine cleanup:
- Reset childSeen map on each Ingest() call (prevents stale dedup entries)
- Switch Ingest() filepath.Walk → WalkDir (matches gitignore refactor)
- Extract binarySniffSize const from magic 512

Build command:
- Switch inference walk from filepath.Walk → WalkDir + ShouldSkipDir

SQLite writer:
- Extract defaultBatchSize const from magic 10000
@jamestexas jamestexas merged commit feb3a4c into main Mar 15, 2026
12 checks passed
@jamestexas jamestexas deleted the feat/overnight-agent-fixes branch March 15, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant