Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ Run the server with `go run ./cmd/server --static-dir web/dist`. Configure:

- `PLATFORM_API_URL`, `PLATFORM_PROJECT_ID`, and the platform OIDC identity settings.
- `TRACKER_DATABASE_URL` (or `DATABASE_URL`) for PostgreSQL. `TRACKER_DEV_SEED=1` enables
development seed data on an empty database.
development seed data on an empty database: 40 issues, three closed one-week sprints
with 18/21/24-point velocities, an active two-week sprint, and a planned sprint.
- `TRACKER_PUBLIC_URL` for the HTTPS browser origin.
- `TRACKER_DIRECTORY_URL` and `TRACKER_DIRECTORY_PUBLIC_URL` for optional Directory links.
- `TRACKER_STATIC_DIR` or `--static-dir` to override `/srv/tracker`.
Expand All @@ -67,6 +68,16 @@ and `/healthz` remains 200. Missing database configuration leaves the API return
when the API is available. `/releasez` uses `TRACKER_RELEASE_VERSION` and
`TRACKER_ARTIFACT_DIGEST` supplied by the catalog.

Sprint settings are workspace-wide: Admins can PATCH `sprintLengthWeeks` (1 or 2)
and an IANA `timezone` (default `Asia/Tokyo`). Any signed-in user can plan, start,
and close a sprint; only Admins can delete a planned sprint. Estimates are sizes
(`XS`, `S`, `M`, `L`, `XL`), worth 1/2/3/5/8 points. The server writes a
transactional ledger for burndown and velocity; closed ledgers never change.
On close, unfinished scope moves to the selected planned sprint or the backlog.
A lineage conflict in the destination sends that issue to the backlog.
Chart days follow the workspace timezone; ideal lines skip weekends, not holidays.
Sprint numbers are never reused after deletion.

