Skip to content

Upgrade Element Web

Marc edited this page May 28, 2024 · 46 revisions

Upgrade Element-web in Tchap

technical study

When merging Element-web, at least three components are updated :

Before going to the upgrade operation, it is important to inspect the release notes of those components in order to list which impacts can be expected :

  • UX impacts :
    • new feature that will be deployed to users
    • warnings feature changes that should be explained to users, features that we don’t want to deploy. In this case, additionnel tchap customisations may apply
  • Technical impacts :
    • tchap patch that can be removed
    • tchap patch can be broken
    • regression bugs
      • in the past we had several regressions with the update of the matrix-js-sdk
🔑 This study might help us choose which element-web version we want to migrate to. 💡 Element Developers might also have good inputs on the matter.

code upgrade with subtrees and patches

Before taking actions in the react-sdk fork you will need to make sure all the latest changes from tchap-web subtree are pushed using the command (this will take some times to complete) :

git subtree push --prefix linked-dependencies/matrix-react-sdk org-35118060@github.com:tchapgouv/matrix-react-sdk-tchap.git develop_tchap

Matrix-react-sdk fork

  • Check the version of matrix-react-sdk vA.B.C against the version of element you want to upgrade
  • If not done yet clone matrix-react-sdk-tchap
  • Checkout to the branch vA.B.C
  • From this branch, merge with the branch develop_tchap
  • Fix all the conflicts and push the changes
  • Merge inside develop_tchap
git fetch upstream v3.100.0-rc.0 --tags

gco -b upgrade-v3.100.0-rc.0

git merge v3.100.0-rc.0

# FIX conflict and and stash the changes

git add .

git stash -u

# This will keep your conflict resolution in separate commits in case there are errors
# The redo the merge without fixing the conflict and directly commiting them

git merge v3.100.0-rc.0

git add .

git merge --continue

# Finally unstash your fix 

git checkout stash -- .

git add .

git commit -m "fix merge conflict"

In tchap-web

  • After you have merged the react-sdk fork, you can follow the legacy code upgrade below for tchap-web, which are the same processes.

  • Once merged with the new element version, you can pull the changes from the subtree. This will create a squash and new merge commit. The squash represent all the new changes in the forked sdk.

git subtree pull --prefix linked-dependencies/matrix-react-sdk https://github.com/tchapgouv/matrix-react-sdk-tchap develop_tchap --squash
  • In the project, we still have a part where we use patches. They are used to keep matrix-js-sdk up to date. So you still need to go through the merge patches process for matrix-js-sdk only (see below)

  • Once done be sure to check that we are using the correct version for each packages


code upgrade - Legacy

The procedure below describes a merge of element web 1.11.30

## Add element remote repository if you don’t have it
git remote add element https://github.com/vector-im/element-web.git --no-tags

## Fetch specific tag from element repository
git fetch element tag v1.11.30

## Create a new branch from tchap_develop 
git checkout origin/develop_tchap -b upgrade/element-web-v1.11.30

## Merge the last element-web release in Tchap-web
git merge v1.11.30

# Resolve the conflicts. 
# You will need to update element version in package.json :
..
"version-element-web": "1.11.30"
..


# yarn.lock will be in conflict, you need to regenerate it.
# To do this, you need to run yarn install, and have the new versions of yarn-linked-dependencies.
# The easiest is to reinstall with the script :
./scripts/tchap/install-yarn-linked-repositories.sh
## note : yarn install will fail because of postinstall scripts but the yarn.lock will be created

# Commit the merge.
git commit

Try to upgrade patches with merge-patches.sh.

# For patches which don't conflict, it will recreate the patch. For those with conflict, it will write in patches_temp/ (see script file for docs on how to use)
bash ./scripts/tchap/merge-patches.sh merge

## Fix conflicted patches in /patches_temp (see script file for docs on how to use), then run : 
bash ./scripts/tchap/merge-patches.sh continue

For more information visit [patches/README.md](https://github.com/tchapgouv/tchap-web-v4/blob/develop_tchap/patches/README.md)

## Once all patches files haven been migrated, apply the patches and run the app :
yarn patches-reapply
yarn start 


## Create a PR for the branch upgrade/element-web-v1.11.30

## Run and fix the tests
yarn test
yarn cypress run 

Manually testing the new upgrade (todo : where is the checklist in notion ? I think we have multiple checklists)

Two scopes must be tested in priority

  • core features of Tchap

  • testing new features, code impacted

  • créer un nouveau compte agent A

  • A. login avec un email

  • A. activer la sauvegarde automatique (il faut envoyer un premier message pour déclencher le dialog

    • vérifier le vocabulaire utilisé : "Sauvegarde automatique des messages", "code de récupération" (pas de mention de la passphrase)
  • A. inviter un interne dans un salon, vérifier qu'il peut rejoindre le salon

    • inviter en cherchant par nom, prenom
    • inviter par email
  • A. essayer d'inviter un externe dans un salon sans externe, ca doit être impossible

  • A. creer une room disponible pour les externe, inviter un externe E

  • E. créer un nouveau compte externe suite à l'invitation

  • E. login avec email. Rejoindre le salon dans lequel on est invité.

  • E. envoyer un fichier à travers l'anti-virus

  • E. vérifier que les externes n'ont pas accès à :

    • la création de salon
    • la liste des forum
    • l'annuaire (chercher qqn ne donne aucun résultat)
  • A. exporter les participants de la room

  • A. logout, faire la procédure "Oublié mon mot de passe"

    • le code de récupération doit être demandé, ensuite les messages sont bien déchiffrés
  • A. expirer le compte, vérifier que les clients affichent un truc cohérent, et qu'on peut réactiver le compte (si l'expiration est active)~

  • A. supprime son compte

En remplacement des cypress tests s'ils ne marchent pas :

  • dans le message composer, on ne peut pas partager sa position
  • dans les settings, on ne voit pas "Expérimental/Labs"
  • in a public room
    • green icon in sidebar, header, room info
    • you cannot enable encryption
    • you cannot invite externs
  • in a private room
    • red icon in sidebar, header, room info
    • you cannot disable encryption
    • you can switch to allow-externs
  • in a private room with externs
    • orange icon in sidebar, header, room info
    • you cannot disable encryption
    • you cannot disallow externs
    • room header displays "ouvert aux externes"

Merge the PR after review (don't squash, we want element history) into develop_tchap. TO BE DISCUSSED : a squash and merge is cleaner. History is still available in the PR.

name merge commit like this

name : upgrade element 1.11.30