RSU commits the host's additionalSchemaInfo copy over the repository's file, deleting other integrations' soft keys

Abierto
#6,727 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
github, typescript

Línea de trabajo

Start with packages/SchemaEngine/src/RuntimeSchemaManager.ts, especially writeAdditionalSchemaInfo, collectAllRSUFiles, and apiCreateTreeFromFiles; trace how RSU reads the host copy and builds its commit from baseSha. Check how to read the target branch’s file through the GitHub API and preserve sections outside the integration being processed. Done means RSU retains the other schemas and sections, reports invalid or missing base data, and refuses unsafe writes; the issue names no tests to run.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Summary

An RSU run that installs or refreshes one integration can replace the whole configured additionalSchemaInfo file in the instance's repository with just that integration's tables. All other soft primary keys, soft foreign keys, value lists and schema-level sections are deleted from git.

Where

packages/SchemaEngine/src/RuntimeSchemaManager.ts (lts/6.2; the same logic is in 6.1.6):

  • writeAdditionalSchemaInfo (about lines 1952–2006) merges the incoming tables into the copy of the file on the MJAPI host's disk. When that file is missing, or can't be read or parsed, it silently starts from {} (the catch {} around JSON.parse).
  • collectAllRSUFiles (about lines 2647–2650) then adds that host file to the RSU commit, and apiCreateTreeFromFiles (base_tree, about line 2568) replaces the repository's blob with it.

How it happens

A deployment that doesn't ship the file to the host leaves the host with no copy. The MJ Central MJAPI deploy zip, for example, doesn't include metadata/. So every RSU run merges into an empty object and commits only its own integration's tables. In one instance, three runs in a row each replaced the file:

  • the first removed two schemas' curated keys (hundreds of foreign keys, thousands of value lists);
  • the later two removed a third schema.

The applied keys survived in the database only because CodeGen on 6.1 adds keys and never removes them. With 6.2's retractRemovedSoftKeys turned on, the next CodeGen would have retracted them.

Expected

An RSU run changes only the tables of the integration it processes; every other section of the file in the repository stays as it was.

Proposed fix

  1. Merge into the target branch's file at the commit RSU builds on (baseSha), read through the GitHub API, not the host's copy.
  2. Refuse to commit when the merged result drops a schema or section that the base file has, unless the run is explicitly authoritative for it.
  3. Don't treat a missing, unreadable or unparsable file as {}: report it, and fail the write step when the base file isn't empty.
  4. Optionally, have the MJ Central MJAPI deploy ship the configured additionalSchemaInfo file, so the host's copy exists. That is not enough on its own: the host's copy is only as new as the last deploy.

Workaround

Ship the file in the instance's MJAPI deploy, and deploy after any hand edit to it. The affected instance did this, and restored the file from git history.

Lenguaje dominante
TSQL
Estrellas
32
Forks
7
Merge medio
1 d 16 h
PR fusionados (30 d)
504

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de MemberJunction/MJ

Todos los issues de MemberJunction/MJ

Issues similares

Más issues de Backend & API Design

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.