Merge Issue - Merging Back intp main

I am having a Merge issues from branch_3_5 merge back into main.
Any suggestions?

const createBranch_3_5 = () => {
console.log(’# Set Database to CRT_Database’)
// set database to use to CRT_Database
WOQL.db(‘CRT_Database’)

// Checkout the main branch
console.log(’# Create branch_3_5’)
let branchName=“branch_3_5”
WOQL.branch(branchName).then(() => {
console.log(’# Created branch_3_5’)
}).catch(error => console.log(‘Create branch_3_5 error’, error))
}

const addRevision7 = () => {
console.log(’# Set Database to CRT_Database’)
// set database to use to CRT_Database
WOQL.db(‘CRT_Database’)

// Checkout the main branch
console.log(’# Merge branch_3_5 into Main’)
let branchName=“branch_3_5”
var rebaseSource= {}
rebaseSource.rebase_from = branchName
rebaseSource.message = ‘Merge branch_3_5 into Main’
WOQL.rebase(rebaseSource).then(() => {
console.log(’# Merged branch_3_5 into Main’)
}).catch(error => console.log(‘Merged branch_3_5 into Main error’, error))
}

Merge branch_3_5 into Main

Merged branch_3_5 into Main error { Error: API Error @type api:RebaseErrorResponse api:message The following rebase source absolute resource descriptor string is invalid: “branch_3_5” api:status api:failure Code: 400 url: https://127.0.0.1:6363/api/rebase/admin/CRT_Database/local/branch/main
at DispatchRequest.axiosInstance.post.then.catch.err (/home/rrivas/JAVA-workspace/CRT_Demo/node_modules/@terminusdb/terminusdb-client/lib/dispatchRequest.js:132:31)
at process._tickCallback (internal/process/next_tick.js:68:7)
data:
{ ‘@type’: ‘api:RebaseErrorResponse’,
‘api:error’:
{ ‘@type’: ‘api:BadAbsoluteSourceDescriptor’,
‘api:absolute_descriptor’: ‘branch_3_5’ },
‘api:message’:
‘The following rebase source absolute resource descriptor string is invalid: “branch_3_5”’,
‘api:status’: ‘api:failure’ } }

Hello orioncri,
I should have mentioned to include the branch URL instead of just the name.
The entire code is great, just got to include this bit for rebase.

// Checkout the main branch
console.log(’# Merge branch_3_5 into Main’)
let branchName = “branch_3_5”
let branchUrl = "admin/CRT_Database/local/branch/" + branchName
var rebaseSource = {}
rebaseSource.rebase_from = branchUrl
rebaseSource.message = ‘Merge branch_3_5 into Main’
WOQL.rebase(rebaseSource).then(() => {
     console.log(’# Merged branch_3_5 into Main’)
})
.catch(error => console.log(‘Merged branch_3_5 into Main error’, error))}

You can also construct the branch url by using resource()

let branchName = “branch_3_5”
let branchUrl = WOQL.resource('branch', branchName)

Let me know if this works yea?

Thanks for the branch rebase data. Could you decipher my current Merge error information:

Checking CRT_Database

CRT_Database Already Created

Set Database to CRT_Database

Checkout Branch main

Set Database to CRT_Database

Merge branch_6_8 into Main

Merge branch_6_8 branchURL = admin/CRT_Database/local/branch/branch_6_8

Merged branch_6_8 into Main error { Error: API Error api:message Error: rebase_commit_application_failed(schema_validation_error(“gelrfic2jgz2e4elajtbi1pdkza3eoa”,[_5418{’@type’:‘vio:UntypedInstance’,‘vio:message’:_5450{’@type’:‘xsd:string’,’@value’:‘The subject ‘terminusdb:///data/personContent2’ has no defined class.’},‘vio:property’:_5462{’@type’:‘xsd:anyURI’,’@value’:‘terminusdb:///schema#first_name’},‘vio:subject’:_5438{’@type’:‘xsd:anyURI’,’@value’:‘terminusdb:///data/personContent2’}},_5480{’@type’:‘vio:UntypedInstance’,‘vio:message’:_5512{’@type’:‘xsd:string’,’@value’:‘The subject ‘terminusdb:///data/personContent2’ has no defined class.’},‘vio:property’:_5524{’@type’:‘xsd:anyURI’,’@value’:‘terminusdb:///schema#first_name’},‘vio:subject’:_5500{’@type’:‘xsd:anyURI’,’@value’:‘terminusdb:///data/personContent2’}}]),[“o37wsbinno3mm6otl88bcxkq3gpfa5q”,“24kcuiil2gz85q7fdni9skw9oakp0il”,“pxevsz3x3eb771wggxwr5xke56fguur”,“gelrfic2jgz2e4elajtbi1pdkza3eoa”]) in CTX context(prolog_stack([frame(27,call(system:throw/1),throw(error(rebase_commit_application_failed(…,…),_5606))),frame(26,pred_line(“catch/3”,’/usr/lib/swipl/boot/init.pl’:483),catch(db_rebase:apply_commit_chain(…,…,…,“admin”,‘terminusdb:///system/data/admin’,…,…,_5670,_5672,_5674),error(apply_commit(…),_5680),db_rebase:throw(…))),frame(25,pred_line(“db_rebase:rebase_on_branch/9”,’/app/terminusdb/core/api/db_rebase.pl’:214),db_rebase:rebase_on_branch(’<garbage_collected>’,‘terminusdb:///system/data/admin’,‘admin/CRT_Database/local/branch/main’,’<garbage_collected>’,’<garbage_collected>’,[],’<garbage_collected>’,’<garbage_collected>’,’<garbage_collected>’)),frame(24,foreign(system:’’/1),’’(’<garbage_collected>’)),frame(23,pred_line(“catch/3”,’/usr/lib/swipl/boot/init.pl’:482),catch(routes:(…,…),error(rebase_commit_application_failed(…,…),context(_5842,_5844)),routes:do_or_die(…,…))),frame(22,pred_line(“catch_with_backtrace/3”,’/usr/lib/swipl/boot/init.pl’:532),catch_with_backtrace(’<garbage_collected>’,’<garbage_collected>’,’<garbage_collected>’))]),_5562) api:status api:failure Code: 500 url: https://127.0.0.1:6363/api/rebase/admin/CRT_Database/local/branch/main
at DispatchRequest.axiosInstance.post.then.catch.err (/home/rrivas/JAVA-workspace/CRT_Demo/node_modules/@terminusdb/terminusdb-client/lib/dispatchRequest.js:132:31)
at process._tickCallback (internal/process/next_tick.js:68:7)
data:
{ ‘api:message’:
‘Error: rebase_commit_application_failed(schema_validation_error(“gelrfic2jgz2e4elajtbi1pdkza3eoa”,[_5418{’@type’:‘vio:UntypedInstance’,‘vio:message’:_5450{’@type’:‘xsd:string’,’@value’:‘The subject \‘terminusdb:///data/personContent2\’ has no defined class.’},‘vio:property’:_5462{’@type’:‘xsd:anyURI’,’@value’:‘terminusdb:///schema#first_name’},‘vio:subject’:_5438{’@type’:‘xsd:anyURI’,’@value’:‘terminusdb:///data/personContent2’}},_5480{’@type’:‘vio:UntypedInstance’,‘vio:message’:_5512{’@type’:‘xsd:string’,’@value’:‘The subject \‘terminusdb:///data/personContent2\’ has no defined class.’},‘vio:property’:_5524{’@type’:‘xsd:anyURI’,’@value’:‘terminusdb:///schema#first_name’},‘vio:subject’:_5500{’@type’:‘xsd:anyURI’,’@value’:‘terminusdb:///data/personContent2’}}]),[“o37wsbinno3mm6otl88bcxkq3gpfa5q”,“24kcuiil2gz85q7fdni9skw9oakp0il”,“pxevsz3x3eb771wggxwr5xke56fguur”,“gelrfic2jgz2e4elajtbi1pdkza3eoa”]) in CTX context(prolog_stack([frame(27,call(system:throw/1),throw(error(rebase_commit_application_failed(…,…),_5606))),frame(26,pred_line(“catch/3”,’/usr/lib/swipl/boot/init.pl’:483),catch(db_rebase:apply_commit_chain(…,…,…,“admin”,‘terminusdb:///system/data/admin’,…,…,_5670,_5672,_5674),error(apply_commit(…),_5680),db_rebase:throw(…))),frame(25,pred_line(“db_rebase:rebase_on_branch/9”,’/app/terminusdb/core/api/db_rebase.pl’:214),db_rebase:rebase_on_branch(’<garbage_collected>’,‘terminusdb:///system/data/admin’,‘admin/CRT_Database/local/branch/main’,’<garbage_collected>’,’<garbage_collected>’,[],’<garbage_collected>’,’<garbage_collected>’,’<garbage_collected>’)),frame(24,foreign(system:’’/1),’’(’<garbage_collected>’)),frame(23,pred_line(“catch/3”,’/usr/lib/swipl/boot/init.pl’:482),catch(routes:(…,…),error(rebase_commit_application_failed(…,…),context(_5842,_5844)),routes:do_or_die(…,…))),frame(22,pred_line(“catch_with_backtrace/3”,’/usr/lib/swipl/boot/init.pl’:532),catch_with_backtrace(’<garbage_collected>’,’<garbage_collected>’,’<garbage_collected>’))]),_5562)’,
‘api:status’: ‘api:failure’ } }

Thanks.

The method of reporting here appears to be a bug - it should have returned as valid JSON. I’ll fix that.

However the message contains the reason for the failure to merge:

[
  {
    "@type":"vio:UntypedInstance",
    "vio:message": {
      "@type":"xsd:string",
      "@value":"The subject 'terminusdb:///data/personContent2' has no defined class."
    },
    "vio:property": {"@type":"xsd:anyURI", "@value":"terminusdb:///schema#first_name"},
    "vio:subject": {
      "@type":"xsd:anyURI",
      "@value":"terminusdb:///data/personContent2"
    }
  },
  {
    "@type":"vio:UntypedInstance",
    "vio:message": {
      "@type":"xsd:string",
      "@value":"The subject 'terminusdb:///data/personContent2' has no defined class."
    },
    "vio:property": {"@type":"xsd:anyURI", "@value":"terminusdb:///schema#first_name"},
    "vio:subject": {
      "@type":"xsd:anyURI",
      "@value":"terminusdb:///data/personContent2"
    }
  }
]

After merger it believes that doc:personContent2 is no longer ascribed a type.

Thanks for the explanation. Do you have a possible solution to assist me to get the MERGE working. I am prototyping your product to confirm it will work for future needs for Lockheed Martin. Once I complete the Branching/Merging testing I am going to exercise the Revision capability. I may be setting up a conference call for initial introductions. Your support has been appreciated.

Ron Rivas
Software Engineering Manager
Lockheed Martin - RMS

1 Like

It’s hard to say for sure without having a closer look at the data or what has changed between branches - it seems that the branch from which you are merging refers to a subject (doc:personContent2) that does not exist in the target branch. One possibility worth checking is to see if the target and source are reversed does it work in the other direction? You can create a new branch from the head of the target to preserve the existing branch if it is incorrect.

Otherwise, if you could visit our discord and share a screen with us, we should be able to find it quick.

1 Like

I pushed a fix to the dev branch which results in correct reporting of the schema issue now.

We could definitely make it merge but it would be easiest if we could show you the method via screen-share or the like. Perhaps on our discord server?

I am currently doing the work on my personal computer until TerminusDb gets approved by Lockheed to install on our unclassified systems.
Ron

I did get the merge to work. I removed the cardinality on all the properties.

1 Like