Metadata
Origin
Follow-up suggestion
What to build
The dashboard-template binding response (the model returned by GET/PUT /orgs/{org}/dashboard-template and the project-override variant) does not currently expose either:
- the commit SHA of the most recent successful sync, or
- a web URL that links to the template's location in the GitHub browsing UI.
Both are useful for diagnostics and for letting an admin click through from the binding to verify configuration.
commit_sha is already stored — dashboard_github_templates.commit_sha (src/docverse/dbschema/dashboard_github_template.py:50), reachable from the binding via the github_template_id FK. web_url is derivable from binding fields directly (github_owner, github_repo, github_ref, root_path) and does not require a successful sync to have happened.
Approach sketch
- Extend the binding response model (in
handlers/orgs/models.py, the dashboard-template binding response near the org/project response models) with two fields:
commit_sha: str | None — populated from binding.github_template.commit_sha when the FK is set; None until the first successful sync.
web_url: str — always present once a binding exists. Derived from (github_owner, github_repo, github_ref, root_path).
- Add a small helper in
storage/github/ that builds the GitHub browse URL: https://github.com/{owner}/{repo}/tree/{ref} when root_path is /, otherwise append the path (handle leading slash carefully). Co-locate with storage/github/tree_fetcher.py so all GitHub-URL knowledge stays in one place.
- Update
from_domain on the response model to call the helper and to read commit_sha off the linked content row.
- Make sure both the org-default and project-override binding responses get both fields (single shared response model or two — match whatever the existing models do).
Acceptance criteria
Metadata
tickets/DM-54689-github-webhookOrigin
Follow-up suggestion
What to build
The dashboard-template binding response (the model returned by
GET/PUT /orgs/{org}/dashboard-templateand the project-override variant) does not currently expose either:Both are useful for diagnostics and for letting an admin click through from the binding to verify configuration.
commit_shais already stored —dashboard_github_templates.commit_sha(src/docverse/dbschema/dashboard_github_template.py:50), reachable from the binding via thegithub_template_idFK.web_urlis derivable from binding fields directly (github_owner,github_repo,github_ref,root_path) and does not require a successful sync to have happened.Approach sketch
handlers/orgs/models.py, the dashboard-template binding response near the org/project response models) with two fields:commit_sha: str | None— populated frombinding.github_template.commit_shawhen the FK is set;Noneuntil the first successful sync.web_url: str— always present once a binding exists. Derived from(github_owner, github_repo, github_ref, root_path).storage/github/that builds the GitHub browse URL:https://github.com/{owner}/{repo}/tree/{ref}whenroot_pathis/, otherwise append the path (handle leading slash carefully). Co-locate withstorage/github/tree_fetcher.pyso all GitHub-URL knowledge stays in one place.from_domainon the response model to call the helper and to readcommit_shaoff the linked content row.Acceptance criteria
commit_sha: str | None—Nonebefore first successful sync, set to the latest synced commit afterwardsweb_url: str— present whenever a binding exists, regardless of sync stateweb_urlis correct for bothroot_path == "/"(omits the path segment) and a non-rootroot_path(appends without double slashes)storage/github/and has unit tests covering root vs subdirectory paths and refs that include/(e.g.release/1.0)GET/PUT /orgs/{org}/dashboard-templateand the project-override variant assert the new fields