A practical Tangled CLI nnabeyang.tngl.sh/swift-tangled

Fork pull request resubmission sends a repository AT URI to the DID-based hidden-ref API #6

Closed nnabeyang.tngl.sh
Closed opened by nnabeyang.tngl.sh

Summary #

tng pr resubmit fails for fork-based pull requests against current Knots because it sends the fork repository's AT URI in sh.tangled.repo.hiddenRef.repo, while the current API requires the fork's repository DID.

This was not an error in the original fork resubmission implementation. The implementation matched the API contract when it was introduced, but the contract later changed from an AT URI to a repository DID and the released CLI did not pick up the corresponding client-side migration.

History #

  • On July 28, 2026, commit df9e1ca added fork pull request resubmission. The pinned Tangled core revision at that time defined sh.tangled.repo.hiddenRef.repo as an AT URI. The Knot implementation parsed that AT URI, loaded the repository record, and resolved the repository DID. Passing sourceRepository.uri was therefore correct and functional.
  • On August 6, 2026, Tangled core commit 560b5c84 migrated repository write APIs to repository DIDs. The hidden-ref Lexicon changed repo from format: at-uri to format: did, and Knot began decoding it directly as a repository DID.
  • On August 11, 2026, swift-tangled commit 7ef4145 updated the generated core Lexicons and included the necessary call-site changes to pass sourceRepositoryDID for regular and stacked fork resubmission.
  • Version 0.6.0 was released from main without 7ef4145. It therefore retained the old AT URI request shape while connecting to Knots that enforce the new DID-based contract.

Reproduction #

With tng 0.6.0, push an updated source branch for a fork-based pull request, then run:

tng pr resubmit PULL_REQUEST_AT_URI --json

The command fails with an error similar to:

InvalidRequest: invalid request body: invalid repo DID: "at://did:plc:owner/sh.tangled.repo/repository"

No new pull request round is created.

Cause #

Both fork resubmission paths pass the repository record URI to the hidden-ref request:

  • PullRequestResubmissionService.resubmitFork
  • PullRequestStackResubmissionService.forkCommits

KnotClient.updateHiddenRef then places that value in RepoHiddenRef_Input.repo. Current Knots correctly reject it because the field is a DID.

Proposed fix #

  • Change KnotClient.updateHiddenRef to accept and validate a repository DID.
  • Pass the pull request source's sourceRepositoryDID from regular fork resubmission.
  • Pass the same source repository DID from stacked fork resubmission.
  • Include the fix in the next tng release.

Commit 7ef4145 already contains the main code changes, but its test coverage needs to be completed before merging:

  • update the regular fork resubmission test to expect the source repository DID instead of the repository AT URI;
  • add a stacked fork resubmission regression test that verifies the DID passed to hidden-ref;
  • verify the hidden-ref request body contains a DID;
  • verify an AT URI is rejected locally before a request is sent.

Expected behavior #

Fork pull request resubmission should update the hidden tracking ref using the fork's repository DID, compare the updated source branch with that ref, and append a new pull request round.

Sign up or Sign in to add to the discussion.