about summary refs log tree commit diff
path: root/db.odin
diff options
context:
space:
mode:
authorPjotr Prins <pjotr.public01@thebird.nl>2026-11-17 10:18:26 +0000
committerPjotr Prins <pjotr.public01@thebird.nl>2026-11-17 10:18:26 +0000
commitb7234d2514b4a693b37cf4968b267a5fafe16678 (patch)
tree0691588a6d1507230f9298ac18b855675c4d2eeb /db.odin
parentb861693dc26a8f9944c3464a34c101af5a81d33c (diff)
downloadai-memory-master.tar.gz
symbols: scan Python and Ruby declarations, and make why FILEBASE resolve HEAD master
A commit that only adds a file recorded nothing: git has no before-side for
the new file, so its hunks carry no context ("@@ -0,0 +1,207 @@"), and Python
and Ruby had no declaration scanner to fall back on. Adding
bin/geno2mdb.py to gemma-wrapper left one commit row and two reasoning
entries with no symbol at all, so `why` could not reach them while `search`
and `list` could.

Both languages are now scanned line by line, which is the right tool here:
in Python and Ruby a declaration is the first token on its line, so the
keyword decides -- `def foo(bar):` declares, `foo(bar)` calls -- the
distinction no C++ line scanner can make.

  Python   def / async def -> fn, class -> type, and at column 0 only
           NAME = value -> const, NAME: Type -> var (an indented assignment
           is a local inside a def)
  Ruby     def / def self.NAME (with ? ! = suffixes) -> fn, class / module ->
           type, and a column-0 capitalised NAME = value -> const

An added file needs no special case: every one of its lines is a '+' line,
which git_touched already walks, so the same path that records an added line
in an existing file now records a new file's declarations. Names strip .py
and .rb like .odin and .rs (script.helper); the C family keeps its extension
because a header declaration and the source definition are different rows.

The lookup's last resort was `s.name like '%name'` -- a suffix match -- so
`why geno2mdb` could never find a file's own symbols even though SKILL.md
documents a LIKE '%...%' scan. It is a substring match now, so the file base
works, and the doc is true again.

The check phase commits script.py and script.rb into its throwaway
repository and asserts both land as `add` rows and that `why script`
resolves; measured on gemma-wrapper, sync adds 344 touches over 319 commits
and `why read_snps` reaches the reasoning attached to the commit that
introduced it.
Diffstat (limited to 'db.odin')
0 files changed, 0 insertions, 0 deletions