diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl index 0391c2ffd..976a03707 100644 --- a/.beads/issues.jsonl +++ b/.beads/issues.jsonl @@ -53,6 +53,11 @@ {"_type":"issue","id":"archie-core-abg.18","title":"[EPIC] Memory: pluggable provider architecture with file-backed persistence","description":"Pluggable memory system to match Hermes parity:\\n\\n1. **MemoryProvider interface**: Abstract interface with methods for initialize(), get_tool_schemas(), prefetch(), sync_turn(), and optional lifecycle hooks (on_session_end, on_session_switch, on_pre_compress, on_memory_write).\\n\\n2. **Built-in file-backed memory**: MEMORY.md and USER.md stored per-session/profile. LLM-callable memory tool with add/replace/remove actions. Frozen snapshot at session start (preserves prefix cache), immediate disk write on updates. Section-sign delimited entries with substring matching.\\n\\n3. **MemoryManager**: Orchestrates built-in + at most one external provider. Background serialized write executor. Prefetch with timeout (8s). Streaming context scrubber that strips injected memory spans from model output.\\n\\nRef: docs/prds/hermes-gap-analysis.md section 4","acceptance_criteria":"An external memory provider (e.g. Honcho, Mem0) can be plugged in via config. The built-in memory tool persists across sessions. Conversation context is recalled on session resume.","status":"open","priority":0,"issue_type":"epic","owner":"sam@catlow.tech","created_at":"2026-07-25T14:02:22Z","created_by":"Sam Catlow","updated_at":"2026-07-25T14:02:22Z","dependencies":[{"issue_id":"archie-core-abg.18","depends_on_id":"archie-core-abg","type":"parent-child","created_at":"2026-07-26T00:02:22Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-abg.16","title":"[EPIC] Gateway: rich message model, adapter lifecycle, session management","description":"Foundational gateway infrastructure to match Hermes parity. Three interdependent pieces:\\n\\n1. **Message model**: Replace the 3-field Message struct with a rich MessageEvent (MessageType enum: text/photo/video/audio/voice/document/sticker/command, media_urls, reply_to context, metadata dict, source). This is the wire type every adapter produces.\\n\\n2. **Adapter lifecycle**: Replace the 3-method Gateway interface with a BasePlatformAdapter interface: connect()/disconnect()/send() as required methods, plus optional overrides for typing indicators, edit/delete, image/voice/video/document send, interactive UX (clarify buttons, approval dialogs). Capability flags (supports_code_blocks, splits_long_messages, supports_async_delivery).\\n\\n3. **Session management**: SessionSource struct (platform, chat_id, chat_type, user_id, thread_id, guild_id, profile), AsyncSessionStore for persistent session storage, SessionContext for system prompt injection.\\n\\nAll three blocks together enable adding new platforms as plugins without touching core gateway code.\\n\\nRef: docs/prds/hermes-gap-analysis.md sections 1-2","acceptance_criteria":"New adapters can be added by implementing a Go interface with connect/disconnect/send + optional media methods. Messages carry full metadata through the pipeline. Sessions persist across gateway restarts.","status":"open","priority":0,"issue_type":"epic","owner":"sam@catlow.tech","created_at":"2026-07-25T14:02:21Z","created_by":"Sam Catlow","updated_at":"2026-07-25T14:02:21Z","dependencies":[{"issue_id":"archie-core-abg.16","depends_on_id":"archie-core-abg","type":"parent-child","created_at":"2026-07-26T00:02:21Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-jfg","title":"Spawned archie-agent containers not on daemon's docker network — can't reach NATS","description":"Root cause of 'agent still failing on the server': archied's container.Pool.Acquire creates archie-agent containers via the Docker SDK with no NetworkMode set, so Docker attaches them to the default bridge network. archied and nats run on the compose-created 'archie-core_default' network instead, so the spawned container's hostname resolution for 'nats' (from NATS_URL=nats://nats:4222) fails and archie-agent can't connect. Confirmed on carina host logs: archied logs show repeating 'taskrun request failed err=\"nats: no responders available for request\"' for every task, containers created and destroyed within ~1.5s (consistent with archie-agent's NATS client failing fast). Fixed by detecting the daemon's own container's network in NewPool (selfNetwork, via ContainerInspect on os.Hostname()) and setting HostConfig.NetworkMode on spawned containers to match.","status":"closed","priority":0,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-07-24T03:10:26Z","created_by":"Sam Catlow","updated_at":"2026-07-25T13:04:34Z","closed_at":"2026-07-25T13:04:34Z","close_reason":"Fix already implemented and verified: selfNetwork() in internal/container/pool.go detects the daemon's own container network via ContainerInspect(os.Hostname()) and Acquire() sets HostConfig.NetworkMode to match, so spawned archie-agent containers join the same compose network as nats. Build and internal/container tests pass.","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-qa4.4","title":"Phase 4: structural refactor (~28 issues)","description":"funlen, gocognit, cyclop, nestif, maintidx, interfacebloat. This IS the internal/config restructure already discussed (finalize at cognitive complexity 106, feature_config loadDirInto at 74) plus daemon process/checkWaiting. MUST BE LAST: refactoring moves line numbers and invalidates every other phase in flight. Fold into the config file-per-responsibility split rather than doing the same work twice.","status":"open","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-27T15:23:01Z","created_by":"Sam Catlow","updated_at":"2026-07-27T15:23:01Z","dependencies":[{"issue_id":"archie-core-qa4.4","depends_on_id":"archie-core-qa4","type":"parent-child","created_at":"2026-07-28T01:23:00Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-qa4.3","title":"Phase 3: correctness findings needing judgement (~62 issues)","description":"nilerr (11: 6 in internal/agentexec inprocess.go/worker.go, 2 gateway), bodyclose (1), contextcheck (7), containedctx (2), fatcontext. SINGLE SESSION, sequential, no subagents: each nilerr site needs a read of whether the swallow is deliberate degradation or a real bug, and a context-free worker will silently convert deliberate behaviour into a change. Do nilerr FIRST -- highest bug probability in the whole set. BLOCKED on a policy decision for noctx (41 sites, mostly webui/worktree/store): fixing it means threading context through public APIs, which is an API change, not a lint fix.","status":"open","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-27T15:23:00Z","created_by":"Sam Catlow","updated_at":"2026-07-27T15:23:00Z","dependencies":[{"issue_id":"archie-core-qa4.3","depends_on_id":"archie-core-qa4","type":"parent-child","created_at":"2026-07-28T01:23:00Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-qa4.1","title":"Phase 1: autofix pass (~35 issues)","description":"golangci-lint run --fix plus the formatters. Covers errorlint, fatcontext, gocritic, sloglint, usestdlibvars, usetesting, gci, gofumpt, goimports. Zero judgement. MUST run first: it touches formatting across every file and would conflict with anything in flight. Single command, single commit, verify with task check.","status":"open","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-27T15:22:59Z","created_by":"Sam Catlow","updated_at":"2026-07-27T15:22:59Z","dependencies":[{"issue_id":"archie-core-qa4.1","depends_on_id":"archie-core-qa4","type":"parent-child","created_at":"2026-07-28T01:22:58Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-qa4.2","title":"Phase 2: mechanical per-package fixes (~40 issues)","description":"forcetypeassert (24, internal/tools 20 + internal/memory 2, nearly all tests), predeclared (9, webui/ratelimit/memory), leftover unconvert. Purely mechanical, package-local, no design judgement. THE ONLY PHASE WORTH PARALLELISING. Partition by package: tools / webui / memory+ratelimit / secret. Use git worktree isolation -- other sessions edit this repo concurrently and stale diagnostics are a known hazard. Each worker verifies scoped: go test ./internal/X/... plus golangci-lint run ./internal/X/...","status":"open","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-27T15:22:59Z","created_by":"Sam Catlow","updated_at":"2026-07-27T15:22:59Z","dependencies":[{"issue_id":"archie-core-qa4.2","depends_on_id":"archie-core-qa4","type":"parent-child","created_at":"2026-07-28T01:22:59Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-qa4","title":"[EPIC] Clear the 160 golangci-lint findings","description":"Config landed in 9298afd; the gate is RED until this epic closes. Four phases, ordered by risk and by what invalidates what. Structural refactor MUST be last: it moves line numbers and invalidates everything in flight.","status":"open","priority":1,"issue_type":"epic","owner":"sam@catlow.tech","created_at":"2026-07-27T15:22:58Z","created_by":"Sam Catlow","updated_at":"2026-07-27T15:22:58Z","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-4we","title":"Port tau internal/indexing (codesearch) into archie-core","description":"First slice of the tau cherry-pick strategy. Copy-and-mutate (NOT extract to pkg/ - Sam's decision: exporting would force designing metrics/session/logger seams upfront before archie-core knows which it wants differently).\n\ntau/internal/indexing is the cheapest high-value lift: 512 LoC, one file, and its only tau coupling is 3 calls to config.WorkspaceIndexDir()/WorkspaceIndexDBPath(). Nothing else in tau imports it.\n\nMutations: replace the global config path helpers with explicit constructor params (archie-core passes config, no globals); add the workspace-codesearch helper subcommand to archied since the manager deliberately runs google/codesearch in a child process (upstream fatal exits + mmap leaks must not kill the daemon).\n\nEach lifted file carries a provenance header (source path + tau commit) so a future refresh is a diff, not archaeology.","status":"closed","priority":1,"issue_type":"feature","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-27T13:41:58Z","created_by":"Sam Catlow","updated_at":"2026-07-27T13:47:42Z","started_at":"2026-07-27T13:42:57Z","closed_at":"2026-07-27T13:47:42Z","close_reason":"Ported tau internal/indexing/codesearch.go @ 4893818d0c76 into archie-core internal/indexing. Mutations: global config path helpers replaced by explicit indexing.Config + DefaultConfig(workDir) (two archied instances share carina and must not share an index); child-process helper is archied's own 'workspace-codesearch' subcommand in cmd/archied/codesearch.go, dispatched from main() before flag parsing so it touches no config/store/NATS; deferred db.Close explicitly discarded for errcheck. Added dep github.com/google/codesearch v1.3.0-rc.1 (uuid and modernc sqlite already present). Verified E2E against the real repo: 2.2MB indexed in 0.05s, correct hits, [] for no match, corrupt index -\u003e clean error exit 1 rather than process death. task check clean; golangci-lint 0 issues on both packages. Commit c924281. NOT pushed. Follow-up: nothing calls indexing.NewManager yet -- it is ported and proven but not wired into the agent's grep path.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-sc5","title":"Chat: real system prompt template for Archie (identity, tools, env)","description":"The chat agent's system prompt is the four-sentence static string in gateway.DefaultPersonas(). It carries no tool inventory, no environment/date block, and no instruction precedence, so the model invents its own capabilities -- it told Sam it 'only has the memory editing tool' and then offered to walk him through installing software it cannot install.\n\nTake the shape from tau: /work/apps/tau/internal/agent/templates/agent.md.tpl renders an agent body plus \u003ctools\u003e, \u003cguidelines\u003e, \u003cproject_context\u003e and \u003cenv\u003e blocks, and /work/apps/tau/internal/agent/spec/templates/tau.agent.md supplies identity, instruction precedence, core rules, communication rules and confirmation boundaries.\n\nKeep the existing PersonaRegistry as the style layer; the template is the substrate it renders into.","status":"closed","priority":1,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-07-27T12:14:08Z","created_by":"Sam Catlow","updated_at":"2026-07-27T12:20:52Z","closed_at":"2026-07-27T12:20:52Z","close_reason":"Implemented gateway.BuildSystemPrompt rendering internal/gateway/templates/archie.md.tpl: instruction precedence, core rules, communication rules, \u003ctools\u003e and \u003cenv\u003e blocks, with PersonaRegistry kept as the style layer on top. Tool inventory is derived from the same core.ToolSet passed to the model (cmd/archied/toolSummaries) so prompt and reality cannot drift; empty toolset renders an explicit 'no tools are available'. Tool metadata is markup-escaped and whitespace-flattened against forged tags and forged list entries. task check clean: vet, full go test ./... , golangci-lint 0 issues on changed packages, gofumpt clean. Commit 7fde716. NOT yet deployed - not pushed.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-qnm","title":"Telegram: remove task approval from the public command surface","description":"Existing /approve [identity=name] \u003ctask-id\u003e was inherited as chat-task lifecycle control, but Sam explicitly states task approvals are not a product requirement. Reserve /approve exclusively for dangerous-command approval. Remove task approval from Telegram command menu/help/router/public UX; retain or remove internal waiting_human task mechanics only after verifying workflow callers. Do not repurpose the command until the dangerous-command approval model (archie-core-alm.6) exists.","acceptance_criteria":"Telegram no longer advertises or accepts task approval via /approve; no documentation/help describes task approvals; task lifecycle code is not broken for existing non-Telegram workflow paths; /approve remains unclaimed or is implemented only for the approved dangerous-command design.","status":"open","priority":1,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-07-27T09:00:56Z","created_by":"Sam Catlow","updated_at":"2026-07-27T09:00:56Z","dependency_count":0,"dependent_count":0,"comment_count":0} @@ -138,6 +143,7 @@ {"_type":"issue","id":"archie-core-s1r","title":"Test forge fakes missing LinkBranch method broke go vet/test for whole module","description":"forge.Forge gained LinkBranch(ctx, owner, repo, issueNumber, branch) error in the branch-linking feature (ff4c51e) but the hand-rolled test doubles (stubForge in cmd/archied/main_test.go, prCapturingForge in cmd/archie-agent/taskrun_test.go, testForge in internal/daemon/daemon_test.go, fakeForge in internal/forgerpc/forgerpc_test.go) never got the method added, so they stopped satisfying forge.Forge. This broke go vet ./... and go test ./... for the entire module, not just those 4 packages, since go vet type-checks all test files as part of module vet. Fixed by adding LinkBranch stubs to all four fakes.","status":"closed","priority":1,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-07-24T03:04:53Z","created_by":"Sam Catlow","updated_at":"2026-07-24T03:04:58Z","closed_at":"2026-07-24T03:04:58Z","close_reason":"Added LinkBranch stub methods to stubForge, prCapturingForge, testForge, and fakeForge. go build/vet/test ./... now clean across the whole module.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-633","title":"config.docker.toml missing required fields, no overlay merge implemented","description":"config.docker.toml was rewritten to be a docs-as-overlay file (comment says base+overlay merge) but internal/config.Load has no merge logic and docker-compose.yml mounts only config.docker.toml at /etc/archie/config.toml. It is missing bot_user, [forge], [dispatch], [models], [providers], [budgets] which Load requires -\u003e daemon fails to start in docker as currently configured. Implement real base+overlay config loading (or restore a full standalone docker config) so there is one source of truth.","status":"closed","priority":1,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-24T02:42:07Z","created_by":"Sam Catlow","updated_at":"2026-07-24T02:44:53Z","started_at":"2026-07-24T02:42:11Z","closed_at":"2026-07-24T02:44:53Z","close_reason":"Implemented config.LoadOverlay (base decode + overlay decode into same struct, then shared finalize/validate), wired -config-overlay flag in cmd/archied, fixed docker-compose.yml to mount both base config.toml and config.docker.toml overlay, minimized config.docker.toml to true diff-only overlay, added tests proving overlay-omitted required fields (bot_user, repos) still come from base.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-u64","title":"Daemon: process multiple tasks concurrently (max_concurrency enforcement)","description":"Daemon currently processes one task at a time (docs/prds/archie-core-v2-architecture.md Phase 2). This is the core blocker between current state and any multi-agent scaling mode — needed before container max_concurrency or same-repo concurrency can matter. Wire the daemon's dispatch loop to run N tasks in parallel, respecting a configurable max_concurrency.","design":"internal/container/pool.go already enforces max_concurrency for container lifecycle — reuse that limit/pattern in the daemon's task dispatch rather than inventing a second concurrency control.","acceptance_criteria":"Daemon dispatch loop runs multiple tasks concurrently up to a configured max_concurrency limit; single-task-at-a-time behavior is gone.","status":"closed","priority":1,"issue_type":"feature","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-23T19:36:31Z","created_by":"Sam Catlow","updated_at":"2026-07-23T21:37:42Z","started_at":"2026-07-23T21:29:41Z","closed_at":"2026-07-23T21:37:42Z","close_reason":"Implemented concurrent SQLite and NATS task dispatch using containers.max_concurrency, with default same-repo serialization and race-tested dispatcher coverage.","dependency_count":0,"dependent_count":2,"comment_count":0} +{"_type":"issue","id":"archie-core-qfx","title":"Flaky: TestRunTaskExecutesBootstrapWorkflowEndToEnd races on NATS responders","description":"cmd/archie-agent. Intermittently fails with ParkReason 'stage prepare: archie.worktree.prepare: nats: no responders available for request'; passes on re-run (-count=3 clean). The test does not wait for the worktreerpc subscription to be established before dispatching. A flaky test in task check is poison: it trains everyone to re-run instead of read, which is how a real regression gets waved through.","status":"open","priority":2,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-07-27T15:27:55Z","created_by":"Sam Catlow","updated_at":"2026-07-27T15:27:55Z","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-5dn","title":"Document Hermes capabilities missing from Archie","description":"Investigate Hermes' available features and commands, compare them with Archie, and publish a simple Markdown TODO checklist excluding Kanban.","status":"closed","priority":2,"issue_type":"task","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-27T12:09:56Z","created_by":"Sam Catlow","updated_at":"2026-07-27T12:11:14Z","started_at":"2026-07-27T12:10:00Z","closed_at":"2026-07-27T12:11:14Z","close_reason":"Investigated local Hermes CLI and current Archie implementation; added the requested parity TODO checklist.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-alm.3","title":"Telegram: multi-home-channel command","description":"When multiple home channels are introduced, design /sethome with /set_home alias to set a chat as a home channel. Define identity ownership, overwrite/confirmation rules, group authorization, persistence, and relationship to sessions before implementation.","acceptance_criteria":"Blocked on the multiple-home-channel model; once unblocked, both aliases have identical safe behaviour, persist correctly, and are covered by authorization and migration tests.","status":"open","priority":2,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-07-27T08:56:50Z","created_by":"Sam Catlow","updated_at":"2026-07-27T08:56:50Z","dependencies":[{"issue_id":"archie-core-alm.3","depends_on_id":"archie-core-alm","type":"parent-child","created_at":"2026-07-27T18:56:49Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-rqp.1","title":"Telegram: report installed gateway and runtime versions","description":"Add an authorized /version command as the installed-version prerequisite for component-aware /update. Telegram remains presentation-only; the composition root supplies installed component versions.","status":"closed","priority":2,"issue_type":"task","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-27T02:50:47Z","created_by":"Sam Catlow","updated_at":"2026-07-27T02:53:56Z","started_at":"2026-07-27T02:50:48Z","closed_at":"2026-07-27T02:53:56Z","close_reason":"Shipped: authorized /version reports installed gateway and runtime build versions from the composition root; menu/help parity covered; task check and scoped lint clean; fresh review found no blocking issues.","dependencies":[{"issue_id":"archie-core-rqp.1","depends_on_id":"archie-core-rqp","type":"parent-child","created_at":"2026-07-27T12:50:46Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} diff --git a/Dockerfile b/Dockerfile index f14723d5b..fef5638c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ # Run: docker run -e NATS_URL=nats://host:4222 archie-agent:latest # ── builder ─────────────────────────────────────────────────────────── -FROM golang:1.26-bookworm AS builder +FROM golang:1.26-trixie AS builder WORKDIR /src COPY go.mod go.sum ./ RUN go mod download diff --git a/cmd/archied/main.go b/cmd/archied/main.go index dac87a7c2..48478165d 100644 --- a/cmd/archied/main.go +++ b/cmd/archied/main.go @@ -19,12 +19,11 @@ import ( "syscall" "time" + "github.com/moby/moby/client" natsio "github.com/nats-io/nats.go" - "github.com/samcharles93/ai-sdk/chat" "github.com/samcharles93/ai-sdk/core" - "github.com/moby/moby/client" "github.com/samcharles93/archie-core/internal/agentexec" "github.com/samcharles93/archie-core/internal/channels/email" "github.com/samcharles93/archie-core/internal/channels/telegram" @@ -40,12 +39,6 @@ import ( "github.com/samcharles93/archie-core/internal/memory/builtin" "github.com/samcharles93/archie-core/internal/nats" "github.com/samcharles93/archie-core/internal/nell" - "github.com/samcharles93/archie-core/internal/tools" - "github.com/samcharles93/archie-core/internal/tools/mcp" - toolprovider "github.com/samcharles93/archie-core/internal/tools/provider" - mcptoolprovider "github.com/samcharles93/archie-core/internal/tools/provider/mcp" - memorytoolprovider "github.com/samcharles93/archie-core/internal/tools/provider/memory" - "github.com/samcharles93/archie-core/internal/plugin" "github.com/samcharles93/archie-core/internal/plugin/pluginextract" "github.com/samcharles93/archie-core/internal/releaseannounce" @@ -55,6 +48,11 @@ import ( "github.com/samcharles93/archie-core/internal/storage" "github.com/samcharles93/archie-core/internal/store" "github.com/samcharles93/archie-core/internal/storerpc" + "github.com/samcharles93/archie-core/internal/tools" + "github.com/samcharles93/archie-core/internal/tools/mcp" + toolprovider "github.com/samcharles93/archie-core/internal/tools/provider" + mcptoolprovider "github.com/samcharles93/archie-core/internal/tools/provider/mcp" + memorytoolprovider "github.com/samcharles93/archie-core/internal/tools/provider/memory" "github.com/samcharles93/archie-core/internal/webui" "github.com/samcharles93/archie-core/internal/workflow/skillbuild" "github.com/samcharles93/archie-core/internal/workflow/wfeval" diff --git a/cmd/archied/main_test.go b/cmd/archied/main_test.go index 96007a3d6..d749332e2 100644 --- a/cmd/archied/main_test.go +++ b/cmd/archied/main_test.go @@ -14,7 +14,6 @@ import ( "github.com/nats-io/nats-server/v2/server" natssrv "github.com/nats-io/nats-server/v2/test" natsio "github.com/nats-io/nats.go" - "github.com/samcharles93/ai-sdk/chat" "github.com/samcharles93/archie-core/internal/config" diff --git a/go.mod b/go.mod index e07f05bcb..8436df1f3 100644 --- a/go.mod +++ b/go.mod @@ -30,6 +30,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/hashicorp/go-version v1.9.0 // indirect + github.com/ilyakaznacheev/cleanenv v1.5.0 // indirect + github.com/joho/godotenv v1.5.1 // indirect github.com/klauspost/compress v1.18.6 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/minio/highwayhash v1.0.4 // indirect @@ -53,6 +55,7 @@ require ( modernc.org/libc v1.74.1 // indirect modernc.org/mathutil v1.7.1 // indirect modernc.org/memory v1.11.0 // indirect + olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 // indirect ) require ( diff --git a/go.sum b/go.sum index d2e788d28..73a06e2bd 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,7 @@ code.gitea.io/sdk/gitea v0.25.1 h1:yywxWwoV+SdjHtbC6unBiXojWdZOtoHuGhEazEXeWuE= code.gitea.io/sdk/gitea v0.25.1/go.mod h1:uDFWYBU8dgZsgOHwe6C/6olxvf8FHguNB3wW1i83fgg= github.com/42wim/httpsig v1.2.4 h1:mI5bH0nm4xn7K18fo1K3okNDRq8CCJ0KbBYWyA6r8lU= github.com/42wim/httpsig v1.2.4/go.mod h1:yKsYfSyTBEohkPik224QPFylmzEBtda/kjyIAJjh3ps= +github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk= github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= @@ -64,6 +65,10 @@ github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/mdns v1.0.7 h1:yWoQVMW5JOiDxQnIUcm3IDt0kCjf3TuXHDbdEKPsbAY= github.com/hashicorp/mdns v1.0.7/go.mod h1:yjuhYhZyPDqXXL48xC7cdpGwGUMwu7OViDmsuT5COvg= +github.com/ilyakaznacheev/cleanenv v1.5.0 h1:0VNZXggJE2OYdXE87bfSSwGxeiGt9moSR2lOrsHHvr4= +github.com/ilyakaznacheev/cleanenv v1.5.0/go.mod h1:a5aDzaJrLCQZsazHol1w8InnDcOX0OColm64SlIi6gk= +github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= +github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/klauspost/compress v1.18.6 h1:2jupLlAwFm95+YDR+NwD2MEfFO9d4z4Prjl1XXDjuao= github.com/klauspost/compress v1.18.6/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -215,5 +220,7 @@ modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0= modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= +olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 h1:slmdOY3vp8a7KQbHkL+FLbvbkgMqmXojpFUO/jENuqQ= +olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3/go.mod h1:oVgVk4OWVDi43qWBEyGhXgYxt7+ED4iYNpTngSLX2Iw= pgregory.net/rapid v1.2.0 h1:keKAYRcjm+e1F0oAuU5F5+YPAWcyxNNRK2wud503Gnk= pgregory.net/rapid v1.2.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= diff --git a/internal/container/pool_test.go b/internal/container/pool_test.go index e569580a3..b3192c2e7 100644 --- a/internal/container/pool_test.go +++ b/internal/container/pool_test.go @@ -118,7 +118,7 @@ func TestWriteTaskJSONNonexistentDir(t *testing.T) { // Create a regular file and then try to use a path where that file // would need to be a directory. Even root cannot mkdir through a // regular file, making this test reliable regardless of privileges. - f, err := os.CreateTemp("", "archie-test-blocker") + f, err := os.CreateTemp(t.TempDir(), "archie-test-blocker") if err != nil { t.Fatal(err) } diff --git a/internal/daemon/daemon.go b/internal/daemon/daemon.go index 7911f903c..45878e923 100644 --- a/internal/daemon/daemon.go +++ b/internal/daemon/daemon.go @@ -15,11 +15,10 @@ import ( "sync" "time" - "github.com/samcharles93/ai-sdk/core" - "github.com/samcharles93/ai-sdk/runtime" - natsio "github.com/nats-io/nats.go" "github.com/nats-io/nats.go/jetstream" + "github.com/samcharles93/ai-sdk/core" + "github.com/samcharles93/ai-sdk/runtime" "github.com/samcharles93/archie-core/internal/agentexec" "github.com/samcharles93/archie-core/internal/config" diff --git a/internal/daemon/daemon_test.go b/internal/daemon/daemon_test.go index 806ca13e0..2f00b1d72 100644 --- a/internal/daemon/daemon_test.go +++ b/internal/daemon/daemon_test.go @@ -563,7 +563,7 @@ func (f *testForge) React(context.Context, string, string, int, string) error func (f *testForge) VerifyPush(context.Context, string, string) error { return nil } func (f *testForge) LinkBranch(context.Context, string, string, int, string) error { return nil } -func testDaemon(t *testing.T, maxRetries int, _ int) (*Daemon, *store.Store, *testForge) { +func testDaemon(t *testing.T, maxRetries, _ int) (*Daemon, *store.Store, *testForge) { t.Helper() s := store.OpenTest(t) diff --git a/internal/forge/gitea.go b/internal/forge/gitea.go index aa557355a..20b5e8732 100644 --- a/internal/forge/gitea.go +++ b/internal/forge/gitea.go @@ -194,7 +194,7 @@ func (c *GiteaClient) React(ctx context.Context, owner, repo string, number int, func (c *GiteaClient) LinkBranch(ctx context.Context, owner, repo string, issueNumber int, branch string) error { url := fmt.Sprintf("%s/api/v1/repos/%s/%s/issues/%d/refs", c.host, owner, repo, issueNumber) body := fmt.Sprintf(`{"ref": "%s"}`, branch) - req, _ := http.NewRequestWithContext(ctx, "POST", url, strings.NewReader(body)) + req, _ := http.NewRequestWithContext(ctx, http.MethodPost, url, strings.NewReader(body)) req.Header.Set("Authorization", "token "+c.token) req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/internal/forge/github_test.go b/internal/forge/github_test.go index d8e7b1a10..0f5567bfb 100644 --- a/internal/forge/github_test.go +++ b/internal/forge/github_test.go @@ -1,7 +1,6 @@ package forge import ( - "io" "log/slog" "testing" ) @@ -29,7 +28,7 @@ func TestNewConfiguresHost(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - f, err := New("github", "token", tt.host, slog.New(slog.NewTextHandler(io.Discard, nil))) + f, err := New("github", "token", tt.host, slog.New(slog.DiscardHandler)) if err != nil { t.Fatal(err) } diff --git a/internal/forge/testclient_test.go b/internal/forge/testclient_test.go index 3eace75d7..03f6640f6 100644 --- a/internal/forge/testclient_test.go +++ b/internal/forge/testclient_test.go @@ -1,7 +1,6 @@ package forge import ( - "io" "log/slog" "net/http" "net/http/httptest" @@ -27,5 +26,5 @@ func newTestClient(t *testing.T) (*GitHubClient, *http.ServeMux) { gh.BaseURL = base gh.UploadURL = base - return &GitHubClient{gh: gh, log: slog.New(slog.NewTextHandler(io.Discard, nil))}, mux + return &GitHubClient{gh: gh, log: slog.New(slog.DiscardHandler)}, mux } diff --git a/internal/gateway/session_store.go b/internal/gateway/session_store.go index 000223b5b..e2b75010c 100644 --- a/internal/gateway/session_store.go +++ b/internal/gateway/session_store.go @@ -50,7 +50,7 @@ type SessionStore interface { // SearchMessages returns messages matching query via semantic // vector search (NellDB SearchSimilar). Falls back to substring // match on message text when vector search is unavailable. - SearchMessages(ctx context.Context, sessionID string, query string, limit int) ([]Message, error) + SearchMessages(ctx context.Context, sessionID, query string, limit int) ([]Message, error) // Close shuts down the underlying store. Close() error @@ -301,7 +301,7 @@ func (s *nellSessionStore) RecentMessages(ctx context.Context, sessionID string, return out, nil } -func (s *nellSessionStore) SearchMessages(ctx context.Context, sessionID string, query string, limit int) ([]Message, error) { +func (s *nellSessionStore) SearchMessages(ctx context.Context, sessionID, query string, limit int) ([]Message, error) { // Substring match on recent messages. Vector search via NellDB // SearchSimilar requires an embedding model — deferred to future // integration with the memory provider's vector store. diff --git a/internal/indexing/codesearch.go b/internal/indexing/codesearch.go index 1db9c0335..daf246352 100644 --- a/internal/indexing/codesearch.go +++ b/internal/indexing/codesearch.go @@ -33,7 +33,6 @@ import ( "github.com/google/codesearch/index" "github.com/google/uuid" - _ "modernc.org/sqlite" ) diff --git a/internal/memory/lifecycle.go b/internal/memory/lifecycle.go index 8ea360248..6ebcfd5a6 100644 --- a/internal/memory/lifecycle.go +++ b/internal/memory/lifecycle.go @@ -53,7 +53,7 @@ type MemoryWriteHook interface { // OnMemoryWrite is invoked after content has been written to memory. // sessionID identifies the session that performed the write. // content is the full text that was stored. - OnMemoryWrite(sessionID string, content string) error + OnMemoryWrite(sessionID, content string) error } // DelegationHook is called when the agent delegates work to a sub-agent diff --git a/internal/memory/manager.go b/internal/memory/manager.go index 39129e55f..3e0296c22 100644 --- a/internal/memory/manager.go +++ b/internal/memory/manager.go @@ -139,7 +139,7 @@ type Manager struct { // - Prefetch timeout: 8 seconds // - Shutdown drain timeout: 10 seconds // - Threat scanning: disabled (no scanner configured) -func NewManager(builtin MemoryProvider, external MemoryProvider) (*Manager, error) { +func NewManager(builtin, external MemoryProvider) (*Manager, error) { m := &Manager{ builtin: builtin, external: external, @@ -383,7 +383,7 @@ func (m *Manager) OnPreCompress(sessionID string) { } } -func (m *Manager) OnMemoryWrite(sessionID string, content string) { +func (m *Manager) OnMemoryWrite(sessionID, content string) { m.mu.RLock() providers := m.activeProvidersLocked() m.mu.RUnlock() @@ -512,6 +512,9 @@ func (m *Manager) PrefetchContext(ctx context.Context, query string) (string, er // shorter deadline. if _, hasDeadline := ctx.Deadline(); !hasDeadline { var cancel context.CancelFunc + // Assignment, not declaration: `:=` here would scope the + // timeout-bearing ctx to this if-block, so the deadline would + // silently never apply to the call below. ctx, cancel = context.WithTimeout(ctx, m.prefetchTimeout) defer cancel() } diff --git a/internal/memory/manager_test.go b/internal/memory/manager_test.go index 13919a9c5..c7ad8b1a1 100644 --- a/internal/memory/manager_test.go +++ b/internal/memory/manager_test.go @@ -63,7 +63,7 @@ type mockProvider struct { // Override functions let tests inject custom behavior without // defining new mock types. When nil, the default behavior is used. prefetchFunc func(query string) (string, error) - memoryWriteFunc func(sessionID string, content string) error + memoryWriteFunc func(sessionID, content string) error } func newMockProvider(name string) *mockProvider { @@ -197,7 +197,7 @@ func (m *mockProvider) OnPreCompress(sessionID string) error { return nil } -func (m *mockProvider) OnMemoryWrite(sessionID string, content string) error { +func (m *mockProvider) OnMemoryWrite(sessionID, content string) error { m.mu.Lock() m.memoryWriteCalls++ m.lastMemorySessionID = sessionID @@ -1221,7 +1221,7 @@ func (p *panickyProvider) OnPreCompress(sessionID string) error { panic("OnPreCompress panicked") } -func (p *panickyProvider) OnMemoryWrite(sessionID string, content string) error { +func (p *panickyProvider) OnMemoryWrite(sessionID, content string) error { panic("OnMemoryWrite panicked") } @@ -1788,7 +1788,7 @@ func TestManager_ShutdownContext_AbandonedCount(t *testing.T) { // Make the external provider's OnMemoryWrite block so sync ops never complete. blocking := make(chan struct{}) - ext.memoryWriteFunc = func(sessionID string, content string) error { + ext.memoryWriteFunc = func(sessionID, content string) error { <-blocking // Still record the call for correctness. ext.mu.Lock() diff --git a/internal/nell/adapter.go b/internal/nell/adapter.go index e1596202b..cb408e7df 100644 --- a/internal/nell/adapter.go +++ b/internal/nell/adapter.go @@ -20,7 +20,7 @@ import ( "time" "unicode/utf8" - "github.com/samcharles93/NellDB" + nell "github.com/samcharles93/NellDB" "github.com/samcharles93/NellDB/logstore" "github.com/samcharles93/NellDB/sdk" diff --git a/internal/tools/budget_test.go b/internal/tools/budget_test.go index eb9e65e8c..a50c8317b 100644 --- a/internal/tools/budget_test.go +++ b/internal/tools/budget_test.go @@ -209,7 +209,7 @@ func TestTurnBudgetSpillDirPermissions(t *testing.T) { // Create a regular file and use a sub-path as the spill directory. // Even root cannot write a file when a path component is a regular // file, making this test reliable regardless of privileges. - f, err := os.CreateTemp("", "archie-test-spill-blocker") + f, err := os.CreateTemp(t.TempDir(), "archie-test-spill-blocker") if err != nil { t.Fatal(err) } diff --git a/internal/tools/dispatch_test.go b/internal/tools/dispatch_test.go index 3db78f3b3..7396b6a86 100644 --- a/internal/tools/dispatch_test.go +++ b/internal/tools/dispatch_test.go @@ -587,7 +587,7 @@ func TestDispatchPerToolLimitSpillFailureFallback(t *testing.T) { // Create a regular file and use a sub-path as the spill directory. // Even root cannot write a file when a path component is a regular // file, making this test reliable regardless of privileges. - f, err := os.CreateTemp("", "archie-test-spill-blocker") + f, err := os.CreateTemp(t.TempDir(), "archie-test-spill-blocker") if err != nil { t.Fatal(err) } diff --git a/internal/tools/mcp/framing.go b/internal/tools/mcp/framing.go index 4d26d0189..8c4854134 100644 --- a/internal/tools/mcp/framing.go +++ b/internal/tools/mcp/framing.go @@ -2,6 +2,7 @@ package mcp import ( "bufio" + "errors" "fmt" "io" ) @@ -49,7 +50,7 @@ func readMessageFromBufio(br *bufio.Reader) ([]byte, error) { if err == nil { break } - if err != bufio.ErrBufferFull { + if !errors.Is(err, bufio.ErrBufferFull) { if err == io.EOF && len(message) > 0 { return nil, fmt.Errorf("read message: missing newline: %w", io.ErrUnexpectedEOF) } diff --git a/internal/tools/mcp/transport_sse_test.go b/internal/tools/mcp/transport_sse_test.go index ff2621811..24b29dc3f 100644 --- a/internal/tools/mcp/transport_sse_test.go +++ b/internal/tools/mcp/transport_sse_test.go @@ -212,12 +212,12 @@ func TestSSETransportConcurrentSendsGetCorrectResponses(t *testing.T) { resp, err := tr.Send(context.Background(), fmt.Appendf(nil, `{"jsonrpc":"2.0","id":%d,"method":"test"}`, id)) if err != nil { - results <- fmt.Errorf("id %d: Send: %v", id, err) + results <- fmt.Errorf("id %d: Send: %w", id, err) return } var msg Message if err := json.Unmarshal(resp, &msg); err != nil { - results <- fmt.Errorf("id %d: parse: %v", id, err) + results <- fmt.Errorf("id %d: parse: %w", id, err) return } if string(msg.ID) != fmt.Sprintf("%d", id) { diff --git a/internal/webui/webui.go b/internal/webui/webui.go index ccc4f3069..841276e27 100644 --- a/internal/webui/webui.go +++ b/internal/webui/webui.go @@ -81,22 +81,22 @@ func (s *Server) handleSummary(w http.ResponseWriter, r *http.Request) { ctx := r.Context() statuses, err := s.Store.StatusCounts(ctx) if err != nil { - http.Error(w, err.Error(), 500) + http.Error(w, err.Error(), http.StatusInternalServerError) return } workflows, err := s.Store.WorkflowStats(ctx) if err != nil { - http.Error(w, err.Error(), 500) + http.Error(w, err.Error(), http.StatusInternalServerError) return } stages, err := s.Store.StageStats(ctx) if err != nil { - http.Error(w, err.Error(), 500) + http.Error(w, err.Error(), http.StatusInternalServerError) return } days, err := s.Store.TokensByDay(ctx, 14) if err != nil { - http.Error(w, err.Error(), 500) + http.Error(w, err.Error(), http.StatusInternalServerError) return } writeJSON(w, map[string]any{ @@ -108,7 +108,7 @@ func (s *Server) handleSummary(w http.ResponseWriter, r *http.Request) { func (s *Server) handleTasks(w http.ResponseWriter, r *http.Request) { tasks, err := s.Store.Tasks(r.Context(), 100) if err != nil { - http.Error(w, err.Error(), 500) + http.Error(w, err.Error(), http.StatusInternalServerError) return } writeJSON(w, tasks) @@ -117,7 +117,7 @@ func (s *Server) handleTasks(w http.ResponseWriter, r *http.Request) { func (s *Server) handleClearTasks(w http.ResponseWriter, r *http.Request) { deleted, err := s.Store.ClearTerminalTasks(r.Context()) if err != nil { - http.Error(w, err.Error(), 500) + http.Error(w, err.Error(), http.StatusInternalServerError) return } writeJSON(w, map[string]any{"deleted": deleted}) @@ -126,12 +126,12 @@ func (s *Server) handleClearTasks(w http.ResponseWriter, r *http.Request) { func (s *Server) handleTask(w http.ResponseWriter, r *http.Request) { id, err := strconv.ParseInt(r.PathValue("id"), 10, 64) if err != nil { - http.Error(w, "bad id", 400) + http.Error(w, "bad id", http.StatusBadRequest) return } evs, err := s.Store.TaskEvents(r.Context(), id) if err != nil { - http.Error(w, err.Error(), 500) + http.Error(w, err.Error(), http.StatusInternalServerError) return } writeJSON(w, evs) @@ -142,7 +142,7 @@ func (s *Server) handleTask(w http.ResponseWriter, r *http.Request) { func (s *Server) handleSSE(w http.ResponseWriter, r *http.Request) { fl, ok := w.(http.Flusher) if !ok { - http.Error(w, "streaming unsupported", 500) + http.Error(w, "streaming unsupported", http.StatusInternalServerError) return } w.Header().Set("Content-Type", "text/event-stream") diff --git a/internal/webui/webui_test.go b/internal/webui/webui_test.go index 148480f95..f0461d53a 100644 --- a/internal/webui/webui_test.go +++ b/internal/webui/webui_test.go @@ -26,7 +26,7 @@ func newTestServer(t *testing.T) *Server { t.Fatal(err) } t.Cleanup(func() { _ = s.Close() }) - return &Server{Store: s, Log: slog.New(slog.NewTextHandler(io.Discard, nil))} + return &Server{Store: s, Log: slog.New(slog.DiscardHandler)} } // stubStore wraps a real TaskStore and overrides selected methods to @@ -67,7 +67,7 @@ func TestHandleSummary(t *testing.T) { t.Fatal(err) } - req := httptest.NewRequest("GET", "/api/summary", nil) + req := httptest.NewRequest(http.MethodGet, "/api/summary", nil) w := httptest.NewRecorder() srv.Handler().ServeHTTP(w, req) @@ -99,7 +99,7 @@ func TestHandleSummaryWorkflowStatsError(t *testing.T) { Log: real.Log, } - req := httptest.NewRequest("GET", "/api/summary", nil) + req := httptest.NewRequest(http.MethodGet, "/api/summary", nil) w := httptest.NewRecorder() srv.Handler().ServeHTTP(w, req) @@ -120,7 +120,7 @@ func TestHandleSummaryStageStatsError(t *testing.T) { Log: real.Log, } - req := httptest.NewRequest("GET", "/api/summary", nil) + req := httptest.NewRequest(http.MethodGet, "/api/summary", nil) w := httptest.NewRecorder() srv.Handler().ServeHTTP(w, req) @@ -141,7 +141,7 @@ func TestHandleSummaryTokensByDayError(t *testing.T) { Log: real.Log, } - req := httptest.NewRequest("GET", "/api/summary", nil) + req := httptest.NewRequest(http.MethodGet, "/api/summary", nil) w := httptest.NewRecorder() srv.Handler().ServeHTTP(w, req) @@ -157,7 +157,7 @@ func TestHandleTasks(t *testing.T) { t.Fatal(err) } - req := httptest.NewRequest("GET", "/api/tasks", nil) + req := httptest.NewRequest(http.MethodGet, "/api/tasks", nil) w := httptest.NewRecorder() srv.Handler().ServeHTTP(w, req) @@ -187,7 +187,7 @@ func TestHandleTask(t *testing.T) { t.Fatal(err) } - req := httptest.NewRequest("GET", "/api/tasks/"+strconv.FormatInt(task.ID, 10), nil) + req := httptest.NewRequest(http.MethodGet, "/api/tasks/"+strconv.FormatInt(task.ID, 10), nil) w := httptest.NewRecorder() srv.Handler().ServeHTTP(w, req) @@ -205,7 +205,7 @@ func TestHandleTask(t *testing.T) { func TestHandleTaskBadID(t *testing.T) { srv := newTestServer(t) - req := httptest.NewRequest("GET", "/api/tasks/not-a-number", nil) + req := httptest.NewRequest(http.MethodGet, "/api/tasks/not-a-number", nil) w := httptest.NewRecorder() srv.Handler().ServeHTTP(w, req) if w.Code != http.StatusBadRequest { @@ -215,7 +215,7 @@ func TestHandleTaskBadID(t *testing.T) { func TestHandleIndex(t *testing.T) { srv := newTestServer(t) - req := httptest.NewRequest("GET", "/", nil) + req := httptest.NewRequest(http.MethodGet, "/", nil) w := httptest.NewRecorder() srv.Handler().ServeHTTP(w, req) if w.Code != http.StatusOK { @@ -228,7 +228,7 @@ func TestHandleIndex(t *testing.T) { func TestIndexContainsViewportMeta(t *testing.T) { srv := newTestServer(t) - req := httptest.NewRequest("GET", "/", nil) + req := httptest.NewRequest(http.MethodGet, "/", nil) w := httptest.NewRecorder() srv.Handler().ServeHTTP(w, req) if w.Code != http.StatusOK { @@ -242,7 +242,7 @@ func TestIndexContainsViewportMeta(t *testing.T) { func TestIndexHasResponsiveFeatures(t *testing.T) { srv := newTestServer(t) - req := httptest.NewRequest("GET", "/", nil) + req := httptest.NewRequest(http.MethodGet, "/", nil) w := httptest.NewRecorder() srv.Handler().ServeHTTP(w, req) if w.Code != http.StatusOK { @@ -305,7 +305,7 @@ func TestHandleSSEBacklogAndLive(t *testing.T) { func TestIndexEscapesSingleQuotesInOnclick(t *testing.T) { srv := newTestServer(t) - req := httptest.NewRequest("GET", "/", nil) + req := httptest.NewRequest(http.MethodGet, "/", nil) w := httptest.NewRecorder() srv.Handler().ServeHTTP(w, req) @@ -331,7 +331,7 @@ func TestIndexEscapesSingleQuotesInOnclick(t *testing.T) { func TestIndexEscDoesNotEscapeSingleQuotes(t *testing.T) { srv := newTestServer(t) - req := httptest.NewRequest("GET", "/", nil) + req := httptest.NewRequest(http.MethodGet, "/", nil) w := httptest.NewRecorder() srv.Handler().ServeHTTP(w, req)