Skip to content

fix(trail): add support for native repos - #2245

Merged
computermode merged 5 commits into
mainfrom
fix-native-trail-list
Sep 3, 2026
Merged

fix(trail): add support for native repos#2245
computermode merged 5 commits into
mainfrom
fix-native-trail-list

Conversation

@computermode

@computermode computermode commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

https://entire.io/gh/entireio/cli/trails/1224

Problem

Entire-native remotes use /et/<project>/<repo>, but trail API client resolution discarded the forge and looked up only <owner>/<repo>. When a legacy GitHub mirror has the same name—as with entirehq/marvin—the CLI can select the /gh/ repository's placement and trails instead.

Native repositories also cannot be resolved reliably through the name-addressed cell route. They need to be resolved through their project-scoped repository identity and queried by repository ID.

Changes

  • preserve the gh versus et forge namespace throughout trail repository resolution
  • resolve Entire-native repositories through the native project and repository lookup, using the resulting repository ULID and home cell
  • use /api/v1/repos/{repo_id}/trails as the base route for native repositories
  • retain /api/v1/trails/gh/{owner}/{repo} for GitHub-backed repositories
  • derive trail lookup, detail, body, metadata update, and delete paths from the selected repository base route
  • add collision coverage for same-named /et/ and /gh/ repositories

Command coverage

This change migrates the affected paths for:

  • entire trail list
  • entire trail show, including number, selector, and default/current-branch lookup
  • entire trail update, including metadata and body updates
  • entire trail delete, including number and branch lookup
  • runner trail gathering

Test plan

  • mise run check
  • mise run lint
  • read-only production trail list smoke test against entire://aws-us-east-2.entire.io/et/entirehq/marvin returned exactly its 3 native trails
  • read-only production trail show 3 --json smoke test returned Marvin native trail 3 with an /et/entirehq/marvin URL
  • update and delete routes verified with local HTTP fixtures only; no production mutations performed

Tracking

Copilot AI lite review requested due to automatic review settings September 2, 2026 20:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The routing change is narrowly scoped, keeps the GitHub path intact, and is covered by targeted regression tests validating both route selection and repo-ID propagation.

Pull request overview

This PR fixes entire trail list (and related “tune” gathering) for Entire-native (et) repositories by routing trail list requests through the repo-ID-addressed entire-api route, while keeping the existing host-addressed route for GitHub (gh) repositories. It also updates the trail API client seam to return the processing placement’s repo ID so callers can select the correct list route.

Changes:

  • Extend newTrailAPIClient to return (client, repoID) and plumb that through a new runAuthenticatedTrailAPIWithRepoID helper.
  • Add trailListBasePath and update trail listing/gathering to use /api/v1/repos/{repoID}/trails for et repos and /api/v1/trails/{forge}/{owner}/{repo} for non-native repos.
  • Add/adjust regression tests to cover repo-ID propagation and route selection.
File summaries
File Description
cmd/entire/cli/api_client.go Updates newTrailAPIClient to resolve placement once, dial the correct cell, and return the processing placement repo ID alongside the client.
cmd/entire/cli/cell_target.go Factors resolveRepoCellPlacementByFullName so both “cell-only” and “cell+repoID” callers share the same placement resolution boundary.
cmd/entire/cli/trail_context_cache.go Introduces runAuthenticatedTrailAPIWithRepoID and adapts existing seams to the new newTrailAPIClient return shape.
cmd/entire/cli/trail_cmd.go Switches trail listing to compute a base path via trailListBasePath and uses the repo-ID route for et repos.
cmd/entire/cli/runner_gather.go Updates trail gathering to use repo-ID-aware trail listing base paths.
cmd/entire/cli/trail_cmd_test.go Adds tests for trailListBasePath and verifies native listing uses the repo-ID route; updates existing tests for the new seam signature.
cmd/entire/cli/trail_repo_flag_test.go Extends routing test coverage to assert repo ID propagation through the authenticated trail API seam.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@computermode computermode changed the title fix(trail): list native repo trails by ID fix(trail): route native repo operations by ID Sep 2, 2026
@computermode computermode changed the title fix(trail): route native repo operations by ID fix(trail): add support for native repos Sep 2, 2026
@computermode
computermode marked this pull request as ready for review September 2, 2026 22:13
@computermode
computermode requested a review from a team as a code owner September 2, 2026 22:13
@computermode
computermode merged commit 7b90695 into main Sep 3, 2026
12 of 13 checks passed
@computermode
computermode deleted the fix-native-trail-list branch September 3, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants