Skip to content

Skip symlinks by default during source enumeration#647

Open
gfs with Copilot wants to merge 6 commits into
mainfrom
copilot/change-default-library-sym-link-behavior
Open

Skip symlinks by default during source enumeration#647
gfs with Copilot wants to merge 6 commits into
mainfrom
copilot/change-default-library-sym-link-behavior

Conversation

Copilot AI commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Source scans now skip direct, nested, and dangling symbolic links by default. Existing traversal behavior remains available as an explicit opt-in.

Changes

  • Added AnalyzeOptions.FollowSymlinks for library callers.
  • Added --follow-symlinks to the analyze and tagdiff CLI commands.
  • Propagated the option through tag-diff scans.
  • Added coverage for file, directory, and dangling symlinks.
appinspector analyze --source-path ./src --follow-symlinks

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@gfs
gfs requested a review from Copilot July 13, 2026 17:42
@gfs

gfs commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

/azp run

@gfs
gfs marked this pull request as ready for review July 13, 2026 17:45
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR changes source enumeration defaults to skip symbolic links unless explicitly enabled, and threads that new behavior through both the library surface area and the CLI (including tag-diff).

Changes:

  • Added AnalyzeOptions.FollowSymlinks and propagated it through TagDiffCommand and the CLI options.
  • Updated source enumeration in AnalyzeCommand to skip reparse points by default (and follow them when opted-in).
  • Added tests covering symlinked files/directories and dangling symlinks.
Show a summary per file
File Description
AppInspector/Commands/AnalyzeCommand.cs Adds FollowSymlinks option and updates enumeration behavior to skip/follow symlinks accordingly.
AppInspector/Commands/TagDiffCommand.cs Threads FollowSymlinks through tag-diff scans by passing it into underlying AnalyzeCommand runs.
AppInspector.CLI/CLICmdOptions.cs Adds --follow-symlinks CLI option via shared analysis options.
AppInspector.CLI/Program.cs Maps CLI FollowSymlinks into AnalyzeOptions/TagDiffOptions.
AppInspector.Tests/Commands/TestAnalyzeCmd.cs Adds tests for follow/skip behavior across file, directory, and dangling symlinks.

Review details

  • Files reviewed: 5/5 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment thread AppInspector/Commands/AnalyzeCommand.cs
Comment on lines +154 to +160
File.CreateSymbolicLink(Path.Combine(sourcePath, "linked-file.js"), Path.GetFullPath(linkedFileTarget));
Directory.CreateSymbolicLink(Path.Combine(sourcePath, "linked-directory"),
Path.GetFullPath(linkedDirectoryTarget));
var directLinkedFile = Path.Combine(testRoot, "direct-linked-file.js");
var directLinkedDirectory = Path.Combine(testRoot, "direct-linked-directory");
File.CreateSymbolicLink(directLinkedFile, Path.GetFullPath(linkedFileTarget));
Directory.CreateSymbolicLink(directLinkedDirectory, Path.GetFullPath(linkedDirectoryTarget));
Comment thread AppInspector.Tests/Commands/TestAnalyzeCmd.cs Outdated
gfs and others added 2 commits July 15, 2026 13:00
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@gfs

gfs commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@gfs

gfs commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@copilot it looks like some tests are failing due to build breaks with the proposed fixes merged. Can you resolve?

Copilot AI commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot it looks like some tests are failing due to build breaks with the proposed fixes merged. Can you resolve?

Fixed in the latest commit. The FollowSymlinks test was missing the try/catch around the first File.CreateSymbolicLink call that the SkipsDanglingSymlinksByDefault test had — so it threw UnauthorizedAccessException on Windows agents without Developer Mode instead of skipping. The test now skips gracefully in that case.

Copilot finished work on behalf of gfs July 15, 2026 23:20
Copilot AI requested a review from gfs July 15, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants