Too many project info
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 68/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- performance
Research direction
Start in Mergin/projects_manager.py at MerginProjectsManager.project_status() and inspect its 19 call sites before changing the return shape. Then trace the project status dialog and its current permission and role inputs; done means the dialog obtains both values from one response while existing three-value callers continue to work.
Written by the indexing model from the issue text.
Description
Current situation
Opening the project status dialog makes three back-to-back requests for the same project info, each returning the project's full file list.
In MerginProjectsManager.project_status() (Mergin/projects_manager.py):
| # | call | what it is after |
|---|---|---|
| 1 | self.mc.project_status(project_dir) → project_info(name, since=vN) |
files, version |
| 2 | self.mc.has_writing_permissions(project_name) → project_info(name) |
permissions.upload |
| 3 | self.mc.project_info(project_name)["role"] |
role |
permissions and role are sibling fields of the same ProjectSchema, and the since= response is already ProjectSchema(exclude=["storage_params"]). So the first response carries everything the other two go back to the server for.
Beyond the wasted payload, has_write_permissions and project_permission reach the dialog from two different responses. They are two snapshots of the same state and can in principle disagree, and the dialog uses one to warn about read-only access and the other to drive MerginProjectValidator.
What we want
One request per status dialog, with the permission and the role coming from the same response.
Proposed approach
Step 1 — plugin only. Drop has_writing_permissions and read both values off a single project_info call. Takes it from three requests to two, no client release needed:
project_info = self.mc.project_info(project_name)
dlg = ProjectStatusDialog(
pull_changes,
push_changes,
push_changes_summary,
project_info["permissions"]["upload"],
mp,
project_info["role"],
)
Step 2 — needs python-api-client. project_status() cannot simply return the server info as a fourth element: 19 call sites (db-sync, cli.py, the plugin) unpack exactly three values. A non-breaking shape is a richer method with the existing one as a thin wrapper:
def project_status(self, directory):
pull, push, summary, _ = self.project_status_with_info(directory)
return pull, push, summary
The plugin then calls project_status_with_info() and takes role and permissions from the response it has already paid for, bringing it to one request.
- Dominant language
- Python
- Stars
- 45
- Forks
- 21
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 2
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MerginMaps/qgis-plugin
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
MerginMaps/qgis-plugin#953 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
MerginMaps/qgis-plugin#848 · 1 comment ·
-
Project history and Remove locally fail in projects with long paths on Windows (> 260 characters)Openbug windows
Difficulty 3/5 1-2 days Newbie friendliness 55/100
MerginMaps/qgis-plugin#967 ·
-
View changes and schema check use the wrong base copy for GeoPackages in subfoldersPossibly taken @harminius claimed this 6 days ago. Openbug
MerginMaps/qgis-plugin#963 · 1 assignee ·
-
Error when syncing project.Possibly taken @harminius claimed this 7 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 54/100
MerginMaps/qgis-plugin#960 · 2 comments · 1 assignee ·
All issues in MerginMaps/qgis-plugin
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Deltares/numba_celltree#100 · 1 comment ·
-
auto-reported bug
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
Maintainers usually reply within 1 day
-
soup airgap-bundle --bundle-size-cap nan, inf or a cap above ~1.67e299 GiB stops with an internal ValueError/OverflowError (exit 1) instead of a usage errorPossibly taken @Keshemir claimed this today. Openbug claimed difficulty:2
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
MakazhanAlpamys/Soup#3045 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
dagster-io/skills#80 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day