Skip to content

editoast: front: adapt nge node path item key - #18105

Open
flomonster wants to merge 2 commits into
devfrom
fam/fix-nge-node-import
Open

editoast: front: adapt nge node path item key#18105
flomonster wants to merge 2 commits into
devfrom
fam/fix-nge-node-import

Conversation

@flomonster

@flomonster flomonster commented Aug 13, 2026

Copy link
Copy Markdown
Member

The idea is to add the country code at the end of the path_item_key. In addition, we adapt nodes trigram so the import/export works again.

Note: I adapted an existing migration; it's normal since we are adapting a fix. It's not a big deal for people who already ran this migration.

@flomonster
flomonster requested review from a team as code owners August 13, 2026 08:36
@github-actions github-actions Bot added area:front Work on Standard OSRD Interface modules area:editoast Work on Editoast Service labels Aug 13, 2026
@flomonster
flomonster requested a review from emersion August 13, 2026 09:20
@flomonster
flomonster force-pushed the fam/fix-nge-node-import branch from 5030db5 to 9be44aa Compare August 13, 2026 09:21
@emersion
emersion dismissed their stale review August 13, 2026 09:31

FR is no longer hardcoded.

@DucNg DucNg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes import/export feature in NGE

...indexNode,
...castNgeNode(node, netzgrafikDto.labels),
trigram: node.betriebspunktName,
trigram: domesticReference,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as #18035 (comment): this creates a desync between NGE's current state and the database state.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to overwrite the user input. This is not ideal but is required to have an import/export working as expected.

I can update the NGE state directly so we don't have to refresh.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should never overwrite the NGE state in response to an NGE change. Overwriting user input is also bad practice.

@flomonster flomonster Aug 13, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I agree, it's not ideal. I'm not defending this behaviour. I'm trying to fix the import/export since @maelysLeratRosso considers the current issue not acceptable for a release.

How can we fix the import/export without overriding the trigram's node (which is what we currently do)?

We could adapt the NGE export:

  • Adding country code information
  • We need to be compatible with the original format
  • This should be done in our fork, I guess 🤷

Do you think it's a reasonable solution?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already do it for secondary code actually

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better like this until we have a propre way to search among infrastructure OPs from NGE ?

Comment thread editoast/migrations/2026-08-06-164808-0000_adapt_node_path_item_key/up.sql Outdated
DELETE FROM macro_node WHERE path_item_key LIKE 'domestic:FR-%';
UPDATE macro_node SET path_item_key = 'domestic:FR-' || SUBSTRING(path_item_key, 9) WHERE path_item_key LIKE 'trigram:%';
DELETE FROM macro_node WHERE path_item_key LIKE 'domestic:%:FR';
UPDATE macro_node SET path_item_key = 'domestic:' || SUBSTRING(path_item_key, 9) || '#FR', trigram = trigram || '#FR' WHERE path_item_key LIKE 'trigram:%';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we update the column trigram as well when path_item_key is not a trigram ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be done by NGE at the opening of the scenario.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is false: we don't overwrite the trigram field at NGE load time. (This PR overwrites it on node update only, see the thread above.)

Comment thread editoast/migrations/2026-08-06-164808-0000_adapt_node_path_item_key/down.sql Outdated
@flomonster
flomonster force-pushed the fam/fix-nge-node-import branch from 8538864 to 5442af8 Compare August 13, 2026 10:41
The idea is to add the country code at the end of the path_item_key.
In addition we adapt nodes trigram so the import/export works again.

Signed-off-by: Florian Amsallem <florian.amsallem@gmail.com>
@flomonster
flomonster force-pushed the fam/fix-nge-node-import branch from 5442af8 to 9831fe0 Compare August 13, 2026 10:43
test('Verify NGE train data', async ({ ngePage }) => {
await test.step('Verify nodes displayed on NGE graph', async () => {
await ngePage.expectNodes(['SWS/BV', 'MWS/BV', 'MES/BV']);
await ngePage.expectNodes(['SWS/BV#…', 'MWS/BV#…', 'MES/BV#…']);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test still fails here: it expects MWS/BV… instead of MWS/BV#…
Shouldn’t the country code be displayed instead of ...?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7cd6922

Displaying the country code instead of "…" requires changing the ellipsis behavior inside NGE so it needs to be done in a distinct PR.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the ellipsis is ok for now. We didn't really want to display the country code at first, we just have to put it in the trigram field. So it's good that we don't see it too much :)

@Maymanaf
Maymanaf self-requested a review August 13, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:editoast Work on Editoast Service area:front Work on Standard OSRD Interface modules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants