Skip to content

Commit e50ae89

Browse files
tae2089claude
andcommitted
Collapse dead parser rung and drop write-only Deps.Parser field
Two parser-plumbing test seams flagged by the interface audit: - The commentParserWithLanguage rung in parseForBuild only matched a test parser that implemented ParseWithComments but not the richer ParseWithCommentsAndMetadata; production parsers (*treesitter.Walker) always match the metadata rung. Upgrade that test parser to the full metadata contract and delete the middle rung and its interface. - Deps.Parser had no production reader (graphService builds from Deps.Walkers); only a test built an incremental syncer from it. Point that test at Deps.Walkers[".go"] and remove the field and its wiring. No production behavior change: Walker already took the metadata path and Deps.Parser was never read outside tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 87c26b2 commit e50ae89

6 files changed

Lines changed: 6 additions & 20 deletions

File tree

internal/mcp/deps.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ type PostprocessPolicy interface {
150150
type Deps struct {
151151
Store store.GraphStore
152152
DB *gorm.DB
153-
Parser Parser
154153
Walkers map[string]Parser
155154
SearchBackend storesearch.Backend
156155
ImpactAnalyzer ImpactAnalyzer

internal/mcp/e2e_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ func setupE2EDeps(t *testing.T) *Deps {
5454
return &Deps{
5555
Store: st,
5656
DB: db,
57-
Parser: goParser,
5857
Walkers: map[string]Parser{".go": goParser},
5958
SearchBackend: sb,
6059
ImpactAnalyzer: impact.New(st),
@@ -243,7 +242,7 @@ func TestE2E_IncrementalReparse(t *testing.T) {
243242
deps := setupE2EDeps(t)
244243
ctx := context.Background()
245244

246-
syncer := incremental.New(deps.Store, deps.Parser)
245+
syncer := incremental.New(deps.Store, deps.Walkers[".go"])
247246

248247
// Step 1: Initial parse
249248
originalCode := `package calc

internal/mcp/testhelpers_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ func (p *commentAwareGoParser) ParseWithComments(ctx context.Context, filePath s
126126
return nodes, edges, comments, nil
127127
}
128128

129+
func (p *commentAwareGoParser) ParseWithCommentsAndMetadata(ctx context.Context, filePath string, content []byte) ([]model.Node, []model.Edge, []treesitter.CommentBlock, treesitter.ParseMetadata, error) {
130+
nodes, edges, comments, err := p.ParseWithComments(ctx, filePath, content)
131+
return nodes, edges, comments, treesitter.ParseMetadata{}, err
132+
}
133+
129134
func (p *commentAwareGoParser) Language() string {
130135
return "go"
131136
}
@@ -159,7 +164,6 @@ func setupTestDeps(t *testing.T) *Deps {
159164
return &Deps{
160165
Store: st,
161166
DB: db,
162-
Parser: goParser,
163167
Walkers: map[string]Parser{".go": goParser},
164168
SearchBackend: sb,
165169
ImpactAnalyzer: impact.New(st),
@@ -203,7 +207,6 @@ func setupTestDepsMinimal(t *testing.T) *Deps {
203207
return &Deps{
204208
Store: st,
205209
DB: db,
206-
Parser: goParser,
207210
Walkers: map[string]Parser{".go": goParser},
208211
SearchBackend: sb,
209212
ImpactAnalyzer: impact.New(st),
@@ -239,7 +242,6 @@ func setupGraphOnlyTestDeps(t *testing.T) *Deps {
239242
return &Deps{
240243
Store: st,
241244
DB: db,
242-
Parser: goParser,
243245
Walkers: map[string]Parser{".go": goParser},
244246
ImpactAnalyzer: impact.New(st),
245247
FlowTracer: flows.New(st),
@@ -373,7 +375,6 @@ func setupTestDepsWithComments(t *testing.T) *Deps {
373375
t.Helper()
374376
deps := setupTestDeps(t)
375377
goParser := &commentAwareGoParser{}
376-
deps.Parser = goParser
377378
deps.Walkers = map[string]Parser{".go": goParser}
378379
return deps
379380
}

internal/mcpruntime/runtime.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ func New(rt *core.Runtime, opts Options) (*Instance, error) {
8787
mcpDeps := &mcp.Deps{
8888
Store: rt.Store,
8989
DB: rt.DB,
90-
Parser: rt.Walkers[".go"],
9190
Walkers: mcpWalkers,
9291
SearchBackend: rt.SearchBackend,
9392
ImpactAnalyzer: impact.New(rt.Store),

internal/service/fileio.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ func parseForBuild(ctx context.Context, parser Parser, relPath string, content [
5656
nodes, edges, comments, meta, err := mp.ParseWithCommentsAndMetadata(ctx, relPath, content)
5757
return nodes, edges, comments, meta, mp.Language(), err
5858
}
59-
if cp, ok := parser.(commentParserWithLanguage); ok {
60-
nodes, edges, comments, err := cp.ParseWithComments(ctx, relPath, content)
61-
return nodes, edges, comments, treesitter.ParseMetadata{}, cp.Language(), err
62-
}
6359
nodes, edges, err := parser.ParseWithContext(ctx, relPath, content)
6460
return nodes, edges, nil, treesitter.ParseMetadata{}, "", err
6561
}

internal/service/indexer.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,6 @@ type Parser interface {
4444
ParseWithContext(ctx context.Context, filePath string, content []byte) ([]model.Node, []model.Edge, error)
4545
}
4646

47-
// commentParserWithLanguage is the optional contract a Parser may satisfy to expose comment blocks plus its source language.
48-
// @intent let the build pipeline collect docstring/comment blocks alongside nodes and edges when the parser supports it.
49-
type commentParserWithLanguage interface {
50-
Parser
51-
ParseWithComments(ctx context.Context, filePath string, content []byte) ([]model.Node, []model.Edge, []treesitter.CommentBlock, error)
52-
Language() string
53-
}
54-
5547
// @intent 메타데이터와 언어 정보까지 돌려주는 parser 확장을 build 경로에서 감지하게 한다.
5648
type metadataParserWithLanguage interface {
5749
Parser

0 commit comments

Comments
 (0)