Import mapping is keyed by repository URL, so a second workspace of the same forge repository imports a partial set

MRMax Rakhimov ☐ · 2026-10-31 · 49f0f3533960 open

The import mapping at <cache>/imports/<url-slug>.json records the commit hash and branch of each imported forge item, keyed by the repository URL. A new workspace that mirrors the same forge repository, into another bucket or after a cloned workspace is deleted, reads the mapping of the earlier workspace. ReadMapping returns it, IsMapped skips each recorded item, and the run imports only the items that the earlier run did not have. The recorded hashes do not exist in the new workspace, so a sub-issue whose parent is in the skipped set fails with: parent issue not found.

Seen on a demo mirror of a GitHub project with 14,414 items: the table printed Imported 13,336, Remaining 1,078, from a mapping that an earlier test workspace wrote, and the new workspace got 1,078 items and two issue-parent errors.

Fix options: validate the mapping against the workspace at the start of a run, and drop an entry whose hash is not on its branch in the workspace, with one note that says how many entries were dropped; or key the mapping by workspace as well, for example by the path or by the first commit of the content branch; or print the mapping path and the imported count in the dry run and in the plan line, so a reader sees the reuse before the run. The first keeps the file layout. A test: a mapping entry whose hash is absent from the workspace is not treated as imported.