Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

bug(tui): a locally created project is written to <path>/datatug/datatug-project.json but read from <path>/datatug-project.json, so it cannot be opened

Đã đóng Phù hợp với người mới
#263 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
85/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu với createLocalProject trong apps/datatugapp/datatugui/dtproject/create_project_screen.go và so sánh cách xử lý đường dẫn của nó với LoadProjectFile trong pkg/storage/filestore/store_loader.go. Kiểm tra project_creator_test.go để xác nhận layout dự kiến ở cấp gốc. Công việc được xem là hoàn tất khi một project được tạo cục bộ có thể mở được và writer và reader thống nhất về vị trí của file project.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

What happens

A project created locally from the TUI cannot be opened afterwards: the create flow writes the project file one directory deeper than the reader looks for it, so opening the project it just created fails with ErrProjectDoesNotExist.

Trigger

Writer — createLocalProject in apps/datatugapp/datatugui/dtproject/create_project_screen.go puts the file inside a datatug subdirectory:

datatugDir := filepath.Join(projectPath, "datatug")
// ...
configFilePath := filepath.Join(datatugDir, storage.ProjectSummaryFileName)

giving <projectPath>/datatug/datatug-project.json.

Reader — the same flow then calls openProject, which builds a store on projectRef.Path (that same projectPath):

store := filestore.NewProjectStore(projectRef.ID, projectRef.Path)

and datatug-core's filestore.LoadProjectFile joins the file name straight onto that path, with no datatug segment (pkg/storage/filestore/store_loader.go):

func LoadProjectFile(projPath string) (v datatug.ProjectFile, err error) {
	fileName := path.Join(projPath, storage.ProjectSummaryFileName)

So the reader opens <projectPath>/datatug-project.json and nothing is there.

Core is consistent with its reader, not with this writer: filestore's own saver writes saveJSONFile(s.projectPath, storage.ProjectSummaryFileName, projFile), and dtprojcreator.CreateProjectFiles writes it at the project root too — core's project_creator_test.go asserts expectedPath := path.Join(projPath, storage.ProjectSummaryFileName). The TUI's extra datatug directory is the odd one out.

Expected

createLocalProject should write datatug-project.json at the project root, the one place every reader in core looks — or, if the datatug subdirectory is deliberate, projectRef.Path should point at it so the two agree. They must not disagree silently.

Worth deciding at the same time whether the now-empty datatug directory should still be created at all.

Notes

Found in review of #259, which changed the directory this file is written into (it is now named after the project id rather than the title) but not the layout below it — the mismatch predates that PR and is not fixed there. Sibling pre-existing defects on the neighbouring GitHub create path: #260, #261, #262.

Ngôn ngữ chính
Go
Star
1
Fork
0
Merge trung bình
16 giờ 2 phút
Pull request đã merge (30 ngày)
120

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của datatug/datatug-cli

Tất cả issue của datatug/datatug-cli

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.