Skip to content

Commit 553631c

Browse files
Mpdreamzclaude
andcommitted
Rename WrapToRead/WrapToWrite to explicit Scope* methods; fix navigation test scope
WrapToRead/WrapToWrite implicitly injected Paths.WorkingDirectoryRoot into every scope, which was a wrong assumption when the inner FS contained files outside the working directory (e.g. navigation tests with MockFS at /checkouts/...). New explicit API in FileSystemFactory: - ScopeCurrentWorkingDirectory(inner) — scopes to WorkingDirectoryRoot + ApplicationData - ScopeCurrentWorkingDirectory(inner, extensionRoots) — adds detection-rules roots - ScopeCurrentWorkingDirectoryForWrite(inner) — write variant (no .git) - ScopeSourceDirectory(inner, sourceRoot) — scopes to an explicit root + ApplicationData - ScopeSourceDirectoryForWrite(inner, sourceRoot) — write variant All production options fields renamed: ReadOptions → WorkingDirectoryReadOptions, WriteOptions → WorkingDirectoryWriteOptions (makes scope intent visible in code). DocumentationSetFile.LoadAndResolve: replace the InvalidOperationException cast guard with FileSystemFactory.ScopeSourceDirectory(fs, directory.FullName) so callers with unscoped IFileSystem/IDirectoryInfo (e.g. from a raw MockFileSystem) are automatically given the tightest correct scope. Navigation.Tests/Assembler: change ScopeCurrentWorkingDirectory(fileSystem) → ScopeSourceDirectory(fileSystem, "/checkouts") for all tests that use SiteNavigationTestFixture (MockFS rooted at /checkouts/current/...). TestDocumentationSetContext: use ScopeSourceDirectory(fileSystem, sourceDirectory.FullName) and ScopeSourceDirectoryForWrite(fileSystem, outputDirectory.FullName) so each test gets a scope precisely matching its mock FS tree. Fix 3 semantic bugs where WriteFileSystem was assigned ScopeCurrentWorkingDirectory instead of ScopeCurrentWorkingDirectoryForWrite: - CodexNavigationTestBase, GroupNavigationTests, CrossLinkRegistryTests Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent ea846b5 commit 553631c

29 files changed

Lines changed: 147 additions & 110 deletions

src/Elastic.Documentation.Configuration/FileSystemFactory.cs

