From 45677c812caca5a5ebf1920bf9b2e97fb166dd6f Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Fri, 7 Aug 2026 16:17:51 +0700 Subject: [PATCH] Bump Chorus for FwHeadless plugin discovery and require plugins Consume SIL.Chorus 6.0.0-beta0074 (sillsdev/chorus#393): plugins load from AppContext.BaseDirectory, so drop the chorusmerge cwd shim. Set ChorusRequirePlugins=1 in the FwHeadless Docker image and bump transitive SIL/L10NSharp pins. Closes #2511. --- backend/Directory.Packages.props | 12 ++++++------ backend/FwHeadless/Dockerfile | 3 +++ backend/FwHeadless/chorusmerge | 10 +++------- backend/FwHeadless/chorusmerge-smoke/run.sh | 6 +++--- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/backend/Directory.Packages.props b/backend/Directory.Packages.props index cc2933483d..6c660faae7 100644 --- a/backend/Directory.Packages.props +++ b/backend/Directory.Packages.props @@ -31,8 +31,8 @@ - - + + @@ -105,17 +105,17 @@ - - + + - + - + diff --git a/backend/FwHeadless/Dockerfile b/backend/FwHeadless/Dockerfile index e5f0eb552a..e99e3fcb77 100644 --- a/backend/FwHeadless/Dockerfile +++ b/backend/FwHeadless/Dockerfile @@ -43,6 +43,9 @@ RUN test -f FixFwData \ && python3 -c "import zipfile; open('/tmp/smoke.fwdata','wb').write(zipfile.ZipFile('/tmp/test-template-repo.zip').read('kevin-test-01.fwdata'))" \ && ./FixFwData /tmp/smoke.fwdata; ec=$?; rm -f /tmp/test-template-repo.zip /tmp/smoke.fwdata; \ if [ $ec -gt 1 ]; then echo "FixFwData smoke test failed with exit $ec"; exit 1; fi +# Fail loudly if ChorusMerge finds no *-ChorusPlugin.dll (sillsdev/chorus#393 / #392); must be set +# before the chorusmerge smoke-test RUN below. +ENV ChorusRequirePlugins=1 # Smoke-test: chorusmerge must engage the FieldWorks merge handler, not silently keep one # whole file (#2508). Runs the real wrapper from a non-/app cwd, exactly as hg does. # Bind-mount rather than COPY so the fixture/script don't ship in the runtime image. diff --git a/backend/FwHeadless/chorusmerge b/backend/FwHeadless/chorusmerge index 62f77d0e8b..74bd8f0db2 100755 --- a/backend/FwHeadless/chorusmerge +++ b/backend/FwHeadless/chorusmerge @@ -1,12 +1,8 @@ #!/bin/bash -# cwd while running script is inside the hg repo. ChorusMerge finds its FieldWorks merge -# handlers by scanning the cwd for *-ChorusPlugin.dll (MEF DirectoryCatalog(".")), so cd to -# where they sit next to ChorusMerge.dll, else merges silently fall back to "keep ours". -# hg passes absolute file paths to the merge tool, so changing cwd is safe. +# cwd while running script is inside the hg repo. ChorusMerge (SIL.Chorus >= 6.0.0-beta0074) +# discovers *-ChorusPlugin.dll from AppContext.BaseDirectory (sillsdev/chorus#393), so plugins +# are found even when hg's cwd is the repo. Resolve ChorusMerge.dll next to this script. SCRIPT_DIR=$(dirname $(readlink -f "$0")) -# Fail loudly rather than merge from the wrong cwd: a merge without the handlers silently -# keeps "ours" (the #2508 data loss); a non-zero exit makes Chorus roll back and throw. -cd "$SCRIPT_DIR" || { echo "chorusmerge: cannot cd to $SCRIPT_DIR; refusing to merge without the FieldWorks handlers" >&2; exit 1; } exec dotnet "${SCRIPT_DIR}/ChorusMerge.dll" "$@" diff --git a/backend/FwHeadless/chorusmerge-smoke/run.sh b/backend/FwHeadless/chorusmerge-smoke/run.sh index 640c9f8960..0566865bf0 100644 --- a/backend/FwHeadless/chorusmerge-smoke/run.sh +++ b/backend/FwHeadless/chorusmerge-smoke/run.sh @@ -5,9 +5,9 @@ # PartsOfSpeech.base.list is the FLExBridge split (nested) form of a possibility list — what # hg actually versions and merges. Regenerate from a .fwdata with the FLExBridge split CLI. # -# The handler is discovered by scanning the *current working directory* for *-ChorusPlugin.dll, -# and hg runs the merge tool with cwd = the repo (not /app). So this MUST run from a non-/app -# cwd to be meaningful — running it from /app would hide the bug and pass falsely. +# Plugins are discovered from AppContext.BaseDirectory (sillsdev/chorus#393), but hg still runs +# the merge tool with cwd = the repo (not /app). Run from a non-/app cwd so we keep exercising +# that path — ChorusRequirePlugins=1 (FwHeadless Dockerfile ENV) fails if none load. set -euo pipefail APP=${APP:-/app}