bug(dtgithub): projectCreator never receives repoOwner, repoName or branch, so every GitHub call targets an empty repo

Open Beginner friendly
#261 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
github, go
Domain
api, cli

Research direction

Start in pkg/dtgithub/github_repo_projects_store.go by reading NewRepoProjectsStore, GithubRepoProjectsStore.CreateNewProject, and newProjectCreator. Trace the parsed owner, repository, and branch into projectCreator, then verify the GitHub calls no longer use empty values and that the resulting repository, ref, README title, and errors use those inputs.

Written by the indexing model from the issue text.

Description

What happens

Every GitHub API call projectCreator makes is addressed to an empty owner and an empty repository name, and it always works on the branch "".

Trigger

newProjectCreator populates only two of the six fields (pkg/dtgithub/github_repo_projects_store.go):

func newProjectCreator(ghClient *github.Client, report datatug.StatusReporter) (creator *projectCreator) {
	return &projectCreator{
		client: ghClient,
		report: report,
	}
}

repoOwner, repoName, repo and branch are left at their zero values, and nothing assigns them afterwards. Meanwhile GithubRepoProjectsStore.CreateNewProject parses exactly those first two out of its projectID and then throws them away:

repoOwner, repoName, projectDir := ids[0], ids[1], path.Join(ids[2:]...)
_, _, _ = repoOwner, repoName, title

So createRepo calls c.client.Repositories.Get(ctx, "", ""), CreateProject asks for the ref heads/ on ""/"", addDatatugSectionToRootReadmeFile writes # as a README title, and the error messages report failed to create GitHub repository '/'.

branch is a second, separate loss: NewRepoProjectsStore defaults it to "main" and stores it on GithubRepoProjectsStore, but the creator it builds never receives it.

Expected

newProjectCreator should take the owner, repo and branch the store already parsed and hold them, so the parsed values are actually used.

Notes

Found while adapting the CLI to datatug-core v0.39.0's caller-supplied project id (#259) and deliberately not fixed there — it is a pre-existing gap in an unfinished code path, not a consequence of the id change. In practice the panic in the sibling issue fires first, so this is only reachable once that is fixed.

Dominant language
Go
Stars
1
Forks
0
Avg merge
1h 56m
Merged PRs (30d)
84

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from datatug/datatug-cli

All issues in datatug/datatug-cli

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.