Skip to content

Conversation

@trackd
Copy link
Owner

@trackd trackd commented Dec 3, 2025

Summary
Merge feature/superb-gamefowl which adds CI/workflow improvements, packaging & release orchestration (WiX), many new and refactored tests, improved logging and JSON contexts, configuration enhancements, and new helpers/services required for current feature work. This is a large feature-branch merge that refactors services, restores/rewires configuration monitors, and adds test coverage and packaging tooling.

Why
Prepares repository for reliable CI, packaging, and improved test coverage. Also provides script-based release tooling and consistent logging formats (NDJSON).

Scope
Cross-cutting: CI, build tooling, tests, logging, configuration, services, and new example configs.

Key changes (high level)

  • CI / Tooling: Updated .github/workflows/ci.yml and added packaging/release scripts under tools/ and tools/wix.xml.
  • Packaging: Added WiX-related packaging orchestration and guards in CI (tools/wix.xml, tools/release.ps1, tools/package.ps1).
  • Logging & Json: Introduced compact JSON contexts and NDJSON helpers in FileWatchRest/Logging/ and FileWatchRest/Models/.
  • Configuration: Consolidated and improved ExternalConfiguration and ExternalConfigurationValidator behavior.
  • Services / Worker: Large refactor of worker and file-sender services, added FileDebounceService, FileSenderService, and other service interfaces.
  • Actions: Added folder action implementations: FileWatchRest/Action/ExecutableAction.cs, FileWatchRest/Action/PowerShellScriptAction.cs, FileWatchRest/Action/RestPostAction.cs.
  • Tests: Many new and reorganized tests under FileWatchRest.Tests/ (integration, unit, helpers, mocks).
  • Examples & Docs: Updated README.md and added example configs in examples/.

Commits included (newest → older)

  • 6ced29e 2025-12-03T15:28:55+01:00 docs: ✨ Update README.md with enhanced project description and formatting
  • 6d39355 2025-12-01T21:26:13+01:00 chore(ci): include tools/wix.xml and track it
  • 04a1d72 2025-12-01T21:16:45+01:00 chore(ci): upload artifacts + guard gh publish; ensure WiX installed in CI; fix release-notes tag logic
  • 191c602 2025-12-01T21:05:26+01:00 feat(tools): ✨ Enhance packaging scripts with WiX installation check
  • c11590b 2025-12-01T20:56:54+01:00 Update CI workflow to include dev branch and coverage
  • b771258 2025-12-01T20:43:17+01:00 Refactor CI workflow to use Windows and build/test
  • 60d48d7 2025-12-01T20:42:11+01:00 refactor(tests): 🔧 Simplify method signatures and improve readability
  • 32cccb6 2025-12-01T16:56:53+01:00 feat(tools): ✨ Add packaging and release orchestration scripts
  • 88b6e84 2025-12-01T10:07:07+01:00 feat(configuration): ✨ update DiagnosticsBearerToken property and improve authorization logic
  • 5f79333 2025-12-01T09:35:38+01:00 test: verify pre-commit hook stages version bump
  • ab71cf9 2025-12-01T09:23:05+01:00 feat(build): ✨ add version bumping functionality
  • a95629a 2025-12-01T08:55:05+01:00 feat(FileDebounceService): ✨ make Schedule method virtual for testing
  • 70e9fee 2025-11-28T17:33:07+01:00 feat(logging): ✨ Introduce compact JSON context for NDJSON log entries
  • 6798383 2025-11-28T16:10:43+01:00 feat(json-serialization): ✨ Update JSON source generation options for improved null handling
  • 207e51f 2025-11-28T16:04:29+01:00 feat(tests): ✨ Enhance tests with additional validations and refactor paths
  • e9c80d3 2025-11-28T15:13:00+01:00 feat(configuration): ✨ Enhance configuration handling and add comprehensive save tests
  • 4651cac 2025-11-28T13:38:48+01:00 feat(logging): ✨ Add distinct logging for missing scripts and executables
  • 9736d28 2025-11-28T12:48:35+01:00 feat(folder-actions): ✨ Add action type resolution for folder paths
  • 2ca2456 2025-11-28T12:26:52+01:00 feat(logging): ✨ Enhance error handling and logging for executable and PowerShell actions
  • 488c2cb 2025-11-28T11:54:29+01:00 feat: ✨ Add execution timeout and output ignore options for actions
  • 91c90ec 2025-11-28T01:51:28+01:00 test: 🧪 Add comprehensive unit tests for Worker functionality
  • e6e7281 2025-11-27T16:16:35+01:00 feat(config): ✨ Enhance configuration management with action-based settings
  • 90eeef9 2025-11-27T09:55:52+01:00 Consolidate analyzer, logging, config and docs changes

