[DIT-13467]: send git metadata with post v2scan - #155
Merged
Conversation
laurakoye
changed the base branch from
master
to
laura/dit-13461-read-git-context-in-the-cli-scan
August 19, 2026 17:56
3 tasks
jholiga
reviewed
Aug 20, 2026
jholiga
left a comment
Contributor
There was a problem hiding this comment.
One comment, I think we want to be passing the repo-relative root in the post /v2/scan body, so we can use it for building the codelinks
jholiga
approved these changes
Aug 20, 2026
laurakoye
merged commit Aug 20, 2026
07701e7
into
laura/dit-13461-read-git-context-in-the-cli-scan
1 check passed
laurakoye
added a commit
that referenced
this pull request
Aug 20, 2026
* [DIT-13461]: Read git context in the CLI scan * bumping * comments * Added -c commit.gpgsign=false to the temp repo's git calls so the tests don't break for teammates who sign commits by default + prettier * comments making test file easier to understand * bumping package and adding port test * [DIT-13467]: send git metadata with post v2scan (#155) * [DIT-13467]: Send git metadata with POST /v2/scan * scanning a directory with no extractable strings now actually prints that warning * repoRelativeRoot
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Stacked on #154 — this diff is only the wiring.
ditto scannow tells the server which repo and commit it scanned, so a later scan can be matched against this one instead of importing every string again.What
POST /v2/scansends:{ "path": "/Users/laura/Desktop/Ditto/cli/lib/src/scan", + "repoKey": "github.com/dittowords/cli", + "gitCommitSha": "d3c1a8148580e1869c91ee6caadda17165ceb0ea", + "gitBranch": "laura/dit-13467-send-git-metadata-with-post-v2scan", + "repoRelativeRoot": "lib/src/scan" }repoRelativeRootis where the scan started inside the repo. Candidate paths come out relative tothe scanned directory, so ditto-app #9367 prefixes this root to build a repo-root-relative code link
path.
""when the scan is the repo root, and omitted if the scanned path somehow sits outside therepo, so a bad value never becomes a wrong link.
Outside a git repo the body is unchanged from today, and the scan still runs:
With uncommitted changes it runs too, with a note that the commit is approximate.
Safe to merge before the server reads any of this — zod strips unknown keys, so
/v2/scanignores the new fields today.Context
repoRelativeRootis the first of DIT-13468's fields, pulled forward so #9367 has its prefix.scannedPathsandscannedAllPathsstay in that ticket.repoRootanddirtyare read but not sent:repoRootis local-only — it only derivesrepoRelativeRoot— anddirtyis a warning, not a field.Test Plan
yarn testpasses —buildInitiateScanBodycovers the payload with and without git context, at the repo root, and outside the repoditto scaninside a repo completes as beforeditto scanin a directory that isn't a repo prints the warning and still completes