Skip to content
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

Alignment merge with extra verse issue #46

Open
JEdward7777 opened this issue Jan 26, 2024 · 6 comments
Open

Alignment merge with extra verse issue #46

JEdward7777 opened this issue Jan 26, 2024 · 6 comments

Comments

@JEdward7777
Copy link
Collaborator

When using the split merge workflow, the merge fails if an extra verse was added to the stripped usfm.
A test showing this error is here: 5ed03d4

@mvahowe
Copy link
Contributor

mvahowe commented Feb 7, 2024

Finally getting to this. The error in the test has nothing to do with adding a verse - not adding a verse results in the same error.

The error is Error: 2 input(s) expected by usfmToPerfPipeline but 1 provided (usfm) and appears to be accurate. You're using a pipeline that expects 2 inputs but only giving it one, and that pipeline isn't the one that does splitting or merging.

The missing input is "selectors" which sounds like it wants the Proskomma document selectors.

This is why it would be better if we could do this using Epitelete, which is supposed to have a workflow corresponding to these pipelines.

@mvahowe
Copy link
Contributor

mvahowe commented Feb 7, 2024

The next problem is that you were passing

 {
  perf: {
    perf: {
      schema: [Object],
      metadata: [Object],
      sequences: [Object],
      main_sequence_id: 'ZmQwNWNmY2Ut'
    }
  }
}

into the pipeline. If I pull .perf out of that the pipeline works.

@mvahowe
Copy link
Contributor

mvahowe commented Feb 7, 2024

And now, having also made the pipeline handler errors a lot more informative, the pipeline works without a new verse but, with a new verse, I get

Cannot read properties of undefined (reading 'after--Testing--1--1')

which I think is the thing we were initially trying to debug, and which still looks trivial to fix. (Famous last words...)

@mvahowe
Copy link
Contributor

mvahowe commented Feb 7, 2024

Sure enough, the error is around

const markup = strippedAlignment[chapter][verses];

If there's no record for the verse, markup is undefined, and then the first lookup inside markup croaks.

@mvahowe
Copy link
Contributor

mvahowe commented Feb 7, 2024

And

const markup = strippedAlignment[chapter][verses] || {};

fixes it.

@mvahowe
Copy link
Contributor

mvahowe commented Feb 7, 2024

Finally,

t.same(output.perf, JSON.parse(perfContent))

will always fail because PERF uses UIDs for sequence names and they cannot be preserved when roundtripping via USFM.

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

No branches or pull requests

2 participants