a7d6f71d5a2c9da170a46bfc4471f9979189de87
13
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d6f526ce4f
|
feat(state): carry channel lifecycle from the Messaging Service to the dashboard
archie-core-8cda.6.8's carrier. The service now records channel lifecycle and has nowhere to put it: /api/channels answered with nothing because webui.Server.Channels had no production source, and reload answered 501 for the same reason. This adds the surface the register decided on, following the split archie-core-ymut established for config snapshots -- a pair of administrative RPCs whose writer is one process and whose reader is the UI -- and wires both ends. Wire and store: PutChannelStatus / ListChannelStatus, with ChannelStatus carrying id, name, state, detail, configured, reload_supported and observed_at. The store holds one row per channel and replaces the reported set, so a channel the reporter no longer mentions is deleted rather than left standing as a stale "running"; an empty report clears the table, because hosting no channels is a fact worth reporting. A row without an id is refused: it could never be replaced or removed by a later report. Writer: the service publishes on every lifecycle transition through a coalescing signal -- a burst of transitions is one write, since a reader only wants the latest state of every channel -- plus a start-up report and a final report after shutdown, so a stopped service leaves the store honest. A failed write is logged and retried on the next signal; the dashboard losing channel state is worth a warning and never worth failing a channel start over. Reader: webui.Server.Channels becomes a source rather than a concrete manager, and webui.RemoteChannelStatus reads the store the way RemoteConfigView reads the config snapshot. A store it cannot reach reports nothing rather than a stale "running", and a state the reader does not recognise is carried through rather than dropped. The contract's own index gains the group in the same change that adds the RPCs -- a surface the grouped table does not list is one nobody finds -- and the count moves to 51. The register records why the surface is the State Store rather than a resource kind, and why reload gets its own surface rather than a field here: reading status must not be able to retrigger an action, a transient request is not distinguishable from state once anything polls it, and it would invert the writer/reader relationship the precedent establishes. Verified: task check exit 0. New coverage: the store's replace-the-set semantics and its refusal of an id-less row, the reader's mapping including an unknown state, and the publisher's start-up, transition and final reports. |
||
|
|
90fda8d53a
|
fix(statestore): carry the workflow pin across the wire
task.WorkflowDefinitionVersion/Digest/YAML had no pb.Task field and no taskProto/taskValue mapping, so over gRPC the pin was never persisted and any pin already in the row was zeroed by the same Update. The production daemon's Store is the gRPC client, so the digest guard in pinWorkflowDefinition was dead there: WorkflowDefinitionYAML was never non-empty for a task read back over the wire, and each retry re-resolved from the active control-plane resource instead of the version it started with (docs/prds/runtime-control-plane.md:95). The SQL store already wrote and read all three columns; only the contract dropped them. Adds proto fields 28-30 and the mapping both ways. Field parity was untied, which is why this was invisible: the task still crossed, just with those fields silently zeroed. TestTaskProtoCarriesEveryDomainField fills every domain field and requires the round trip to return it, so the next forgotten field fails by name. The conformance battery now carries the pin through Update and back out of TaskByID, failing in grpc mode only. |
||
|
|
d9dd7885b7
|
feat(statestore): carry control-plane apply status on the store contract
Adds PutApplyStatus/ListApplyStatus so each process can report which version of a control-plane resource it is running, and the UI can read it back. docs/prds/control-plane-apply-status.md is the approved design. It goes on the State Store contract rather than the control plane, whose service is for editing a resource: a status report is not an edit. The config-snapshot pair is the precedent, and the deny-by-default arm of authorizesTaskScopedCall already refuses both new RPCs to a task grant, which TestOnlyAdminReportsApplyStatus pins. The row is keyed on (process, kind) and replaced in place, because a process re-stamps on an interval and nothing reads a history of re-stamps. An error leaves applied_version alone, so a rejected edit never erases the fact that an older version is live. The read is a list and an empty one is not an error, unlike the config snapshot's found=false singleton. Contract PRD inventory and RPC count follow in the same series. Relates to archie-core-pskb. |
||
|
|
e0b6aa6105 |
feat(workflow): post line-anchored review comments with suggested fixes (#891)
* feat(workflow): post line-anchored review comments with suggested fixes Bead archie-core-q9au (docs/prds/inline-review.md). A review's findings reached the operator only as a flat list in the PR body, so the author had to map every finding back to its line by hand and apply mechanical fixes by hand. Now the line-anchored findings are also posted as inline review comments, carrying a one-click suggestion when the reviewer could state the fix. Domain (internal/domain/workflow): - ReviewFinding gains Suggestion; Validate rejects one on anything but a confirmed finding, so the agent's record_finding call is refused with something it can act on. Validate splits into validateAnchor / validateClassification / validateDisposition, which also brings it back under the cyclop limit the gate enforces. - StagePostReviewComments runs after StageOpenPR in the implement workflow. It posts only line-anchored findings (Line > 0); a whole-file finding has no line to attach to and stays in the body list, which remains the complete record. It is best-effort: the PR is open and the body already lists every finding, so a failed comment is logged, never a park -- the same reasoning as OpenPR's existing best-effort LinkBranch call. - The suggestion fence is gated on Verdict == confirmed where the fence is written, because it is a one-click apply: a wrong suggestion breaks the code and the author has to notice. Forge (internal/forge): ReviewCommentWriter + GitHub/Gitea implementations, type-asserted like PullRequestReader so a forge that cannot is skipped rather than faked (NoopForge is pinned as not satisfying it). GitHub loops one CreateComment per comment and joins the failures, so one refused anchor cannot drop the rest; Gitea carries them on a single COMMENT-state review. Two deliberate departures from the PRD's sketch, both recorded in it: - The interface is batch (CreateReviewComments), not one call per comment: Gitea's only inline shape is one submitted review, and the set then crosses NATS once instead of once per finding. - The head SHA is resolved inside each forge implementation rather than by the caller. The stage runs in archie-agent, which holds no forge credentials and has no PullRequestReader; the daemon-side forgerpc handler is the only place that does. Transport (internal/forgerpc): workflow.Forger gains the method, so the agent reaches the daemon over the new create_review_comments subject; the server type-asserts the writer and answers an incapable forge with an error the stage logs. This is the one proxied method whose absence on an image skew does not park a task. The reviewer prompt and record_finding schema ask for a suggestion on a confirmed, mechanically fixable defect only. Regenerating the wfextract symbol table -- the documented way a new exported workflow symbol reaches interpreted stage plugins -- also picked up symbols that were missing from the committed table (the Status* and Source* constants, ReviewCheck, Store, Task, and the _Store wrapper). Nil-guards were re-applied to every wrapper afterwards, as that file's header requires. Evidence: task check exit 0 (incl. 229 UI tests). Three mutations of the new stage logic each fail a test that names the behaviour -- dropping the confirmed-only gate, dropping the Line > 0 filter, and letting a posting failure escape -- so the tests discriminate rather than passing vacuously. * fix(build): drop the Dockerfile pin assertion The guard fetched golangci-lint's go.mod at image build time to fail the build when GOLANGCI_LINT_VERSION and GOFUMPT_VERSION disagreed. It only ever tripped on self-inflicted pin drift, but it added a network fetch and a new failure mode to the release build, which is not where that belongs. The pins stay correct (golangci-lint 2.13.2, whose vendored gofumpt v0.11.0 equals GOFUMPT_VERSION) and the comment above them still states the invariant, so the reasoning survives without the build-time machinery. The pin change itself reaches the agent image through the normal release path: CI rebuilds and pushes archie-agent on an archie/vX.Y.Z release, and a gateway-only release deliberately does not. * feat(workflow): add the remediate workflow for PR review remediation Implements step 5 of docs/prds/pr-review-remediation.md: a remediate workflow that resumes the task's existing worktree onto its PR branch (worktree.Manager.Resume, not Prepare's refresh), runs a builder agent against the review's actionable comments, commits and pushes to the same branch, and replies via the forge's ReplyToReview. Task.RetryCount doubles as the remediation round counter, capped by the repo's max_retries; the round-cap stage parks the task and posts one comment when it's hit. Task gains a ReviewPayload field (JSON-encoded review unit) with full store/proto/staterpc plumbing. workflow.Forger gains Comment and ReplyToReview, proxied to archie-agent via a new forgerpc RPC. Resume and its Dir lookup are added as an unexported optional Trees capability rather than widening the exported interface, which is already at golangci-lint's interfacebloat cap and is projected into wfextract's Yaegi symbol table for repository-authored stage plugins. The daemon-side reaction consumer that dispatches into this workflow (subscribing ARCHIE_REACTIONS, grouping comments by review, enforcing per-task serialization) is tracked separately in archie-core-8li9.4. * feat(messaging): extract standalone messaging service binary and process composition * feat(messaging): adapt channel frontends to consume Gateway ChatContract * feat(messaging): remove in-process channels and Router from daemon bootstrap Telegram, email and webhook now run only in the Messaging Service, which reaches this process through the Gateway's ChatContract. The daemon builds no channel and no gateway.Router, so the wiring that existed only to serve them goes with it: setupGateways, setupEmailGateway, setupWebhookGateway, setupTelegramGateway, buildTelegramRouter, makeTelegramReload and the release-announcement path helper. The seams those paths owned move to where they can still be honoured: - Channel ValidateConfig runs in archiemessaging.compose, which now returns an error, so a configured-but-invalid front-end fails the service rather than being dropped silently. - The inbound rate limiter moves to the Gateway process, which owns the only Router and therefore the only place a per-sender budget applies to every channel's turns. - The daemon's gateway readiness probe becomes a ContractProbe against the Gateway. It cannot observe a channel lifecycle it no longer runs, and a channel-count probe would have reported every daemon degraded. - telegramSetup is now chatSetup (in chat_setup.go), trimmed to the fields a chat turn runner actually reads. Telegram operator features that were wired only in the daemon (/update, release announcements, version reporting, SIGHUP reload) are not yet wired in the Messaging Service: archie-core-8cda.6.6. Channel lifecycle reporting: archie-core-8cda.6.8. The Gateway process builds no worktree manager, so review_pr is unadvertised on every channel: archie-core-8cda.6.7. * feat(messaging): re-wire the Telegram operator surface in the Messaging Service setupTelegramGateway satisfied eight telegram.Gateway seams from the daemon's own process. Each is resolved by where the fact it needs is owned, not by where it used to be built; the decision table is in docs/architecture/migration-decisions.md. Wired here: /update (built from this service's own [chat.telegram] check and install commands), the update-report relay (same sha256(bot_user)[:8] path the daemon wrote, so a pending report is found rather than written afresh), show_tool_calls, and /restart's config reload, which re-resolves the token and allowlist from this service's own file and refuses a reload that resolves to an empty token. /version is sourced from the Gateway: ChatSnapshot gains a Version field carrying the Gateway's rendered build block, read per call and bounded by the dependency timeout. cmd/archie-messaging deliberately takes no version ldflags, so it cannot report a partial upgrade as a matched one. RunningVersions and ReleaseAnnouncements stay nil. Both need a component's real running version, and the only versions this process can obtain are a different binary's stamps -- reporting them would manufacture exactly the false success the update check exists to catch, and the announcer without parseable versions is a no-op that reads as configured. archie-core-8cda.6.9 carries the contract that unblocks them. Dangerous stays nil: no composition has ever supplied a command authority. Enrich is dropped from the update service: componentInstallTypeEnricher read [nats], which this service must not decode, so the check command's own reported install type stands. * fix(workflow): guard inline review comments against head drift Two findings from the review of q9au. A comment's line numbers describe exactly one revision of the branch, but the forge resolved the pull request's head at posting time -- after the review had already read the worktree. A push in that window (a collaborator, a retry) meant the findings were anchored to whatever now occupied those lines, mislabelling instead of failing. The revision the review measured now travels with the comment set: OpenPR records it from the same worktree read it already performs (TaskContext.ReviewedHeadSHA), StagePostReviewComments threads it through Forger to forgerpc, and the forge refuses the whole set once the head it reads has moved off it -- which the best-effort stage logs, the PR body remaining the record. An unmeasured revision posts unverified rather than dropping every finding, so a worktree that cannot report one degrades instead of regressing. Suggestion was documented single-line only, because GitHub applies a suggestion fence up to its first line and a multi-line replacement would silently corrupt the file. Only the verdict was validated, so a multi-line suggestion reached the renderer and posted as that truncated fence. Validate now rejects an embedded newline, which makes record_finding refuse it with feedback the model can act on instead of the reviewer discovering the corruption later. |
||
|
|
2ef962912a
|
feat(tasks): attribute events, changes and config to the attempt that produced them
The events table had no attempt column, so two attempts of the same task were indistinguishable: a retried task's stage events interleaved into one timeline and nothing could say which run produced a given result. - events gains an `attempt` column through the existing presence-gated migrateTasks loop rather than a version bump, so user_version stays 3 and an existing archie.db is migrated in place. A legacy-database test builds the pre-change schema and proves both that existing rows survive unattributed (attempt = 0) and that a new value round-trips. - Event.attempt = 11 and ReadTaskLogRequest.stage = 9 are field additions to existing messages: no new RPC, no new table, and no change to any canonical error message that crosses the state-store wire. - Every task event the workflow engine emits now carries the attempt. Producers that have no attempt yet (task_queued, binding_dispatch_failure) stay unattributed rather than guessing one. - Changed files are captured as a durable changes_captured event at commit and push time, reusing the existing three-dot diff primitive: paths from FilePatches(), counts from Stats(), base_sha recorded as the merge base actually diffed rather than the base tip, a 200-file cap with totals kept complete. Consumption goes through an unexported optional interface so workflow.Trees -- the yaegi capability surface for interpreted stage plugins -- is not widened. A capture is also taken once the pull request exists, so the capture can link it. - The per-attempt configuration is captured as a durable config_captured event carrying the non-secret config.TaskConfig, instead of a new table plus two new state-store RPCs: events are already this system's per-attempt provenance stream, so a table would have given one feature two provenance mechanisms. Redaction is proven against canary secrets. Measured payload: 539 bytes typical, 2333 bytes at 20 models. - Captures carry a schema marker and are refused unless their key set matches the declared payload shape, so drift surfaces as "recorded but could not be read" rather than as a capture of zeroes. - Three read endpoints serve the attempt rail, the changed-file captures and a raw debug view, mapping to UI-owned response types rather than dumping store types. - The task-log read gains a stage filter, bound to the stage logger for that stage's own lines; agent and tool output records no stage. A task-scoped grant may already insert events on its own task, so this provenance is exactly as trustworthy as the rest of that task's event stream. That limit is documented rather than papered over. |
||
|
|
c6dcfd6671 |
fix(staterpc): never decode a collection field to a nil slice
Every client method that decodes a repeated proto field goes through
mapValues, which returned nil for nil input. Protobuf decodes an empty
repeated field to nil, so an empty collection crossed the wire as JSON null
rather than an empty list: the field's type depended on whether it happened
to have contents, and the wire path disagreed with the local path, which
normalises its own slices.
This is the nil-slice class the contract-conformance audit deferred, arriving
by the route its own revisit condition names -- a handler that can produce
nil. The audit checked the webui handlers (clean, as it said) and did not
cover the wire mapping added afterwards, so the regressed field was the new
one: ReadTaskLog's components, observed as "components": null from the live
dashboard.
mapValues now returns []B{} for empty input, which fixes the class once at
the mapping helper rather than at each of its 36 call sites -- none of them
compares the result to nil, so nothing depended on the old behaviour.
TaskLog also normalises components, which is read straight from the proto
rather than through mapValues.
Red first: the test drives the existing local/grpc matrix and asserts the
marshalled JSON, so it fails on a null collection without depending on which
path is under test. Both collections are exercised empty -- entries present
with components empty, and a log file that exists with no lines -- because
the first shape alone leaves the entries side untested. Verified by mutation:
restoring the nil return fails it on "entries marshalled to null".
|
||
|
|
21d8250cde |
feat(webui): read a task's log through the State Store and let it be downloaded
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.
|
||
|
|
42adee2f87
|
fix(staterpc): preserve marshal_error marker in eventDataJSON
WIRE: docs/prds/state-store-contract.md §11 requires the remote wire and the
local adapter to behave identically. The local adapter (internal/store/events.go)
records a {"marshal_error":%q} marker when json.Marshal of event Data fails,
while eventDataJSON silently returned "" on the same failure, emptying the
event's Data on the wire. Carry the same marker so an unmarshalable Data
value survives the hop with the local adapter's fidelity.
|
||
|
|
da28ddb5e6 |
refactor(ui): sever the archie-ui binary from every daemon runtime package
Completes the objective deletion gate for the UI Service (archie-core-8cda.5.6): go list -deps ./cmd/archie-ui now links zero banned packages -- no modernc.org/sqlite, no internal/store, gateway, channels, memory, secret, agentexec, tools, skill, yaegiutil, curator, or the workflow engine. The closure shrinks from 68 to 26 archie-core packages. Each cut is a producer-side move; no consumer-side defensive shims. - Store contracts (TaskStore family, value types, sentinels) moved from internal/store to internal/domain/storecontract -- the approved contract location per state-store-contract rev. 2d, and NOT internal/contracts: that tree is buf generate output and tools/proto.sh check deletes hand-written files there. internal/store keeps aliases; sentinel message strings are byte-identical and remain the wire contract. - Chat contracts (ChatContract, sessions, turns, streaming, commands) moved from internal/gateway to internal/domain/messaging; gateway keeps aliases. ToolCallEvent rendering helpers become gateway functions (methods cannot live on alias types). - Task vocabulary (Task, statuses, mid-run Store, Definition) split into internal/domain/workflow/task; the pipeline engine stays in package workflow with aliases, so daemon-side callers are unchanged. - overlay.DeniedKeys moved to internal/infrastructure/configuration: webui referenced the constant and that dragged the overlay SQLite store in. - webui.Server's concrete runtime handles become webui-owned view interfaces with daemon-side bootstrap adapters: channel lifecycle (internal/channels/status), MemoryStatus, CuratorStatus, and a SkillCatalog seam replacing the direct skill.DefaultRoots/CatalogRoots calls. Each degrades to an empty page when unwired. - config.SecretRef moved into internal/config (config vocabulary); internal/secret keeps an alias and Registry.Resolve absorbs the zero-value short-circuit. Docs: state-store-contract rev. 2d relocation record; ui-service-boundary deletion gate marked satisfied; ARCHITECTURE.md package map rows. |
||
|
|
3699f51f9b |
refactor(store): move the producer-owned contracts to internal/contracts/store/v1
The deletion gate for the UI Service (archie-core-8cda.5.6) is objective: go list -deps from cmd/archie-ui must show no SQL/store implementation. internal/store's hand-written contract surfaces (TaskStore and its component interfaces, CaptureStore, MappingStore, BindingStore, BindingDispatcher, BindingTaskCreator, ConfigSnapshotStore) move to internal/contracts/store/v1 (package storev1), alongside the value types they carry (CapturedEvent, ConfigSnapshot, WorkflowStat, StageStat, DayTokens) and the sentinel errors -- whose canonical message strings are the wire contract and are byte-identical after the move. internal/store keeps type aliases, so daemon-side callers (archied, the daemon, staterpc's server side, taskactions) are unaffected. The UI-facing packages switch to storev1 directly: webui, archieui, captureintake, gatewayrpc, and staterpc's client/values -- which drops internal/store and modernc.org/sqlite from the archie-ui binary's import closure. overlay.DeniedKeys moves to internal/infrastructure/configuration for the same reason: webui referenced the constant and that dragged the overlay package's SQLite store in. The chat-contract and remaining runtime-handle decoupling continues under the same bead. |
||
|
|
d32196f664 |
feat(staterpc): carry the dashboard's configuration snapshot
archie-core-ymut decided the configuration page reads a projection the daemon publishes rather than reaching into a shared config.Holder. This is the carrier: a single-row store surface plus PutConfigSnapshot/GetConfigSnapshot, taking the contract to 42 RPCs. The document is opaque here. Its shape belongs to the daemon that builds it and the page that renders it, so the store neither parses nor validates it, and schema names the projection so a reader can refuse one it does not understand. It is secret-free where it is built: the projection carries an API key's environment variable name and whether it resolved, never a value. Both RPCs are administrative. authorizesTaskScopedCall is deny-by-default, so a container's task-scoped grant can neither rewrite what an operator reads nor read a projection of the deployment it runs inside; a test pins both. Nothing publishes or reads it yet -- the daemon's publisher and the UI's read path land with the rest of the cutover. |
||
|
|
33751abe4e |
test(staterpc): verify State Store end-to-end and preserve context error identity (#775)
* test(state-store): real-process smoke + deadline/sentinel error contract Add end-to-end verification for archie-core-8cda.4.7, the .4.7 State Store verification stage against docs/prds/state-store-contract.md (rev. 2c): - Real-process smoke coverage: build ./cmd/archie-state-store, run it against a minimal config on loopback, poll the readiness surface, and drive the State Store gRPC contract through staterpc.NewClient exactly as a consumer does. Covers the combined task/event/capture view, error-sentinel fidelity across the wire, the found=false-not-error convention, single-owner SQLite (the binary owns the one archie.db file; the consumer never opens a store file), per-call deadline behaviour, restart/recovery (SIGTERM + reopen on the same db), and the remote capture/mapping/binding surfaces. - Fix a real deadline-identity gap in unmapError: a cancelled or deadline-exceeded context surfaced by gRPC-Go as a *status.Error was re-wrapped into a sanitised internal-style error, breaking errors.Is(err, context.Canceled/DeadlineExceeded). The agent's deadlineStore bounds each Store call with context.WithTimeout and the workflow consumer (workflow.go) uses errors.Is(err, context.DeadlineExceeded) to mark a stage interrupted rather than failed, so the re-wrap would wrongly park an interrupted task. Unmap Canceled/DeadlineExceeded codes back to the standard context sentinels. - Pin the error-mapping contract in staterpc: context-identity preservation, sentinel round-trip fidelity for every store sentinel, and the sanitisation rule (an Internal error must not leak raw detail or map to a sentinel). * test(state-store): assert single-owner SQLite composition (daemon/gateway require target) The single-owner invariant (docs/prds/state-store-contract.md §12 step 7/8) is that only archie-state-store opens archie.db; the daemon and gateway resolve their task-store surface from openStateStoreAdapter, which requires [services.state].target and opens no local store. This test pins that composition root so a future change cannot silently reintroduce a local *store.Store in the daemon or gateway path (dual-store ownership). * test(state-store): skip real-process smoke tests under -short The smoke tests build and exec the real archie-state-store binary, which is slow enough that a -short run (e.g. a focused edit loop) should skip them. task check (go test ./... -count=1) does not use -short, so they still run in the full gate. * test(state-store): fix subprocess log race under -race The smoke test captured the subprocess's stdout/stderr in a strings.Builder that the os/exec writer goroutine and the test reader goroutine touched concurrently, racing under -race. Replace it with a mutex-guarded buffer, the standard pattern for reading a running subprocess's output. * test(state-store): satisfy lint (noctx, errorlint) on new tests - exec.Command -> exec.CommandContext, http.Get -> NewRequestWithContext + Client.Do, so the subprocess and readiness polling honour the test context (noctx). - errorlint: compare the raw non-status error via errors.Is rather than != on a wrapped error. * docs(deployments): document State Store readiness verification and single-owner invariant The deployment runbook described how to launch archie-state-store but not how to verify it is healthy before starting archied. Document the -ready-addr readiness surface (/healthz, /health/detailed state_db component) and the single-owner invariant: one task SQLite file owned by archie-state-store, with archied/archie-gateway never opening archie.db directly (state-store-contract §12 step 7/8). * fix(state-store): preserve context deadline/cancel identity in mapError The symmetric server-side gap to the unmapError fix: if a store query fails because the caller's context expires mid-call (§6 StoreTimeout), the handler's mapError folded context.Canceled/DeadlineExceeded into codes.Internal. The client would receive a sanitised internal error with no deadline identity, so the agent's workflow consumer (errors.Is(err, context.DeadlineExceeded)) could not distinguish an interrupted stage from a failed one. Map a context cancel/deadline error to its matching gRPC code so unmapError rehydrates it back to the standard context sentinel, completing the §6/§7 round-trip. Pin both directions with TestMapErrorPreservesContextIdentity. |
||
|
|
2b102b04a2 |
feat(state-store): generalize storerpc as the State Store gRPC contract (archie-core-8cda.4.2) (#770)
* feat(state-store): generalize storerpc as the State Store gRPC contract Implements archie-core-8cda.4.2 against docs/prds/state-store-contract.md rev. 2c: generate protobuf/gRPC client and server adapters for every ratified store contract (proto/state/v1/state.proto, 40 RPCs, one StateStoreService), add internal/infrastructure/staterpc with a bufconn conformance suite exercising both local and remote adapters, serve the service in-process (bridge address + mandatory per-task bearer token when agent containers exist, loopback-only otherwise), and flip archie-agent's workflow.Store to a long-lived gRPC client when the daemon injects STATE_STORE_URL/STATE_STORE_TOKEN (falling back to the legacy NATS storerpc path otherwise -- one agent process is never both). Also drops the *sql.Tx parameter from store.BindingDispatcher.RecordDispatch (a required wire-blocker fix: a transaction cannot cross a gRPC boundary, and production always passed nil). fix(store): drop RecordDispatch's unusable *sql.Tx parameter feat(config): add services.state contract-adapter selector * fix(state-store): apply no-mistakes review decisions - Drop StreamTokenInterceptor (unused; the State Store service has no streaming RPCs and nothing calls it). - Make StateStoreTokens.Validate compare tokens in constant time (crypto/subtle) per the auto-fix hardening.ing finding. - Amend config.example.toml / config.Services.State doc text so it frames [services.state].target as the ratified surface consumed by the upcoming standalone archie-state-store binary (.4.3), not active today. |