Skip to content

[Bug] AST index can't build #59

Description

@CK-k1vv9

Termdock Version | Termdock 版本

Latest (main branch) | 最新版 (主分支)

Platform | 平台

macOS (Apple Silicon - M1 ~ M5)

Bug Description | 錯誤描述

This might be caused by the following issues:

  1. Bug in Termdock's .gitignore parser: The repository's .gitignore uses [Oo]bj/ (a character class) to ignore the obj/ directory. However, Termdock's GitignoreParser.gitignorePatternToRegex() escapes [ and ] as literal characters. As a result, the converted regex never matches the actual obj/ path. Verified behavior:
    regex: /(^|/)[Oo]bj(/.*)?$/ → match obj/ = false
  2. Cascade failure & crash loop: Because obj/ is not excluded, the worker scans the build output directory and hits project.packagespec.json. This file begins with a UTF-8 BOM, causing JSON.parse to fail. The worker attempts a regex fallback but ends up crashing with Aborted(). Upon restarting and re-initializing, the worker scans the exact same file and crashes again—triggering an infinite crash loop, which leaves indexSize: 0 and lastUpdate: 1970.

Steps to Reproduce | 重現步驟

  1. use code analysis.home.buildindex

Expected Behavior | 預期行為

No response

Screenshots | 螢幕截圖

No response

Logs | 日誌

{"timestamp":"2026-08-21T02:06:28.386Z","level":"error","message":"[ASTWorker:stderr] 🔍 [loadLanguageParser] Loading parser for language: c_sharp","source":"main-process"}
{"timestamp":"2026-08-21T02:06:29.675Z","level":"error","message":"[ASTWorker:stderr] 🔍 [loadLanguageParser] Loading parser for language: c_sharp","source":"main-process"}
{"timestamp":"2026-08-21T02:06:29.675Z","level":"error","message":"[ASTWorker:stderr] 🔍 [loadLanguageParser] Loading parser for language: c_sharp","source":"main-process"}
{"timestamp":"2026-08-21T02:06:30.037Z","level":"error","message":"[ASTWorker:stderr] Invalid JSON in /project/obj/local/project.packagespec.json, extracting keys with regex","source":"main-process"}
{"timestamp":"2026-08-21T02:06:38.453Z","level":"error","message":"[ASTWorker:stderr] Aborted()","source":"main-process"}
{"timestamp":"2026-08-21T02:06:39.511Z","level":"error","message":"[ASTWorkerManager] TIMEOUT ast_4_1787277699512","source":"main-process"}

Additional Context | 額外資訊

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working as expectedtriage

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions