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

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

Open
#244 0 comments 0 reactions 0 assignees View on GitHub
ticket
Dominant language
Rust
Stars
0
Forks
0
Avg merge
14h 13m
Merged PRs (30d)
16

Description

### 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.