Skip to content

Fixbranch1 - #24

Closed
Widthdom wants to merge 6 commits into
mainfrom
fixbranch1
Closed

Fixbranch1#24
Widthdom wants to merge 6 commits into
mainfrom
fixbranch1

Conversation

@Widthdom

Copy link
Copy Markdown
Owner

No description provided.

…ionData

The default IL cache directory was Path.Combine(AppContext.BaseDirectory, "ILCache"),
placing cache files next to the executable. This caused startup failures in read-only
or container deployments and silently wrote files into the installation directory in
multi-user environments.

Change RunScopeBuilder.CreateIlCache to use
Environment.GetFolderPath(SpecialFolder.LocalApplicationData) as the base, giving:
  - Windows:      %LOCALAPPDATA%\FolderDiffIL4DotNet\ILCache
  - macOS/Linux:  ~/.local/share/FolderDiffIL4DotNet/ILCache

Explicit ILCacheDirectoryAbsolutePath in config.json continues to take priority,
so existing custom configurations are unaffected.

Updated: RunScopeBuilder.cs (fix), ConfigSettings.cs (XML doc), README.md (EN+JP
config table), CHANGELOG.md. Added test
CreateIlCache_WhenPathIsEmpty_DefaultsToLocalApplicationDataSubfolder to
ProgramRunnerTests.cs.
Any non-list property in config.json can now be overridden at runtime
without modifying the file by setting FOLDERDIFF_<PROPERTYNAME>
(e.g. FOLDERDIFF_MAXPARALLELISM=4, FOLDERDIFF_ENABLEILCACHE=false,
FOLDERDIFF_ILCACHEDIRECTORYABSOLUTEPATH=/tmp/il-cache).

Bool values accept true/false (case-insensitive) and 1/0. Unrecognised
values are silently ignored. Overrides are applied after JSON
deserialization and before validation, so env-var values are subject to
the same constraints as JSON values. List-type properties
(IgnoredExtensions, TextFileExtensions, etc.) are not overridable via
environment variables.

Implementation: ConfigService.ApplyEnvironmentVariableOverrides (new
internal static method) covers all 27 scalar properties of
ConfigSettings. Added ENV_VAR_PREFIX constant ("FOLDERDIFF_").
Added env var summary block to --help output in ProgramRunner.
Added 10 tests to ConfigServiceTests covering int/bool/string
overrides, env-var-wins-over-JSON, invalid values ignored,
validation still runs, and case-insensitive bool variants.
Added bilingual "Environment Variable Overrides" section to README.md
(EN + JP) and CHANGELOG.md (EN + JP).
Add InlineDiffLazyRender config setting (default true). When enabled,
inline diff tables are Base64-encoded and stored in a data-diff-html
attribute on each <details> element instead of being rendered as live
DOM children. JavaScript decodes and injects the HTML only when the
user expands that row.

For reports with many modified files this eliminates millions of DOM
nodes at page load time — e.g. 5 000 modified files × 200 diff rows
× 3 cells ≈ 3 M fewer nodes — making the initial load and UI
interactions (Clear all, column resize, localStorage save) dramatically
faster.

Setting InlineDiffLazyRender = false restores the previous behaviour
where all diff content is embedded directly in the DOM, which allows
the browser's Find-in-page to search inside collapsed diffs.

Implementation:
- HtmlReportGenerateService: extract BuildDiffViewHtml helper, add
  lazy/non-lazy branch in AppendInlineDiffRow, add setupLazyDiff() /
  decodeDiffHtml() JavaScript functions (called from DOMContentLoaded)
- ConfigSettings: add InlineDiffLazyRender bool property
- HtmlReportGenerateServiceTests: add 4 new tests (data-attr present,
  base64 decodes correctly, non-lazy content inline, JS present);
  update CreateConfig helper with lazyRender parameter (default false
  to preserve existing test semantics)
- README.md (EN + JP): add InlineDiffLazyRender config table entry
- CHANGELOG.md (EN + JP): add entry in [Unreleased] Added section
…dows

