-
-
Notifications
You must be signed in to change notification settings - Fork 6
[claude] Fix FwHeadless silently dropping FieldWorks edits (chorusmerge handler discovery) #2513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+293
−1
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,12 @@ | ||
| #!/bin/bash | ||
|
|
||
| # cwd while running script is inside hg repo, so ensure we look for ChorusMerge.dll in right place | ||
| # 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. | ||
| 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" "$@" |
246 changes: 246 additions & 0 deletions
246
backend/FwHeadless/chorusmerge-smoke/PartsOfSpeech.base.list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,246 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <PartsOfSpeech> | ||
| <CmPossibilityList | ||
| guid="64dd1920-ba7a-43ca-9577-4dcc3b8ede9a"> | ||
| <Abbreviation> | ||
| <AUni | ||
| ws="en">Pos</AUni> | ||
| </Abbreviation> | ||
| <DateCreated | ||
| val="2023-08-16 09:28:29.486" /> | ||
| <DateModified | ||
| val="2023-08-16 09:28:29.486" /> | ||
| <Depth | ||
| val="127" /> | ||
| <DisplayOption | ||
| val="0" /> | ||
| <IsClosed | ||
| val="False" /> | ||
| <IsSorted | ||
| val="True" /> | ||
| <IsVernacular | ||
| val="False" /> | ||
| <ItemClsid | ||
| val="5049" /> | ||
| <ListVersion | ||
| val="00000000-0000-0000-0000-000000000000" /> | ||
| <Name> | ||
| <AUni | ||
| ws="en">Parts Of Speech</AUni> | ||
| </Name> | ||
| <Possibilities> | ||
| <ownseq | ||
| class="PartOfSpeech" | ||
| guid="46e4fe08-ffa0-4c8b-bf98-2c56f38904d9"> | ||
| <Abbreviation> | ||
| <AUni | ||
| ws="en">adv</AUni> | ||
| </Abbreviation> | ||
| <BackColor | ||
| val="-1073741824" /> | ||
| <CatalogSourceId> | ||
| <Uni>Adverb</Uni> | ||
| </CatalogSourceId> | ||
| <DateCreated | ||
| val="2023-08-16 09:28:29.490" /> | ||
| <DateModified | ||
| val="2023-08-16 09:28:29.490" /> | ||
| <Description> | ||
| <AStr | ||
| ws="en"> | ||
| <Run | ||
| ws="en">An adverb, narrowly defined, is a part of speech whose members modify verbs for such categories as time, manner, place, or direction. An adverb, broadly defined, is a part of speech whose members modify any constituent class of words other than nouns, such as verbs, adjectives, adverbs, phrases, clauses, or sentences. Under this definition, the possible type of modification depends on the class of the constituent being modified.</Run> | ||
| </AStr> | ||
| </Description> | ||
| <ForeColor | ||
| val="6303632" /> | ||
| <Hidden | ||
| val="False" /> | ||
| <IsProtected | ||
| val="False" /> | ||
| <Name> | ||
| <AUni | ||
| ws="en">Adverb</AUni> | ||
| </Name> | ||
| <SortSpec | ||
| val="0" /> | ||
| <UnderColor | ||
| val="-1073741824" /> | ||
| <UnderStyle | ||
| val="1" /> | ||
| </ownseq> | ||
| <ownseq | ||
| class="PartOfSpeech" | ||
| guid="a8e41fd3-e343-4c7c-aa05-01ea3dd5cfb5"> | ||
| <Abbreviation> | ||
| <AUni | ||
| ws="en">n</AUni> | ||
| </Abbreviation> | ||
| <BackColor | ||
| val="-1073741824" /> | ||
| <CatalogSourceId> | ||
| <Uni>Noun</Uni> | ||
| </CatalogSourceId> | ||
| <DateCreated | ||
| val="2023-08-16 09:28:29.491" /> | ||
| <DateModified | ||
| val="2023-08-16 09:28:29.491" /> | ||
| <Description> | ||
| <AStr | ||
| ws="en"> | ||
| <Run | ||
| ws="en">A noun is a broad classification of parts of speech which include substantives and nominals.</Run> | ||
| </AStr> | ||
| </Description> | ||
| <ForeColor | ||
| val="6303632" /> | ||
| <Hidden | ||
| val="False" /> | ||
| <IsProtected | ||
| val="False" /> | ||
| <Name> | ||
| <AUni | ||
| ws="en">Noun</AUni> | ||
| </Name> | ||
| <SortSpec | ||
| val="0" /> | ||
| <UnderColor | ||
| val="-1073741824" /> | ||
| <UnderStyle | ||
| val="1" /> | ||
| </ownseq> | ||
| <ownseq | ||
| class="PartOfSpeech" | ||
| guid="a4fc78d6-7591-4fb3-8edd-82f10ae3739d"> | ||
| <Abbreviation> | ||
| <AUni | ||
| ws="en">pro-form</AUni> | ||
| </Abbreviation> | ||
| <BackColor | ||
| val="-1073741824" /> | ||
| <CatalogSourceId> | ||
| <Uni>Pro-form</Uni> | ||
| </CatalogSourceId> | ||
| <DateCreated | ||
| val="2023-08-16 09:28:29.491" /> | ||
| <DateModified | ||
| val="2023-08-16 09:28:29.491" /> | ||
| <Description> | ||
| <AStr | ||
| ws="en"> | ||
| <Run | ||
| ws="en">A pro-form is a part of speech whose members usually substitute for other constituents, including phrases, clauses, or sentences, and whose meaning is recoverable from the linguistic or extralinguistic context.</Run> | ||
| </AStr> | ||
| </Description> | ||
| <ForeColor | ||
| val="6303632" /> | ||
| <Hidden | ||
| val="False" /> | ||
| <IsProtected | ||
| val="False" /> | ||
| <Name> | ||
| <AUni | ||
| ws="en">Pro-form</AUni> | ||
| </Name> | ||
| <SortSpec | ||
| val="0" /> | ||
| <SubPossibilities> | ||
| <ownseq | ||
| class="PartOfSpeech" | ||
| guid="a3274cfd-225f-45fd-8851-a7b1a1e1037a"> | ||
| <Abbreviation> | ||
| <AUni | ||
| ws="en">pro</AUni> | ||
| </Abbreviation> | ||
| <BackColor | ||
| val="-1073741824" /> | ||
| <CatalogSourceId> | ||
| <Uni>Pronoun</Uni> | ||
| </CatalogSourceId> | ||
| <DateCreated | ||
| val="2023-08-16 09:28:29.491" /> | ||
| <DateModified | ||
| val="2023-08-16 09:28:29.491" /> | ||
| <Description> | ||
| <AStr | ||
| ws="en"> | ||
| <Run | ||
| ws="en">A pronoun is a pro-form which functions like a noun and substitutes for a noun or noun phrase.</Run> | ||
| </AStr> | ||
| </Description> | ||
| <ForeColor | ||
| val="6303632" /> | ||
| <Hidden | ||
| val="False" /> | ||
| <IsProtected | ||
| val="False" /> | ||
| <Name> | ||
| <AUni | ||
| ws="en">Pronoun</AUni> | ||
| </Name> | ||
| <SortSpec | ||
| val="0" /> | ||
| <UnderColor | ||
| val="-1073741824" /> | ||
| <UnderStyle | ||
| val="1" /> | ||
| </ownseq> | ||
| </SubPossibilities> | ||
| <UnderColor | ||
| val="-1073741824" /> | ||
| <UnderStyle | ||
| val="1" /> | ||
| </ownseq> | ||
| <ownseq | ||
| class="PartOfSpeech" | ||
| guid="86ff66f6-0774-407a-a0dc-3eeaf873daf7"> | ||
| <Abbreviation> | ||
| <AUni | ||
| ws="en">v</AUni> | ||
| </Abbreviation> | ||
| <BackColor | ||
| val="-1073741824" /> | ||
| <CatalogSourceId> | ||
| <Uni>Verb</Uni> | ||
| </CatalogSourceId> | ||
| <DateCreated | ||
| val="2023-08-16 09:28:29.491" /> | ||
| <DateModified | ||
| val="2023-08-16 09:28:29.491" /> | ||
| <Description> | ||
| <AStr | ||
| ws="en"> | ||
| <Run | ||
| ws="en">A verb is a part of speech whose members typically signal events and actions; constitute, singly or in a phrase, a minimal predicate in a clause; govern the number and types of other constituents which may occur in the clause; and, in inflectional languages, may be inflected for tense, aspect, voice, modality, or agreement with other constituents in person, number, or grammatical gender.</Run> | ||
| </AStr> | ||
| </Description> | ||
| <ForeColor | ||
| val="6303632" /> | ||
| <Hidden | ||
| val="False" /> | ||
| <IsProtected | ||
| val="False" /> | ||
| <Name> | ||
| <AUni | ||
| ws="en">Verb</AUni> | ||
| </Name> | ||
| <SortSpec | ||
| val="0" /> | ||
| <UnderColor | ||
| val="-1073741824" /> | ||
| <UnderStyle | ||
| val="1" /> | ||
| </ownseq> | ||
| </Possibilities> | ||
| <PreventChoiceAboveLevel | ||
| val="0" /> | ||
| <PreventDuplicates | ||
| val="True" /> | ||
| <PreventNodeChoices | ||
| val="False" /> | ||
| <UseExtendedFields | ||
| val="True" /> | ||
| <WsSelector | ||
| val="-3" /> | ||
| </CmPossibilityList> | ||
| </PartsOfSpeech> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #!/bin/bash | ||
| # Smoke-test: does chorusmerge actually engage the FieldWorks merge handler, or silently | ||
| # fall back to keeping one whole file? See sillsdev/languageforge-lexbox#2508 / #2509. | ||
| # | ||
| # 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. | ||
| set -euo pipefail | ||
|
|
||
| APP=${APP:-/app} | ||
| SMOKE="$(dirname "$(readlink -f "$0")")" | ||
| BASE="$SMOKE/PartsOfSpeech.base.list" | ||
| WORK="$(mktemp -d)" | ||
| trap 'rm -rf "$WORK"' EXIT | ||
|
|
||
| # Two edits to DIFFERENT possibility items (different guids) => they must auto-merge cleanly. | ||
| # A real 3-way merge keeps both; the whole-file "keep ours" fallback drops the theirs edit. | ||
| sed 's#>Adverb</AUni>#>Adverb_OURS</AUni>#' "$BASE" > "$WORK/ours.list" | ||
| sed 's#>Verb</AUni>#>Verb_THEIRS</AUni>#' "$BASE" > "$WORK/theirs.list" | ||
| cp "$WORK/ours.list" "$WORK/merged.list" # ChorusMerge writes the result back to arg 0 | ||
|
|
||
| cd "$WORK" # a non-/app cwd, exactly as hg runs the merge tool inside the repo | ||
| rc=0 | ||
| ChorusPathToRepository="$WORK" "$APP/chorusmerge" "$WORK/merged.list" "$BASE" "$WORK/theirs.list" || rc=$? | ||
|
|
||
| if grep -q Adverb_OURS "$WORK/merged.list" && grep -q Verb_THEIRS "$WORK/merged.list"; then | ||
| echo "chorusmerge smoke OK: FieldWorks 3-way merge engaged; both edits preserved" | ||
| else | ||
| echo "chorusmerge smoke FAILED: merge dropped a side (FieldWorks handler not engaged; chorusmerge exit=$rc)" | ||
| echo " Adverb_OURS=$(grep -c Adverb_OURS "$WORK/merged.list" || true) Verb_THEIRS=$(grep -c Verb_THEIRS "$WORK/merged.list" || true)" | ||
| exit 1 | ||
| fi | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.