Files changed (summary)

  • Totals: 136 files changed, 10048 insertions(+), 4631 deletions(-)
  • Notable new/modified files:
    • FileWatchRest/Action/ExecutableAction.cs (added)
    • FileWatchRest/Action/PowerShellScriptAction.cs (added)
    • FileWatchRest/Logging/SimpleFileLogger.cs (modified)
    • FileWatchRest/Monitor/ExternalConfigurationOptionsMonitor.cs (added)
    • FileWatchRest/Services/Worker.cs (significant refactor)
    • FileWatchRest.json.example (updated examples)
    • tools/package.ps1 (added packaging)
    • README.md (doc updates)

trackd and others added 23 commits November 27, 2025 09:55
- Centralize hot-path logging with LoggerMessage delegates (Logging/LoggerDelegates.cs) and refactor call sites for CA1848/perf.
- Consolidate analyzer rules in .editorconfig; enable language-style rules and apply safe fixes (prefer is null/is not null).
- Replace reference-equality null checks, fix IDE0052 unused-private warnings, and resolve duplicate-parameter compile issue.
- Improve SimpleFileLoggerProvider and SimpleFileLoggerOptions: streaming-safe CSV header replacement, per-run rotation with seconds, retention by days, and CSV/JSON path resolution fixes.
- Harden ExternalConfigurationOptionsMonitor: robust deserialization fallback, legacy-structure migrations (top-level LogLevel and Logging.MinimumLevel), Windows token encryption handling, and normalize Folders to typed WatchedFolderConfig.
- Update FileWatchRest.json.example and README to reflect the merged Folders object shape and runtime defaults.
- Run dotnet format, dotnet build, and dotnet test to validate; build succeeded and tests passed.
…ttings

- Introduced support for `Actions` in the configuration, allowing folders to reference reusable action configurations by name.
- Updated `ConfigureFolderActions` method to accept global configuration, enabling per-folder action overrides.
- Enhanced `FileWatcherManager` and `Worker` to utilize merged configurations for file processing.
- Improved error handling and logging for watcher errors and restart attempts.
- Added command-line and environment variable support for overriding the default configuration file path.
- Updated README with detailed configuration examples and migration notes for legacy folder formats.
- Implement tests for `WorkerDuplicatePrevention` to ensure already posted files are skipped.
- Add tests for `WorkerEnqueueExistingFiles` to verify that existing files are not re-queued.
- Create tests for `WorkerHelper` to validate file readiness and content reading.
- Develop tests for `WorkerMoveProcessed` to check the movement of processed files and handle timestamp collisions.
- Introduce retry logic tests in `WorkerRetry` to confirm correct behavior under failure conditions.
- Add streaming upload tests in `WorkerStreaming` to ensure multipart content is used for large files.
- Enhance `OptionsMonitorMock` tests to validate change notifications.
- Update example configuration files to reflect new features and settings.
- Introduced `ExecutionTimeoutMilliseconds` to specify maximum allowed execution time for actions.
- Added `IgnoreOutput` option to suppress stdout/stderr logging for actions.
- Updated `ExecutableAction` and `PowerShellScriptAction` to utilize new configuration options.
- Enhanced logging to capture exit codes and process start failures.
- Modified tests to reflect changes in action configurations.
- Updated example configuration and README for clarity on new options.
…d PowerShell actions

* Added detailed logging for unauthorized access and process start failures in `ExecutableAction` and `PowerShellScriptAction`.
* Improved validation error logging in `ExternalConfigurationOptionsMonitor` to emit structured log entries for each validation failure.
* Introduced new log messages for access denial in `FileWatcherManager`.
* Updated JSON serialization in `JsonContexts` to include additional configuration types.
* Introduced `GetActionTypeForPath` method in `IFileWatcherManager` to determine the configured action type for a given file path.
* Enhanced `FileWatcherManager` to maintain a mapping of folder paths to their respective action types.
* Updated `Worker` to conditionally execute actions based on the resolved action type.
* Added integration tests for PowerShell script execution based on folder action configuration.
…bles

* Implemented logging for missing PowerShell scripts and executables in `PowerShellScriptAction` and `ExecutableAction`.
* Enhanced `LoggerDelegates` with new log messages for clearer diagnostics.
* Updated `FileWatcherManager` to log missing action scripts and executables during configuration.
…ensive save tests

