Back to the room

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

Code Observatory / Source

Compare before returning

The check itself. A mismatch returns unavailable:content_mismatch and no code. With no recorded SHA, code is returned with verified left false.

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

PHAROS at 975a38dMIT license

_resolve_onebackend/app/codeintel/source.py, lines 141–162Open source
def _resolve_one(req: SourceRequest, token: str | None) -> SourceResult:    try:        data, origin = _load(req, token)    except PermissionError:        return SourceResult(req.key, "unavailable:host_not_allowed")    except FileNotFoundError:        return SourceResult(req.key, "unavailable:not_found")    except OverflowError:        return SourceResult(req.key, "unavailable:too_large")    except LookupError:        return SourceResult(req.key, "unavailable:no_raw_endpoint")    except GitError:        return SourceResult(req.key, "unavailable:git_error")    except Exception as exc:  # network errors, timeouts        logger.info("source fetch failed for %s: %s", req.path, type(exc).__name__)        return SourceResult(req.key, "unavailable:fetch_failed")    verified = False    if req.blob_sha:        if git_blob_sha(data) != req.blob_sha:            return SourceResult(req.key, "unavailable:content_mismatch")        verified = True    return SourceResult(req.key, "resolved", _slice(data, req.start_line, req.end_line), verified, origin)

Where this comes from

Commit
975a38d5d17839c26ee219295a5be6ac66b6d910
File
backend/app/codeintel/source.py
Lines
141–162
Git blob
c9f05cf7bf871b09919d64e9fdaf8380ecc3df2c
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/source.py
git show 975a38d:backend/app/codeintel/source.py | sed -n '141,162p'