The dashboard's attempt-log panel answered every read with "task logging is
optional and was not enabled for this run". That message was false: logging is
wired unconditionally in the daemon, and the log files exist. The dashboard
process simply had no reader -- composition left TaskLogs absent because no
contract carried it -- so the handler saw a nil registry and reported the
disabled shape, which the page rendered as a claim about configuration.
internal/logging now answers whether an attempt has a log at all: Tail sets
Result.Found, so "this attempt has no log" is a value rather than an empty
list indistinguishable from a read that never happened. Its registry gains
TaskLog (a decoded page) and TaskLogContent (the file verbatim, streamed,
because a log is unbounded input), and an absent reader reports
ErrTaskLogsUnavailable rather than an empty page -- a process that cannot read
logs must not implicate the attempt.
Those two answers travel the State Store contract as storecontract.TaskLogStore
(ReadTaskLog, StreamTaskLogContent) and are rehydrated on the client by
(Unavailable, canonical message), so archie-ui composes the reader from its own
store client instead of opening another process's files. The daemon's registry
is wired as the server-side reader in the State Store process only.
On top of that read, GET /api/tasks/{id}/logs/download serves the attempt's log
as a Content-Disposition attachment named task-<id>-attempt-<n>.log, and the
panel offers it. The JSON route keeps its shape and gains found, so the page
states the attempt has no log instead of blaming a setting.
Task log files stay owned by their directory's owner: archiving still removes a
task's log directory, and that removal is the daemon's, not the dashboard's.
71 lines
2.8 KiB
Go
71 lines
2.8 KiB
Go
// Package store defines the task and event persistence for archied's data.
|
|
// TaskStore is the full surface the daemon needs and *Store is its SQLite
|
|
// implementation.
|
|
//
|
|
// REVISED (archie-core-8cda.5.6): the producer-owned contract surfaces this
|
|
// package used to define live in internal/contracts/store/v1 (package
|
|
// storev1) -- the approved contract location -- so the archie-ui process can
|
|
// reference the contract without linking this SQLite implementation. The
|
|
// definitions below are type aliases for compatibility with the daemon-side
|
|
// callers; new UI-process-facing code imports storev1 directly.
|
|
package store
|
|
|
|
import (
|
|
"github.com/samcharles93/archie-core/internal/domain/storecontract"
|
|
"github.com/samcharles93/archie-core/internal/domain/workflow"
|
|
)
|
|
|
|
// Aliases: the daemon/webui/intake store surfaces moved to storecontract. The
|
|
// message strings of the sentinel errors are the wire contract (see
|
|
// storev1's var block); the aliases change nothing observable.
|
|
type (
|
|
TaskStore = storecontract.TaskStore
|
|
TaskLifecycle = storecontract.TaskLifecycle
|
|
TaskArchiver = storecontract.TaskArchiver
|
|
TaskRetryer = storecontract.TaskRetryer
|
|
TaskQueries = storecontract.TaskQueries
|
|
TaskEvents = storecontract.TaskEvents
|
|
TaskLogStore = storecontract.TaskLogStore
|
|
CaptureStore = storecontract.CaptureStore
|
|
ConfigSnapshotStore = storecontract.ConfigSnapshotStore
|
|
MappingStore = storecontract.MappingStore
|
|
BindingStore = storecontract.BindingStore
|
|
BindingDispatcher = storecontract.BindingDispatcher
|
|
BindingTaskCreator = storecontract.BindingTaskCreator
|
|
CapturedEvent = storecontract.CapturedEvent
|
|
ConfigSnapshot = storecontract.ConfigSnapshot
|
|
WorkflowStat = storecontract.WorkflowStat
|
|
StageStat = storecontract.StageStat
|
|
DayTokens = storecontract.DayTokens
|
|
)
|
|
|
|
var (
|
|
ErrStaleTransition = storecontract.ErrStaleTransition
|
|
ErrBindingNotFound = storecontract.ErrBindingNotFound
|
|
ErrBindingOverlap = storecontract.ErrBindingOverlap
|
|
ErrBindingTransition = storecontract.ErrBindingTransition
|
|
ErrAlreadyDispatched = storecontract.ErrAlreadyDispatched
|
|
ErrMappingNotFound = storecontract.ErrMappingNotFound
|
|
)
|
|
|
|
// Compile-time check: *Store satisfies TaskStore.
|
|
var _ TaskStore = (*Store)(nil)
|
|
|
|
// Compile-time check: *Store satisfies workflow.Store.
|
|
var _ workflow.Store = (*Store)(nil)
|
|
|
|
// Compile-time check: *Store satisfies CaptureStore.
|
|
var _ CaptureStore = (*Store)(nil)
|
|
|
|
// Compile-time check: *Store satisfies MappingStore.
|
|
var _ MappingStore = (*Store)(nil)
|
|
|
|
// Compile-time check: *Store satisfies BindingStore.
|
|
var _ BindingStore = (*Store)(nil)
|
|
|
|
// Compile-time check: *Store satisfies BindingDispatcher.
|
|
var _ BindingDispatcher = (*Store)(nil)
|
|
|
|
// Compile-time check: *Store satisfies BindingTaskCreator.
|
|
var _ BindingTaskCreator = (*Store)(nil)
|