Closed
      
        Bug 1994123
      
      
        Opened 17 days ago
          Closed 16 days ago
      
        
    
  
moz-phab uplift throws a KeyError when trying to display a link to Lando 
    Categories
(Conduit :: moz-phab, defect)
        Conduit
          
        
        
      
        
    
        moz-phab
          
        
        
      
        
    Tracking
(Not tracked)
        RESOLVED
        FIXED
        
    
  
People
(Reporter: yannis, Assigned: sheehan)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
While following Release Management/Requesting an Uplift, more specifically the Manual Cherry-Pick section.
Output of my uplifting command:
$ moz-phab uplift --no-rebase --train firefox-beta -i --no-wip HEAD^ HEAD
Submitting 1 commit for review
(New) 02878c7418bc Bug 1992678 - Use a more resilient initialization for sandboxed children.
Submit to https://phabricator.services.mozilla.com (YES/No/Always)? YES
Creating new revision:
02878c7418bc Bug 1992678 - Use a more resilient initialization for sandboxed children.
Completed
(D268500) 02878c7418bc Bug 1992678 - Use a more resilient initialization for sandboxed children.
-> https://phabricator.services.mozilla.com/D268500
KeyError: 'https://phabricator.services.mozilla.com'
Run moz-phab again with '--trace' to show debugging output
Sentry is attempting to send 2 pending events
Waiting up to 2 seconds
Press Ctrl-Break to quit
Running again with --trace:
$ moz-phab uplift --trace --no-rebase --train firefox-beta -i --no-wip HEAD^ HEAD
[...]
ERROR    2025-10-14 10:30:00,347 Traceback (most recent call last):
  File "C:\mozilla-build\python3\Lib\site-packages\mozphab\mozphab.py", line 133, in main
    args.func(repo, args)
  File "C:\mozilla-build\python3\Lib\site-packages\mozphab\commands\uplift.py", line 83, in uplift
    tip_lando_url = f"{repo.lando_url}/D{tip_commit_id}"
                       ^^^^^^^^^^^^^^
  File "C:\mozilla-build\python3\Lib\site-packages\mozphab\repository.py", line 307, in lando_url
    return get_lando_url_for_phabricator(self.phab_url)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\mozilla-build\python3\Lib\site-packages\mozphab\repository.py", line 42, in get_lando_url_for_phabricator
    return LANDO_URL_MAPPING[phab_url]
           ~~~~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 'https://phabricator.services.mozilla.com'
In mozphab/repository.py, we have:
# Mapping of known Phabricator URLs to Lando URLs.
LANDO_URL_MAPPING = {
    "https://phabricator.services.mozilla.com/": "https://lando.moz.tools",
    "https://phabricator-dev.allizom.org/": "https://dev.lando.nonprod.webservices.mozgcp.net",
    "https://phabricator.allizom.org/": "https://stage.lando.nonprod.webservices.mozgcp.net",
}
def get_lando_url_for_phabricator(phab_url: str) -> str:
    """Return the Lando URL for the given Phabricator URL."""
    return LANDO_URL_MAPPING[phab_url]
class Repository(object):
    def __init__(self, path: str, dot_path: str, phab_url: Optional[str] = None):
        # ...
        self.phab_url = (phab_url or self._phab_url()).rstrip("/")
        # ...
    @property
    def lando_url(self) -> str:
        """Return the Lando URL for this repository."""
        return get_lando_url_for_phabricator(self.phab_url)
Because of the rstrip call, I believe that the keys in LANDO_URL_MAPPING should be listed without their trailing / character.
| Assignee | ||
| Updated•17 days ago
           | 
Assignee: nobody → sheehan
| Assignee | ||
| Comment 1•17 days ago
           | ||
| Comment 2•16 days ago
           | ||
Authored by https://github.com/cgsheeh
https://github.com/mozilla-conduit/review/commit/57a201fed2e7c521cdd5461741998a4856ec4a51
[main] repository: account for trailing slash in get_lando_url_for_phabricator (Bug 1994123) r=zeid
Status: NEW → RESOLVED
Closed: 16 days ago
Resolution: --- → FIXED
| Reporter | ||
| Comment 3•14 days ago
           | ||
I confirm this now works fine after updating MozPhab:
$ moz-phab uplift --no-rebase --train firefox-beta -i --no-wip HEAD^ HEAD
Submitting 1 commit for review
(New) 769e3e271e66 Bug 1993904 - Acknowledge a possible failure during file copy/move.
Submit to https://phabricator.services.mozilla.com (YES/No/Always)? YES
Creating new revision:
769e3e271e66 Bug 1993904 - Acknowledge a possible failure during file copy/move.
Completed
(D269010) 769e3e271e66 Bug 1993904 - Acknowledge a possible failure during file copy/move.
-> https://phabricator.services.mozilla.com/D269010
Please navigate to https://lando.moz.tools/D269010 and complete the uplift request form.
Thank you!
          You need to log in
          before you can comment on or make changes to this bug.
        
Description
•