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