Back to the room

Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works

Code Observatory / Source

Pointer to request

The blob SHA comes from the row written at index time, not from the file being checked.

PINNED SOURCE Copied from the repository at this commit. Source, not an execution.

PHAROS at 975a38dMIT license

source_requestsbackend/app/codeintel/context.py, lines 116–151Open source
def source_requests(db: Session, hits: list[Hit]) -> list[SourceRequest]:    if not hits:        return []    repo_rows = {        str(r.id): r        for r in db.execute(            select(Repository).where(Repository.id.in_({uuid.UUID(h.repository_id) for h in hits}))        ).scalars()    }    blob = dict(        db.execute(            select(Resource.id, Resource.content_sha).where(                Resource.id.in_({uuid.UUID(h.resource_id) for h in hits if h.resource_id})            )        ).all()    )    reqs = []    for h in hits:        repo = repo_rows[h.repository_id]        start, end = h.start_line or 1, h.end_line or 1        if h.kind == "module":            end = min(end, start + MODULE_CODE_LINES - 1)        reqs.append(            SourceRequest(                key=h.chunk_id,                source_type=repo.source_type,                repository_url=repo.url,                local_path=repo.local_path,                commit=h.commit_sha or "",                path=h.path,                start_line=start,                end_line=end,                blob_sha=blob.get(uuid.UUID(h.resource_id)) if h.resource_id else None,            )        )    return reqs

Where this comes from

Commit
975a38d5d17839c26ee219295a5be6ac66b6d910
File
backend/app/codeintel/context.py
Lines
116–151
Git blob
0c4a7dd4639651a5c13142d168630e344439f22a
License
MIT, © 2024–2026 Pharos Contributors. Notice

Read it on GitHub at this commit

Check it yourself

From a clone of the repository, the first command prints the blob above and the second prints these lines.

git rev-parse 975a38d:backend/app/codeintel/context.py
git show 975a38d:backend/app/codeintel/context.py | sed -n '116,151p'