ADORSYS-GIS / ADORSYS-GIS/lightbridge-code-intelligence

[Ticket]: Implement RFC-0002 — incremental / layered indexing (base + per-PR overlay)

Abierto
#244 0 comentarios 0 reacciones 0 asignados Ver en GitHub
ticket
Lenguaje dominante
Rust
Estrellas
0
Forks
0
Merge medio
14 h 13 min
PR fusionados (30 d)
16

Descripción

### Type

Feature

### Summary

Implement RFC-0002: incremental/layered indexing — index the default branch once, build per-PR overlays keyed by commit-sha, retrieve over base ⊕ overlay, manage layer lifecycle from webhooks (add on PR open, delete on close/branch-delete) + a sweeper, with correct Neo4j pruning.

### Intent

Stop re-indexing per PR (wasteful) and keep multi-branch retrieval correct without unbounded Neo4j/pgvector buildup.

### Source of truth (links)

- `docs/rfc/0002-incremental-layered-indexing.md` (the RFC; implementation is not yet built)
- Related: ADR-0050 (snapshot pinning), ADR-0052 (pruning)

### Current Behavior

Reviews reuse the latest base snapshot (ADR-0050) and snapshots are pruned (ADR-0052), but there is no base⊕overlay layering: a PR on a non-default branch can't get a branch-accurate overlay.

### Expected Behavior

Base index for the default branch; per-PR overlay layers keyed by commit-sha; retrieval merges base ⊕ overlay; overlays created/deleted by webhook lifecycle + a sweeper; Neo4j + pgvector both pruned correctly.

### Acceptance Criteria

- [ ] Default-branch base index built once and reused
- [ ] Per-PR overlay created on PR open, deleted on close/branch-delete
- [ ] Retrieval returns branch-accurate results (base ⊕ overlay)
- [ ] A sweeper removes orphaned layers; no unbounded store growth

### Out of Scope

Changing the embedding model/dimension; the structural-parser replacement (tracked separately).

### Technical Context

Likely warrants its own epic once scoped. Touches the indexer (agent-runner), the snapshot model (control-plane db), and the webhook lifecycle. Builds on ADR-0050/0052.

### Risks

Large feature — overlay correctness, lifecycle races (PR closed mid-index), and pruning correctness are the main risks.

### Test Plan

Index a repo; open a PR on a feature branch; confirm retrieval reflects the branch; close the PR; confirm the overlay (pg + Neo4j) is swept.

### Verification evidence

_None yet — this is a freshly-filed backlog item; evidence to be attached on implementation._

### Human accountable owner

@stephane-segning

### AI Usage Declaration

- [x] Drafting the ticket
- [x] Understanding code
- [ ] Proposing implementation
- [ ] Generating code
- [ ] Refactoring
- [ ] Generating tests
- [ ] Reviewing the diff
- [ ] Writing documentation
- [ ] Not used

### Human verification completed

> AI-drafted from a code/repo audit this session. The accountable owner (@stephane-segning) verifies and checks these — left unchecked deliberately (AI output is not truth).

- [ ] I understood the intent
- [ ] I checked the source of truth
- [ ] I reviewed all AI-generated text/code
- [ ] I verified the implementation manually
- [ ] I verified the tests
- [ ] I checked for hallucinated assumptions
- [ ] I documented remaining risks
- [ ] I am the accountable owner and accept responsibility for this ticket.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.