Skip to content

[claude] Fix FwHeadless silently dropping FieldWorks edits (chorusmerge handler discovery) - #2513

Merged
hahn-kev merged 3 commits into
developfrom
claude/fw-headless-conflict-mode-e2066c
Aug 4, 2026
Merged

[claude] Fix FwHeadless silently dropping FieldWorks edits (chorusmerge handler discovery)#2513
hahn-kev merged 3 commits into
developfrom
claude/fw-headless-conflict-mode-e2066c

Conversation

@myieye

@myieye myieye commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

[Claude, autonomous]

FwHeadless silently drops FieldWorks-desktop edits when a file needs a real 3-way merge: the ChorusMerge process never finds its *-ChorusPlugin.dll handlers (the MEF scan is cwd-relative and hg runs the merge tool from the repo, not /app), so conflicts fall back to whole-file "keep ours". Background in #2508.

Two commits, landing intentionally red → green:

  1. A build-time smoke-test that runs the real chorusmerge from a non-/app cwd on a split PartsOfSpeech.list, editing two different possibility items, and asserts both survive. Red on the current setup — it reproduces the data loss in CI.
  2. The fix: cd into the script dir so ChorusMerge's cwd-relative handler scan lands on /app. hg passes absolute file paths to the merge tool, so changing cwd is safe. Turns the smoke-test green.

Interim shim (#2510); the durable upstream fix is tracked in #2511 / sillsdev/chorus#392.

Closes #2509, #2510.

🤖 Generated with Claude Code

FwHeadless silently drops FieldWorks edits when a file needs a real 3-way
merge: the ChorusMerge process never finds its *-ChorusPlugin.dll handlers
(MEF scans the cwd, and hg runs the merge tool from the repo, not /app), so
conflicts fall back to whole-file "keep ours".

This smoke-test runs the real chorusmerge from a non-/app cwd on a split
PartsOfSpeech.list, editing two different possibility items, and asserts both
survive. It fails on the current setup by design; the fix follows next.

Fixes #2509, part of #2508.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added the 📦 Lexbox issues related to any server side code, fw-headless included label Jul 30, 2026
ChorusMerge finds its *-ChorusPlugin.dll handlers with a cwd-relative MEF
scan, but hg runs the merge tool from the repo, not /app, so the handlers
were never found and merges fell back to whole-file "keep ours". cd into the
script dir so they're found; hg passes absolute file paths, so changing cwd
is safe. Turns the previous commit's smoke-test green.

Fixes #2510. Part of #2508; durable upstream fix tracked in #2511 /
sillsdev/chorus#392.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The chorusmerge wrapper now runs from its script directory. A new PartsOfSpeech fixture and shell smoke test validate handler-based merging, and the Docker build executes that test using a bind mount.

Changes

Chorusmerge smoke validation

Layer / File(s) Summary
Chorusmerge working-directory handling
backend/FwHeadless/chorusmerge
The wrapper changes to its resolved script directory before invoking ChorusMerge.dll, failing with an error if the directory change fails.
Smoke-test fixture and merge validation
backend/FwHeadless/chorusmerge-smoke/*
A PartsOfSpeech XML fixture and shell script create divergent inputs, run chorusmerge, and verify both edits appear in the merged output.
Docker build integration
backend/FwHeadless/Dockerfile
The build bind-mounts the smoke-test fixture and executes its runner.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • #2509 — Requests the build-time chorusmerge smoke test and handler-discovery fix.
  • #2508 — Describes the handler-discovery regression addressed by the working-directory change and smoke test.
  • #2510 — Requests changing into the wrapper directory before launching ChorusMerge.dll.

Suggested reviewers: rmunn

Poem

I thump my paws: the merge now knows
Which directory its handler grows.
Two edits hop into the list,
The Docker build gives them a kiss.
“No silent keep-ours!” sings the hare.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main fix: FwHeadless was dropping FieldWorks edits due to chorusmerge handler discovery.
Description check ✅ Passed The description directly matches the changeset and explains the smoke test plus the cwd fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/fw-headless-conflict-mode-e2066c

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

- chorusmerge: exit non-zero if `cd` to the app dir fails, so a merge can't
  silently fall back to "keep ours" (a failed merge tool makes Chorus roll
  back and throw instead).
- Dockerfile: bind-mount the smoke fixture instead of COPY, so it isn't
  shipped in the runtime image.
- smoke run.sh: capture the merge tool's exit code in the failure diagnostic.

Part of #2508.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@backend/FwHeadless/chorusmerge-smoke/run.sh`:
- Around line 27-29: Update the success condition following the chorusmerge
invocation to require rc to indicate a zero exit status in addition to finding
Adverb_OURS and Verb_THEIRS in merged.list. Preserve the existing content
checks, and ensure non-zero or conflicted merge results cannot report success.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: eacfd2c4-68bb-459e-96d0-2b8bfe17c392

📥 Commits

Reviewing files that changed from the base of the PR and between a425984 and 5f59196.

📒 Files selected for processing (4)
  • backend/FwHeadless/Dockerfile
  • backend/FwHeadless/chorusmerge
  • backend/FwHeadless/chorusmerge-smoke/PartsOfSpeech.base.list
  • backend/FwHeadless/chorusmerge-smoke/run.sh

Comment thread backend/FwHeadless/chorusmerge-smoke/run.sh
@hahn-kev
hahn-kev requested a review from rmunn August 3, 2026 03:25
@hahn-kev
hahn-kev merged commit ec86b3e into develop Aug 4, 2026
12 checks passed
@hahn-kev
hahn-kev deleted the claude/fw-headless-conflict-mode-e2066c branch August 4, 2026 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📦 Lexbox issues related to any server side code, fw-headless included

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[claude] Add a build-time merge smoke-test for FwHeadless chorusmerge

2 participants