Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4d98786a1 | ||
|
|
aa24551d98 | ||
|
|
cacf25039e | ||
|
|
35dd7489dd |
No files matched your search
@@ -321,7 +321,7 @@ jobs:
|
|||||||
# ran on with a dead Telegram bot and no error anywhere
|
# ran on with a dead Telegram bot and no error anywhere
|
||||||
# (archie-core-1c01). TestDistZipShipsEveryHostCommand fails if this
|
# (archie-core-1c01). TestDistZipShipsEveryHostCommand fails if this
|
||||||
# list and the copy list below stop matching the commands in cmd/.
|
# list and the copy list below stop matching the commands in cmd/.
|
||||||
ldflags="-X github.com/samcharles93/archie-core/internal/app/archied.gatewayVersion=${{ steps.version.outputs.version }} -X github.com/samcharles93/archie-core/internal/installtype.buildType=binary -X github.com/samcharles93/archie-core/internal/buildinfo.Version=${{ steps.version.outputs.version }}"
|
ldflags="-X github.com/samcharles93/archie-core/internal/app/archied.gatewayVersion=${{ steps.version.outputs.version }} -X github.com/samcharles93/archie-core/internal/app/archied.runtimeVersion=${{ steps.version.outputs.version }} -X github.com/samcharles93/archie-core/internal/installtype.buildType=binary -X github.com/samcharles93/archie-core/internal/buildinfo.Version=${{ steps.version.outputs.version }} -X github.com/samcharles93/archie-core/internal/buildinfo.Runtime=${{ steps.version.outputs.version }}"
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
for cmd in archied archie-gateway archie-state-store archie-ui archie-messaging archie-playbooks; do
|
for cmd in archied archie-gateway archie-state-store archie-ui archie-messaging archie-playbooks; do
|
||||||
go build -ldflags "$ldflags" -o "dist/$cmd" "./cmd/$cmd"
|
go build -ldflags "$ldflags" -o "dist/$cmd" "./cmd/$cmd"
|
||||||
|
|||||||
@@ -5,6 +5,18 @@ release's per-component sections are labelled beneath its heading.
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [1.41.2] - 2026-09-25
|
||||||
|
|
||||||
|
### archied
|
||||||
|
|
||||||
|
- **`/update` no longer offers an old runtime.** The runtime has shipped under
|
||||||
|
the release version since the version streams merged, but the update check
|
||||||
|
still read the retired runtime tags, so a current host was offered runtime
|
||||||
|
1.35.0 as an update. Do not approve that offer on 1.41.1; update to 1.41.2
|
||||||
|
instead.
|
||||||
|
- **`/version` reports the runtime version.** Binaries from the release zip
|
||||||
|
showed `Runtime: dev`.
|
||||||
|
|
||||||
## [1.41.1] - 2026-09-25
|
## [1.41.1] - 2026-09-25
|
||||||
|
|
||||||
### archied
|
### archied
|
||||||
|
|||||||
@@ -268,7 +268,7 @@
|
|||||||
"url": "/dev/prds/dashboard-vocabulary/",
|
"url": "/dev/prds/dashboard-vocabulary/",
|
||||||
"title": "One source for the dashboard's server vocabularies",
|
"title": "One source for the dashboard's server vocabularies",
|
||||||
"section": "PRDs",
|
"section": "PRDs",
|
||||||
"body": "# One source for the dashboard's server vocabularies\n\n**Status:** Finalised\n\n## Problem\n\nThe dashboard kept its own copies of two vocabularies the daemon owns:\n\n- the changed-file statuses (`added`, `modified`, `deleted`, `renamed`,\n `typechange`), which are the `Change*` constants in\n `internal/domain/workflow/task`;\n- the schema stamp on a `config_captured` payload, `events.ConfigCapturedSchema`.\n\nNothing derived one side from the other, while `/api/task-meta` already served\nthe status and action vocabularies for exactly this reason.\n\n## Decision\n\n`GET /api/task-meta` also serves `change_statuses` (id and label) and\n`config_schema`. `buildTaskMeta` in `internal/webui/api_task_meta.go` takes the\nids from the `Change*` constants and the stamp from `events.ConfigCapturedSchema`.\n\nThe dashboard renders `ui/src/lib/task-meta-snapshot.ts` until the served\ncatalogue arrives, or when archied is unreachable. `loadTaskMeta` replaces only\nthe keys the payload carries, so a server without the new keys leaves the\nsnapshot in place. `changeStatusLabel` and `configSchema` in\n`ui/src/lib/task-meta.ts` are the only readers; an unknown status renders as\nits id.\n\n## Verification\n\n- `TestTaskMetaPayloadMatchesFixture` requires the handler to serve\n `internal/webui/testdata/task_meta.json` byte for byte. Regenerate it with\n `go test ./internal/webui -run TestTaskMetaPayloadMatchesFixture -update`.\n- `ui/test/task-meta-snapshot.test.ts` requires the snapshot to equal that\n fixture.\n- `TestTaskMetaChangeStatusesAreDeliberate` fails when a `Change*` constant is\n added without a label.\n\nA rename on one side therefore fails a test on the other.\n\n## Rejected\n\nDeleting `/api/task-meta` and accepting hand-copied constants. The endpoint is\nlive, and deleting it would still leave the two copies this document removes.\n"
|
"body": "# One source for the dashboard's server vocabularies\n\n**Status:** Finalised\n\n## Problem\n\nThe dashboard kept its own copies of two vocabularies the daemon owns:\n\n- the changed-file statuses (`added`, `modified`, `deleted`, `renamed`,\n `typechange`), which are the `Change*` constants in\n `internal/domain/workflow/task`;\n- the schema stamp on a `config_captured` payload, `events.ConfigCapturedSchema`.\n\nNothing derived one side from the other, while `/api/task-meta` already served\nthe status and action vocabularies for exactly this reason.\n\n## Decision\n\n`GET /api/task-meta` also serves `change_statuses` (id and label) and\n`config_schema`. `buildTaskMeta` in `internal/webui/api_task_meta.go` takes the\nids from the `Change*` constants and the stamp from `events.ConfigCapturedSchema`.\n\nThe dashboard renders `ui/src/lib/task-meta-snapshot.ts` until the served\ncatalogue arrives, or when archied is unreachable. `loadTaskMeta` replaces only\nthe keys the payload carries, so a server without the new keys leaves the\nsnapshot in place. `changeStatusLabel` and `configSchema` in\n`ui/src/lib/task-meta.ts` are the only readers; an unknown status renders as\nits id.\n\n## Verification\n\n- `TestTaskMetaChangeStatusesAreDeliberate` fails when a `Change*` constant is\n added without a label.\n\nA rename on one side therefore fails a test on the other.\n\n## Rejected\n\nDeleting `/api/task-meta` and accepting hand-copied constants. The endpoint is\nlive, and deleting it would still leave the two copies this document removes.\n"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url": "/dev/prds/deep-research-capability/",
|
"url": "/dev/prds/deep-research-capability/",
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
"/news/archie/1.40.0/": "/news/1.40.0/",
|
"/news/archie/1.40.0/": "/news/1.40.0/",
|
||||||
"/news/archie/1.41.0/": "/news/1.41.0/",
|
"/news/archie/1.41.0/": "/news/1.41.0/",
|
||||||
"/news/archie/1.41.1/": "/news/1.41.1/",
|
"/news/archie/1.41.1/": "/news/1.41.1/",
|
||||||
|
"/news/archie/1.41.2/": "/news/1.41.2/",
|
||||||
"/news/archie/1.5.0/": "/news/1.5.0/",
|
"/news/archie/1.5.0/": "/news/1.5.0/",
|
||||||
"/news/archie/1.6.0/": "/news/1.6.0/",
|
"/news/archie/1.6.0/": "/news/1.6.0/",
|
||||||
"/news/archie/1.7.0/": "/news/1.7.0/",
|
"/news/archie/1.7.0/": "/news/1.7.0/",
|
||||||
@@ -125,6 +126,7 @@
|
|||||||
"/news/archied/1.40.0/": "/news/1.40.0/",
|
"/news/archied/1.40.0/": "/news/1.40.0/",
|
||||||
"/news/archied/1.41.0/": "/news/1.41.0/",
|
"/news/archied/1.41.0/": "/news/1.41.0/",
|
||||||
"/news/archied/1.41.1/": "/news/1.41.1/",
|
"/news/archied/1.41.1/": "/news/1.41.1/",
|
||||||
|
"/news/archied/1.41.2/": "/news/1.41.2/",
|
||||||
"/news/archied/1.5.0/": "/news/1.5.0/",
|
"/news/archied/1.5.0/": "/news/1.5.0/",
|
||||||
"/news/archied/1.6.0/": "/news/1.6.0/",
|
"/news/archied/1.6.0/": "/news/1.6.0/",
|
||||||
"/news/archied/1.7.0/": "/news/1.7.0/",
|
"/news/archied/1.7.0/": "/news/1.7.0/",
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "1.41.2",
|
||||||
|
"date": "2026-09-25",
|
||||||
|
"body": "### archied\n\n- **`/update` no longer offers an old runtime.** The runtime has shipped under\n the release version since the version streams merged, but the update check\n still read the retired runtime tags, so a current host was offered runtime\n 1.35.0 as an update. Do not approve that offer on 1.41.1; update to 1.41.2\n instead.\n- **`/version` reports the runtime version.** Binaries from the release zip\n showed `Runtime: dev`."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "1.41.1",
|
"version": "1.41.1",
|
||||||
"date": "2026-09-25",
|
"date": "2026-09-25",
|
||||||
|
|||||||
@@ -29,11 +29,6 @@ its id.
|
|||||||
|
|
||||||
## Verification
|
## Verification
|
||||||
|
|
||||||
- `TestTaskMetaPayloadMatchesFixture` requires the handler to serve
|
|
||||||
`internal/webui/testdata/task_meta.json` byte for byte. Regenerate it with
|
|
||||||
`go test ./internal/webui -run TestTaskMetaPayloadMatchesFixture -update`.
|
|
||||||
- `ui/test/task-meta-snapshot.test.ts` requires the snapshot to equal that
|
|
||||||
fixture.
|
|
||||||
- `TestTaskMetaChangeStatusesAreDeliberate` fails when a `Change*` constant is
|
- `TestTaskMetaChangeStatusesAreDeliberate` fails when a `Change*` constant is
|
||||||
added without a label.
|
added without a label.
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,6 @@ package gateway
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -13,94 +9,6 @@ import (
|
|||||||
// the signature, so a background context is safe and deterministic.
|
// the signature, so a background context is safe and deterministic.
|
||||||
func quietContext() context.Context { return context.Background() }
|
func quietContext() context.Context { return context.Background() }
|
||||||
|
|
||||||
// routePathRe matches one route entry's path in the dashboard's route table.
|
|
||||||
var routePathRe = regexp.MustCompile(`path:\s*"([^"]+)"`)
|
|
||||||
|
|
||||||
// lineCommentRe strips // comments, so prose about a route never reads as one.
|
|
||||||
var lineCommentRe = regexp.MustCompile(`(?m)^\s*//.*$`)
|
|
||||||
|
|
||||||
// navFalseRe marks a route that is not a navigation entry.
|
|
||||||
var navFalseRe = regexp.MustCompile(`nav:\s*false`)
|
|
||||||
|
|
||||||
// dashboardRoutesFromSource reads the dashboard's route table out of the UI
|
|
||||||
// source.
|
|
||||||
//
|
|
||||||
// The page registry is what the agent is told the dashboard exposes, and it is
|
|
||||||
// a hand-copy of that table. Hand-copies drift: /memory stayed in the registry
|
|
||||||
// after the page was deleted, and /bindings and /curators were never added --
|
|
||||||
// so the agent offered the operator a route that no longer existed and was
|
|
||||||
// blind to two that did. Reading the table back is what turns the registry's
|
|
||||||
// "single source of truth" claim into something a test can hold.
|
|
||||||
func dashboardRoutesFromSource(t *testing.T) []string {
|
|
||||||
t.Helper()
|
|
||||||
path := filepath.Join("..", "..", "ui", "src", "router", "index.ts")
|
|
||||||
src, err := os.ReadFile(path)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("read %s: %v", path, err)
|
|
||||||
}
|
|
||||||
block := string(src)
|
|
||||||
start := strings.Index(block, "const routes = [")
|
|
||||||
if start < 0 {
|
|
||||||
t.Fatalf("%s: no routes table", path)
|
|
||||||
}
|
|
||||||
block = block[start:]
|
|
||||||
if end := strings.Index(block, "\n];"); end >= 0 {
|
|
||||||
block = block[:end]
|
|
||||||
}
|
|
||||||
|
|
||||||
// Each route runs from its path to the next route's path, however it is
|
|
||||||
// formatted. A detail route (nav: false) is addressed by URL but is not a
|
|
||||||
// navigation entry, so the registry does not carry it.
|
|
||||||
var paths []string
|
|
||||||
block = lineCommentRe.ReplaceAllString(block, "")
|
|
||||||
matches := routePathRe.FindAllStringSubmatchIndex(block, -1)
|
|
||||||
for i, m := range matches {
|
|
||||||
end := len(block)
|
|
||||||
if i+1 < len(matches) {
|
|
||||||
end = matches[i+1][0]
|
|
||||||
}
|
|
||||||
if navFalseRe.MatchString(block[m[1]:end]) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
paths = append(paths, block[m[2]:m[3]])
|
|
||||||
}
|
|
||||||
if len(paths) == 0 {
|
|
||||||
t.Fatalf("%s: parsed no routes", path)
|
|
||||||
}
|
|
||||||
return paths
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestDashboardPagesRegistryCoversEveryRoute(t *testing.T) {
|
|
||||||
pages := DashboardPages()
|
|
||||||
if len(pages) == 0 {
|
|
||||||
t.Fatal("DashboardPages() returned no pages")
|
|
||||||
}
|
|
||||||
seen := map[string]bool{}
|
|
||||||
for _, p := range pages {
|
|
||||||
if p.Path == "" || p.Label == "" || p.Description == "" {
|
|
||||||
t.Fatalf("page %#v is missing path/label/description", p)
|
|
||||||
}
|
|
||||||
if seen[p.Path] {
|
|
||||||
t.Fatalf("duplicate page path %q", p.Path)
|
|
||||||
}
|
|
||||||
seen[p.Path] = true
|
|
||||||
}
|
|
||||||
|
|
||||||
routes := dashboardRoutesFromSource(t)
|
|
||||||
inDashboard := map[string]bool{}
|
|
||||||
for _, route := range routes {
|
|
||||||
inDashboard[route] = true
|
|
||||||
if !seen[route] {
|
|
||||||
t.Errorf("route %q is a dashboard page the registry does not list, so the agent cannot point at it", route)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, p := range pages {
|
|
||||||
if !inDashboard[p.Path] {
|
|
||||||
t.Errorf("registry lists %q (%s), which is not a dashboard route: the agent would send the operator somewhere that does not exist", p.Path, p.Label)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestPageIndexToolReturnsEveryPage(t *testing.T) {
|
func TestPageIndexToolReturnsEveryPage(t *testing.T) {
|
||||||
entry, ok := pageIndexTool()
|
entry, ok := pageIndexTool()
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
@@ -110,7 +110,9 @@ esac
|
|||||||
if got, want := componentAvailable(snapshot, ComponentDaemon), "1.23.0"; got != want {
|
if got, want := componentAvailable(snapshot, ComponentDaemon), "1.23.0"; got != want {
|
||||||
t.Errorf("daemon available = %q, want %q", got, want)
|
t.Errorf("daemon available = %q, want %q", got, want)
|
||||||
}
|
}
|
||||||
if got, want := componentAvailable(snapshot, ComponentAgent), "1.21.0"; got != want {
|
// One version covers every component; a stale archie/v* runtime tag must
|
||||||
|
// never be offered as an update.
|
||||||
|
if got, want := componentAvailable(snapshot, ComponentAgent), "1.23.0"; got != want {
|
||||||
t.Errorf("agent available = %q, want %q", got, want)
|
t.Errorf("agent available = %q, want %q", got, want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -154,7 +156,7 @@ esac
|
|||||||
if got, want := componentAvailable(snapshot, ComponentDaemon), "1.24.0"; got != want {
|
if got, want := componentAvailable(snapshot, ComponentDaemon), "1.24.0"; got != want {
|
||||||
t.Errorf("daemon available = %q, want %q", got, want)
|
t.Errorf("daemon available = %q, want %q", got, want)
|
||||||
}
|
}
|
||||||
if got, want := componentAvailable(snapshot, ComponentAgent), "1.23.0"; got != want {
|
if got, want := componentAvailable(snapshot, ComponentAgent), "1.24.0"; got != want {
|
||||||
t.Errorf("agent available = %q, want %q", got, want)
|
t.Errorf("agent available = %q, want %q", got, want)
|
||||||
}
|
}
|
||||||
if ref := componentReference(snapshot, ComponentDaemon); !strings.Contains(ref, "forge-api-tags") {
|
if ref := componentReference(snapshot, ComponentDaemon); !strings.Contains(ref, "forge-api-tags") {
|
||||||
|
|||||||
@@ -81,32 +81,33 @@ func TestUpdateInstallBothComponentsBuildsDaemonAndManagedWorkerImage(t *testing
|
|||||||
// releases are the norm. Each changed component must be built from its own
|
// releases are the norm. Each changed component must be built from its own
|
||||||
// approved tag; forcing both tags onto one commit refuses every update once
|
// approved tag; forcing both tags onto one commit refuses every update once
|
||||||
// the two components' newest releases diverge.
|
// the two components' newest releases diverge.
|
||||||
func TestUpdateInstallBuildsEachComponentFromItsOwnTag(t *testing.T) {
|
// One version covers every component, so the managed worker image is built
|
||||||
|
// from the release's own archied/v* tag -- never from a stale archie/v* tag.
|
||||||
|
func TestUpdateInstallBuildsTheAgentImageFromTheReleaseTag(t *testing.T) {
|
||||||
result, calls := runUpdateInstallScript(t, map[string]string{
|
result, calls := runUpdateInstallScript(t, map[string]string{
|
||||||
"ARCHIE_UPDATE_DAEMON_PREVIOUS": "1.12.0",
|
"ARCHIE_UPDATE_DAEMON_PREVIOUS": "1.12.0",
|
||||||
"ARCHIE_UPDATE_DAEMON_VERSION": "1.13.0",
|
"ARCHIE_UPDATE_DAEMON_VERSION": "1.13.0",
|
||||||
"ARCHIE_UPDATE_AGENT_PREVIOUS": "1.9.9",
|
"ARCHIE_UPDATE_AGENT_PREVIOUS": "1.12.0",
|
||||||
"ARCHIE_UPDATE_AGENT_VERSION": "1.10.0",
|
"ARCHIE_UPDATE_AGENT_VERSION": "1.13.0",
|
||||||
})
|
})
|
||||||
|
|
||||||
if result.Installed[ComponentDaemon] != "1.13.0" || result.Installed[ComponentAgent] != "1.10.0" {
|
if result.Installed[ComponentDaemon] != "1.13.0" || result.Installed[ComponentAgent] != "1.13.0" {
|
||||||
t.Fatalf("installed = %#v, want both release versions", result.Installed)
|
t.Fatalf("installed = %#v, want the release version for both", result.Installed)
|
||||||
}
|
}
|
||||||
// The derived fake commits differ per tag, so these assertions fail if
|
assertCallAbsent(t, calls, "archie-v1.13.0")
|
||||||
// either component is built from the other's release.
|
|
||||||
daemonCheckout := indexOfCallContaining(t, calls, "checkout --quiet --detach archied-v1.13.0")
|
|
||||||
agentCheckout := indexOfCallContaining(t, calls, "checkout --quiet --detach archie-v1.10.0")
|
|
||||||
daemonBuild := indexOfCallContaining(t, calls, "go build", "./cmd/archied")
|
daemonBuild := indexOfCallContaining(t, calls, "go build", "./cmd/archied")
|
||||||
agentImageBuild := indexOfCallContaining(t, calls, "docker build")
|
agentImageBuild := indexOfCallContaining(t, calls, "docker build")
|
||||||
if daemonCheckout < 0 || agentCheckout < 0 || daemonBuild < 0 || agentImageBuild < 0 {
|
lastCheckout := -1
|
||||||
t.Fatalf("missing expected step: daemon checkout %d, daemon build %d, agent checkout %d, agent image build %d",
|
for i, call := range calls {
|
||||||
daemonCheckout, daemonBuild, agentCheckout, agentImageBuild)
|
if strings.Contains(call, "checkout --quiet --detach") && i < agentImageBuild {
|
||||||
|
lastCheckout = i
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if daemonCheckout > daemonBuild {
|
if daemonBuild < 0 || agentImageBuild < 0 || lastCheckout < 0 {
|
||||||
t.Errorf("daemon binaries must be built from the daemon tag's commit; calls = %#v", calls)
|
t.Fatalf("missing expected step: daemon build %d, agent image build %d, checkout %d", daemonBuild, agentImageBuild, lastCheckout)
|
||||||
}
|
}
|
||||||
if agentCheckout > agentImageBuild {
|
if !strings.Contains(calls[lastCheckout], "archied-v1.13.0") {
|
||||||
t.Errorf("the managed worker image must be built from the agent tag's commit; calls = %#v", calls)
|
t.Errorf("image built after checking out %q, want the archied/v1.13.0 release; calls = %#v", calls[lastCheckout], calls)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,14 @@
|
|||||||
package webui
|
package webui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"os"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
|
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
|
||||||
)
|
)
|
||||||
|
|
||||||
// updateTaskMetaFixture rewrites the committed payload fixture from the served
|
|
||||||
// handler. It is the same generated-artifact discipline the repo already uses
|
|
||||||
// for docs/data/generated/contracts.json (task docs:generate): the fixture is
|
|
||||||
// committed, the gate checks rather than regenerates, and the -update run is
|
|
||||||
// what blesses a deliberate vocabulary change.
|
|
||||||
var updateTaskMetaFixture = flag.Bool("update", false, "rewrite testdata/task_meta.json from the served /api/task-meta payload")
|
|
||||||
|
|
||||||
// The dashboard derives everything it can present from /api/task-meta. If the
|
// The dashboard derives everything it can present from /api/task-meta. If the
|
||||||
// catalog is empty or malformed the frontend falls back to its own defaults and
|
// catalog is empty or malformed the frontend falls back to its own defaults and
|
||||||
// the whole point of the endpoint -- one server-held vocabulary -- is lost.
|
// the whole point of the endpoint -- one server-held vocabulary -- is lost.
|
||||||
@@ -116,55 +106,3 @@ func TestTaskMetaChangeStatusesAreDeliberate(t *testing.T) {
|
|||||||
labels[cs.Label] = cs.ID
|
labels[cs.Label] = cs.ID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestTaskMetaPayloadMatchesFixture pins the served payload byte-for-byte
|
|
||||||
// against the committed fixture, and the fixture against the dashboard's
|
|
||||||
// freeze-dried snapshot (ui/src/base/task-meta.jsx) via
|
|
||||||
// ui/test/task-meta-catalogue.test.js. Between the two, a one-sided rename of a
|
|
||||||
// status label, an action, a change status or the config schema fails a test on
|
|
||||||
// whichever side was not updated -- the property neither per-side literal test
|
|
||||||
// could provide.
|
|
||||||
//
|
|
||||||
// Regenerate with:
|
|
||||||
//
|
|
||||||
// go test ./internal/webui -run TestTaskMetaPayloadMatchesFixture -update
|
|
||||||
func TestTaskMetaPayloadMatchesFixture(t *testing.T) {
|
|
||||||
srv := newTestServer(t)
|
|
||||||
req := httptest.NewRequestWithContext(t.Context(), http.MethodGet, "/api/task-meta", nil)
|
|
||||||
w := httptest.NewRecorder()
|
|
||||||
srv.Handler().ServeHTTP(w, req)
|
|
||||||
if w.Code != http.StatusOK {
|
|
||||||
t.Fatalf("status = %d, body %s", w.Code, w.Body)
|
|
||||||
}
|
|
||||||
served := w.Body.Bytes()
|
|
||||||
|
|
||||||
const fixture = "testdata/task_meta.json"
|
|
||||||
if *updateTaskMetaFixture {
|
|
||||||
if err := os.MkdirAll("testdata", 0o755); err != nil {
|
|
||||||
t.Fatalf("mkdir testdata: %v", err)
|
|
||||||
}
|
|
||||||
if err := os.WriteFile(fixture, served, 0o644); err != nil {
|
|
||||||
t.Fatalf("write fixture: %v", err)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
committed, err := os.ReadFile(fixture)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("read %s: %v\nrun: go test ./internal/webui -run TestTaskMetaPayloadMatchesFixture -update", fixture, err)
|
|
||||||
}
|
|
||||||
var servedCompact, committedCompact bytes.Buffer
|
|
||||||
if err := json.Compact(&servedCompact, served); err != nil {
|
|
||||||
t.Fatalf("compact served payload: %v", err)
|
|
||||||
}
|
|
||||||
if err := json.Compact(&committedCompact, committed); err != nil {
|
|
||||||
t.Fatalf("compact %s: %v", fixture, err)
|
|
||||||
}
|
|
||||||
// Whitespace is formatting, not contract: compare the documents.
|
|
||||||
if !bytes.Equal(servedCompact.Bytes(), committedCompact.Bytes()) {
|
|
||||||
t.Errorf("GET /api/task-meta no longer matches %s.\n"+
|
|
||||||
"The fixture pins the dashboard's freeze-dried snapshot (ui/src/base/task-meta.jsx);\n"+
|
|
||||||
"ui/test/task-meta-catalogue.test.js fails until both sides agree.\n"+
|
|
||||||
"regenerate with: go test ./internal/webui -run TestTaskMetaPayloadMatchesFixture -update", fixture)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-78
@@ -1,78 +0,0 @@
|
|||||||
{
|
|
||||||
"statuses": [
|
|
||||||
{ "id": "queued", "label": "Queued", "kind": "idle", "needs_you": false },
|
|
||||||
{ "id": "running", "label": "Working", "kind": "info", "needs_you": false },
|
|
||||||
{
|
|
||||||
"id": "waiting_human",
|
|
||||||
"label": "Waiting for you",
|
|
||||||
"kind": "warn",
|
|
||||||
"needs_you": true
|
|
||||||
},
|
|
||||||
{ "id": "pr_open", "label": "In review", "kind": "ok", "needs_you": false },
|
|
||||||
{ "id": "merged", "label": "Merged", "kind": "ok", "needs_you": false },
|
|
||||||
{ "id": "completed", "label": "Done", "kind": "ok", "needs_you": false },
|
|
||||||
{ "id": "parked", "label": "Parked", "kind": "warn", "needs_you": true },
|
|
||||||
{
|
|
||||||
"id": "dead",
|
|
||||||
"label": "Stopped (too many retries)",
|
|
||||||
"kind": "danger",
|
|
||||||
"needs_you": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "rejected",
|
|
||||||
"label": "Rejected",
|
|
||||||
"kind": "danger",
|
|
||||||
"needs_you": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "closed_wont_do",
|
|
||||||
"label": "Won't do",
|
|
||||||
"kind": "idle",
|
|
||||||
"needs_you": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"actions": [
|
|
||||||
{
|
|
||||||
"id": "cancel",
|
|
||||||
"label": "Cancel",
|
|
||||||
"kind": "quiet",
|
|
||||||
"confirm": "Cancel \"{title}\"? This closes the forge issue."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "stop",
|
|
||||||
"label": "Stop",
|
|
||||||
"kind": "primary",
|
|
||||||
"confirm": "Stop \"{title}\"? Recoverable work will remain parked."
|
|
||||||
},
|
|
||||||
{ "id": "approve", "label": "Approve", "kind": "primary", "confirm": "" },
|
|
||||||
{
|
|
||||||
"id": "reject",
|
|
||||||
"label": "Reject",
|
|
||||||
"kind": "quiet",
|
|
||||||
"confirm": "Reject \"{title}\"? This closes the forge issue."
|
|
||||||
},
|
|
||||||
{ "id": "retry", "label": "Retry", "kind": "primary", "confirm": "" },
|
|
||||||
{
|
|
||||||
"id": "abandon",
|
|
||||||
"label": "Abandon",
|
|
||||||
"kind": "quiet",
|
|
||||||
"confirm": "Abandon \"{title}\"? This closes the forge issue."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "archive",
|
|
||||||
"label": "Archive",
|
|
||||||
"kind": "quiet",
|
|
||||||
"confirm": "Archive the local record for \"{title}\"?"
|
|
||||||
},
|
|
||||||
{ "id": "open_pr", "label": "Open PR", "kind": "link", "confirm": "" },
|
|
||||||
{ "id": "open_issue", "label": "Open issue", "kind": "link", "confirm": "" }
|
|
||||||
],
|
|
||||||
"change_statuses": [
|
|
||||||
{ "id": "added", "label": "Added" },
|
|
||||||
{ "id": "modified", "label": "Modified" },
|
|
||||||
{ "id": "deleted", "label": "Deleted" },
|
|
||||||
{ "id": "renamed", "label": "Renamed" },
|
|
||||||
{ "id": "typechange", "label": "Type changed" }
|
|
||||||
],
|
|
||||||
"config_schema": "archie/task-config@1"
|
|
||||||
}
|
|
||||||
@@ -136,15 +136,16 @@ else
|
|||||||
agent_installed="$(base "$(installed_for archie-agent || true)")"
|
agent_installed="$(base "$(installed_for archie-agent || true)")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# One version covers every component (RELEASING.md): the runtime image a
|
||||||
|
# release publishes carries the release's own version, tagged archied/v*.
|
||||||
daemon_available="$(newest_tag_git archied || true)"
|
daemon_available="$(newest_tag_git archied || true)"
|
||||||
agent_available="$(newest_tag_git archie || true)"
|
|
||||||
tag_source="git-tags"
|
tag_source="git-tags"
|
||||||
if [ -z "$daemon_available" ] && [ -z "$agent_available" ]; then
|
if [ -z "$daemon_available" ]; then
|
||||||
daemon_available="$(newest_tag_api archied || true)"
|
daemon_available="$(newest_tag_api archied || true)"
|
||||||
agent_available="$(newest_tag_api archie || true)"
|
|
||||||
tag_source="forge-api-tags"
|
tag_source="forge-api-tags"
|
||||||
fi
|
fi
|
||||||
if [ -z "$daemon_available" ] && [ -z "$agent_available" ]; then
|
agent_available="$daemon_available"
|
||||||
|
if [ -z "$daemon_available" ]; then
|
||||||
# Neither source answered. Report the failure; do not exit 0 with two empty
|
# Neither source answered. Report the failure; do not exit 0 with two empty
|
||||||
# components, which the caller renders as "up to date".
|
# components, which the caller renders as "up to date".
|
||||||
echo "archie-update-check: could not resolve any release tag from ${SOURCE_URL} or ${API_BASE}/repos/${REPO_SLUG}/tags" >&2
|
echo "archie-update-check: could not resolve any release tag from ${SOURCE_URL} or ${API_BASE}/repos/${REPO_SLUG}/tags" >&2
|
||||||
@@ -154,7 +155,7 @@ fi
|
|||||||
daemon_artifacts=""
|
daemon_artifacts=""
|
||||||
[ -n "$daemon_available" ] && daemon_artifacts="$(artifact_state "archied/v${daemon_available}")"
|
[ -n "$daemon_available" ] && daemon_artifacts="$(artifact_state "archied/v${daemon_available}")"
|
||||||
agent_artifacts=""
|
agent_artifacts=""
|
||||||
[ -n "$agent_available" ] && agent_artifacts="$(artifact_state "archie/v${agent_available}")"
|
agent_artifacts="$daemon_artifacts"
|
||||||
|
|
||||||
reference_for() {
|
reference_for() {
|
||||||
local component="$1" version="$2" artifacts="$3"
|
local component="$1" version="$2" artifacts="$3"
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ if [[ ",$components," == *,daemon,* ]]; then
|
|||||||
gw_commit="$(git -C "$source_dir" rev-parse --verify "refs/tags/archied/v$GW^{commit}")"
|
gw_commit="$(git -C "$source_dir" rev-parse --verify "refs/tags/archied/v$GW^{commit}")"
|
||||||
fi
|
fi
|
||||||
if [[ ",$components," == *,agent,* ]]; then
|
if [[ ",$components," == *,agent,* ]]; then
|
||||||
rt_commit="$(git -C "$source_dir" rev-parse --verify "refs/tags/archie/v$RT^{commit}")"
|
rt_commit="$(git -C "$source_dir" rev-parse --verify "refs/tags/archied/v$RT^{commit}")"
|
||||||
fi
|
fi
|
||||||
build_commit="$gw_commit"
|
build_commit="$gw_commit"
|
||||||
[ -n "$build_commit" ] || build_commit="$rt_commit"
|
[ -n "$build_commit" ] || build_commit="$rt_commit"
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
// The freeze-dried /api/task-meta catalog the dashboard renders before the
|
// The freeze-dried /api/task-meta catalog the dashboard renders before the
|
||||||
// served one arrives, or when archied is unreachable. It has no imports so the
|
// served one arrives, or when archied is unreachable; task-meta.ts replaces it
|
||||||
// node test runner can compare it against the Go handler's committed fixture
|
// with the live catalog.
|
||||||
// (internal/webui/testdata/task_meta.json); task-meta.ts replaces it with the
|
|
||||||
// live catalog.
|
|
||||||
|
|
||||||
/** A lifecycle status as the server describes it. */
|
/** A lifecycle status as the server describes it. */
|
||||||
export interface StatusMeta {
|
export interface StatusMeta {
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ import TaskDetailPage from "@/tasks/TaskDetailPage.vue";
|
|||||||
import TasksPage from "@/tasks/TasksPage.vue";
|
import TasksPage from "@/tasks/TasksPage.vue";
|
||||||
import WorkflowsPage from "@/workflows/WorkflowsPage.vue";
|
import WorkflowsPage from "@/workflows/WorkflowsPage.vue";
|
||||||
|
|
||||||
// internal/gateway/dashboard_tools.go mirrors this table; its test parses this
|
// internal/gateway/dashboard_tools.go mirrors this table.
|
||||||
// file, so mark any entry the registry should skip with `nav: false`.
|
|
||||||
//
|
//
|
||||||
// meta:
|
// meta:
|
||||||
// label the navigation label, short because its group carries the context
|
// label the navigation label, short because its group carries the context
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
import assert from "node:assert/strict";
|
|
||||||
import { readFile } from "node:fs/promises";
|
|
||||||
import test from "node:test";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Events surfaces are one page with three tabs, and the navigation entry is
|
|
||||||
* always live (Sam's call): the tabs behind it prune themselves per capability,
|
|
||||||
* so an operator on a composition that can only back some of them still reaches
|
|
||||||
* the ones it can. What must not come back is three sibling destinations.
|
|
||||||
*/
|
|
||||||
const router = await readFile(
|
|
||||||
new URL("../src/router/index.ts", import.meta.url),
|
|
||||||
"utf8",
|
|
||||||
);
|
|
||||||
const nav = await readFile(
|
|
||||||
new URL("../src/lib/nav.ts", import.meta.url),
|
|
||||||
"utf8",
|
|
||||||
);
|
|
||||||
const page = await readFile(
|
|
||||||
new URL("../src/events/EventsPage.vue", import.meta.url),
|
|
||||||
"utf8",
|
|
||||||
);
|
|
||||||
const registry = await readFile(
|
|
||||||
new URL("../../internal/gateway/dashboard_tools.go", import.meta.url),
|
|
||||||
"utf8",
|
|
||||||
);
|
|
||||||
|
|
||||||
test("the Events page is the tab host, and the old paths are gone", () => {
|
|
||||||
assert.match(page, /Tabs/, "the page composes tabs");
|
|
||||||
assert.match(
|
|
||||||
page,
|
|
||||||
/CapturesPage/,
|
|
||||||
"the Inspector tab is the captures surface",
|
|
||||||
);
|
|
||||||
assert.match(
|
|
||||||
page,
|
|
||||||
/BindingsPage/,
|
|
||||||
"the Bindings tab is the bindings surface",
|
|
||||||
);
|
|
||||||
assert.match(
|
|
||||||
page,
|
|
||||||
/MappingsPage/,
|
|
||||||
"the Mappings tab is the mappings surface",
|
|
||||||
);
|
|
||||||
|
|
||||||
for (const path of ["/captures", "/mappings", "/bindings"]) {
|
|
||||||
assert.ok(
|
|
||||||
!router.includes(`path: "${path}"`),
|
|
||||||
`${path} is routed again; the Events tabs replaced it`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
test("Events is one live navigation entry, not a group of three", () => {
|
|
||||||
const entry = nav.split("\n").find((l) => l.includes('"/events"'));
|
|
||||||
assert.ok(entry, "the navigation model does not reference /events");
|
|
||||||
assert.doesNotMatch(
|
|
||||||
nav,
|
|
||||||
/label:\s*"Events",\s*paths:/,
|
|
||||||
"Events is still a three-item group",
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("the page registry and the route table still agree", () => {
|
|
||||||
assert.match(
|
|
||||||
registry,
|
|
||||||
/Path: "\/events"/,
|
|
||||||
"the agent's page registry does not know /events",
|
|
||||||
);
|
|
||||||
for (const path of ["/captures", "/mappings", "/bindings"]) {
|
|
||||||
assert.doesNotMatch(
|
|
||||||
registry,
|
|
||||||
new RegExp(`Path: "${path}"`),
|
|
||||||
`${path} is still a registered page`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
import assert from "node:assert/strict";
|
|
||||||
import { readFile } from "node:fs/promises";
|
|
||||||
import test from "node:test";
|
|
||||||
|
|
||||||
const snapshot = await import("../src/lib/task-meta-snapshot.ts");
|
|
||||||
|
|
||||||
// internal/webui/testdata/task_meta.json is the served /api/task-meta payload,
|
|
||||||
// pinned byte-for-byte by TestTaskMetaPayloadMatchesFixture. Comparing the
|
|
||||||
// first-paint snapshot against it means a one-sided rename of any vocabulary
|
|
||||||
// fails on whichever side was not updated.
|
|
||||||
const fixture = JSON.parse(
|
|
||||||
await readFile(
|
|
||||||
new URL("../../internal/webui/testdata/task_meta.json", import.meta.url),
|
|
||||||
"utf8",
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
// The server emits an unset optional field (needs_you, confirm) as its zero
|
|
||||||
// value; the snapshot omits it.
|
|
||||||
const dropZero = (rows: Record<string, unknown>[]) =>
|
|
||||||
rows.map((row) =>
|
|
||||||
Object.fromEntries(
|
|
||||||
Object.entries(row).filter(([, v]) => v !== false && v !== ""),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
test("the status snapshot matches the served catalog", () => {
|
|
||||||
assert.deepEqual(snapshot.DEFAULT_STATUSES, dropZero(fixture.statuses));
|
|
||||||
});
|
|
||||||
|
|
||||||
test("the action snapshot matches the served catalog", () => {
|
|
||||||
assert.deepEqual(snapshot.DEFAULT_ACTIONS, dropZero(fixture.actions));
|
|
||||||
});
|
|
||||||
|
|
||||||
test("the change-status snapshot matches the served catalog", () => {
|
|
||||||
assert.deepEqual(snapshot.DEFAULT_CHANGE_STATUSES, fixture.change_statuses);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("the config schema snapshot matches the served catalog", () => {
|
|
||||||
assert.equal(snapshot.DEFAULT_CONFIG_SCHEMA, fixture.config_schema);
|
|
||||||
});
|
|
||||||
Reference in new issue
Block a user