* Refactor `ExecutableAction` and `PowerShellScriptAction` constructors to set default values for `executionTimeoutMilliseconds`.
* Update `ExternalConfiguration` properties to remove default values, allowing for more flexible configuration.
* Introduce `ExternalConfigurationSaveTests` to ensure actions remain unchanged during configuration save operations.
* Improve logging regex handling in `ExternalConfigurationOptionsMonitor`.
… paths

* Added checks to ensure the presence of required PowerShell test scripts.
* Updated configuration tests to use temporary directories for improved isolation.
* Improved file system integration tests to handle existing target files gracefully.
* Introduced `MyJsonContext.SaveOptions` for consistent JSON serialization settings.
* Enhanced diagnostics service to reflect requested URL prefixes immediately for better test validation.
… improved null handling

* Changed `JsonSourceGenerationOptions` to enable `WriteIndented` formatting and ignore null values.
* Updated serialization method in `SaveConfigAsync` to use the source-generated context for AOT compatibility.
* Added `MyJsonLogContext` for efficient serialization of log entries.
* Updated `SimpleFileLoggerProvider` to utilize the new context for NDJSON formatting.
* Enhanced `ExternalConfigurationOptionsMonitor` to handle file locking scenarios gracefully.
* Improved diagnostics tests to ensure accurate logging behavior under various conditions.
- Updated `Schedule` method in `FileDebounceService` to be virtual, allowing for easier testing and mocking.
- This change enhances the testability of the service by enabling derived classes to override the scheduling behavior.

fix(Worker): 🐛 use `await using` for `FileStream` to ensure proper disposal

- Changed `using` to `await using` for `FileStream` in `Worker` to ensure asynchronous disposal of the stream.
- This prevents potential resource leaks and ensures that file handles are released properly.

refactor(Worker): 🔄 improve configuration merging logic for clarity

- Enhanced the logic for merging action settings with global defaults in `GetConfigForPath`.
- Added comments to clarify the precedence of settings and the handling of null/empty arrays.

docs(README): 📚 update configuration options section for clarity

- Revised the documentation to clarify the precedence of settings and the behavior of null/empty arrays in configuration.
- Improved explanations regarding how action settings override global settings.

test(tests): ✅ add comprehensive tests for configuration overrides

- Introduced new tests to validate the behavior of configuration overrides, ensuring that action settings correctly override global settings.
- Added tests for various scenarios including null and empty array handling for `AllowedExtensions` and `ExcludePatterns`.

test(integration): 🔍 add integration tests for filtering behavior

- Implemented integration tests to verify that the filtering behavior works as expected when using action-specific settings.
- Ensured that files are correctly included or excluded based on the defined action settings.
* Introduced a new `bump-version.ps1` script to increment the build/patch version number in `FileWatchRest.csproj`.
* Added a `-VersionBump` switch to the `build.ps1` script to trigger version updates before building.
* Enhanced version management by supporting major and minor version increments.
…mprove authorization logic

* Removed default value for `DiagnosticsBearerToken` to allow explicit configuration.
* Enhanced authorization logic to allow unauthenticated access unless a non-empty bearer token is set.
* Added new configuration properties in `DiagnosticsService` for better diagnostics handling.
* Updated version bump script to handle git operations based on context.
- Introduced `package.ps1` for creating MSI and ZIP packages for `FileWatchRest`.
- Added `release-notes.ps1` to generate release notes from git history.
- Created `release.ps1` to orchestrate the release process, including testing, building, packaging, and generating release notes.
- Enhanced `bump-version.ps1` to support target version input and dry-run functionality.
- Improved XML handling in `bump-version.ps1` for robust version extraction and updates.
- Updated project structure to facilitate CI/CD workflows and local packaging.
* Changed `WaitForAllAsync` method to static for better clarity.
* Updated array initialization syntax for consistency.
* Removed unnecessary using directives to clean up the code.
Replaced global usings check with build and test job, and updated environment to Windows.
Added 'dev' branch to CI workflow triggers and included coverage upload step.
* Added logic to check for WiX CLI availability before MSI creation.
* If WiX is not found, attempts to install the dotnet global tool `wix` version 6.0.2.
* Improved error handling to skip MSI packaging if installation fails.
* Updated release notes script to better determine the last tag based on current tags.
…ting

- Improved project title and description for clarity.
- Added a brief overview of the FileWatch Windows Service.
- Enhanced formatting for better visual presentation.
Copilot AI review requested due to automatic review settings December 3, 2025 14:48
@codecov-commenter
Copy link

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@trackd trackd merged commit 88e4f71 into main Dec 3, 2025
10 checks passed
@trackd trackd deleted the feature/superb-gamefowl branch December 3, 2025 15:09
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