Repository navigation
feat(extensions): diff untracked files in project.gitDiff - #468
Merged
Merged
Conversation
✅ Deploy Preview for lustrous-tiramisu-75059c ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Summary
context.project.gitDiff()now also returnsuntracked: every untracked, non-ignored regular file in the repository diffed as a new file (git diff --no-index -- /dev/null <path>), next to the existingstagedandunstagedsections. The field is optional in the contract, the control-api schema and the SDK types, so existing callers and older extensions are unaffected.Bounds: at most 32 untracked files of up to 128 KiB each, and the serialized
untrackedsection is capped at 48 KiB (cut at a line boundary) so the full envelope (96 + 96 + 48 KiB) still fitsEXTENSION_PEER_LIMITS.project. Symlinks, directories (including nested repositories), unreadable or oversized files, and files past the 32nd are skipped; any cut or skip sets the existingtruncatedflag. Untracked listing usesgit ls-files --others --exclude-standard -z --full-name -- :/, the top level comes fromrev-parse --show-cdup(validated as(../)*), and the physical project path (realpath) is used for the lstat/access checks so a symlinked project path checks the same files Git reads. The per-file diff runs under the same hardened fixed argv as the tracked diffs and shares their 2 s deadline.Commits: reader (8d1f882), schema + SDK types (8f81af8), docs (accc0ad), route test (2e927d8), physical-path fix (17770a2), docs/comment follow-ups (d5a51a9, 0b20277), regenerated embedded public assets for the SDK change (d31a8d2).
Motivation and scope
The Changes context view (
wolfpack-extension-changes) showed status rows for untracked files but could not open a diff for them:git diff/git diff --cachednever include untracked content, and extensions have no git or filesystem access of their own by design. Adding the section host-side keeps git execution host-owned and read-only instead of exposing paths or arguments to extensions.wolfpack-extension-changes@0.1.1(published) renders this section when present and shows "This host does not diff untracked files." on hosts without it.Out of scope: a separate truncation flag for the untracked section (the single
truncatedflag is kept), and any change to the staged/unstaged caps or argv.Validation
bun test tests/unit/project-git-diff.test.ts: 12 pass, 0 fail (covers untracked diffs across subdirectories, ignore rules, nested repositories, symlinks, count/size caps, a project reached through a symlink, a file that vanishes between listing and diffing, and the serialized-size bound).tests/integration/extension-routes.test.tsandtests/integration/extension-peer-proxy.test.tsupdated for the new field (worst-case 96 + 96 + 48 KiB envelope accepted by the peer limit).bun run scripts/gen-assets.tsregeneratedsrc/public-assets.tswith the same hashes CI computes (app.bundle.js4edf9ebb94a216b5,ASSET_VERSION9484a71fdf3031dc); the first CI run failed only on that stale generated file.bun run typecheck,bun run check:bundle-budgets(app.bundle.js gzip 104992 of 105500, +24 B),bun run check:context: exit 0.bun teston this machine: 4 failures only from the missing localbroker/target/release/wolfpack-brokerbinary, plus timing-sensitive tests that pass alone;extensions-frontend.e2e.tspassed, other e2e failures were environmental (missing webkit, broker binary).git diff --no-indexon symlinks: links to regular/outside/dangling targets are emitted asnew file mode 120000without following; only a link to a named pipe is read through and would block, which is why only regular files are diffed.ls-files --othersreads every file in untracked, non-ignored directories, so such a tree can hit the shared 2 s deadline and makegitDiffunavailable (documented).User, security, and compatibility impact
truncatednow also reports skipped untracked entries, so a truncation notice can appear while staged/unstaged diffs are complete..gitignoreis honored; symlinks and nested repositories are never read; the peer proxy re-validatesuntrackedthrough the schema (maxLength49152).parseProjectGitDiffaccepts responses without it; no change for callers that ignore it.Documentation
docs/extensions.md:untrackedsection, caps, skip rules,truncatedsemantics, large-tree timeout risk.docs/generated/control-api.schema.json,sdk/types/*.d.ts,src/extensions/sdk.ts: regenerated/updated for the optional field andMAX_GIT_DIFF_UNTRACKED_BYTES.Checklist