Skip to content

Conversation

@johnml1135
Copy link
Contributor

@johnml1135 johnml1135 commented Nov 25, 2025

(Thanks for the comment Copilot)

Merging spec-kit-rebase into release/9.3 provides a solid foundation for modernizing our workflows and build environment. Highlights:

  • Aligns the spec kit and docs with current FieldWorks conventions and 9.3 codebase.
  • Consolidates prior spec-kit work and rebase fixes into a clean, reviewable history.
  • Clarifies agent workflows (feature specs, bugfix flows, and src-catalog usage).
  • Updates VS/CLI/WiX/.NET assumptions to match the modern build toolchain.
  • Improves inner-loop productivity via editor tasks and checks that mirror CI.
  • Adds CI hooks for doc linting and future agent-based analysis.
  • Keeps changes scoped to tooling, docs, and workflows with no intentional runtime behavior changes.
  • Builds and basic checks pass against release/9.3.
  • Risk is low and localized; any follow-up tweaks can be handled in small, targeted PRs.

This change is Reviewable

Copilot AI review requested due to automatic review settings November 25, 2025 12:13
@github-actions
Copy link

Agent analysis is currently a stub and does not execute prompts.
Intended workflow: run .github/prompts/test-failure-debug.prompt.md in analysis-only mode and post findings.
See .github/option3-plan.md for enablement steps.

@github-actions
Copy link

github-actions bot commented Nov 25, 2025

⚠️ Commit Message Format Issues ⚠️
commit 29a03635af:
5: B1 Line exceeds max length (89>80): "Isolate container Obj/OutDir/IntDir, suppress MSB3026 copy noise, guard config mismatches"
6: B1 Line exceeds max length (87>80): "Bump Palaso/SIL deps to 17.0.0-beta0082; restore legacy/localization assets when needed"
9: B1 Line exceeds max length (82>80): "ScriptureProvider injection and Utilities ref removal; ParatextHelper test cleanup"
11: B1 Line exceeds max length (81>80): "Repair C# test projects (missing refs, duplicate attributes, ignored flaky cases)"
12: B1 Line exceeds max length (89>80): "Add parse_msbuild_warnings/remove_duplicate_assemblyinfo and native Invoke-CppTest switch"
16: B1 Line exceeds max length (87>80): "Streamline VS Code tasks and auto-approval; kill omnisharp/dotnet/fieldworks on cleanup"

commit 33e714fdf6:
17: B1 Line exceeds max length (83>80): "- Lib/src/ScrChecks/ScrChecksTests/SentenceFinalPunctCapitalizationCheckUnitTest.cs"

commit 74336bbbf8:
2: B4 Second line is not empty: "* As well as for NativeBuild"

commit b6c86feed5:
44: B1 Line exceeds max length (88>80): "- Paratext8Plugin.csproj: Paratext.LexicalContracts → removed (provided by ParatextData)"

Copy link

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.

Pull request overview

This PR merges the spec-kit-rebase branch into release/9.3, modernizing FieldWorks workflows, build infrastructure, and documentation tooling. Key changes align the codebase with 9.3 conventions while introducing structured specification-driven development patterns and agent-based documentation automation.

Key changes:

  • Introduces comprehensive specification kit framework (.specify/ folder with templates, scripts, and prompts) for structured feature development
  • Modernizes CI workflows by consolidating whitespace and commit message checks into reusable scripts
  • Adds extensive Copilot/AI agent guidance files (.github/instructions/*.instructions.md, Src/**/COPILOT.md) with validation tooling
  • Introduces VSCode tasks for CI parity checks, agent workflows, and Docker container management
  • Establishes project constitution (.specify/memory/constitution.md) defining core development principles

Reviewed changes