A request whose bearer the server refuses (401 `unauthenticated`) writes one
`tracker auth rejected:` log line: method, path, the edge `X-Request-Id`, a
reason (`issuer`, `audience`, `expired_or_not_yet_valid`, `signature_or_keys`,
Expand Down Expand Up @@ -102,14 +113,14 @@ a required BuildKit secret, never through build arguments or committed files.

## Catalog and release

The next app release is **0.1.9**, also recorded in `web/package.json`.
The next app release is **0.1.10**, also recorded in `web/package.json`.
`catalog/entry.yaml` carries no committed version: the first tag (`v0.1.0`)
created `versions[]` with `ghcr.io/appthrust/tracker@sha256:<index-digest>`,
stream `0.1`; later tags append at publication time. Do not add a version with
an unbuilt or placeholder image digest. OpenAPI's `info.version` describes the
API schema, not the app release. This repository has no hand-maintained changelog.

After the release prerequisites are available, push the SemVer tag `v0.1.9`.
After the release prerequisites are available, push the SemVer tag `v0.1.10`.
The tag workflow:

1. Performs one multi-platform build on `ubuntu-24.04` for Linux amd64 and arm64,
Expand All @@ -129,8 +140,8 @@ The tag workflow:
Publication commands used by the workflow:

```sh
bun hack/publish-entry.ts submit --version 0.1.9 --digest sha256:<image-index-digest>
bun hack/publish-entry.ts await --version 0.1.9 --digest sha256:<image-index-digest>
bun hack/publish-entry.ts submit --version 0.1.10 --digest sha256:<image-index-digest>
bun hack/publish-entry.ts await --version 0.1.10 --digest sha256:<image-index-digest>
```

Writers are serialized by `tracker-catalog-publish`; the workflow is guarded to
Expand All @@ -151,8 +162,8 @@ After publication, each estate's `AppCatalogSource` syncs the signed catalog.
Install Issues from the Project Marketplace (Directory is an automatic
dependency). Existing `follow` installations on stream `0.1` roll to the new
version; `pinned` installations show `UpdateAvailable` and require an explicit
version update. Confirm the installation is Ready, `/releasez` reports `0.1.9`,
and a signed-in Tracker page lists the Epics page in the navigation. These are release steps,
version update. Confirm the installation is Ready, `/releasez` reports `0.1.10`,
and a signed-in Tracker page lists the Sprints page in the navigation. These are release steps,
not actions performed by a source-only version bump.

Migration authority:
Expand Down
15 changes: 14 additions & 1 deletion cmd/server/internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ func New(database *store.Store, auth *identity.Authenticator, upstream *platform
a.route("GET /projects/{id}", false, false, a.projectGet)
a.route("PATCH /projects/{id}", true, true, a.projectPatch)
a.route("DELETE /projects/{id}", true, true, a.projectDelete)
a.route("GET /sprints", false, false, a.sprintList)
a.route("POST /sprints", true, false, a.sprintCreate)
a.route("GET /sprints/{id}", false, false, a.sprintGet)
a.route("PATCH /sprints/{id}", true, false, a.sprintPatch)
a.route("POST /sprints/{id}/start", true, false, a.sprintStart)
a.route("POST /sprints/{id}/close", true, false, a.sprintClose)
a.route("DELETE /sprints/{id}", true, true, a.sprintDelete)
a.route("GET /sprints/{id}/burndown", false, false, a.sprintBurndown)
a.route("GET /velocity", false, false, a.velocity)
a.route("GET /issues", false, false, a.issueList)
a.route("POST /issues", true, false, a.issueCreate)
a.route("GET /issues/{id}", false, false, a.issueGet)
Expand Down Expand Up @@ -191,7 +200,11 @@ func decode(s *request, target any, nullable ...string) error {
}
decoder := json.NewDecoder(bytes.NewReader(body))
decoder.DisallowUnknownFields()
if decoder.Decode(target) != nil {
if err := decoder.Decode(target); err != nil {
var typed *json.UnmarshalTypeError
if errors.As(err, &typed) && (typed.Field == "estimate" || typed.Field == "sprintId") {
return &domain.FieldError{Path: typed.Field, Message: "Value must be a string or null"}
}
return invalid("Request body contains invalid or unknown fields")
}
if decoder.Decode(new(any)) != io.EOF {
Expand Down
13 changes: 7 additions & 6 deletions cmd/server/internal/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ import (
)

type harness struct {
t *testing.T
server *httptest.Server
t *testing.T
server *httptest.Server
database *store.Store
}

func token(subject string) string {
Expand Down Expand Up @@ -55,7 +56,7 @@ func newHarness(t *testing.T) *harness {
require.NoError(t, err)
server := httptest.NewServer(New(database, auth, platformclient.New(upstream.URL, "pj-test"), directory.New(nil, ""), "pj-test"))
t.Cleanup(server.Close)
return &harness{t: t, server: server}
return &harness{t: t, server: server, database: database}
}
func call[T any](h *harness, subject, method, path string, body any, status int) T {
h.t.Helper()
Expand Down Expand Up @@ -197,7 +198,7 @@ func TestOpenAPIRouteInventory(t *testing.T) {
}
require.NoError(t, json.Unmarshal(openapiDocument, &document))
require.Equal(t, "3.1.0", document.OpenAPI)
for path, methods := range map[string][]string{"/me": {"get"}, "/workspace": {"get", "patch"}, "/statuses": {"get", "post"}, "/statuses/{id}": {"patch", "delete"}, "/statuses/order": {"put"}, "/labels": {"get", "post"}, "/labels/{id}": {"patch", "delete"}, "/issues": {"get", "post"}, "/issues/{id}": {"get", "patch", "delete"}, "/issues/{id}/timeline": {"get"}, "/issues/{id}/comments": {"post"}, "/comments/{id}": {"patch", "delete"}, "/issues/{id}/attachments": {"post"}, "/attachments/{id}": {"get", "delete"}, "/views": {"get", "post"}, "/views/{id}": {"patch", "delete"}, "/people": {"get"}, "/openapi.json": {"get"}} {
for path, methods := range map[string][]string{"/me": {"get"}, "/workspace": {"get", "patch"}, "/statuses": {"get", "post"}, "/statuses/{id}": {"patch", "delete"}, "/statuses/order": {"put"}, "/labels": {"get", "post"}, "/labels/{id}": {"patch", "delete"}, "/issues": {"get", "post"}, "/issues/{id}": {"get", "patch", "delete"}, "/issues/{id}/timeline": {"get"}, "/issues/{id}/comments": {"post"}, "/comments/{id}": {"patch", "delete"}, "/issues/{id}/attachments": {"post"}, "/attachments/{id}": {"get", "delete"}, "/views": {"get", "post"}, "/views/{id}": {"patch", "delete"}, "/people": {"get"}, "/openapi.json": {"get"}, "/sprints": {"get", "post"}, "/sprints/{id}": {"get", "patch", "delete"}, "/sprints/{id}/start": {"post"}, "/sprints/{id}/close": {"post"}, "/sprints/{id}/burndown": {"get"}, "/velocity": {"get"}} {
for _, method := range methods {
require.Contains(t, document.Paths[path], method, "%s %s", method, path)
}
Expand Down Expand Up @@ -247,9 +248,9 @@ func TestOpenAPIHierarchyContract(t *testing.T) {
require.NoError(t, json.Unmarshal(openapiDocument, &document))
schemas := document.Components.Schemas
require.Equal(t, domain.Types, schemas["IssueType"].Enum)
require.Equal(t, []string{"none", "epic", "story"}, schemas["GroupBy"].Enum)
require.Equal(t, []string{"none", "epic", "story", "sprint"}, schemas["GroupBy"].Enum)
require.Equal(t, "none", schemas["GroupBy"].Default)
require.ElementsMatch(t, []string{"total", "completed"}, schemas["Progress"].Required)
require.ElementsMatch(t, []string{"total", "completed", "points"}, schemas["Progress"].Required)
for _, field := range []string{"total", "completed"} {
require.JSONEq(t, `{"type":"integer","minimum":0}`, string(schemas["Progress"].Properties[field]))
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/server/internal/api/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (a *API) assignee(s *request, sub *string) (*domain.Person, error) {
}
func (a *API) issueCreate(s *request) (any, int, error) {
var input store.IssueCreate
if err := decode(s, &input, "assigneeSub", "projectId", "parentId", "dueOn", "report"); err != nil {
if err := decode(s, &input, "assigneeSub", "projectId", "parentId", "dueOn", "report", "estimate", "sprintId"); err != nil {
return nil, 0, err
}
assignee, err := a.assignee(s, input.AssigneeSub)
Expand All @@ -70,7 +70,7 @@ func (a *API) issueCreate(s *request) (any, int, error) {
}
func (a *API) issuePatch(s *request) (any, int, error) {
var input store.IssuePatch
if err := decode(s, &input, "assigneeSub", "projectId", "parentId", "dueOn", "report"); err != nil {
if err := decode(s, &input, "assigneeSub", "projectId", "parentId", "dueOn", "report", "estimate", "sprintId"); err != nil {
return nil, 0, err
}
var assignee *domain.Person
Expand Down
Loading