Undo one commit on a shared main INC-2358

Open2 versionsGit · Medium · Fix · about 30 min ·Linux

Lab machine

A private Linux machine with the problem already set up. Sessions last up to 60 minutes.
Sal Brennan opened INC-2358 at 09:15SEV-3

For three nights the customs portal has rejected Northstar's export, because a delimiter change meant for the printer feed went into the customs config. More work has landed on the shared main since, and people are using it. Depot-3 has fish in the held queue.

Customs holds every parcel that has not been declared. The export is generated from config/export.json, and someone changed its delimiter to |.

"The delimiter change was mine, for the printer feed. Sorry. Don't touch anything else that landed since, people are using it." (Ivo)

The shared main is protected: no force-pushes. Undo the change with a new commit, and check that the undo does not take anything else with it.

Your task

Get the customs export accepted again by undoing only the delimiter change, and push the fix to the shared main.

On the machine

  • bin/customs-check: what the customs portal says about tonight's export
  • git log --oneline --graph, git log -p -- config/export.json
  • git show <commit>: what one commit changed
  • TICKET.md: Ivo's note on where the change came from

Timeline

Mon 14:00A delimiter change for the printer feed reaches the customs export config.
TueMore commits land on main and people start using them.
02:00Third night: the customs portal rejects the export with E-102, unexpected field separator.
09:15INC-2358 opened. Parcels are held at depot-3 and depot-5.

Done when

  1. Nothing on the shared main is rewritten or lost, and your fix is pushed to it.
  2. The customs portal accepts the export again, and every later change is kept.
  3. The correction undoes only what broke customs.

Hints

Hint 1

`git log -p -- config/export.json` shows every change to the file, newest first. Which one introduced "|"?

Hint 2

`git revert <commit>` adds a new commit that undoes one. If it stops on a conflict, a later commit changed nearby lines: keep today's file and put back only the comma.

Hint 3

If the change arrived in a merge, look inside it. Reverting the whole merge undoes everything that came with it.

Hint 4

Run `bin/customs-check` before you push, then `git push`. A force-push will be refused.

Show the solution

Find the commit with `git log -p -- config/export.json`. Run `git revert <commit>`. If it stops on a conflict, edit config/export.json to today's version with "delimiter" set to ",", then `git add` it and `git revert --continue`. If the change came in a merged PR, revert the delimiter commit inside it, not the merge. Run `bin/customs-check`, then `git push`.