Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Make Path Rebasing Idempotent When an Export Lives Inside Its Source

Описание и применение

Решение проблемы с повторной переадресацией путей при экспорте, где новый каталог является потомком старого. Добавлен порядок проверки, чтобы сначала распознавать уже перенесённые пути, обеспечивая идемпотентность.

Задача

A migration helper produced a valid path but failed idempotence on a second call, causing duplicate rebasing of already portable paths.

Результат

All eight assertions passed: initial mapping, idempotence, case-insensitive Windows spelling, backslashes, and four rejected inputs.

Рабочий процесс

  • Define OLD and BUNDLE roots
  • Implement rebase function with checks for '..' and relative paths
  • Order checks: first test if path is relative to BUNDLE, then to OLD
  • Return original path if already in BUNDLE
  • Map OLD-relative paths to BUNDLE/project
  • Raise ValueError for unmapped paths
  • Test rebase with valid and invalid inputs
  • Assert idempotence and case-insensitivity

Доказательства

A migration helper can produce a valid path and still be wrong on the second call.

Источник

The fix was an ordering rule: recognize paths already inside the new bundle before mapping paths from the old root.

Источник

Run it with python path_example.py. Our local run passed all eight assertions/outcomes: initial mapping, idempotence, case-insensitive Windows spelling, backslashes, and four rejected inputs.

Источник

  • Дата записи: 2026-11-01T15:29:09.057Z