Add a `test-windows` job to `.github/workflows/dotnet.yml` that runs
the full test suite on `windows-latest` in parallel with the existing
Ubuntu `build` job. The Windows job:
- Restores and builds `FolderDiffIL4DotNet.sln`
- Installs `dotnet-ildasm` (global tool)
- Runs `dotnet test` with `DOTNET_ROLL_FORWARD=Major`

This ensures `RealDisassemblerE2ETests` — which was previously always
skipped in CI because `dotnet-ildasm` was unavailable — now executes
on every push. The six `DotNetDisassembleServiceTests` that use Unix
shell scripts continue to report Skipped on Windows (by design, via
`Skip.If(OperatingSystem.IsWindows())`).

Updated bilingual `doc/TESTING_GUIDE.md` (test count 516→533 from
prior fixes; CI notes now describe both jobs) and `doc/DEVELOPER_GUIDE.md`
(CI behavior section split into `build`/`test-windows`, "Why this is
safe" updated). Added entry to `CHANGELOG.md` (EN + JP).
Add `--print-config` CLI flag that loads `config.json` (honouring
`--config <path>`), applies all `FOLDERDIFF_*` environment variable
overrides, serialises the resulting `ConfigSettings` as indented JSON
to stdout, and exits with code 0. Config errors (missing file, invalid
JSON) exit with code 3 and print to stderr.

This directly addresses the discoverability gap where users had to read
source code to find out the `IgnoredExtensions` and `TextFileExtensions`
defaults, or to verify which env var overrides are in effect. The output
can also be redirected to bootstrap a pre-populated `config.json`.

Also fixes the omission of `FOLDERDIFF_INLINEDIFFLAZYRENDER` from
`ConfigService.ApplyEnvironmentVariableOverrides` (the property was
added in a prior release but its env var entry was missing).

Changes:
- Runner/CliOptions.cs: add `PrintConfig` parameter
- Runner/CliParser.cs: recognise `--print-config` flag
- ProgramRunner.cs: add `PrintConfigAsync`, handle early exit,
  add `using System.Text.Json`, update `--help` text
- Services/ConfigService.cs: add missing INLINEDIFFLAZYRENDER override
- ProgramRunnerTests.cs: 4 new tests covering exit-0 JSON output,
  env var reflection, custom config path, and missing-file error
- README.md (EN + JP): add `--print-config` to options table
- CHANGELOG.md (EN + JP): document the new flag and bugfix
- doc/TESTING_GUIDE.md (EN + JP): update test count to 537/536/1
…ist and helper tests

Add 11 tests covering previously untested branches in
DisassemblerBlacklist and DisassemblerHelper.

DisassemblerBlacklistTests (3 new tests):
- RegisterFailure_NullOrWhitespace_DoesNotThrow_AndNoEntryCreated
- ResetFailure_NullOrWhitespace_DoesNotThrow
- ResetFailure_NonExistentCommand_DoesNotThrow
→ DisassemblerBlacklist branch coverage: 83.3% → 100%

DisassemblerHelperTests (8 new tests):
- ResolveExecutablePath_RelativePathWithSeparator_NonExistent_ReturnsNull
- ResolveExecutablePath_RelativePathWithSeparator_Existing_ReturnsFullPath
- ResolveExecutablePath_WhitespacePathVariable_ReturnsNull
- ResolveExecutablePath_PathWithEmptyEntries_SkipsEmptyAndReturnsNull
- ResolveExecutablePath_CommandFoundInPath_ReturnsAbsolutePath
- EnumerateExecutableNames_OnWindows_CommandWith{Exe,Cmd,Bat}Suffix_NoDuplicate (3 tests)
→ DisassemblerHelper branch coverage: 53.3% → 80.0%

Overall branch coverage: 71.6% → 83.7%
Total test count: 537 → 548 (547 passing, 1 skipped)

Update CHANGELOG.md (EN + JP), doc/TESTING_GUIDE.md (EN + JP, count and
scope-map) to reflect the improvement.
@Widthdom Widthdom closed this Mar 19, 2026
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.

1 participant