Copilot reviewed 106 out of 1007 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
BUFFERING_FIX.md Documents VwDrawRootBuffered GDI resource management bugfix
.vscode/tasks.json Replaces legacy build tasks with CI parity checks, agent workflows, and COPILOT tooling
.vscode/settings.json Configures Copilot prompt recommendations and terminal auto-approve patterns
.vscode/launch.json Simplifies launch configuration to single Windows CLR debugger profile
.specify/templates/*.md Adds specification templates for feature specs, plans, tasks, and checklists
.specify/scripts/powershell/*.ps1 PowerShell automation for feature creation, agent context updates, and prerequisite checks
.specify/memory/constitution.md Establishes FieldWorks constitution with data integrity, testing, i18n, and licensing principles
.serena/*.md Adds Serena agent configuration with project overview and style conventions
.github/workflows/*.yml Consolidates whitespace/commit checks into scripts; adds doc linting and agent analysis stubs
.github/instructions/*.instructions.md Concise domain-specific rules for managed/native/installer/testing code
.github/prompts/*.prompt.md Structured prompts for spec-driven feature development and bugfix workflows
.github/*.py Python tooling for COPILOT doc scaffolding, validation, and automated change-log generation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

#>
param(
[Parameter(Position = 0)]
[ValidateSet('claude', 'gemini', 'copilot', 'cursor-agent', 'qwen', 'opencode', 'codex', 'windsurf', 'kilocode', 'auggie', 'roo', 'codebuddy', 'amp', 'q')]
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

The ValidateSet list on line 28 includes 'codebuddy' (lowercase with hyphen) but line 388 uses 'CodeBuddy' (capitalized). Ensure agent type identifiers are consistently cased throughout the file to prevent matching failures.

Copilot uses AI. Check for mistakes.
}

$normalized = $Branch -replace '^refs/heads/', ''
$normalized = $normalized.Trim()
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

[nitpick] The Trim() call on line 71 is redundant because the regex replacement on line 70 already strips leading/trailing slashes. Consider removing this line or documenting why double-trimming is necessary.

Suggested change
$normalized = $normalized.Trim()

Copilot uses AI. Check for mistakes.
id: build_installer
shell: powershell
run: |
$ErrorActionPreference = 'Stop'
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

[nitpick] Lines 199 and 220 both set $ErrorActionPreference = 'Stop' in separate script blocks. Consider consolidating error handling configuration if these steps are logically related to reduce duplication.

Copilot uses AI. Check for mistakes.
Comment on lines +54 to +55
$ErrorActionPreference = 'Stop'
./build.ps1 -Configuration Debug -Platform x64 -MsBuildArgs @('/m', '/p:action=test', '/p:desktopNotAvailable=true') -LogFile Build/build.log
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

The build command on line 55 references Build/build.log but the script location is ./build.ps1 at repository root. Ensure the path is correct or use an absolute path for clarity.

Copilot uses AI. Check for mistakes.
Comment on lines +151 to +152
# Always overwrite with the latest computed hash when available.
if tree_hash:
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

[nitpick] Lines 152-153 unconditionally overwrite last-reviewed-tree when tree_hash is available, even if the existing hash matches. Consider adding a comparison to avoid unnecessary updates when the hash is unchanged.

Suggested change
# Always overwrite with the latest computed hash when available.
if tree_hash:
# Only update if the hash has changed.
if tree_hash and fm.get("last-reviewed-tree") != tree_hash:

Copilot uses AI. Check for mistakes.
msbuild FieldWorks.proj /p:Configuration=Debug /p:Platform=x64 /p:action=test
# Run tests for a specific component
msbuild Build\FieldWorks.targets /t:CacheLightTests /p:Configuration=Debug /p:Platform=x64 /p:action=test
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

Line 44 references Build\FieldWorks.targets but the primary orchestrator is Build/Orchestrator.proj (per other workflow changes). Ensure this path is correct and consistent with the traversal build model.

Suggested change
msbuild Build\FieldWorks.targets /t:CacheLightTests /p:Configuration=Debug /p:Platform=x64 /p:action=test
msbuild Build/Orchestrator.proj /t:CacheLightTests /p:Configuration=Debug /p:Platform=x64 /p:action=test

Copilot uses AI. Check for mistakes.
Comment on lines 72 to 74
catch {
# Ignore fetch errors
}
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

[nitpick] Lines 72-74 and 88-90 silently ignore errors without logging. Consider adding diagnostic output (e.g., Write-Verbose or Write-Debug) to aid troubleshooting when remote/local branch detection fails.

Copilot uses AI. Check for mistakes.
@johnml1135 johnml1135 force-pushed the spec-kit-rebase branch 6 times, most recently from 84617d8 to e8d5a9e Compare December 4, 2025 20:24
jasonleenaylor and others added 8 commits December 4, 2025 15:44
- Created convertToSDK script in Build folder
- Updated mkall.targets RestoreNuGet to use dotnet restore
- Update mkall.targets to use dotnet restore instead of old NuGet restore
- Update build scripts to use RestorePackages target

Implement and execute improved convertToSDK.py

* Use mkall.targets-based NuGet detection
* Fix test package references causing build failures
* Add PrivateAssets to test packages to exclude transitive deps

  SDK-style PackageReferences automatically include transitive
  dependencies. The SIL.LCModel.*.Tests packages depend on
  TestHelper, which causes NU1102 errors. Adding PrivateAssets="All"
  prevents transitive dependencies from flowing to consuming
  projects

Co-authored-by: jasonleenaylor <2295227+jasonleenaylor@users.noreply.github.com>

Convert DesktopAnalytics and IPCFramework to PackageReferences

Converted regular References to PackageReferences for NuGet packages:
- SIL.DesktopAnalytics (version 4.0.0) in 6 projects
- SIL.FLExBridge.IPCFramework (version 1.1.1-beta0001) in FwUtils
- Updated package versions to resolve NU1605 downgrade errors:
- Moq: 4.17.2 → 4.20.70 in XMLViewsTests.csproj
- TagLibSharp: 2.2.0 → 2.3.0 in xWorks.csproj

Co-authored-by: jasonleenaylor <2295227+jasonleenaylor@users.noreply.github.com>

Fix bare References and update convertToSDK.py script

* Fixed bare Reference elements in FieldWorks.csproj and
  XMLViews.csproj that should have been PackageReferences:
- Geckofx60.32/64 packages (provide Geckofx-Core, Geckofx-Winforms)
- SharpZipLib (provides ICSharpCode.SharpZipLib)
- SIL.ParatextShared (provides ParatextShared)
- FwControls.csproj: ParatextShared → SIL.ParatextShared
- ITextDll.csproj: Geckofx, SharpZipLib, ParatextShared → packages
- FwParatextLexiconPlugin.csproj: Paratext.LexicalContracts → ParatextData
- ScriptureUtilsTests.csproj: ParatextShared → SIL.ParatextShared
- Paratext8Plugin.csproj: Paratext.LexicalContracts → removed (provided by ParatextData)
- FwParatextLexiconPluginTests.csproj: Paratext.LexicalContracts* → ParatextData
- ParatextImportTests.csproj: ParatextShared → SIL.ParatextShared

Co-authored-by: jasonleenaylor <2295227+jasonleenaylor@users.noreply.github.com>

Fix Geckofx version and DotNetZip warnings

Updated Geckofx60.32/64 from 60.0.50/51 to 60.0.52 (only
version available on NuGet). This resolves NU1603 warnings
about missing package version 60.0.51.

Updated SharpZipLib in ITextDll.csproj from 1.3.3 to 1.4.0
to avoid downgrade warning (SIL.LCModel requires >= 1.4.0).

Suppressed DotNetZip NU1903 security warning in xWorks.csproj
and xWorksTests.csproj (already suppressed globally in
Directory.Build.props, but some projects need local suppression).

All 115 projects now restore successfully without errors.

Co-authored-by: jasonleenaylor <2295227+jasonleenaylor@users.noreply.github.com>

Fix post .csproj conversion build issues

* Add excludes for test subdirectories
* Fix several references that should have been PackageReferences
* Fix Resource ambiguity
* Add c++ projects to the solution

Delete some obsolete files and clean-up converted .csproj

* Fix more encoding converter and geckofx refs
* Delete obsolete projects
* Delete obsoleted test fixture

Copilot assisted NUnit3 to NUnit4 migration

* Also removed some obsolete tests and clean up some incomplete
  reference conversions

Update palaso dependencies and remove GeckoFx 32bit

* The conditional 32/64 bit dependency was causing issues
  and wasn't necessary since we aren't shipping 32 bit anymore

Fix broken test projects by adding needed external dependencies

* Mark as test projects and include test adapter
* Add .config file and DependencyModel package if needed
* Add AssemblyInfoForTests.cs link if needed
* Also fix issues caused by a stricter compiler in net48

Update FieldWorks.cs to use latest dependencies

* Update L10nSharp calls
* Specify the LCModel BackupProjectSettings
* Add CommonAsssemblyInfo.cs link lost in conversion
* Set Deterministic builds to false for now (evaluate later)

Spec kit and AI docs, tasks and instructions

Refine AI onboarding and workflows:
* Update copilot-instructions.md with agentic workflow links and
clearer pointers to src-catalog and per-folder guidance (COPILOT.md).
* Tune native and installer instructions for mixed C++/CLI, WiX, and build
nuances (interop, versioning, upgrade behavior, build gotchas).

Spec kit improvements:
* Refresh spec.md and plan.md to align with the
feature-spec and bugfix agent workflows and FieldWorks conventions.
Inner-loop productivity:
* Extend tasks.json with quick checks for whitespace and commit
message linting to mirror CI and shorten feedback loops.

CI hardening for docs and future agent flows:
* Add lint-docs.yml to verify COPILOT.md presence per
Src/<Folder> and ensure folders are referenced in .github/src-catalog.md.
* Add agent-analysis-stub.yml (disabled-by-default) to
document how we will run prompts/test-failure analysis in CI later.

Locally run CI checks in Powershell
* Refactor scripts and add whitespace fixing algorithm
* Add system to keep track of changes needed to be reflected in
  COPILOT.md files.

Use FieldWorks.proj for main file
Add local mulit-agent capability
Remove LexTextExe.exe
* As well as for NativeBuild
* Fix LcmArtifactsDir in mkall.targets
Co-authored-by: johnml1135 <13733556+johnml1135@users.noreply.github.com>
- Fixed DrawTheRoot to properly manage GDI bitmap resources
  * Clean up previous cached bitmap/DC before creating new ones
  * Keep bitmap in m_hdcMem for ReDrawLastDraw support
  * Delete stock bitmap that comes with new DC (not the previous bitmap)

- Fixed DrawTheRootRotated to use local DC/bitmap
  * Uses local resources since rotation makes caching impractical
  * Properly cleanup bitmap and DC on exit and in exception paths

The previous code had a critical bug: it was deleting the OLD bitmap
(hbmpOld) immediately after selecting the new one, instead of keeping
it for restoration. This caused resource leaks and visual artifacts.

The new implementation follows the correct GDI resource management pattern:
1. Create compatible DC and bitmap
2. Select bitmap into DC (save old bitmap)
3. Delete the stock bitmap (not the old one!)
4. Draw to bitmap
5. Blit to screen
6. Keep bitmap/DC cached in m_hdcMem for ReDrawLastDraw (DrawTheRoot)
   OR cleanup local resources (DrawTheRootRotated, DrawTheRootAt)

Also, update COPILOT.md files to be shorter
* Remove all Any CPU mappings
* Ensure each project has a Debug and Release mapping to x64
* For any csproj file map bounds to Debug, but .vcxproj files
  still map to Bounds (for c++ memory debugging)
Infrastructure:
- Configure Serena MCP with OmniSharp (IPv6 workaround)
- Enable managed code builds in Docker containers
- Add unified intermediate output paths (host: Obj/, container: C:\Temp\Obj/)

CI/CD:
- Upgrade NETFX 4.6.1→4.8.1, WiX 3.11.2→3.14.1
- Add copilot-setup-steps.yml with testable agent scripts
- Add docker-build-publish.yml workflow

Testing:
- Fix VSTest execution (DependencyModel, System.Memory conflicts)
- Add Test.runsettings with InIsolation=true
- Resolve 500+ pre-existing test failures

Docs:
- Migrate FwDocumentation wiki to docs/ and .github/instructions/
- Add AGENTS.md, CONTRIBUTING.md, developer setup guides
Re-checkout all 261 test files from origin/release/9.3 and run
scripts/tests/convert_nunit.py with corrected comparison logic.

This fixes swapped argument order in Greater/Less assertions that
were introduced during the SDK migration rebase (43d1fd5).

The previous conversion incorrectly produced:
  Assert.That(0, Is.GreaterThan(value))  // WRONG - always false

Now correctly produces:
  Assert.That(value, Is.GreaterThan(0))  // CORRECT

Also restores 3 test files that were unintentionally deleted during
the SDK migration:
- Lib/src/ScrChecks/ScrChecksTests/SentenceFinalPunctCapitalizationCheckUnitTest.cs
- Src/Common/ViewsInterfaces/ViewsInterfacesTests/ExtraComInterfacesTests.cs
- Src/FwCoreDlgs/FwCoreDlgsTests/FwWritingSystemSetupDlgTests.cs
Re-apply intentional fixes from commits 575eaa0..9eff1d4 on top
of the clean NUnit conversion.

Changes applied:
- FieldWorksTests.cs: Use rooted temp paths for cross-platform compat
- IVwCacheDaTests.cs: Add COM cleanup in OneTimeTearDown and TearDown
- RespellingTests.cs: Use real Mediator instead of Mock (sealed class)
- SCTextEnumTests.cs: Migrate from Rhino.Mocks to Moq
- PUAInstallerTests.cs: Use DistFiles relative to SourceDirectory

These fixes address test failures discovered during VSTest migration
without reintroducing the swapped assertion arguments from the
original buggy conversion.
Stage native builds to C:\Temp and enforce NativeBuild → traversal order
Hyper-V isolation + named/global NuGet caches to fix MoveFile and path errors
Isolate container Obj/OutDir/IntDir, suppress MSB3026 copy noise, guard config mismatches
Bump Palaso/SIL deps to 17.0.0-beta0082; restore legacy/localization assets when needed
Fix native corruption and COM activation (Views.dll/TestViews.exe, VwSelection)
Replace crashy StackWalk64 with CaptureStackBackTrace + SEH guards
ScriptureProvider injection and Utilities ref removal; ParatextHelper test cleanup
Migrate RhinoMocks/NMock → Moq; add helper scripts and warning suppressions
Repair C# test projects (missing refs, duplicate attributes, ignored flaky cases)
Add parse_msbuild_warnings/remove_duplicate_assemblyinfo and native Invoke-CppTest switch
Improve native test runner staging and DirectoryFinder fallback
MCP server for PowerShell wrappers; steer Copilot to approved scripts
Spec-kit agents + AgentConfiguration module for worktrees/containers
Streamline VS Code tasks and auto-approval; kill omnisharp/dotnet/fieldworks on cleanup
File-lock retries, process killing, and more aggressive cleanup to speed builds
Defender/antivirus exclusion scripts and documentation updates
NuGet vulnerability upgrades and invalid lib cleanup
Regen_midl/Post-Install fixes and container path hygiene
Exclude SIL.LCModel.Tests run; settings tidy
Build speed-up touch-ups and git hash cleaning fix
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