Lines changed: 57 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static class FileSystemFactory
1313
// Read options: workspace + app data, all confirmed hidden names allowed.
1414
// Includes .git (GitCheckoutInformation reads it) and .artifacts/.doc.state
1515
// (incremental build reads existing output state).
16-
private static readonly ScopedFileSystemOptions ReadOptions = new(
16+
private static readonly ScopedFileSystemOptions WorkingDirectoryReadOptions = new(
1717
[Paths.WorkingDirectoryRoot.FullName, Paths.ApplicationData.FullName])
1818
{
1919
AllowedHiddenFolderNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { ".git", ".artifacts" },
@@ -23,7 +23,7 @@ public static class FileSystemFactory
2323
// Write options: same scope roots but no .git — nothing in the build output
2424
// pipeline should ever write into the git repository metadata.
2525
// Temp is allowed because deploy operations (e.g. S3 sync) stage files there.
26-
private static readonly ScopedFileSystemOptions WriteOptions = new(
26+
private static readonly ScopedFileSystemOptions WorkingDirectoryWriteOptions = new(
2727
[Paths.WorkingDirectoryRoot.FullName, Paths.ApplicationData.FullName])
2828
{
2929
AllowedHiddenFolderNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { ".artifacts" },
@@ -44,14 +44,14 @@ public static class FileSystemFactory
4444
/// (read by <c>GitCheckoutInformation</c>), <c>.artifacts</c> and <c>.doc.state</c>
4545
/// (read for incremental build state).
4646
/// </summary>
47-
public static ScopedFileSystem RealRead { get; } = new ScopedFileSystem(new FileSystem(), ReadOptions);
47+
public static ScopedFileSystem RealRead { get; } = new ScopedFileSystem(new FileSystem(), WorkingDirectoryReadOptions);
4848

4949
/// <summary>
5050
/// A pre-allocated <see cref="ScopedFileSystem"/> for writing build output.
5151
/// Same scope as <see cref="RealRead"/> but without <c>.git</c> access —
5252
/// nothing in the output pipeline should write into git repository metadata.
5353
/// </summary>
54-
public static ScopedFileSystem RealWrite { get; } = new ScopedFileSystem(new FileSystem(), WriteOptions);
54+
public static ScopedFileSystem RealWrite { get; } = new ScopedFileSystem(new FileSystem(), WorkingDirectoryWriteOptions);
5555

5656
/// <summary>
5757
/// A pre-allocated <see cref="ScopedFileSystem"/> scoped only to the per-user
@@ -63,30 +63,36 @@ public static class FileSystemFactory
6363

6464
/// <summary>
6565
/// Creates a new <see cref="ScopedFileSystem"/> wrapping a fresh <see cref="MockFileSystem"/>,
66-
/// using the read workspace options. Each call returns a new independent in-memory file system.
66+
/// using the working-directory read options. Each call returns a new independent in-memory file system.
6767
/// </summary>
68-
public static ScopedFileSystem InMemory() => new(new MockFileSystem(), ReadOptions);
68+
public static ScopedFileSystem InMemory() => new(new MockFileSystem(), WorkingDirectoryReadOptions);
6969

70-
/// <summary>Wraps <paramref name="inner"/> with read workspace options (.git allowed).</summary>
71-
public static ScopedFileSystem WrapToRead(IFileSystem inner) =>
72-
new(inner, ReadOptions);
70+
/// <summary>
71+
/// Scopes <paramref name="inner"/> to <see cref="Paths.WorkingDirectoryRoot"/> and
72+
/// <see cref="Paths.ApplicationData"/> for reading. Use when the inner FS contains files
73+
/// that live within the current working-directory tree (e.g. a test <c>MockFileSystem</c>
74+
/// seeded with workspace-relative paths).
75+
/// </summary>
76+
public static ScopedFileSystem ScopeCurrentWorkingDirectory(IFileSystem inner) =>
77+
new(inner, WorkingDirectoryReadOptions);
7378

7479
/// <summary>
75-
/// Wraps <paramref name="inner"/> with read workspace options extended by
76-
/// <paramref name="extensionRoots"/> (e.g. detection-rules folders declared via
80+
/// Scopes <paramref name="inner"/> to <see cref="Paths.WorkingDirectoryRoot"/> and
81+
/// <see cref="Paths.ApplicationData"/> for reading, extended by <paramref name="extensionRoots"/>
82+
/// (e.g. detection-rules folders declared via
7783
/// <see cref="IDocsBuilderExtension.ExternalScopeRoots"/>).
7884
/// </summary>
79-
public static ScopedFileSystem WrapToRead(IFileSystem inner, IEnumerable<string>? extensionRoots)
85+
public static ScopedFileSystem ScopeCurrentWorkingDirectory(IFileSystem inner, IEnumerable<string>? extensionRoots)
8086
{
8187
if (extensionRoots is null)
82-
return WrapToRead(inner);
88+
return ScopeCurrentWorkingDirectory(inner);
8389

8490
var roots = new[] { Paths.WorkingDirectoryRoot.FullName, Paths.ApplicationData.FullName }
8591
.Concat(extensionRoots)
8692
.Distinct(StringComparer.OrdinalIgnoreCase)
8793
.ToArray();
8894
if (roots.Length == 2)
89-
return WrapToRead(inner);
95+
return ScopeCurrentWorkingDirectory(inner);
9096

9197
return new ScopedFileSystem(inner, new ScopedFileSystemOptions(roots)
9298
{
@@ -95,14 +101,48 @@ public static ScopedFileSystem WrapToRead(IFileSystem inner, IEnumerable<string>
95101
});
96102
}
97103

98-
/// <summary>Wraps <paramref name="inner"/> with write workspace options (.git not allowed).</summary>
99-
public static ScopedFileSystem WrapToWrite(IFileSystem inner) =>
100-
new(inner, WriteOptions);
104+
/// <summary>
105+
/// Scopes <paramref name="inner"/> to <see cref="Paths.WorkingDirectoryRoot"/> and
106+
/// <see cref="Paths.ApplicationData"/> for writing (.git not allowed). Use when
107+
/// the inner FS writes into the working-directory tree.
108+
/// </summary>
109+
public static ScopedFileSystem ScopeCurrentWorkingDirectoryForWrite(IFileSystem inner) =>
110+
new(inner, WorkingDirectoryWriteOptions);
111+
112+
/// <summary>
113+
/// Scopes <paramref name="inner"/> to an explicit <paramref name="sourceRoot"/> and
114+
/// <see cref="Paths.ApplicationData"/> for reading. Use when the files to be read live under
115+
/// a specific known root that is not <see cref="Paths.WorkingDirectoryRoot"/> — for example
116+
/// test fixtures with assembler-checkout paths or service code operating on a given directory.
117+
/// </summary>
118+
public static ScopedFileSystem ScopeSourceDirectory(IFileSystem inner, string sourceRoot) =>
119+
new(inner, new ScopedFileSystemOptions([sourceRoot, Paths.ApplicationData.FullName])
120+
{
121+
AllowedHiddenFolderNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { ".git", ".artifacts" },
122+
AllowedHiddenFileNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { ".git", ".doc.state" }
123+
});
124+
125+
/// <summary>
126+
/// Scopes <paramref name="inner"/> to an explicit <paramref name="sourceRoot"/> and
127+
/// <see cref="Paths.ApplicationData"/> for writing (.git not allowed). Write variant
128+
/// of <see cref="ScopeSourceDirectory(IFileSystem, string)"/>.
129+
/// </summary>
130+
public static ScopedFileSystem ScopeSourceDirectoryForWrite(IFileSystem inner, string sourceRoot) =>
131+
new(inner, new ScopedFileSystemOptions([sourceRoot, Paths.ApplicationData.FullName])
132+
{
133+
AllowedHiddenFolderNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { ".artifacts" },
134+
AllowedHiddenFileNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { ".doc.state" },
135+
AllowedSpecialFolders = AllowedSpecialFolder.Temp
136+
});
101137

102138
/// <summary>
103139
/// Creates a read <see cref="ScopedFileSystem"/> scoped to the git root of
104140
/// <paramref name="path"/>. Falls back to <see cref="RealRead"/> when <paramref name="path"/>
105141
/// is <see langword="null"/>. Use in commands that accept an explicit <c>--path</c> argument.
142+
/// <para>
143+
/// Suitable for command-layer code. Service-layer tests use <see cref="InMemory()"/> directly
144+
/// and do not exercise this method.
145+
/// </para>
106146
/// </summary>
107147
public static ScopedFileSystem RealForPath(string? path)
108148
{
@@ -144,5 +184,4 @@ public static ScopedFileSystem RealForPathWrite(string? path, string? output = n
144184
AllowedHiddenFileNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { ".doc.state" }
145185
});
146186
}
147-
148187
}

src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ public static DocumentationSetFile LoadMetadata(IFileInfo file)
9999
/// </summary>
100100
public static DocumentationSetFile LoadAndResolve(IDiagnosticsCollector collector, IFileInfo docsetPath, ScopedFileSystem? fileSystem = null, HashSet<HintType>? noSuppress = null)
101101
{
102-
fileSystem ??= docsetPath.FileSystem as ScopedFileSystem
103-
?? throw new InvalidOperationException($"Expected {nameof(ScopedFileSystem)} on {nameof(docsetPath)}");
102+
fileSystem ??= FileSystemFactory.ScopeSourceDirectory(docsetPath.FileSystem, docsetPath.Directory!.FullName);
104103
// Validate that the docset.yml is not a symlink (security: prevents path traversal attacks)
105104
EnsureNotSymlink(docsetPath);
106105
var yaml = fileSystem.File.ReadAllText(docsetPath.FullName);
@@ -122,8 +121,7 @@ public static DocumentationSetFile LoadAndResolve(IDiagnosticsCollector collecto
122121
/// </summary>
123122
public static DocumentationSetFile LoadAndResolve(IDiagnosticsCollector collector, string yaml, IDirectoryInfo sourceDirectory, ScopedFileSystem? fileSystem = null, HashSet<HintType>? noSuppress = null)
124123
{
125-
fileSystem ??= sourceDirectory.FileSystem as ScopedFileSystem
126-
?? throw new InvalidOperationException($"Expected {nameof(ScopedFileSystem)} on {nameof(sourceDirectory)}");
124+
fileSystem ??= FileSystemFactory.ScopeSourceDirectory(sourceDirectory.FileSystem, sourceDirectory.FullName);
127125
var docSet = Deserialize(yaml);
128126
var docsetPath = fileSystem.Path.Join(sourceDirectory.FullName, "docset.yml").OptionalWindowsReplace();
129127
docSet.SuppressDiagnostics.ExceptWith(noSuppress ?? []);

tests-integration/Elastic.Assembler.IntegrationTests/AssemblerConfigurationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public PublicOnlyAssemblerConfigurationTests()
2929
var configurationFileProvider = new ConfigurationFileProvider(NullLoggerFactory.Instance, FileSystem, skipPrivateRepositories: true);
3030
var configurationContext = TestHelpers.CreateConfigurationContext(FileSystem, configurationFileProvider: configurationFileProvider);
3131
var config = AssemblyConfiguration.Create(configurationContext.ConfigurationFileProvider);
32-
var scopedFs = FileSystemFactory.WrapToRead(FileSystem);
32+
var scopedFs = FileSystemFactory.ScopeCurrentWorkingDirectory(FileSystem);
3333
Context = new AssembleContext(config, configurationContext, "dev", Collector, scopedFs, scopedFs, CheckoutDirectory.FullName, null);
3434
}
3535

@@ -66,7 +66,7 @@ public AssemblerConfigurationTests(DocumentationFixture fixture, ITestOutputHelp
6666
Collector = new DiagnosticsCollector([]);
6767
var configurationContext = TestHelpers.CreateConfigurationContext(FileSystem);
6868
var config = AssemblyConfiguration.Create(configurationContext.ConfigurationFileProvider);
69-
var scopedFs = FileSystemFactory.WrapToRead(FileSystem);
69+
var scopedFs = FileSystemFactory.ScopeCurrentWorkingDirectory(FileSystem);
7070
Context = new AssembleContext(config, configurationContext, "dev", Collector, scopedFs, scopedFs, CheckoutDirectory.FullName, null);
7171
}
7272

tests-integration/Elastic.Assembler.IntegrationTests/DocsSyncTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public async Task TestPlan()
4545

4646
var configurationContext = TestHelpers.CreateConfigurationContext(fileSystem);
4747
var config = AssemblyConfiguration.Create(configurationContext.ConfigurationFileProvider);
48-
var scopedFs = FileSystemFactory.WrapToRead(fileSystem);
49-
var scopedWriteFs = FileSystemFactory.WrapToWrite(fileSystem);
48+
var scopedFs = FileSystemFactory.ScopeCurrentWorkingDirectory(fileSystem);
49+
var scopedWriteFs = FileSystemFactory.ScopeCurrentWorkingDirectoryForWrite(fileSystem);
5050
var context = new AssembleContext(config, configurationContext, "dev", collector, scopedFs, scopedWriteFs, null, Path.Join(Paths.WorkingDirectoryRoot.FullName, ".artifacts", "assembly"));
5151
A.CallTo(() => mockS3Client.ListObjectsV2Async(A<ListObjectsV2Request>._, A<Cancel>._))
5252
.Returns(new ListObjectsV2Response
@@ -188,8 +188,8 @@ bool valid
188188

189189
var configurationContext = TestHelpers.CreateConfigurationContext(fileSystem);
190190
var config = AssemblyConfiguration.Create(configurationContext.ConfigurationFileProvider);
191-
var scopedFs2 = FileSystemFactory.WrapToRead(fileSystem);
192-
var scopedWriteFs2 = FileSystemFactory.WrapToWrite(fileSystem);
191+
var scopedFs2 = FileSystemFactory.ScopeCurrentWorkingDirectory(fileSystem);
192+
var scopedWriteFs2 = FileSystemFactory.ScopeCurrentWorkingDirectoryForWrite(fileSystem);
193193
var context = new AssembleContext(config, configurationContext, "dev", collector, scopedFs2, scopedWriteFs2, null, Path.Join(Paths.WorkingDirectoryRoot.FullName, ".artifacts", "assembly"));
194194

195195
var s3Objects = new List<S3Object>();
@@ -240,8 +240,8 @@ public async Task TestApply()
240240
var configurationContext = TestHelpers.CreateConfigurationContext(fileSystem);
241241
var config = AssemblyConfiguration.Create(configurationContext.ConfigurationFileProvider);
242242
var checkoutDirectory = Path.Join(Paths.WorkingDirectoryRoot.FullName, ".artifacts", "assembly");
243-
var scopedFs3 = FileSystemFactory.WrapToRead(fileSystem);
244-
var scopedWriteFs3 = FileSystemFactory.WrapToWrite(fileSystem);
243+
var scopedFs3 = FileSystemFactory.ScopeCurrentWorkingDirectory(fileSystem);
244+
var scopedWriteFs3 = FileSystemFactory.ScopeCurrentWorkingDirectoryForWrite(fileSystem);
245245
var context = new AssembleContext(config, configurationContext, "dev", collector, scopedFs3, scopedWriteFs3, null, checkoutDirectory);
246246
var plan = new SyncPlan
247247
{

tests-integration/Elastic.Assembler.IntegrationTests/NavigationBuildingTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public async Task AssertRealNavigation()
4747
var assemblyConfiguration = AssemblyConfiguration.Create(configurationContext.ConfigurationFileProvider);
4848
var collector = new TestDiagnosticsCollector(TestContext.Current.TestOutputHelper);
4949
var fs = new FileSystem();
50-
var assembleContext = new AssembleContext(assemblyConfiguration, configurationContext, "dev", collector, FileSystemFactory.WrapToRead(fs), FileSystemFactory.WrapToRead(new MockFileSystem()), null, null);
50+
var assembleContext = new AssembleContext(assemblyConfiguration, configurationContext, "dev", collector, FileSystemFactory.ScopeCurrentWorkingDirectory(fs), FileSystemFactory.ScopeCurrentWorkingDirectory(new MockFileSystem()), null, null);
5151
var logFactory = new TestLoggerFactory(TestContext.Current.TestOutputHelper);
5252
var cloner = new AssemblerRepositorySourcer(logFactory, assembleContext);
5353
var checkoutResult = cloner.GetAll();

tests-integration/Elastic.Assembler.IntegrationTests/NavigationRootTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public async Task AssertRealNavigation()
4747
var assemblyConfiguration = AssemblyConfiguration.Create(configurationContext.ConfigurationFileProvider);
4848
var collector = new TestDiagnosticsCollector(TestContext.Current.TestOutputHelper);
4949
var fs = new FileSystem();
50-
var assembleContext = new AssembleContext(assemblyConfiguration, configurationContext, "dev", collector, FileSystemFactory.WrapToRead(fs), FileSystemFactory.WrapToRead(new MockFileSystem()), null, null);
50+
var assembleContext = new AssembleContext(assemblyConfiguration, configurationContext, "dev", collector, FileSystemFactory.ScopeCurrentWorkingDirectory(fs), FileSystemFactory.ScopeCurrentWorkingDirectory(new MockFileSystem()), null, null);
5151
var logFactory = new TestLoggerFactory(TestContext.Current.TestOutputHelper);
5252
var cloner = new AssemblerRepositorySourcer(logFactory, assembleContext);
5353
var checkoutResult = cloner.GetAll();

tests-integration/Elastic.Assembler.IntegrationTests/SiteNavigationTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public SiteNavigationTests(DocumentationFixture fixture, ITestOutputHelper outpu
4444
Collector = new DiagnosticsCollector([]);
4545
var configurationContext = TestHelpers.CreateConfigurationContext(FileSystem);
4646
var config = AssemblyConfiguration.Create(configurationContext.ConfigurationFileProvider);
47-
var scopedFs = FileSystemFactory.WrapToRead(FileSystem);
47+
var scopedFs = FileSystemFactory.ScopeCurrentWorkingDirectory(FileSystem);
4848
Context = new AssembleContext(config, configurationContext, "dev", Collector, scopedFs, scopedFs, CheckoutDirectory.FullName, null);
4949
}
5050

@@ -98,7 +98,7 @@ public async Task ReadAllPathPrefixes()
9898
var fileSystem = new FileSystem();
9999
var configurationContext = TestHelpers.CreateConfigurationContext(fileSystem);
100100
var config = AssemblyConfiguration.Create(configurationContext.ConfigurationFileProvider);
101-
var scopedFileSystem = FileSystemFactory.WrapToRead(fileSystem);
101+
var scopedFileSystem = FileSystemFactory.ScopeCurrentWorkingDirectory(fileSystem);
102102
var context = new AssembleContext(config, configurationContext, "dev", collector, scopedFileSystem, scopedFileSystem, null, null);
103103

104104
var navigationFileInfo = configurationContext.ConfigurationFileProvider.NavigationFile;
@@ -191,7 +191,7 @@ public async Task UriResolving()
191191
var fs = new FileSystem();
192192
var configurationContext = TestHelpers.CreateConfigurationContext(fs);
193193
var config = AssemblyConfiguration.Create(configurationContext.ConfigurationFileProvider);
194-
var scopedFs = FileSystemFactory.WrapToRead(fs);
194+
var scopedFs = FileSystemFactory.ScopeCurrentWorkingDirectory(fs);
195195
var assembleContext = new AssembleContext(config, configurationContext, "prod", collector, scopedFs, scopedFs, null, null);
196196
var repos = assembleContext.Configuration.AvailableRepositories
197197
.Where(kv => !kv.Value.Skip)

tests/Elastic.Changelog.Tests/Changelogs/BundleChangelogsTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3282,7 +3282,7 @@ public async Task BundleChangelogs_WithProfileMode_MissingConfig_ReturnsErrorWit
32823282
currentDirectory: "/empty-project"
32833283
);
32843284
cwdFs.Directory.CreateDirectory("/empty-project");
3285-
var service = new ChangelogBundlingService(LoggerFactory, ConfigurationContext, FileSystemFactory.WrapToRead(cwdFs));
3285+
var service = new ChangelogBundlingService(LoggerFactory, ConfigurationContext, FileSystemFactory.ScopeCurrentWorkingDirectory(cwdFs));
32863286

32873287
var input = new BundleChangelogsArguments
32883288
{
@@ -3342,7 +3342,7 @@ public async Task BundleChangelogs_WithProfileMode_ConfigAtCurrentDir_LoadsSucce
33423342
""";
33433343
await cwdFs.File.WriteAllTextAsync(Path.Join(root, "changelogs/1755268130-feature.yaml"), changelogContent, TestContext.Current.CancellationToken);
33443344

3345-
var service = new ChangelogBundlingService(LoggerFactory, ConfigurationContext, FileSystemFactory.WrapToRead(cwdFs));
3345+
var service = new ChangelogBundlingService(LoggerFactory, ConfigurationContext, FileSystemFactory.ScopeCurrentWorkingDirectory(cwdFs));
33463346

33473347
var input = new BundleChangelogsArguments
33483348
{
@@ -3402,7 +3402,7 @@ public async Task BundleChangelogs_WithProfileMode_ConfigAtDocsSubdir_LoadsSucce
34023402
""";
34033403
await cwdFs.File.WriteAllTextAsync(Path.Join(root, "changelogs/1755268130-feature.yaml"), changelogContent, TestContext.Current.CancellationToken);
34043404

3405-
var service = new ChangelogBundlingService(LoggerFactory, ConfigurationContext, FileSystemFactory.WrapToRead(cwdFs));
3405+
var service = new ChangelogBundlingService(LoggerFactory, ConfigurationContext, FileSystemFactory.ScopeCurrentWorkingDirectory(cwdFs));
34063406

34073407
var input = new BundleChangelogsArguments
34083408
{

tests/Elastic.Changelog.Tests/Changelogs/ChangelogRemoveTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ public async Task Remove_WithProfileMode_MissingConfig_ReturnsErrorWithAdvice()
617617
currentDirectory: "/empty-project"
618618
);
619619
cwdFs.Directory.CreateDirectory("/empty-project");
620-
var service = new ChangelogRemoveService(LoggerFactory, ConfigurationContext, FileSystemFactory.WrapToRead(cwdFs));
620+
var service = new ChangelogRemoveService(LoggerFactory, ConfigurationContext, FileSystemFactory.ScopeCurrentWorkingDirectory(cwdFs));
621621

622622
var input = new ChangelogRemoveArguments
623623
{

tests/Elastic.Changelog.Tests/Changelogs/ChangelogTestBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected ChangelogTestBase(ITestOutputHelper output)
2929
{
3030
Output = output;
3131
var mockFileSystem = new MockFileSystem(new MockFileSystemOptions { CurrentDirectory = Paths.WorkingDirectoryRoot.FullName });
32-
FileSystem = FileSystemFactory.WrapToRead(mockFileSystem);
32+
FileSystem = FileSystemFactory.ScopeCurrentWorkingDirectory(mockFileSystem);
3333
Collector = new TestDiagnosticsCollector(output);
3434
LoggerFactory = new TestLoggerFactory(output);
3535

0 commit comments

Comments
 (0)