Repository navigation
fix(v1.8): keep dd.watch.digest across Portwing reports and share the lookup-label helper - #1067
Conversation
…ainers across reports preserveControllerDockerEnrichment restores a fixed list of controller-owned top-level fields onto an incoming agent report, but image isn't among them. Portwing hardcodes image.digest.watch to false on every "live runtime state" report since digest watching is the controller's own bridged Docker watcher's job, not Portwing's. Without restoring the field, that report wholesale- replaces the stored image and silently turns digest watching back off for any container the dd.watch.digest label had enabled.
… agent path AgentClient's applyRegistryLookupLabels duplicated container-init.ts's unexported resolveLookupImageFromContainerLabels. Export the helper and call it from both sites instead; each site's own precedence check (agent-reported lookupUrl/lookupImage beats the label, checked before the helper runs) is unchanged.
…estore preserveControllerDockerEnrichment's digest.watch restore (DR-38) guards on merged.image existing before spreading it, since EdgeAgentAdapter casts an incoming dd:container_sync frame straight to Container[] with no schema validation, so image can be missing at runtime despite the type. Add the missing case: a stored container with image.digest.watch: true and an incoming report with no image at all, asserting the restore does not throw and does not fabricate an image.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe agent path now uses the shared Docker label resolver for registry lookup. Controller-owned Merge Risk: ⚪ Minimal · up to This preserves controller-configured digest watching during agent container synchronization while keeping unlabeled containers unchanged and reusing the existing Docker label precedence. The covered synchronization paths show no remaining merge-blocking risk. 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
biggest-littlest
left a comment
There was a problem hiding this comment.
DR-38 with a reproducing test, DR-39 helper shared. Gate green, CI green, only the Vercel daily quota red.
ALARGECOMPANY
left a comment
There was a problem hiding this comment.
DR-38 with a reproducing test, DR-39 helper shared. Gate green, CI green, only the Vercel daily quota red.
…phore (#1104) * test(agent): pin digest watch across Portwing reports DR-38 traced dd.watch.digest=true as dead for controller-Docker-transport (Portwing) containers because preserveControllerDockerEnrichment did not restore image.digest.watch across a Portwing runtime-state report. That fix already landed in 7276699 (#1067); this adds an independent end-to-end regression guard driven through two real handleContainerSync calls (not a pre-seeded existing-container mock) asserting both digest.watch and digest.repo survive the second report, since image-comparison.ts's digest-comparison gate requires both. Confirmed passing on current code — DR-38 is not refuted, it was already fixed; the roadmap entry predates that commit. * feat(updates): add a concurrency semaphore around action execution DD_UPDATE_CONCURRENCY (default 1) and a per-action DD_ACTION_<TYPE>_<NAME>_CONCURRENCY override now bound how many update operations the docker, dockercompose and command actions run at once, replacing Docker's hardcoded TRIGGER_BATCH_CONCURRENCY=3. Docker.triggerBatch and Dockercompose.triggerBatch both resolve the same value through the new updates/action-concurrency.ts helper and apply it with p-limit at their own per-container / per-compose-file-group fan-out point; Command.runCommand holds a lock-primitives Semaphore for the duration of its child process, since its batches don't fan out. Each compose-file group still runs its own withContainerUpdateLocks() critical section to completion as one unit, so a compose-file-once batch keeps its existing serial ordering guarantees; concurrency only unlocks work across independent compose files, which is safe because their lock keys and compose object/document caches are both keyed by file path. * feat(ui): show batch update progress Automatic and scan-triggered fleet updates already carry a real batchId end to end (enqueueContainerUpdates -> operation store via SSE), but nothing in the UI surfaced it. The existing "Updating stack" text in ContainersGroupHeader only covers manually-clicked group batches via separate UI-side bookkeeping. Add getActiveBatchProgress() to the operation store: derives the set of in-flight multi-container batches (2+ containers, at least one non-terminal) from the existing byId operation map, no new SSE event needed. UiBatchProgress gains activeContainerNames so the banner can name what's currently running, not just the counts. useFleetUpdateProgress composable wraps the store call in a computed so it self-cleans once a batch finishes, and falls back to installing its own Pinia instance when none is active (matching the pattern already used by useToast and useUpdateBatches). FleetUpdateProgressBanner renders one line per active batch above the container list, reusing the existing muted-primary banner style already used for the list's error state. Caps named running containers at 3 and folds the rest into a "+N more" suffix so the line stays bounded on a large fleet. New i18n keys added to all 17 locales (English source text, Crowdin fills real translations later) to satisfy the key-parity gate. * fix(updates): bound action concurrency across independent trigger() calls The per-call pLimit added in 7094f5b75 only bounded concurrency within one triggerBatch() invocation. That covers the automatic scan-triggered digest batch flow, which calls triggerBatch() once with the whole ready set, but not the manual bulk "Update All" endpoint, dependency-chain updates, or startup recovery: all three dispatch through runAcceptedContainerUpdates()'s own wave-worker pool, which calls trigger() once per container with no shared batch call for a per-call limiter to bound. Each of those trigger() calls created its own throwaway pLimit(concurrency) sized for exactly one task, so DD_UPDATE_ CONCURRENCY and the per-action override had no effect on the primary large-fleet scenario the roadmap item exists for. Docker and Dockercompose (which extends Docker) now hold a persistent per-instance Semaphore, created lazily on first use and sized once from resolveActionConcurrency(). trigger() acquires and releases it around the real update; triggerBatch() no longer needs its own limiter, since every trigger() call it fans out to draws from the same permit pool as every other caller on that instance. Dockercompose's triggerBatch() gates at the same compose-file-group granularity it already used, just through the shared semaphore instead of a call-scoped pLimit, so compose-file-once ordering is unchanged. Docker.test.ts, Docker.trigger-prune-progress.test.ts, and Dockercompose.test.ts had concurrency tests that spied on trigger() itself, which now bypasses the gate that lives inside it; they're rewritten to spy on runContainerUpdateLifecycle/processComposeFile instead, and each file gains a test driving several independent trigger() calls concurrently (mirroring runAcceptedContainerUpdates's per-container dispatch) to prove the persistent semaphore actually bounds them. Docker.test.helpers.ts resets the semaphore alongside configuration in its shared beforeEach, since the instance it exports is reused across every test in the six files that import it. * test(load): cover concurrent updates in the load-test scenario The Artillery harness under test/test.yml only asserts HTTP-level correctness (status codes, latency, 429/5xx counts) against a live container built and run through docker-compose (scripts/run-load- test.sh); it has no way to see whether update-operation store writes stayed consistent under concurrency, and this task's environment has no way to build or run that compose stack. This adds the fleet-scale scenario the roadmap item's "Done when" line actually asks for as a vitest integration test instead, run in the normal unit test pass and in CI with no container runtime required. fleet-update-concurrency.integration.test.ts drives the real dispatch orchestration (runAcceptedContainerUpdates, the wave-worker pool a manual bulk "Update All", a dependency-chain update, or startup recovery goes through) against a real SQLite update-operation store, with a fake action gated by the same persistent per-instance Semaphore primitive Docker/Dockercompose/Command use in production. A 12- container fleet is run at concurrency 1 and concurrency 4: both prove every operation reaches a terminal, successful status with no lost operation, and that each stored row's containerId/containerName still match the operation it was queued for, with no interleaving from a sibling container that ran concurrently alongside it. A separate case runs the same 16-container fleet at concurrency 1 and 4 and asserts the concurrent run is meaningfully faster, which is the property the feature exists to deliver, not just that it doesn't corrupt anything. * docs: document update concurrency Add the DD_UPDATE_CONCURRENCY / DD_ACTION_<TYPE>_<NAME>_CONCURRENCY feature to the docs and changelog. content/docs/current/configuration/actions/index.mdx gets a new "Update concurrency" section ahead of the existing "Global concurrency cap" one, explaining the default, the per-action override, how it relates to compose-file-once ordering, and the new fleet update progress banner in the UI. The existing "Global concurrency cap" section's opening claim that drydock runs updates concurrently by default is no longer true now that DD_UPDATE_CONCURRENCY defaults to 1, so that framing sentence is corrected and the section now points back at the new one instead of restating it. A callout spells out how the two settings interact: DD_UPDATE_MAX_CONCURRENT (unchanged) bounds the whole controller's simultaneous update lifecycles across every action, DD_UPDATE_CONCURRENCY bounds one action's own concurrent executions, and the effective concurrency is whichever is tighter. The per-provider CONCURRENCY row is added to the docker, docker-compose, and command trigger reference tables, each linking back to the shared explanation instead of repeating it. CHANGELOG.md gets an Added bullet under [Unreleased] in this repo's usual dense narrative style, covering the default, the override, the persistent-semaphore mechanism, compose-file-once ordering, the relationship to DD_UPDATE_MAX_CONCURRENT, and the UI progress banner. README.md is unchanged: it does not enumerate action trigger options. * test(ui): mock the active batch progress getter in the ContainersView specs * fix(updates): read the update concurrency setting through the configuration module DD_UPDATE_CONCURRENCY was read from process.env at action-concurrency.ts module evaluation instead of through ddEnvVars, breaking the configuration module's role as the single source of truth for DD_ settings and making the concurrency default untestable in isolation. getGlobalUpdateConcurrency() now reads ddEnvVars.DD_UPDATE_CONCURRENCY lazily on each call; per-instance callers (Docker.ts, Command.ts) already memoize the result at semaphore construction, so no caller needed a memo of its own. Updated the affected tests to control ddEnvVars directly instead of depending on the process environment.
* fix(v1.8): stash policy on agent prunes, single-flight manual scans, expiring once reservations, SPA fallback allowlist (#1038)
* fix(agents): stash update policy on the agent-side prunes too
under its Docker id (deleteContainer's identityChangeExpected option) so
the record that replaces it under a new identity inherits the snooze,
maturity mode/min-age, and skipped tags or digests. Two other prunes that
delete a record ahead of an identity change still called deleteContainer
plainly and lost the policy the same way the startup prune used to:
pruneOrphanedAgentContainers in app/registry/index.ts, which runs when an
agent is removed from config or renamed, and AgentClient.pruneOldContainers
in app/agent/AgentClient.ts, which runs when a container is missing from
an agent's incoming report because it moved to another agent.
Both now pass identityChangeExpected: true, so a container that reappears
under the same Docker id but a different agent, watcher, or name carries
its update policy across the move instead of resetting to defaults.
* chore(ci): drop the no-op pre-commit coverage hook
lefthook.yml ran ./scripts/pre-commit-coverage.sh with no {staged_files}
argument, so the script's `for f in "$@"` loop always saw an empty list
and printed "No app/ or ui/ files staged; skipping tests" on every commit
regardless of what was staged. Commit-time checks are meant to stay cheap,
so rather than wiring {staged_files} through and turning this into a
per-commit test run, the command and the script are gone. Pre-push
coverage already runs the full suite on every push.
Removes the coverage command from lefthook.yml's pre-commit block,
deletes scripts/pre-commit-coverage.sh and its test, updates the two
.github/tests/ci-verify-workflow.test.ts assertions that expected the
hook to exist, and corrects CONTRIBUTING.md's description of what
pre-commit actually runs now.
* fix(notifications): expire once-notification reservations that never settle
reserveOnceNotificationSlot/releaseOnceNotificationSlot guard once=true
sends against an overlapping evaluation of the same result, but the
release only ran when the handler's own promise settled.
runHandlerWithTimeout detaches a handler that misses its 30s deadline
instead of awaiting it forever, so a provider that never resolves or
rejects held its reservation for the process lifetime, and every later
scan for that exact result read it as still in flight and skipped the
send silently.
Give each reservation its own expiry timer, four times the handler
timeout (event.getHandlerTimeoutMs(), a new production-facing getter
alongside the existing test-only one), that deletes the map entry and
logs a warn naming the key if nothing released it first.
releaseOnceNotificationSlot and deregisterComponent now clear that
timer wherever they clear the reservation, so a normal settle or an
explicit teardown never leaves it to fire later against a reused key.
* fix(notifications): route manual scans through the single-flight cron scan
watch() has no re-entrancy guard of its own. POST /api/v1/containers/watch,
POST /api/v1/webhook/watch, and the agent's own watcher API (the endpoint
the controller polls) each called it directly, so a manual "check now"
landing while a cron scan (or another manual scan) was already running
started a second, fully independent handleContainerReports pass. Under
once=true both passes could read "not yet notified" before either had
finished writing its own history, so a trigger sent the same update twice.
All three now route through triggerManualWatch() (app/watchers/manual-watch.ts),
which calls the Docker watcher's existing watchFromCron()/
watchFromCronOrchestration() single-flight orchestration instead of watch()
when a watcher exposes it, falling back to watch() for any watcher type that
does not. ignoreMaintenanceWindow: true preserves manual/API scans' existing
behavior of running regardless of a configured maintenance window. Whether
the call coalesced into an already-running scan is surfaced back: a
`coalesced` field in the JSON body for the containers/webhook endpoints
(added to the WebhookWatchAllResponse OpenAPI schema), and an
X-Drydock-Watch-Coalesced header for the agent endpoint, which keeps its
existing bare ContainerReport[] body so a controller and agent on either
side of a version skew keep working unchanged.
Also, handleMaturityGateClearedEvent's once=true check read notification
history with a bare hasAlreadyNotifiedForResult(), with the matching write
landing an await later once delivery confirms -- the same window
reserveOnceNotificationSlot()/releaseOnceNotificationSlot() exist to close
for the generic update-available path. Two overlapping evaluations of the
same maturity-cleared event could both read "not notified" and both
dispatch. It now takes the same reservation before dispatching, released
from recordEventDeliverySuccess() on success, a new
releaseEventDeliveryReservation() on failure (since a maturity-cleared
dispatch can be optimistic-and-detached or deferred to a later batch
flush, so handleMaturityGateClearedEvent's own call stack returns long
before the send settles), or locally when dispatchContainerForEvent()
returns false without ever queuing or sending anything.
* fix(ui): allowlist SPA routes for the service worker navigation fallback
The workbox navigateFallback denylist only ever excluded /api from the SW's
offline app-shell fallback. Express also owns /auth's OIDC subpaths,
/health, and /metrics: a document navigation to any of them (in particular
the identity provider's /auth/oidc/<name>/cb redirect, #939) was served
index.html instead of reaching the server, so an OIDC login's code
exchange never ran and the SPA silently bounced back to /login.
Replace the denylist with navigateFallbackAllowlist, built directly from
ui/src/router/routes.ts (buildSpaNavigateFallbackPattern, both exported
from vite.config.ts). A route path segment starting with `:` (e.g.
CONTAINER_LOGS's `:id`) becomes a `[^/]+` wildcard; every other segment is
escaped and matched literally, with the trailing slash and query string
both optional to match workbox's NavigationRoute (matched against
pathname + search). A route added to the router without a matching
allowlist entry is now impossible by construction: the allowlist is
Object.values(ROUTES) run through the pattern builder, not a second list
someone has to remember to update in step. Bare /auth is still an SPA
view and still matches; its OIDC subpaths, /health and /metrics do not,
and now correctly fall through to Express, along with any future
server-owned path added without a change here.
ui/tests/config/vite.config.spec.ts pins: every ROUTES path (concrete,
trailing-slash, and query-string variants) matches; known server-owned
paths (the OIDC callback, /health, /metrics, /api) do not; bare /auth
matches but its subpaths do not; and the CONTAINER_LOGS wildcard matches
exactly one path segment.
* fix(notifications): key once-reservation release on the reservation that took it
reserveOnceNotificationSlot's key alone did not prove ownership: once
reservation A expired and its timer deleted the key, a fresh reservation B
could take the same key, and A's own release (settling later, success or
failure) would clear B's entry by key lookup, letting a third evaluation
dispatch while B was still supposed to be held.
Every reservation now carries a unique token, and release (from either the
expiry timer or a settling caller) only clears the entry when its token
matches. Threaded the token through every reserve/release pair: the simple,
batch, digest, retry-buffer and maturity-gate paths, plus the batch
dispatcher's queue/flush split via a side map since BatchDispatcher has no
room to carry it on its own entries.
* fix(ui): keep query delimiters out of route parameter wildcards
buildSpaNavigateFallbackPattern's :param wildcard was [^/]+, which accepts
"?", so /containers/:id/logs matched /containers/abc?x/logs (actual pathname
/containers/abc, the rest is query text). Narrow the wildcard to [^/?]+ so a
param segment can't swallow a literal "?" and the literal path segment that
follows it.
* docs(agents): port the TLS example pair and health monitor test scope to 1.8 (#1048)
* docs(agents): serve TLS on the agent in the paired registry example
* test(rollback): pass backupScope to every health monitor case
* fix(release): probe each platform by its own manifest digest in the image arch check (#1049)
(cherry picked from commit 1b439dfb3288d93bc3718a59c245debfc25ac535)
* feat(ui): add the approval queue view, nav badge and dashboard tile (#1052)
* feat(ui): add the approval-queue service layer
Wraps the /api/v1/approvals REST endpoints (list, summary, get, approve,
reject, defer) behind a typed service module, matching the pattern used
by every other view's service. Nothing consumes it yet.
Part of spec-ca-2-approval-queue.md, slice 5.
* feat(ui): add the /approvals route and queue view
Lists every row the reconciler has sighted with its release notes and
soft-blocker hold reasons inline, and approve/reject/defer actions that
call straight through the approval service added earlier. Each row
expands in place for detail rather than opening a separate panel.
Part of spec-ca-2-approval-queue.md, slice 5.
* feat(ui): add a sidebar approvals badge and its SSE wiring
The sidebar nav gets an Approvals entry with a live pending-count badge,
fed by the three approval SSE events the API already emits rather than
polling; eventStream.ts parses each payload and AppLayout re-dispatches
it as a window CustomEvent for any component to consume.
Part of spec-ca-2-approval-queue.md, slice 5.
* feat(ui): add an approvals stat tile to the dashboard
Wires a pending-count stat card into the existing generic dashboard
widget system (own DASHBOARD_WIDGET_IDS entry, layout constraints, and
default position) rather than a bespoke component, so the widget-order
and hide/show machinery already covers it. Fetches once on mount and
then follows the same three approval SSE events as the sidebar badge.
Part of spec-ca-2-approval-queue.md, slice 5.
* feat(notifications): add the update-pending-approval rule
Registers update-pending-approval in DEFAULT_NOTIFICATION_RULES so it
can be enabled and assigned triggers like any other rule. It ships
enabled: false and bellEnabled: false: no audit action names it yet
and no event dispatches to it in this release, so it is reserved for
an upcoming one rather than wired end to end here.
Part of spec-ca-2-approval-queue.md, slice 6.
* docs(approvals): document the approval queue and its API
New configuration/actions/approvals.mdx explains what puts a candidate
in the queue (soft blockers become hold reasons, hard blockers keep it
out) and what each of the three decisions does; new api/approvals.mdx
covers the list, summary, get-one and decision endpoints. Replaces the
inline "## Approvals" section in api/index.mdx (a leftover from the
read-only API slice) with a proper overview-table row pointing at the
dedicated page, and cross-links update-eligibility.mdx and the trigger
Notification Rules table for update-pending-approval, noted there as
shipped disabled with no dispatch wired yet.
Part of spec-ca-2-approval-queue.md, slices 5 and 6.
* docs(changelog): add the approval queue view to the Unreleased notes
Adds the CA-2 slice 5/6 bullet (route, sidebar badge, dashboard tile,
the reserved-but-undispatched notification rule) and closes out the
prior slice's "the queue view itself lands next" line now that it has.
Flips the README feature-comparison rows and roadmap table entry for
the approval queue from partial to shipped to match.
* refactor(ui): keep the approval service types module-private
knip flags exported types with no importer; the view and composable only use
the service functions.
* chore(web): regenerate the analytics route manifest for the approvals docs pages
* build(docker): bump the cosign apk pin to 3.0.6-r2 (#1058)
Alpine replaced cosign 3.0.6-r1 with r2, so every image build fails at
apk add with 'unable to select packages' until the pin follows.
* fix(rollback): resolve auto-rollback through the identity binding policy (#1051)
* fix(rollback): resolve auto-rollback image through the identity binding policy
Auto-rollback used a fixed fallback (pre-update digest, then mutable tag) that
ignored the required/optional/disabled post-pull identity policy DR-43 gave
the manual rollback API. It now resolves through the same
resolveRollbackImageReference helper, so a required policy that cannot
establish a digest refuses the rollback as a rollback-failure audit event
instead of silently deploying the mutable tag.
DR-59
* fix(portainer): preserve an explicit docker.io/ prefix when pinning the stack image
applyPortainerDigestPin rewrote the stack file's image using the identity
binder's normalised repository, so docker.io/library/nginx:1.27 came back as
library/nginx:1.27@sha256:.... Reuse preserveExplicitDockerIoPrefix, exported
from Dockercompose.ts, so the pinned reference keeps the prefix the stack file
wrote whenever it wrote one.
DR-65
* test(api): build the api-key enforcement app once per file, not once per case
Each of the ~30 cases in api-key-enforcement.integration.test.ts rebuilt a
Basic authenticator (a real argon2id hash), a LokiJS-backed session store and
a listening HTTP server from scratch. That's cheap in isolation but pushed a
single case past the 5000ms default under the CPU contention of the parallel
app+ui coverage gate. The app, its Basic authenticator and its server are now
built once in beforeAll; beforeEach only resets the mutable state a case can
leave behind: the api-key collection, the session store's rows, and the
authenticator chain a couple of cases deliberately swap out.
DR-63
* fix(demo): send Cross-Origin-Opener-Policy so the weekly DAST scan passes
ZAP rule 90004 checks both COOP and COEP. #878 added the embedder policy; the
2026-09-02 weekly run still flagged the missing opener policy and fail_action
turned the warning into exit 2.
* chore(i18n): sync translations from Crowdin (#1053)
Co-authored-by: Crowdin Bot <[email protected]>
* fix(v1.8): pinned-tag shape check, rename events, and handshake body validation (#1061)
* fix(tag): stop isTagPinned treating every non-rolling tag as pinned
The tail of isTagPinned() fell through to an unconditional return true
after checking for a numeric version shape, so a bare distro or variant
tag with no version number (redis:alpine, node:slim, postgres:bookworm,
fpm-alpine, production) was reported as pinned and hidden by the Hide
Pinned UI filter alongside genuinely pinned releases like 1.4.5 or
16-alpine. It now returns the numeric-shape check's own result. Also
corrects the watchers doc, which described Hide Pinned as reading
tagPrecision when it actually reads the shape-based tagPinned field.
* fix(store): emit containerUpdated on a name or displayName delta
hasContainerChangedWithSecurityHashes compared neither name nor
displayName, so a docker rename persisted to the store without ever
satisfying the check that gates containerUpdated. SSE rows, Prometheus
gauge labels, and MQTT topics kept the old name until an unrelated
field also changed. Both fields are now part of the comparison.
* fix(agent): reject a non-array handshake containers body before deregistering triggers
AgentClient._doHandshake validated nothing about the /api/containers
response body, so an object, string, or number body threw inside
processAuthoritativeContainers after deregisterAgentComponents had
already run and before trigger re-registration reached it. handleAckEvent
only logs the failure, and dd:ack fires once per connection, so the
agent's triggers stayed deregistered with no retry. The body is now
checked with Array.isArray immediately after the request and rejected
before any registry mutation, with a warning naming the agent and the
body's type.
* feat(store): add the node:sqlite driver, schema and first-start import framework (#1059)
* feat(store): add a swappable node:sqlite driver for the v1.8 store
Groundwork for 7-STORE. Nothing imports it yet.
The driver owns transaction(), pragma(), error normalisation and backup()
rather than exposing the engine's own API, because those are exactly the
places node:sqlite and better-sqlite3 disagree. Keeping them here is what
makes the driver choice a one-file swap later instead of a rewrite spread
across every store module.
Opening applies the store's pragmas in a fixed order and probes for WAL,
falling back to TRUNCATE with a warning when the filesystem refuses it,
since /store is routinely an NFS or CIFS mount with no shared memory. A
memory database skips the probe so agent mode never warns.
* feat(store): add the v1.8 SQLite schema and its migration runner
The full DDL for every collection in the store, plus schema_migrations and
a store_metadata table for bookkeeping that is not schema versioning. Every
table is STRICT, so a type mistake is a write-time error rather than a
silently coerced value, which is the class of bug the JSON store could not
catch at all.
A field is a column when the code queries, filters, sorts or individually
patches it; everything else is JSON in a TEXT column, and the five payloads
the store is documented never to inspect are never indexed.
The runner records applied versions and applies only what is missing, so
running it against an already migrated database does nothing. Each run is
one transaction, so a migration that throws leaves the schema and the
bookkeeping consistent with each other.
* feat(store): add the first-start import framework for the v1.8 store
Reads a serialised LokiJS database, serves both the flat and the {data}
enveloped document shapes, and runs a registry of per-collection importers
into SQLite. secrets is implemented as the worked example; later slices add
one entry to the registry each.
The whole import runs into <database>.importing inside one transaction and
is renamed into place only once it has succeeded, so a partial import is
never visible under the real filename and a crash anywhere before the
rename leaves dd.json untouched for the next start to retry. A leftover
.importing file is discarded rather than resumed: resuming correctly would
need per-collection progress tracking, which a one-shot operation does not
justify.
A marker row in store_metadata makes a second import into the same database
a no-op even when it is called directly. dd.json becomes dd.json.pre-1.8.bak
once the rename lands, and an existing backup is never overwritten, since
that file is the whole rollback story for a downgrade to v1.7.
Sessions are read from the dedicated sessions file when DR-121 has already
split them out, and from the Sessions collection in dd.json otherwise.
* docs(changelog): note the v1.8 SQLite store groundwork
* chore(store): hold the new store db exports to what something reaches
knip runs over the app workspace and reports an export nothing imports.
Three of these were real: the import status union is only ever read through
FirstStartImportResult, so it stops being exported, and the reader's two
public constants were duplicated as string literals in their own test
instead of being used.
The rest are the driver's type surface, which is the point of the module
and stays exported. A test now pins it by annotating each of Statement,
Row, SqlValue, SqlBinding, StatementRunResult and TransactionMode at a real
call site, which also covers the exclusive transaction mode nothing else
exercised.
* fix(store): fsync the store directory after each import rename
The directory fsync ran before the temp-database rename and the legacy
backup rename, so neither directory entry change was durably persisted
on crash. Move the sync after each rename instead.
* fix(store): normalize errors thrown while iterating a statement
node:sqlite evaluates iterate() lazily: the call that produces the
iterator never touches the database, only each next() does. Wrapping
just that call left every later step unguarded, so an error thrown
mid-scan surfaced as the raw ERR_SQLITE_ERROR instead of a StoreError.
Wrap next() and return() through the same guard.
* test(store): cover the no-return-method branch of the iterator wrapper
wrapIterator only sets return() when the underlying iterator has one;
every real and previously-mocked iterator in the suite had one, so that
branch never ran and the 100% coverage gate caught it.
* fix(store): stop the session store and main store clobbering dd.json (#1055)
* fix(store): stop the session store and main store clobbering dd.json
DR-121: express-session's connect-loki store opened its own LokiJS
instance directly on ${configuration.path}/${configuration.file}, the
exact file the main store already used. LokiJS's saveDatabase() always
serializes the whole in-memory database, so whichever instance saved
last erased the other's writes: a session autosave (every 5 seconds,
armed by any authenticated request touching its session via
express-session's touch) reverted every container and setting written
since boot, while the main store's own autosave deleted the Sessions
collection out from under active logins.
store.getSessionStorePath() now derives a sibling file from the main
store's own configured path and file name (dd.json -> dd-sessions.json
by default), so a custom DD_STORE_FILE still lands on a distinct
sibling instead of colliding with anything else on the volume.
auth.ts's LokiStore now points at that path instead of building the
main store's own file path by hand. The main store also drops and logs
a stale Sessions collection left inside dd.json by an older build
instead of continuing to re-save it forever.
Replaces the shared-file-clobber reproduction test with
session-store-file.test.ts, asserting the two stores use different
files and that saving one never erases what the other wrote, including
the touch-driven case, a restart reload, and the legacy-collection
cleanup.
* docs(store): note the session store's own file and its DR-121 fix
The storage page said mounting /store persists "the state" without
naming what state, and now that sessions live in dd-sessions.json
rather than inside dd.json itself, that sentence needs to say so
explicitly so an operator mounting /store knows both files ride along.
CHANGELOG bullet describes the user-visible effect of DR-121: containers
or settings written after startup could vanish from dd.json after a
crash or hard stop, and every restart logged users out, because the
session store rewrote the same file. Notes that backups stay scoped to
the main store file and sessions are not included.
* fix(store): persist the legacy Sessions cleanup during init
dropLegacySessionsCollection() only removed the collection from the
in-memory Loki database. loadDb() resolved without a save(), and
autosave only fires on a later dirty write, so a store that never
writes again kept the stale Sessions collection in dd.json across a
restart. createCollections() now reports whether it dropped the
collection, and loadDb() flushes once when it did.
* fix(v1.8): keep dd.watch.digest across Portwing reports and share the lookup-label helper (#1067)
* fix(agent): keep dd.watch.digest for controller-Docker-transport containers across reports
preserveControllerDockerEnrichment restores a fixed list of controller-owned
top-level fields onto an incoming agent report, but image isn't among them.
Portwing hardcodes image.digest.watch to false on every "live runtime state"
report since digest watching is the controller's own bridged Docker watcher's
job, not Portwing's. Without restoring the field, that report wholesale-
replaces the stored image and silently turns digest watching back off for any
container the dd.watch.digest label had enabled.
* refactor(agent): share resolveLookupImageFromContainerLabels with the agent path
AgentClient's applyRegistryLookupLabels duplicated container-init.ts's
unexported resolveLookupImageFromContainerLabels. Export the helper and call
it from both sites instead; each site's own precedence check (agent-reported
lookupUrl/lookupImage beats the label, checked before the helper runs) is
unchanged.
* docs(changelog): note the DR-38 digest-watch fix
* test(agent): cover the report-without-image arm of the digest-watch restore
preserveControllerDockerEnrichment's digest.watch restore (DR-38) guards on
merged.image existing before spreading it, since EdgeAgentAdapter casts an
incoming dd:container_sync frame straight to Container[] with no schema
validation, so image can be missing at runtime despite the type. Add the
missing case: a stored container with image.digest.watch: true and an
incoming report with no image at all, asserting the restore does not throw
and does not fabricate an image.
* feat(store): open dd.sqlite alongside dd.json and add DD_STORE_DB_FILE (#1065)
* fix(store): keep synchronous=FULL when the WAL fallback lands on a rollback journal
applyOpenPragmas always set synchronous=NORMAL, which is only safe under WAL:
under a rollback journal (applyJournalMode's fallback when WAL is refused,
e.g. on NFS/CIFS) a crash between deleting and recreating the journal can
corrupt the database under NORMAL. It now takes the journal mode
applyJournalMode actually granted and uses FULL for a writable file-backed
database that isn't in WAL mode, keeping NORMAL under WAL and for read-only
or memory connections that never probed a journal mode at all.
* feat(store): open dd.sqlite alongside dd.json and add DD_STORE_DB_FILE
Slice 2 of the SQLite store plan (roadmap 7-STORE). init() now opens the
slice 1 SQLite driver at DD_STORE_DB_FILE (default dd.sqlite, next to
DD_STORE_FILE in the same store directory; :memory: in agent mode) and runs
the slice 1 migrations, so the schema exists from a fresh install onward.
save() checkpoints the SQLite WAL (PRAGMA wal_checkpoint(TRUNCATE))
everywhere it already flushes dd.json, getDebugSnapshot() reports the SQLite
path, and isMemoryStore() covers both engines. The same 0600/0700 permission
contract dd.json gets now also applies to dd.sqlite and its -wal/-shm
sidecars. Nothing reads from SQLite yet.
GET /api/v1/store gains configuration.dbFile next to the unchanged path and
file, documented in the OpenAPI schema and asserted in the store e2e feature.
DD_STORE_DB_FILE is parsed as its own flat field in getStoreConfiguration()
rather than through the generic dotted-path walk, which would otherwise nest
it under configuration.db.file.
* fix(v1.8): recovery image check, scheduled preflight failure events, skipped batch services (#1068)
* fix(lifecycle): check the image before marking a foreign container recovered-active
* fix(dockercompose): emit the failed lifecycle event when a scheduled preflight blocks
* fix(dockercompose): terminalize untouched batch services as skipped, naming the blocker
* test(dockercompose): cover the preflight blocking-context helpers
* fix(lifecycle): accept a digest-pinned image as a recovery match
reconcileWithActiveContainerOnly compared the active container's raw
Config.Image against the operation's recorded targetImage. The
replacement is created from the digest-pinned reference
bindPulledImageIdentity resolves (app:2.0@sha256:...), but targetImage
stays unpinned (it's a documented API field whose example shows a
plain repo:tag). Without newContainerId to identify the replacement by
id, the mismatch check saw app:2.0 vs app:2.0@sha256:... and marked
the executor's own replacement recovery-failed as foreign.
Strip the @sha256:... suffix from both sides before comparing instead
of rewriting targetImage to the pinned form, since other API consumers
(content/docs/current/api/container.mdx) expect the unpinned shape.
* feat(store): move app, secrets, settings and ui-preferences onto SQLite (#1073)
* feat(store): add collection importers for app, settings and ui-preferences
Registers the app, settings and ui-preferences collections into the
first-start import framework alongside the existing secrets worked example,
completing the set of leaf-singleton importers for roadmap 7-STORE slice 3.
settings.update_mode becomes nullable so the importer can carry a legacy
document straight across without replicating the "existing installations
predate the update-mode setting" migration itself; app/store/settings.ts's
own boot-time normalise-and-rewrite (unchanged in spirit, moved onto SQLite
in the next commit) is what turns a NULL into 'auto' for those installs.
* feat(store): move app, secrets, settings and ui-preferences onto SQLite
Roadmap 7-STORE slice 3: the four leaf singletons with the fewest consumers
move off LokiJS collections onto the SQLite tables slice 1 already created.
Each module's createCollections() now takes the SQLite Database and reads
and writes it directly; the module boundary consumers see (getAppInfos,
isUpgrade, getStoredSessionSecret, setStoredSessionSecret, getSettings,
updateSettings, getUpdateMode, isInternetlessModeEnabled, getPreferences,
replacePreferences) is unchanged. app is converted first since its version
record drives app/store/migrate.ts and has to be correct before anything
else reads a version.
settings.ts keeps its exact boot-time normalise-and-rewrite: a row whose
update_mode is NULL (only possible right after an import from a legacy
document that never had the field) still gets 'auto', preserving existing
installations' automatic-trigger behavior; a fresh install with no row still
defaults to the safer 'manual'.
store/index.ts wires app/store/db/import.ts's runFirstStartImport() into
init(), right before the SQLite database is opened for real: a database
that already exists is never re-imported, a fresh install with no legacy
dd.json creates an empty one, and an existing dd.json is imported — app
first, so the version comparison sees the right value — before dd.json is
renamed to dd.json.pre-1.8.bak. The four Loki collections are no longer
created, so their data is absent from new dd.json writes.
Covered by an end-to-end test against a real v1.7-era dd.json fixture,
verifying the import preserves the update mode and the session secret
across a restart, and by the existing-installations-get-auto case.
* docs(changelog): note the SQLite-backed leaf singletons and first-start import
Extend the slice-2 store bullet (rather than adding a new one) to cover
slice 3: app metadata, settings, the session secret and UI preferences now
read and write SQLite directly, imported from an existing dd.json on first
start before it's renamed to dd.json.pre-1.8.bak, app first since its
version drives app/store/migrate.ts. Update the DD_STORE_DB_FILE docs row
to match — it's no longer true that nothing reads from it.
* chore(qlty): exclude the store fixtures from checkov secret scanning
* perf(ui): reconcile display holds through id and identityKey maps (#1072)
* perf(ui): reconcile display holds through id and identityKey maps
reconcileHoldsAgainstContainers ran a find over the full container list
for every held operation on each SSE patch, and every read crossed the
deep-reactive proxy Vue wraps the container list in. Hoist the per-hold
eligibility check so an all-ineligible pass returns before the container
list is touched, toRaw the list once, and look a hold up by id or
identityKey through two maps built once per call instead of a linear
scan per hold. A name-only hold keeps the linear path.
* docs(ui): state the hold eligibility rule the right way round
* fix(v1.8): platform check in compose preflight, per-replica binding policy, digest exclusion log (#1075)
* fix(dockercompose): check platform compatibility in compose-file-once preflight
The compose-file-once preflight covered signature, scan and SBOM but
never checked the pulled image would run on the host. A single-arch
image that pulled cleanly but targeted the wrong platform passed the
preflight, recreated earlier services in the batch, and only failed
once it reached the wrong container, leaving a partial apply and a
partially rewritten compose file.
buildComposeFileOnceRuntimeContextByService now runs
verifyPulledImageCompatibility against the bound image identity right
after capturePulledImageIdentity, before any service in the batch is
touched or the compose file is rewritten (DR-41).
* fix(dockercompose): apply identity-binding policy per replica, not once per service
capturePulledImageIdentity was called once per service using the
first replica's getPostPullIdentityBindingPolicy, but replicas of the
same service can carry different dd.security.gate labels. A gate-off
replica resolving first let a gated replica scan the mutable tag
unbound, and the reverse aborted the whole batch including gate-off
replicas that never needed it. recordUnboundSecurityWarning also
fired twice for the first replica under warn.
capturePulledImageIdentity gains an optional bindingPolicyOverride
parameter; the service-level capture now forces 'optional' to get the
raw identity or reason with no policy applied, and
runComposeFileOncePostPullGate applies each container's own policy to
that raw result, so exactly one audit row lands per replica that
needs one (DR-42).
* fix(triggers): log the digest path's mustTrigger exclusion like the batch path
handleContainerReportDigest returned silently once mustTrigger() said
no, while the equivalent batch/simple path
(runUpdateAvailableSimpleTrigger) already logs the same exclusion.
This left a digest-excluded container invisible to anyone reading the
logs.
The digest path now logs the same debug line, naming the container
and the exclusion reason (DR-95).
* feat(store): move agent keys, name bindings and API keys onto SQLite (#1074)
Moves app/store/agent-keys.ts, name-bindings.ts and api-key.ts onto the
SQLite agent_keys, name_bindings, api_keys and api_key_scope tables
(roadmap 7-STORE, slice 4), with every exported function signature and
return shape unchanged so callers in app/api, app/agent and the
portwing hello path need no changes.
- importers and fixture: first-start importers for the agent-keys,
name-bindings and api-keys LokiJS collections, registered in
importers/index.ts, with a v1.7 fixture extended for an API key, a
scoped child key, an agent key and a name binding
- module conversions and tests: agent-keys.ts, name-bindings.ts and
api-key.ts read and write SQLite directly; scopes become rows in
api_key_scope ordered by insertion rowid; revokeApiKey's cascade is
a BFS walk of parent_key_id inside one transaction, pinned by a test
that captured the old LokiJS sibling-revocation order before
conversion so it stays identical
- API test conversions: app/api/api-keys.test.ts, api-key-auth.test.ts
and api-key-enforcement.integration.test.ts move off a real LokiJS
instance onto createMigratedMemoryDatabase()
- portwing restart tests: the name-bindings persistence describe block
in portwing-ws.test.ts moves its LokiJS-shaped restart mock onto the
same SQLite fixture, reusing one connection across each simulated
restart
- docs and changelog: extends the existing v1.8 SQLite changelog
bullet and the DD_STORE_DB_FILE storage doc row
- empty-scope coverage: a test for a key with no api_key_scope rows,
the shape a legacy import with an empty scopes array leaves behind
* ci: track the Dockerfile apk pins and allowlist doc placeholder credentials by pattern (#1077)
Three former units, squashed into one commit so a flagged fixture
line doesn't survive in history:
- Renovate has no built-in manager for apk pins, so an Alpine package
revision rotating with no advance notice (cosign 3.0.6-r1 -> -r2 on
2026-09-06) broke the Docker build check on every open PR at once.
A new customManagers regex entry in renovate.json extracts every
name=version-rN pin from the Dockerfile and resolves it through the
repology datasource's alpine_3_24 repository, the Alpine release the
Dockerfile's own alpine:3.24 stage pins.
- The webhooks doc's curl examples use the literal placeholder
your-token-here as the Bearer credential, and .gitleaksignore
carried one line-pinned curl-auth-header fingerprint per occurrence.
A promotion PR's base is main, which only gains ignore entries
through the promotion itself, so a docs edit that shifts those lines
(as happened to webhooks/index.mdx on 2026-09-06) re-triggers the
finding against main's stale line numbers. .gitleaks.toml now
allowlists the placeholder by pattern instead of by line, scoped to
content/docs/ and requiring both the path and the placeholder text
to match, so a docs reflow can't retrigger it and a real credential
anywhere else still fires. The redundant line-pinned
curl-auth-header entries for content/docs/ are removed from
.gitleaksignore, including the frozen v1.6 archive's copy, and
scripts/release-docs-archive.test.mjs's exact expected list is
updated to match.
- The workflow tests covering both changes assert the Dockerfile
regex against the live file, drive gitleaks itself against a
shifted copy of the webhooks doc and a control credential outside
content/docs, and the existing "no bare paths allowlist" guard in
ci-verify-workflow.test.ts is narrowed to permit a paths entry only
when paired with condition = "and" and a regexes match. The control
fixture is assembled from fragments at run time, with the header
name split across two string literals, so this file's own tracked
source never contains a literal curl command with an Authorization
header for gitleaks to flag.
* feat(store): move audit, backups, notification history and outbox onto SQLite (#1078)
* feat(store): import audit, backups, notification history and outbox from dd.json
Registers importers for the four append-only collections (roadmap 7-STORE
slice 5) alongside the existing ones: audit backfills timestamp_ms once,
at import, for a document that predates the indexed column; backups carries
container_identity_key across when present; notification history and the
outbox carry every field straight across. Extends the v1.7 fixture with one
row per collection (one audit row missing its timestampMs sibling to exercise
the backfill) and the first-start-import test with assertions against them.
* feat(store): move audit, backups, notification history and outbox onto SQLite
Rewrites the four modules (roadmap 7-STORE slice 5) as plain SQL against the
shared database instead of LokiJS collections. audit's dual chain/fallback
read path and its startup migrateMissingTimestampIndex scan collapse into one
indexed query for filtering, sorting and pagination, since timestamp_ms is now
NOT NULL and computed once at import; the hourly prune timer is unchanged.
The outbox's ready-for-delivery scan and terminal-entry purge are each a
single statement. backups gains a container_identity_key column, populated on
every write, but getBackupsByName stays the same name-keyed thin wrapper it
always was. Updates the one integration test that wired a fake Loki handle
into notificationOutboxStore.createCollections() to hand it a real in-memory
database instead, since the module now calls prepare() on it directly.
* docs: note audit, backups and notification storage moving onto SQLite
Extends the existing v1.8 SQLite changelog bullet with the audit, backups,
notification history and outbox move (roadmap 7-STORE slice 5), and updates
DD_STORE_DB_FILE's row in the storage docs to list what now lives there.
* test(store): cover the remaining slice 5 branches
Covers the branches the pre-push coverage gate flagged as never taken:
insertAudit's timestampMs fallback for a timestamp that fails Date.parse,
the audit importer's empty-timestamp fallback for a document that never
recorded one, the backups importer's NULL fallback for a missing containerId,
and the outbox importer carrying a deliveredAt string across. Also removes
getAuditEntries's dead totalRow/count fallback: a COUNT(*) query always
returns exactly one row with a numeric count, so there was no undefined-row
or nullish-count case for it to guard.
* fix(store): dedupe audit action filters and tighten the slice 5 tests
Dedupes the actions filter in buildWhereClause (a Set, preserving first-seen
order) before building the IN clause, so a repeated action can no longer
inflate the placeholder count or mint a new cached statement per distinct
length; the values are already validated against the fixed AuditEntry action
union upstream (app/api/audit.ts), which bounds both by the size of that set.
Adds a test asserting a repeated action returns the same page as the single
action and produces one placeholder.
Adds an insertAudit test that populates every optional AuditEntry field and
round-trips it through getAuditEntries, since every existing insert omitted
them and only exercised optionalString's null side indirectly.
Fixes the first-start-import test's audit fixture patch: it was assigning a
computed timestampMs onto the fixture record next to the one meant to
exercise the importer's timestamp backfill, which meant neither audit row
actually needed the backfill to survive the retention prune. Both rows now
import with no timestampMs sibling, and the test asserts each imported row's
timestamp_ms against Date.parse of its own timestamp directly, rather than
only inferring it from the row surviving pruning.
* fix(dockercompose): keep the post-pull gate outcome off the caller-supplied context (#1079)
imageIdentity, securityGateUnboundWarn, securityGateUnboundReason and
securityGateUnboundWarnRecorded are meant to come only from
capturePulledImageIdentity(), but trigger()/triggerBatch() accept an
unknown runtime-context argument and nothing stopped a value carrying
those same keys from being merged into a service's runtime context,
which decides what the post-pull gate verifies and scans and whether
it runs at all. No caller can reach this today (CWE-693, refuted on
that basis), but triggerBatch() now strips those keys from its
argument before it is threaded anywhere, closing the gap structurally
(DR-52).
* fix(watchers): gate stale scan side effects behind a per-scan generation (#1076)
* fix(watchers): gate stale scan side effects behind a per-scan generation
DR-72: a Docker watcher scan already inside watch() when the watcher is
deregistered kept emitting container reports, writing the snapshot, and
persisting store writes until it settled. watch() and watchContainer() now
capture a per-scan generation, bumped again on deregister, and skip those
side effects on a mismatch; the cron path skips resetting
isCronWatchInProgress the same way.
* fix(watchers): close the stale-scan windows the review found
DR-72's scanGeneration guard was self-minted by watch() itself, so a
concurrent watch() call on the same instance (an AgentWatcher's direct
delegate.watch(), a manual single-container scan) collided with a
cron run's own identity and could leave isCronWatchInProgress stuck
true forever with nothing left to clear it. It also stopped short of
three other windows: a post-watch() cron finish could still announce
a maintenance-window opening on a scan gone stale, getContainers()
pruned the store unconditionally after a deregistration mid-listing,
and the per-container and batch report emitters could still start a
snapshot after a deregistration mid-emit.
Splits the concern in two: scanGeneration stays deregistration-only
and read-only outside deregisterComponent(), and a new
cronRunGeneration field, minted fresh by every cron run, gates only
the isCronWatchInProgress reset. runCronWatch() now also bails out
before computing stats or announcing a maintenance-window opening
once its captured scanGeneration goes stale. getContainers() takes an
options.scanGeneration and skips the prune (and the gauge update)
when it no longer matches. watch() rechecks scanGeneration after each
awaited report emission and again before the snapshot.
* test(watchers): cover the fallback-emit and cron-run generation guards
Docker.watch.test.ts: deregister from inside the per-container fallback
emitContainerReport() handler and assert watch() discards the scan
there instead of reaching the batch emit or the snapshot - the
recheck at Docker.ts's fallback-loop guard had no test exercising its
true branch.
docker-cron-watch.test.ts: run the post-watch() stale-scan discard
with a logger that has no debug method, so the guard around that log
call takes its false branch instead of always finding one to call.
* ci(dast): bound the ZAP spider and active scan inside the job budget (#1081)
* ci(dast): bound the ZAP spider and active scan inside the job budget
* test(ci): floor the ZAP scan caps instead of only checking the budget
* feat(store): move notification rules and approvals onto SQLite (#1086)
* feat(store): import notification rules and approvals from dd.json
Adds the notification-rules and approvals collection importers (roadmap
7-STORE slice 6), registers them in the importer registry, and extends the
v1.7 fixture with a rule carrying trigger allow-lists and template overrides
plus a pending and a decided approval. Extends the first-start import test to
assert both round-trip through the real SQLite-backed store modules.
* feat(store): move notification rules and approvals onto SQLite
Roadmap 7-STORE slice 6. Both modules keep every exported function signature
and return shape unchanged; rule trigger and template allow-lists live in
notification_rule_trigger/notification_rule_template, decideApprovalIfPending
is a compare-and-set inside BEGIN IMMEDIATE (one UPDATE ... WHERE
status = 'pending' plus a change-count check), and listApprovals' filtering
and pagination are SQL. Adds the approvals.operation_id index that was
deferred to this slice, and wires both modules' createCollections to the
SQLite database in store/index.ts.
* test(approvals): move the reconcile test off its LokiJS db
approvals/reconcile.test.ts built a real new Loki() for approvalStore's
collection; now wires a migrated in-memory SQLite database instead, matching
the module it exercises (roadmap 7-STORE slice 6). api/notification.test.ts
and api/approvals.test.ts already fully mock the store layer and needed no
change.
* docs(store): note notification rules and approvals in dd.sqlite
Extends the existing v1.8 SQLite Changed bullet and the DD_STORE_DB_FILE row
to cover the roadmap 7-STORE slice 6 move.
* test(store): expect the rules and approvals tables in the import summary
* feat(store): move the two update caches onto SQLite keyed by identity (#1091)
* feat(store): add SQLite importers for the two update caches
Registers importers that map a legacy dd.json update-lifecycle-cache row's
watcher::name key forward to the identity key of the container that still
holds it, dropping rows whose container is gone or whose legacy key is now
ambiguous between two containers. The retention cache is already keyed on
identity, so its importer carries rows across unchanged. Extends the
dd-v1.7.json fixture and the first-start import test with rows for both
caches, and the import rowsByTable expectations with the two new tables.
* feat(store): move the two update caches onto SQLite
Moves update-lifecycle-cache.ts and update-policy-retention-cache.ts onto
the SQLite tables slice 1 already created, with public function signatures
unchanged. The lifecycle cache's key moves from `${watcher}::${name}` to
the same identity key the retention cache already used, so a compose
container recreated under a new name (Compose regenerates the container
name from the project, service and an ordinal, but the compose labels stay
put) now inherits its predecessor's maturity clock. container.ts's
insertContainer and deleteContainer derive the lifecycle cache key the same
way the retention cache already does, guarding the rare case where a
container has no derivable identity. store/index.ts wires both caches'
createCollections calls to sqliteDb instead of the LokiJS db, preserving
the existing rehydration order.
* docs(store): note the two update caches' move to SQLite
Extends the v1.8 SQLite store CHANGELOG entry and the storage config docs
to name the update-lifecycle and update-policy-retention caches among the
tables DD_STORE_DB_FILE now holds, matching how slice 6 documented its
tables.
* fix(store): upsert the retention-cache import on a duplicate legacy cacheKey
A plain INSERT in the update-policy-retention-cache importer threw on the
second of two legacy dd.json documents sharing a cacheKey, failing the whole
first-start import transaction on a corrupted or hand-edited store. Upsert
with the same ON CONFLICT shape the module's own upsertRecord() already uses,
so the later document wins instead.
Checked the sibling update-lifecycle-cache importer for the same shape: its
insert.run() is already gated on a seenNewKeys check immediately before it
runs, so it can never attempt two inserts for the same cache_key and needed
no change. Pinned that down with a regression test.
* fix(store): order lifecycle/retention cache rehydration by refresh, not document order
Eviction in container.ts reads Map insertion order as its LRU for both the
update-lifecycle-cache and update-policy-retention-cache Maps, but rehydration
fed that Map from a SELECT with no ORDER BY, and an upsert never moves a row's
rowid. A just-refreshed entry could resurface ahead of the row it should have
outlived after a restart. The retention cache masked this by re-sorting on
expiresAt in container.ts, but that only approximates refresh order (every
stash shares one TTL) and ties on equal timestamps; the lifecycle cache had no
such sort at all.
Add a refresh_order column to both tables (migration 3), a monotonic per-
database counter in each store module bumped on every upsert and seeded from
the table's current max on open, and order listRecords() by it. container.ts's
two rehydrate functions now just consume that order instead of re-deriving it.
Both importers assign refresh_order in legacy document order on first-start
import, the only ordering evidence available at that point.
* feat(store): move containers onto SQLite with a whole-record write shim (#1096)
* feat(store): move containers onto SQLite
Moves container.ts onto the containers table slice 1 already created, with
public function signatures unchanged. Every read (getContainer,
getContainers, getContainerCount and their raw/stats variants) queries SQL
instead of a LokiJS collection. updateContainer is reimplemented as a
diff-then-patch: SELECT the current row, run the existing merge logic
unchanged, then UPDATE it in place if it exists or INSERT it if it doesn't,
replacing Loki's remove-and-reinsert fallback with a real update. The
in-memory query cache and its reverse index are unchanged, since neither
depended on Loki. Adds two columns the initial schema (slice 1) planned the
containers table around but never got right - source_repo and
current_release_notes - as migration 3, since both are nullable and need no
backfill. store/index.ts wires container.ts's createCollections call to
sqliteDb instead of the LokiJS db.
container.test.ts now runs every case against a real in-memory migrated
database instead of a hand-rolled LokiJS collection double, exercising the
same buildImportedContainerRow/insertImportedContainerRow helpers a live
import uses to seed fixtures. Loki-internals assertions (collection.find/
update call spies) are replaced with behavioral assertions, cache-key
assertions against the existing _getContainersQueryCacheForTests hook, or
db.prepare call-count spies against the real driver. A few cases relied on
Loki quirks that have no SQL equivalent: a literal override of a
Joi-derived field (updateAvailable) can't survive a real write, and a Map/
RegExp/Date value in labels can't survive the JSON TEXT column round trip
LokiJS never required - both are covered against cloneContainer directly
instead. AgentClient.container-reconcile.test.ts and
registry/index.container-reconcile.test.ts, which deliberately exercise the
real store module instead of mocking it, move from a real LokiJS collection
to a real migrated SQLite database the same way.
* feat(store): add a SQLite importer for containers
Unlike every other importer in this registry, this one reuses
container.ts's own buildImportedContainerRow/insertImportedContainerRow
helpers instead of hand-writing the column mapping a second time: the
containers table has by far the largest column count of any table in the
schema, most of it grouped JSON rather than flat scalars, and every column
is derived from validateContainer() exactly the way a fresh
insertContainer() would derive it. A document that fails validation is
skipped, the same as every other importer's convention for an unusable
document. Extends the dd-v1.7.json fixture and the first-start import test
with a container row, and the import rowsByTable expectations with the
containers table.
* docs(store): note containers' move to SQLite
Extends the v1.8 SQLite store CHANGELOG entry and the storage config docs
to name containers among the tables DD_STORE_DB_FILE now holds, matching
how slice 7 documented the two update caches.
* test(store): move the session-file and recovery integration tests onto the SQLite containers table
* docs(store): point the schema comment at migration 4
* fix(store): patch container fields instead of writing whole records (#1097)
* feat(store): add field-level container writes (roadmap 7-STORE slice 9)
Add updateContainerFields(id, patch) to write only the caller's named
fields inside one transaction, inheriting everything else from a fresh
read of the current row instead of a caller's possibly-stale in-memory
copy. Recomputes the derived lifecycle fields and the security hash
inside the same transaction, and emits containerUpdated/containerRemoved
the same way updateContainer does for a whole-record write.
Covers the per-field patch, multi-field patch, the !db and
missing-row guards, the derived-field recompute, a name-only delta
emitting containerUpdated exactly once (DR-24), the no-op no-emit
case, a health transition independent of the rest of the patch, the
security hash recompute (patched vs untouched), and both rollback
transitions.
Also adds the two interleave acceptance tests from spec 4.3: a rename
applied by the event path mid-scan survives the scan's own write, and
the scan's result survives a rename applied after it, using the real
updateContainerFromInspect and mapContainerToContainerReport against
an in-memory SQLite store. Both failed before this slice, since
updateContainer's whole-record write let whichever writer finished
last silently revert the other's fields.
* fix(watchers): move Docker event and scan writes onto field-level patches
Move the two whole-record writers named in spec-7-store-sqlite.md 4.3
onto updateContainerFields, so an event-path rename and a watch-cycle
scan result can interleave without one clobbering the other.
container-event-update.ts's updateContainerFromInspect now builds a
patch of only the fields it actually changed (status, health, name,
labels plus the label-derived fields, details, display name) and calls
dependencies.updateContainer(id, patch) instead of handing over the
whole in-memory container. container-processing.ts's
mapContainerToContainerReport patches only the fields a scan cycle
owns: result, image, error, and the release notes derived from result.
Docker.ts's event-path dependency wiring is updated to match.
container-init.ts's separate updateContainer call for a stopped
container kept in watch scope is out of scope for this slice and is
unchanged.
Updates the affected watcher tests for the new call signature.
* docs(changelog): note the container write clobber fix (v1.8, slice 9)
* fix(watchers): persist scan-observed runtime state at inspect time
Slice 9's narrower scan patch (mapContainerToContainerReport) writes only
result/image/error/currentReleaseNotes, so the runtime fields the stored-
container discovery branch refreshes from a fresh inspect/summary (name,
displayName, health, details, status) stopped reaching the store once the
whole-record write went away. A health flip seen only by that branch (the
cron #198 fallback, or a targeted POST /api/v1/containers/:id/watch refresh)
was computed in memory but never persisted, since findNewVersion's registry
lookup can run long enough for the observation to go stale before any write
happens.
Write those observed fields immediately after they're computed, before the
registry lookup starts, so the inspect-to-write gap stays negligible per
spec 4.3. image is left out of this write; it's still being resolved by
refreshStoredContainerImageFields and lands via the scan patch once that
settles.
* fix(store): stop a stray patch id from redirecting updateContainerFields
Partial<Container> let a patch carry a different id than the one the caller
looked the row up by. Since that id would win the merge and land in
WHERE id = ?, a stray id on the patch (an untyped object, `as any`, whatever
bypasses the type) could write a different row, or report a change under an
id nothing here actually wrote.
Type the patch as Omit<Partial<Container>, 'id'> (both here and on the
event-path callback's type in container-event-update.ts) and restore the
looked-up id after the merge as a runtime backstop.
* fix(watchers): persist declarative update-policy fields on label changes
LABEL_DERIVED_PATCH_FIELDS omitted updatePolicy/updatePolicyDeclarative/
updatePolicyOverrides/updatePolicySources, but applyEffectiveDockerConfigFromLabels
(via applyDockerDeclarativeUpdatePolicy -> applyDeclarativeUpdatePolicy) mutates
exactly those four fields on the container whenever labels change. Since the
event path's patch is diffed off LABEL_DERIVED_PATCH_FIELDS, a label change
that only touched the declarative update policy updated memory but never
reached the store.
Add the four fields to the constant. The pre-slice-9 updateContainer
whole-record write did persist them (it received the whole mutated
container object, and updateContainer's own hasOwn checks pick the
caller's value over the stored row's whenever the property is present) —
this closes a gap slice 9's field-level write introduced, not a
longer-standing one.
* feat(store)!: move update operations onto SQLite and cut container identity over to identity keys (#1099)
* feat(store): move update operations onto SQLite
Moves update-operation.ts onto the update_operations table (roadmap
7-STORE, slice 10) and makes the identity cut: every by-name lookup
becomes by-identity, taking a single durable identityKey (agent::
watcher::name, or the Compose-aware project/service form) instead of
a container name plus an optional agent/watcher filter object.
getActiveOperationByContainerName, getInProgressOperationByContainerName,
getOperationsByContainerName, getRecentTerminalSucceededOperationByContainerName
and hasOtherActiveOperationByContainerName are renamed to their
...ByContainerIdentity forms and take exactly one identityKey argument,
doing strict SQL equality against the row's own container_identity_key.
The old two-tier "match by name, then optionally narrow by agent/watcher"
ContainerIdentityFilter mechanism is gone - this is an intentional
behavior change, not just a rename: an identity that fails to resolve,
or a row with none, simply never matches, with no bare-name fallback.
classifyDuplicateOpTerminalStatus (updates/duplicate-op-classification.ts)
follows the same shape: identityKey moves to a single positional
argument ahead of windowMs/excludeOperationId.
Every caller is updated to match: request-update.ts, the API list/crud/
actions handlers, sse-container-enrichment.ts, ContainerUpdateExecutor.ts,
Docker.ts, Portainer.ts, and self-update-operation.ts. Adds a SQLite
importer (store/db/importers/update-operations.ts) reusing update-
operation.ts's own buildImportedUpdateOperationRow/
insertImportedUpdateOperationRow helpers, extends the dd-v1.7.json
fixture and first-start-import test with update-operation rows (one
with a resolvable identity, one legacy row with none), and wires
store/index.ts's createCollections call to the SQLite database.
Test files across store/, api/, updates/, triggers/providers/docker/,
triggers/providers/dockercompose/, triggers/providers/portainer/, and
model/ move off hand-rolled LokiJS-shaped test doubles onto
createMigratedMemoryDatabase() and real SQL assertions, and every
vi.mock('.../store/update-operation.js', ...) stub is updated to the
renamed exports. Scenarios that only made sense under the old filter's
short-circuit rules (e.g. "identity.watcher absent skips the lookup")
have no equivalent under single-key equality and are replaced with
tests of the new stricter behavior.
* refactor(store): key backups by container identity
Backups move off name-based ownership onto the durable identity key
(roadmap 7-STORE, slice 10, spec 2.3): getBackupsForContainer and
pruneOldBackups now query WHERE container_identity_key = ? directly
instead of filtering a by-name result set through the includeLegacy
heuristic. createContainerBackupScope drops the includeLegacy
computation and its sameNamedContainers parameter entirely -
isBackupInScope is now a plain identity-key comparison with no legacy
branch. A backup made under an identity before a rename or recreate is
still found; a legacy backup carrying no identity is never matched by
any scope, deliberately.
Every caller drops the now-unnecessary getContainers() call that fed
the old heuristic: Docker.ts's resolveContainerBackupScope and
api/backup.ts's getContainerBackupScope both call
createContainerBackupScope(container) directly. HealthMonitor.ts and
RollbackMonitor.ts only carry the ContainerBackupScope type through
unchanged, since neither constructs one.
The backups importer backfills identity for legacy rows: a
containerName that matches exactly one imported container resolves to
that container's identity_key; zero or multiple matches stay NULL and
are counted in one summary log line. This importer moves to run after
containersImporter in the registry so the backfill query sees the
imported rows. The dd-v1.7.json fixture gains a resolvable legacy
backup (matches the single 'full-app' container) and a genuinely
ambiguous one (matches two 'shared-svc' containers under different
watchers), both covered in index.first-start-import.test.ts.
* feat(mqtt)!: derive topics and unique_id from container identity
MQTT state topics and the Home Assistant discovery unique_id were both
built from the container's current name, so a rename or a Compose
recreate changed them and orphaned the HA entity behind a duplicate
"Unknown" ghost.
State topics are now `${baseTopic}/${watcher}/${identitySlug}`, where
identitySlug is the Compose project-service pair when the container
carries com.docker.compose.* labels (getContainerIdentitySlug in
naming.ts, backed by the existing getComposeProjectService extracted
from model/container.ts's deriveContainerIdentityKey), falling back to
the sanitized container name otherwise. unique_id is now
dd_ + the first 12 hex characters of sha256(identity_key)
(getHassUniqueId in Hass.ts), independent of the topic entirely, so it
survives both a rename and a Compose recreate.
A one-time post-upgrade sweep (Hass.cleanupLegacyIdentityTopics, run
from resyncDiscovery) publishes an empty retained message on every
pre-v1.8 name-based discovery topic so Home Assistant prunes the old
entity instead of duplicating it. It is guarded by a store_metadata
marker (app/store/mqtt-hass.ts) so it runs at most once, reusing the
same generic key/value table the legacy-JSON import marker already
uses rather than adding a table or a column.
BREAKING CHANGE: hand-written subscriptions to drydock's MQTT state
topics must be updated to the new identity-based shape.
* docs: record the MQTT topic change and the identity cut
Document the breaking MQTT/Home Assistant identity change from the
previous commit: a DEPRECATIONS.md entry describing the new topic and
unique_id shape, the automatic one-time discovery cleanup, and the
migration path for hand-written subscriptions; the mqtt trigger doc
page updated with the new topic shape and an upgrade callout; and
CHANGELOG.md's v1.8 Unreleased section gets the breaking Changed
bullet plus two Fixed bullets for the rename/recreate bugs it closes
(backups unreachable after a rename, HA entities orphaned by one).
* test(mqtt): pin unique_id stability across a rename and a recreate
Adds the direct unique_id-stability assertion the identity cut needed:
addContainerSensor for a compose-identified container three times (an
id, the same id renamed, then a new id after a recreate) publishes the
same unique_id all three times.
* test(store): select the store logger by component instead of call order
* fix(store): upsert imported update-operation rows instead of a plain insert
A second import of the same legacy snapshot (a restarted first-start
import, a re-run migration) threw a UNIQUE constraint error on `id`.
insertImportedUpdateOperationRow now upserts on conflict, the same
shape update-policy-retention-cache's importer already uses.
* perf(store): project only id/timestamps for the update-operation retention sweep
pruneOperationsForRetention ran a plain SELEC…
* chore(i18n): sync translations from Crowdin (#1053) Co-authored-by: Crowdin Bot <[email protected]> * fix(v1.8): pinned-tag shape check, rename events, and handshake body validation (#1061) * fix(tag): stop isTagPinned treating every non-rolling tag as pinned The tail of isTagPinned() fell through to an unconditional return true after checking for a numeric version shape, so a bare distro or variant tag with no version number (redis:alpine, node:slim, postgres:bookworm, fpm-alpine, production) was reported as pinned and hidden by the Hide Pinned UI filter alongside genuinely pinned releases like 1.4.5 or 16-alpine. It now returns the numeric-shape check's own result. Also corrects the watchers doc, which described Hide Pinned as reading tagPrecision when it actually reads the shape-based tagPinned field. * fix(store): emit containerUpdated on a name or displayName delta hasContainerChangedWithSecurityHashes compared neither name nor displayName, so a docker rename persisted to the store without ever satisfying the check that gates containerUpdated. SSE rows, Prometheus gauge labels, and MQTT topics kept the old name until an unrelated field also changed. Both fields are now part of the comparison. * fix(agent): reject a non-array handshake containers body before deregistering triggers AgentClient._doHandshake validated nothing about the /api/containers response body, so an object, string, or number body threw inside processAuthoritativeContainers after deregisterAgentComponents had already run and before trigger re-registration reached it. handleAckEvent only logs the failure, and dd:ack fires once per connection, so the agent's triggers stayed deregistered with no retry. The body is now checked with Array.isArray immediately after the request and rejected before any registry mutation, with a warning naming the agent and the body's type. * feat(store): add the node:sqlite driver, schema and first-start import framework (#1059) * feat(store): add a swappable node:sqlite driver for the v1.8 store Groundwork for 7-STORE. Nothing imports it yet. The driver owns transaction(), pragma(), error normalisation and backup() rather than exposing the engine's own API, because those are exactly the places node:sqlite and better-sqlite3 disagree. Keeping them here is what makes the driver choice a one-file swap later instead of a rewrite spread across every store module. Opening applies the store's pragmas in a fixed order and probes for WAL, falling back to TRUNCATE with a warning when the filesystem refuses it, since /store is routinely an NFS or CIFS mount with no shared memory. A memory database skips the probe so agent mode never warns. * feat(store): add the v1.8 SQLite schema and its migration runner The full DDL for every collection in the store, plus schema_migrations and a store_metadata table for bookkeeping that is not schema versioning. Every table is STRICT, so a type mistake is a write-time error rather than a silently coerced value, which is the class of bug the JSON store could not catch at all. A field is a column when the code queries, filters, sorts or individually patches it; everything else is JSON in a TEXT column, and the five payloads the store is documented never to inspect are never indexed. The runner records applied versions and applies only what is missing, so running it against an already migrated database does nothing. Each run is one transaction, so a migration that throws leaves the schema and the bookkeeping consistent with each other. * feat(store): add the first-start import framework for the v1.8 store Reads a serialised LokiJS database, serves both the flat and the {data} enveloped document shapes, and runs a registry of per-collection importers into SQLite. secrets is implemented as the worked example; later slices add one entry to the registry each. The whole import runs into <database>.importing inside one transaction and is renamed into place only once it has succeeded, so a partial import is never visible under the real filename and a crash anywhere before the rename leaves dd.json untouched for the next start to retry. A leftover .importing file is discarded rather than resumed: resuming correctly would need per-collection progress tracking, which a one-shot operation does not justify. A marker row in store_metadata makes a second import into the same database a no-op even when it is called directly. dd.json becomes dd.json.pre-1.8.bak once the rename lands, and an existing backup is never overwritten, since that file is the whole rollback story for a downgrade to v1.7. Sessions are read from the dedicated sessions file when DR-121 has already split them out, and from the Sessions collection in dd.json otherwise. * docs(changelog): note the v1.8 SQLite store groundwork * chore(store): hold the new store db exports to what something reaches knip runs over the app workspace and reports an export nothing imports. Three of these were real: the import status union is only ever read through FirstStartImportResult, so it stops being exported, and the reader's two public constants were duplicated as string literals in their own test instead of being used. The rest are the driver's type surface, which is the point of the module and stays exported. A test now pins it by annotating each of Statement, Row, SqlValue, SqlBinding, StatementRunResult and TransactionMode at a real call site, which also covers the exclusive transaction mode nothing else exercised. * fix(store): fsync the store directory after each import rename The directory fsync ran before the temp-database rename and the legacy backup rename, so neither directory entry change was durably persisted on crash. Move the sync after each rename instead. * fix(store): normalize errors thrown while iterating a statement node:sqlite evaluates iterate() lazily: the call that produces the iterator never touches the database, only each next() does. Wrapping just that call left every later step unguarded, so an error thrown mid-scan surfaced as the raw ERR_SQLITE_ERROR instead of a StoreError. Wrap next() and return() through the same guard. * test(store): cover the no-return-method branch of the iterator wrapper wrapIterator only sets return() when the underlying iterator has one; every real and previously-mocked iterator in the suite had one, so that branch never ran and the 100% coverage gate caught it. * fix(store): stop the session store and main store clobbering dd.json (#1055) * fix(store): stop the session store and main store clobbering dd.json DR-121: express-session's connect-loki store opened its own LokiJS instance directly on ${configuration.path}/${configuration.file}, the exact file the main store already used. LokiJS's saveDatabase() always serializes the whole in-memory database, so whichever instance saved last erased the other's writes: a session autosave (every 5 seconds, armed by any authenticated request touching its session via express-session's touch) reverted every container and setting written since boot, while the main store's own autosave deleted the Sessions collection out from under active logins. store.getSessionStorePath() now derives a sibling file from the main store's own configured path and file name (dd.json -> dd-sessions.json by default), so a custom DD_STORE_FILE still lands on a distinct sibling instead of colliding with anything else on the volume. auth.ts's LokiStore now points at that path instead of building the main store's own file path by hand. The main store also drops and logs a stale Sessions collection left inside dd.json by an older build instead of continuing to re-save it forever. Replaces the shared-file-clobber reproduction test with session-store-file.test.ts, asserting the two stores use different files and that saving one never erases what the other wrote, including the touch-driven case, a restart reload, and the legacy-collection cleanup. * docs(store): note the session store's own file and its DR-121 fix The storage page said mounting /store persists "the state" without naming what state, and now that sessions live in dd-sessions.json rather than inside dd.json itself, that sentence needs to say so explicitly so an operator mounting /store knows both files ride along. CHANGELOG bullet describes the user-visible effect of DR-121: containers or settings written after startup could vanish from dd.json after a crash or hard stop, and every restart logged users out, because the session store rewrote the same file. Notes that backups stay scoped to the main store file and sessions are not included. * fix(store): persist the legacy Sessions cleanup during init dropLegacySessionsCollection() only removed the collection from the in-memory Loki database. loadDb() resolved without a save(), and autosave only fires on a later dirty write, so a store that never writes again kept the stale Sessions collection in dd.json across a restart. createCollections() now reports whether it dropped the collection, and loadDb() flushes once when it did. * fix(v1.8): keep dd.watch.digest across Portwing reports and share the lookup-label helper (#1067) * fix(agent): keep dd.watch.digest for controller-Docker-transport containers across reports preserveControllerDockerEnrichment restores a fixed list of controller-owned top-level fields onto an incoming agent report, but image isn't among them. Portwing hardcodes image.digest.watch to false on every "live runtime state" report since digest watching is the controller's own bridged Docker watcher's job, not Portwing's. Without restoring the field, that report wholesale- replaces the stored image and silently turns digest watching back off for any container the dd.watch.digest label had enabled. * refactor(agent): share resolveLookupImageFromContainerLabels with the agent path AgentClient's applyRegistryLookupLabels duplicated container-init.ts's unexported resolveLookupImageFromContainerLabels. Export the helper and call it from both sites instead; each site's own precedence check (agent-reported lookupUrl/lookupImage beats the label, checked before the helper runs) is unchanged. * docs(changelog): note the DR-38 digest-watch fix * test(agent): cover the report-without-image arm of the digest-watch restore preserveControllerDockerEnrichment's digest.watch restore (DR-38) guards on merged.image existing before spreading it, since EdgeAgentAdapter casts an incoming dd:container_sync frame straight to Container[] with no schema validation, so image can be missing at runtime despite the type. Add the missing case: a stored container with image.digest.watch: true and an incoming report with no image at all, asserting the restore does not throw and does not fabricate an image. * feat(store): open dd.sqlite alongside dd.json and add DD_STORE_DB_FILE (#1065) * fix(store): keep synchronous=FULL when the WAL fallback lands on a rollback journal applyOpenPragmas always set synchronous=NORMAL, which is only safe under WAL: under a rollback journal (applyJournalMode's fallback when WAL is refused, e.g. on NFS/CIFS) a crash between deleting and recreating the journal can corrupt the database under NORMAL. It now takes the journal mode applyJournalMode actually granted and uses FULL for a writable file-backed database that isn't in WAL mode, keeping NORMAL under WAL and for read-only or memory connections that never probed a journal mode at all. * feat(store): open dd.sqlite alongside dd.json and add DD_STORE_DB_FILE Slice 2 of the SQLite store plan (roadmap 7-STORE). init() now opens the slice 1 SQLite driver at DD_STORE_DB_FILE (default dd.sqlite, next to DD_STORE_FILE in the same store directory; :memory: in agent mode) and runs the slice 1 migrations, so the schema exists from a fresh install onward. save() checkpoints the SQLite WAL (PRAGMA wal_checkpoint(TRUNCATE)) everywhere it already flushes dd.json, getDebugSnapshot() reports the SQLite path, and isMemoryStore() covers both engines. The same 0600/0700 permission contract dd.json gets now also applies to dd.sqlite and its -wal/-shm sidecars. Nothing reads from SQLite yet. GET /api/v1/store gains configuration.dbFile next to the unchanged path and file, documented in the OpenAPI schema and asserted in the store e2e feature. DD_STORE_DB_FILE is parsed as its own flat field in getStoreConfiguration() rather than through the generic dotted-path walk, which would otherwise nest it under configuration.db.file. * fix(v1.8): recovery image check, scheduled preflight failure events, skipped batch services (#1068) * fix(lifecycle): check the image before marking a foreign container recovered-active * fix(dockercompose): emit the failed lifecycle event when a scheduled preflight blocks * fix(dockercompose): terminalize untouched batch services as skipped, naming the blocker * test(dockercompose): cover the preflight blocking-context helpers * fix(lifecycle): accept a digest-pinned image as a recovery match reconcileWithActiveContainerOnly compared the active container's raw Config.Image against the operation's recorded targetImage. The replacement is created from the digest-pinned reference bindPulledImageIdentity resolves (app:2.0@sha256:...), but targetImage stays unpinned (it's a documented API field whose example shows a plain repo:tag). Without newContainerId to identify the replacement by id, the mismatch check saw app:2.0 vs app:2.0@sha256:... and marked the executor's own replacement recovery-failed as foreign. Strip the @sha256:... suffix from both sides before comparing instead of rewriting targetImage to the pinned form, since other API consumers (content/docs/current/api/container.mdx) expect the unpinned shape. * feat(store): move app, secrets, settings and ui-preferences onto SQLite (#1073) * feat(store): add collection importers for app, settings and ui-preferences Registers the app, settings and ui-preferences collections into the first-start import framework alongside the existing secrets worked example, completing the set of leaf-singleton importers for roadmap 7-STORE slice 3. settings.update_mode becomes nullable so the importer can carry a legacy document straight across without replicating the "existing installations predate the update-mode setting" migration itself; app/store/settings.ts's own boot-time normalise-and-rewrite (unchanged in spirit, moved onto SQLite in the next commit) is what turns a NULL into 'auto' for those installs. * feat(store): move app, secrets, settings and ui-preferences onto SQLite Roadmap 7-STORE slice 3: the four leaf singletons with the fewest consumers move off LokiJS collections onto the SQLite tables slice 1 already created. Each module's createCollections() now takes the SQLite Database and reads and writes it directly; the module boundary consumers see (getAppInfos, isUpgrade, getStoredSessionSecret, setStoredSessionSecret, getSettings, updateSettings, getUpdateMode, isInternetlessModeEnabled, getPreferences, replacePreferences) is unchanged. app is converted first since its version record drives app/store/migrate.ts and has to be correct before anything else reads a version. settings.ts keeps its exact boot-time normalise-and-rewrite: a row whose update_mode is NULL (only possible right after an import from a legacy document that never had the field) still gets 'auto', preserving existing installations' automatic-trigger behavior; a fresh install with no row still defaults to the safer 'manual'. store/index.ts wires app/store/db/import.ts's runFirstStartImport() into init(), right before the SQLite database is opened for real: a database that already exists is never re-imported, a fresh install with no legacy dd.json creates an empty one, and an existing dd.json is imported — app first, so the version comparison sees the right value — before dd.json is renamed to dd.json.pre-1.8.bak. The four Loki collections are no longer created, so their data is absent from new dd.json writes. Covered by an end-to-end test against a real v1.7-era dd.json fixture, verifying the import preserves the update mode and the session secret across a restart, and by the existing-installations-get-auto case. * docs(changelog): note the SQLite-backed leaf singletons and first-start import Extend the slice-2 store bullet (rather than adding a new one) to cover slice 3: app metadata, settings, the session secret and UI preferences now read and write SQLite directly, imported from an existing dd.json on first start before it's renamed to dd.json.pre-1.8.bak, app first since its version drives app/store/migrate.ts. Update the DD_STORE_DB_FILE docs row to match — it's no longer true that nothing reads from it. * chore(qlty): exclude the store fixtures from checkov secret scanning * perf(ui): reconcile display holds through id and identityKey maps (#1072) * perf(ui): reconcile display holds through id and identityKey maps reconcileHoldsAgainstContainers ran a find over the full container list for every held operation on each SSE patch, and every read crossed the deep-reactive proxy Vue wraps the container list in. Hoist the per-hold eligibility check so an all-ineligible pass returns before the container list is touched, toRaw the list once, and look a hold up by id or identityKey through two maps built once per call instead of a linear scan per hold. A name-only hold keeps the linear path. * docs(ui): state the hold eligibility rule the right way round * fix(v1.8): platform check in compose preflight, per-replica binding policy, digest exclusion log (#1075) * fix(dockercompose): check platform compatibility in compose-file-once preflight The compose-file-once preflight covered signature, scan and SBOM but never checked the pulled image would run on the host. A single-arch image that pulled cleanly but targeted the wrong platform passed the preflight, recreated earlier services in the batch, and only failed once it reached the wrong container, leaving a partial apply and a partially rewritten compose file. buildComposeFileOnceRuntimeContextByService now runs verifyPulledImageCompatibility against the bound image identity right after capturePulledImageIdentity, before any service in the batch is touched or the compose file is rewritten (DR-41). * fix(dockercompose): apply identity-binding policy per replica, not once per service capturePulledImageIdentity was called once per service using the first replica's getPostPullIdentityBindingPolicy, but replicas of the same service can carry different dd.security.gate labels. A gate-off replica resolving first let a gated replica scan the mutable tag unbound, and the reverse aborted the whole batch including gate-off replicas that never needed it. recordUnboundSecurityWarning also fired twice for the first replica under warn. capturePulledImageIdentity gains an optional bindingPolicyOverride parameter; the service-level capture now forces 'optional' to get the raw identity or reason with no policy applied, and runComposeFileOncePostPullGate applies each container's own policy to that raw result, so exactly one audit row lands per replica that needs one (DR-42). * fix(triggers): log the digest path's mustTrigger exclusion like the batch path handleContainerReportDigest returned silently once mustTrigger() said no, while the equivalent batch/simple path (runUpdateAvailableSimpleTrigger) already logs the same exclusion. This left a digest-excluded container invisible to anyone reading the logs. The digest path now logs the same debug line, naming the container and the exclusion reason (DR-95). * feat(store): move agent keys, name bindings and API keys onto SQLite (#1074) Moves app/store/agent-keys.ts, name-bindings.ts and api-key.ts onto the SQLite agent_keys, name_bindings, api_keys and api_key_scope tables (roadmap 7-STORE, slice 4), with every exported function signature and return shape unchanged so callers in app/api, app/agent and the portwing hello path need no changes. - importers and fixture: first-start importers for the agent-keys, name-bindings and api-keys LokiJS collections, registered in importers/index.ts, with a v1.7 fixture extended for an API key, a scoped child key, an agent key and a name binding - module conversions and tests: agent-keys.ts, name-bindings.ts and api-key.ts read and write SQLite directly; scopes become rows in api_key_scope ordered by insertion rowid; revokeApiKey's cascade is a BFS walk of parent_key_id inside one transaction, pinned by a test that captured the old LokiJS sibling-revocation order before conversion so it stays identical - API test conversions: app/api/api-keys.test.ts, api-key-auth.test.ts and api-key-enforcement.integration.test.ts move off a real LokiJS instance onto createMigratedMemoryDatabase() - portwing restart tests: the name-bindings persistence describe block in portwing-ws.test.ts moves its LokiJS-shaped restart mock onto the same SQLite fixture, reusing one connection across each simulated restart - docs and changelog: extends the existing v1.8 SQLite changelog bullet and the DD_STORE_DB_FILE storage doc row - empty-scope coverage: a test for a key with no api_key_scope rows, the shape a legacy import with an empty scopes array leaves behind * ci: track the Dockerfile apk pins and allowlist doc placeholder credentials by pattern (#1077) Three former units, squashed into one commit so a flagged fixture line doesn't survive in history: - Renovate has no built-in manager for apk pins, so an Alpine package revision rotating with no advance notice (cosign 3.0.6-r1 -> -r2 on 2026-09-06) broke the Docker build check on every open PR at once. A new customManagers regex entry in renovate.json extracts every name=version-rN pin from the Dockerfile and resolves it through the repology datasource's alpine_3_24 repository, the Alpine release the Dockerfile's own alpine:3.24 stage pins. - The webhooks doc's curl examples use the literal placeholder your-token-here as the Bearer credential, and .gitleaksignore carried one line-pinned curl-auth-header fingerprint per occurrence. A promotion PR's base is main, which only gains ignore entries through the promotion itself, so a docs edit that shifts those lines (as happened to webhooks/index.mdx on 2026-09-06) re-triggers the finding against main's stale line numbers. .gitleaks.toml now allowlists the placeholder by pattern instead of by line, scoped to content/docs/ and requiring both the path and the placeholder text to match, so a docs reflow can't retrigger it and a real credential anywhere else still fires. The redundant line-pinned curl-auth-header entries for content/docs/ are removed from .gitleaksignore, including the frozen v1.6 archive's copy, and scripts/release-docs-archive.test.mjs's exact expected list is updated to match. - The workflow tests covering both changes assert the Dockerfile regex against the live file, drive gitleaks itself against a shifted copy of the webhooks doc and a control credential outside content/docs, and the existing "no bare paths allowlist" guard in ci-verify-workflow.test.ts is narrowed to permit a paths entry only when paired with condition = "and" and a regexes match. The control fixture is assembled from fragments at run time, with the header name split across two string literals, so this file's own tracked source never contains a literal curl command with an Authorization header for gitleaks to flag. * feat(store): move audit, backups, notification history and outbox onto SQLite (#1078) * feat(store): import audit, backups, notification history and outbox from dd.json Registers importers for the four append-only collections (roadmap 7-STORE slice 5) alongside the existing ones: audit backfills timestamp_ms once, at import, for a document that predates the indexed column; backups carries container_identity_key across when present; notification history and the outbox carry every field straight across. Extends the v1.7 fixture with one row per collection (one audit row missing its timestampMs sibling to exercise the backfill) and the first-start-import test with assertions against them. * feat(store): move audit, backups, notification history and outbox onto SQLite Rewrites the four modules (roadmap 7-STORE slice 5) as plain SQL against the shared database instead of LokiJS collections. audit's dual chain/fallback read path and its startup migrateMissingTimestampIndex scan collapse into one indexed query for filtering, sorting and pagination, since timestamp_ms is now NOT NULL and computed once at import; the hourly prune timer is unchanged. The outbox's ready-for-delivery scan and terminal-entry purge are each a single statement. backups gains a container_identity_key column, populated on every write, but getBackupsByName stays the same name-keyed thin wrapper it always was. Updates the one integration test that wired a fake Loki handle into notificationOutboxStore.createCollections() to hand it a real in-memory database instead, since the module now calls prepare() on it directly. * docs: note audit, backups and notification storage moving onto SQLite Extends the existing v1.8 SQLite changelog bullet with the audit, backups, notification history and outbox move (roadmap 7-STORE slice 5), and updates DD_STORE_DB_FILE's row in the storage docs to list what now lives there. * test(store): cover the remaining slice 5 branches Covers the branches the pre-push coverage gate flagged as never taken: insertAudit's timestampMs fallback for a timestamp that fails Date.parse, the audit importer's empty-timestamp fallback for a document that never recorded one, the backups importer's NULL fallback for a missing containerId, and the outbox importer carrying a deliveredAt string across. Also removes getAuditEntries's dead totalRow/count fallback: a COUNT(*) query always returns exactly one row with a numeric count, so there was no undefined-row or nullish-count case for it to guard. * fix(store): dedupe audit action filters and tighten the slice 5 tests Dedupes the actions filter in buildWhereClause (a Set, preserving first-seen order) before building the IN clause, so a repeated action can no longer inflate the placeholder count or mint a new cached statement per distinct length; the values are already validated against the fixed AuditEntry action union upstream (app/api/audit.ts), which bounds both by the size of that set. Adds a test asserting a repeated action returns the same page as the single action and produces one placeholder. Adds an insertAudit test that populates every optional AuditEntry field and round-trips it through getAuditEntries, since every existing insert omitted them and only exercised optionalString's null side indirectly. Fixes the first-start-import test's audit fixture patch: it was assigning a computed timestampMs onto the fixture record next to the one meant to exercise the importer's timestamp backfill, which meant neither audit row actually needed the backfill to survive the retention prune. Both rows now import with no timestampMs sibling, and the test asserts each imported row's timestamp_ms against Date.parse of its own timestamp directly, rather than only inferring it from the row surviving pruning. * fix(dockercompose): keep the post-pull gate outcome off the caller-supplied context (#1079) imageIdentity, securityGateUnboundWarn, securityGateUnboundReason and securityGateUnboundWarnRecorded are meant to come only from capturePulledImageIdentity(), but trigger()/triggerBatch() accept an unknown runtime-context argument and nothing stopped a value carrying those same keys from being merged into a service's runtime context, which decides what the post-pull gate verifies and scans and whether it runs at all. No caller can reach this today (CWE-693, refuted on that basis), but triggerBatch() now strips those keys from its argument before it is threaded anywhere, closing the gap structurally (DR-52). * fix(watchers): gate stale scan side effects behind a per-scan generation (#1076) * fix(watchers): gate stale scan side effects behind a per-scan generation DR-72: a Docker watcher scan already inside watch() when the watcher is deregistered kept emitting container reports, writing the snapshot, and persisting store writes until it settled. watch() and watchContainer() now capture a per-scan generation, bumped again on deregister, and skip those side effects on a mismatch; the cron path skips resetting isCronWatchInProgress the same way. * fix(watchers): close the stale-scan windows the review found DR-72's scanGeneration guard was self-minted by watch() itself, so a concurrent watch() call on the same instance (an AgentWatcher's direct delegate.watch(), a manual single-container scan) collided with a cron run's own identity and could leave isCronWatchInProgress stuck true forever with nothing left to clear it. It also stopped short of three other windows: a post-watch() cron finish could still announce a maintenance-window opening on a scan gone stale, getContainers() pruned the store unconditionally after a deregistration mid-listing, and the per-container and batch report emitters could still start a snapshot after a deregistration mid-emit. Splits the concern in two: scanGeneration stays deregistration-only and read-only outside deregisterComponent(), and a new cronRunGeneration field, minted fresh by every cron run, gates only the isCronWatchInProgress reset. runCronWatch() now also bails out before computing stats or announcing a maintenance-window opening once its captured scanGeneration goes stale. getContainers() takes an options.scanGeneration and skips the prune (and the gauge update) when it no longer matches. watch() rechecks scanGeneration after each awaited report emission and again before the snapshot. * test(watchers): cover the fallback-emit and cron-run generation guards Docker.watch.test.ts: deregister from inside the per-container fallback emitContainerReport() handler and assert watch() discards the scan there instead of reaching the batch emit or the snapshot - the recheck at Docker.ts's fallback-loop guard had no test exercising its true branch. docker-cron-watch.test.ts: run the post-watch() stale-scan discard with a logger that has no debug method, so the guard around that log call takes its false branch instead of always finding one to call. * ci(dast): bound the ZAP spider and active scan inside the job budget (#1081) * ci(dast): bound the ZAP spider and active scan inside the job budget * test(ci): floor the ZAP scan caps instead of only checking the budget * feat(store): move notification rules and approvals onto SQLite (#1086) * feat(store): import notification rules and approvals from dd.json Adds the notification-rules and approvals collection importers (roadmap 7-STORE slice 6), registers them in the importer registry, and extends the v1.7 fixture with a rule carrying trigger allow-lists and template overrides plus a pending and a decided approval. Extends the first-start import test to assert both round-trip through the real SQLite-backed store modules. * feat(store): move notification rules and approvals onto SQLite Roadmap 7-STORE slice 6. Both modules keep every exported function signature and return shape unchanged; rule trigger and template allow-lists live in notification_rule_trigger/notification_rule_template, decideApprovalIfPending is a compare-and-set inside BEGIN IMMEDIATE (one UPDATE ... WHERE status = 'pending' plus a change-count check), and listApprovals' filtering and pagination are SQL. Adds the approvals.operation_id index that was deferred to this slice, and wires both modules' createCollections to the SQLite database in store/index.ts. * test(approvals): move the reconcile test off its LokiJS db approvals/reconcile.test.ts built a real new Loki() for approvalStore's collection; now wires a migrated in-memory SQLite database instead, matching the module it exercises (roadmap 7-STORE slice 6). api/notification.test.ts and api/approvals.test.ts already fully mock the store layer and needed no change. * docs(store): note notification rules and approvals in dd.sqlite Extends the existing v1.8 SQLite Changed bullet and the DD_STORE_DB_FILE row to cover the roadmap 7-STORE slice 6 move. * test(store): expect the rules and approvals tables in the import summary * feat(store): move the two update caches onto SQLite keyed by identity (#1091) * feat(store): add SQLite importers for the two update caches Registers importers that map a legacy dd.json update-lifecycle-cache row's watcher::name key forward to the identity key of the container that still holds it, dropping rows whose container is gone or whose legacy key is now ambiguous between two containers. The retention cache is already keyed on identity, so its importer carries rows across unchanged. Extends the dd-v1.7.json fixture and the first-start import test with rows for both caches, and the import rowsByTable expectations with the two new tables. * feat(store): move the two update caches onto SQLite Moves update-lifecycle-cache.ts and update-policy-retention-cache.ts onto the SQLite tables slice 1 already created, with public function signatures unchanged. The lifecycle cache's key moves from `${watcher}::${name}` to the same identity key the retention cache already used, so a compose container recreated under a new name (Compose regenerates the container name from the project, service and an ordinal, but the compose labels stay put) now inherits its predecessor's maturity clock. container.ts's insertContainer and deleteContainer derive the lifecycle cache key the same way the retention cache already does, guarding the rare case where a container has no derivable identity. store/index.ts wires both caches' createCollections calls to sqliteDb instead of the LokiJS db, preserving the existing rehydration order. * docs(store): note the two update caches' move to SQLite Extends the v1.8 SQLite store CHANGELOG entry and the storage config docs to name the update-lifecycle and update-policy-retention caches among the tables DD_STORE_DB_FILE now holds, matching how slice 6 documented its tables. * fix(store): upsert the retention-cache import on a duplicate legacy cacheKey A plain INSERT in the update-policy-retention-cache importer threw on the second of two legacy dd.json documents sharing a cacheKey, failing the whole first-start import transaction on a corrupted or hand-edited store. Upsert with the same ON CONFLICT shape the module's own upsertRecord() already uses, so the later document wins instead. Checked the sibling update-lifecycle-cache importer for the same shape: its insert.run() is already gated on a seenNewKeys check immediately before it runs, so it can never attempt two inserts for the same cache_key and needed no change. Pinned that down with a regression test. * fix(store): order lifecycle/retention cache rehydration by refresh, not document order Eviction in container.ts reads Map insertion order as its LRU for both the update-lifecycle-cache and update-policy-retention-cache Maps, but rehydration fed that Map from a SELECT with no ORDER BY, and an upsert never moves a row's rowid. A just-refreshed entry could resurface ahead of the row it should have outlived after a restart. The retention cache masked this by re-sorting on expiresAt in container.ts, but that only approximates refresh order (every stash shares one TTL) and ties on equal timestamps; the lifecycle cache had no such sort at all. Add a refresh_order column to both tables (migration 3), a monotonic per- database counter in each store module bumped on every upsert and seeded from the table's current max on open, and order listRecords() by it. container.ts's two rehydrate functions now just consume that order instead of re-deriving it. Both importers assign refresh_order in legacy document order on first-start import, the only ordering evidence available at that point. * feat(store): move containers onto SQLite with a whole-record write shim (#1096) * feat(store): move containers onto SQLite Moves container.ts onto the containers table slice 1 already created, with public function signatures unchanged. Every read (getContainer, getContainers, getContainerCount and their raw/stats variants) queries SQL instead of a LokiJS collection. updateContainer is reimplemented as a diff-then-patch: SELECT the current row, run the existing merge logic unchanged, then UPDATE it in place if it exists or INSERT it if it doesn't, replacing Loki's remove-and-reinsert fallback with a real update. The in-memory query cache and its reverse index are unchanged, since neither depended on Loki. Adds two columns the initial schema (slice 1) planned the containers table around but never got right - source_repo and current_release_notes - as migration 3, since both are nullable and need no backfill. store/index.ts wires container.ts's createCollections call to sqliteDb instead of the LokiJS db. container.test.ts now runs every case against a real in-memory migrated database instead of a hand-rolled LokiJS collection double, exercising the same buildImportedContainerRow/insertImportedContainerRow helpers a live import uses to seed fixtures. Loki-internals assertions (collection.find/ update call spies) are replaced with behavioral assertions, cache-key assertions against the existing _getContainersQueryCacheForTests hook, or db.prepare call-count spies against the real driver. A few cases relied on Loki quirks that have no SQL equivalent: a literal override of a Joi-derived field (updateAvailable) can't survive a real write, and a Map/ RegExp/Date value in labels can't survive the JSON TEXT column round trip LokiJS never required - both are covered against cloneContainer directly instead. AgentClient.container-reconcile.test.ts and registry/index.container-reconcile.test.ts, which deliberately exercise the real store module instead of mocking it, move from a real LokiJS collection to a real migrated SQLite database the same way. * feat(store): add a SQLite importer for containers Unlike every other importer in this registry, this one reuses container.ts's own buildImportedContainerRow/insertImportedContainerRow helpers instead of hand-writing the column mapping a second time: the containers table has by far the largest column count of any table in the schema, most of it grouped JSON rather than flat scalars, and every column is derived from validateContainer() exactly the way a fresh insertContainer() would derive it. A document that fails validation is skipped, the same as every other importer's convention for an unusable document. Extends the dd-v1.7.json fixture and the first-start import test with a container row, and the import rowsByTable expectations with the containers table. * docs(store): note containers' move to SQLite Extends the v1.8 SQLite store CHANGELOG entry and the storage config docs to name containers among the tables DD_STORE_DB_FILE now holds, matching how slice 7 documented the two update caches. * test(store): move the session-file and recovery integration tests onto the SQLite containers table * docs(store): point the schema comment at migration 4 * fix(store): patch container fields instead of writing whole records (#1097) * feat(store): add field-level container writes (roadmap 7-STORE slice 9) Add updateContainerFields(id, patch) to write only the caller's named fields inside one transaction, inheriting everything else from a fresh read of the current row instead of a caller's possibly-stale in-memory copy. Recomputes the derived lifecycle fields and the security hash inside the same transaction, and emits containerUpdated/containerRemoved the same way updateContainer does for a whole-record write. Covers the per-field patch, multi-field patch, the !db and missing-row guards, the derived-field recompute, a name-only delta emitting containerUpdated exactly once (DR-24), the no-op no-emit case, a health transition independent of the rest of the patch, the security hash recompute (patched vs untouched), and both rollback transitions. Also adds the two interleave acceptance tests from spec 4.3: a rename applied by the event path mid-scan survives the scan's own write, and the scan's result survives a rename applied after it, using the real updateContainerFromInspect and mapContainerToContainerReport against an in-memory SQLite store. Both failed before this slice, since updateContainer's whole-record write let whichever writer finished last silently revert the other's fields. * fix(watchers): move Docker event and scan writes onto field-level patches Move the two whole-record writers named in spec-7-store-sqlite.md 4.3 onto updateContainerFields, so an event-path rename and a watch-cycle scan result can interleave without one clobbering the other. container-event-update.ts's updateContainerFromInspect now builds a patch of only the fields it actually changed (status, health, name, labels plus the label-derived fields, details, display name) and calls dependencies.updateContainer(id, patch) instead of handing over the whole in-memory container. container-processing.ts's mapContainerToContainerReport patches only the fields a scan cycle owns: result, image, error, and the release notes derived from result. Docker.ts's event-path dependency wiring is updated to match. container-init.ts's separate updateContainer call for a stopped container kept in watch scope is out of scope for this slice and is unchanged. Updates the affected watcher tests for the new call signature. * docs(changelog): note the container write clobber fix (v1.8, slice 9) * fix(watchers): persist scan-observed runtime state at inspect time Slice 9's narrower scan patch (mapContainerToContainerReport) writes only result/image/error/currentReleaseNotes, so the runtime fields the stored- container discovery branch refreshes from a fresh inspect/summary (name, displayName, health, details, status) stopped reaching the store once the whole-record write went away. A health flip seen only by that branch (the cron #198 fallback, or a targeted POST /api/v1/containers/:id/watch refresh) was computed in memory but never persisted, since findNewVersion's registry lookup can run long enough for the observation to go stale before any write happens. Write those observed fields immediately after they're computed, before the registry lookup starts, so the inspect-to-write gap stays negligible per spec 4.3. image is left out of this write; it's still being resolved by refreshStoredContainerImageFields and lands via the scan patch once that settles. * fix(store): stop a stray patch id from redirecting updateContainerFields Partial<Container> let a patch carry a different id than the one the caller looked the row up by. Since that id would win the merge and land in WHERE id = ?, a stray id on the patch (an untyped object, `as any`, whatever bypasses the type) could write a different row, or report a change under an id nothing here actually wrote. Type the patch as Omit<Partial<Container>, 'id'> (both here and on the event-path callback's type in container-event-update.ts) and restore the looked-up id after the merge as a runtime backstop. * fix(watchers): persist declarative update-policy fields on label changes LABEL_DERIVED_PATCH_FIELDS omitted updatePolicy/updatePolicyDeclarative/ updatePolicyOverrides/updatePolicySources, but applyEffectiveDockerConfigFromLabels (via applyDockerDeclarativeUpdatePolicy -> applyDeclarativeUpdatePolicy) mutates exactly those four fields on the container whenever labels change. Since the event path's patch is diffed off LABEL_DERIVED_PATCH_FIELDS, a label change that only touched the declarative update policy updated memory but never reached the store. Add the four fields to the constant. The pre-slice-9 updateContainer whole-record write did persist them (it received the whole mutated container object, and updateContainer's own hasOwn checks pick the caller's value over the stored row's whenever the property is present) — this closes a gap slice 9's field-level write introduced, not a longer-standing one. * feat(store)!: move update operations onto SQLite and cut container identity over to identity keys (#1099) * feat(store): move update operations onto SQLite Moves update-operation.ts onto the update_operations table (roadmap 7-STORE, slice 10) and makes the identity cut: every by-name lookup becomes by-identity, taking a single durable identityKey (agent:: watcher::name, or the Compose-aware project/service form) instead of a container name plus an optional agent/watcher filter object. getActiveOperationByContainerName, getInProgressOperationByContainerName, getOperationsByContainerName, getRecentTerminalSucceededOperationByContainerName and hasOtherActiveOperationByContainerName are renamed to their ...ByContainerIdentity forms and take exactly one identityKey argument, doing strict SQL equality against the row's own container_identity_key. The old two-tier "match by name, then optionally narrow by agent/watcher" ContainerIdentityFilter mechanism is gone - this is an intentional behavior change, not just a rename: an identity that fails to resolve, or a row with none, simply never matches, with no bare-name fallback. classifyDuplicateOpTerminalStatus (updates/duplicate-op-classification.ts) follows the same shape: identityKey moves to a single positional argument ahead of windowMs/excludeOperationId. Every caller is updated to match: request-update.ts, the API list/crud/ actions handlers, sse-container-enrichment.ts, ContainerUpdateExecutor.ts, Docker.ts, Portainer.ts, and self-update-operation.ts. Adds a SQLite importer (store/db/importers/update-operations.ts) reusing update- operation.ts's own buildImportedUpdateOperationRow/ insertImportedUpdateOperationRow helpers, extends the dd-v1.7.json fixture and first-start-import test with update-operation rows (one with a resolvable identity, one legacy row with none), and wires store/index.ts's createCollections call to the SQLite database. Test files across store/, api/, updates/, triggers/providers/docker/, triggers/providers/dockercompose/, triggers/providers/portainer/, and model/ move off hand-rolled LokiJS-shaped test doubles onto createMigratedMemoryDatabase() and real SQL assertions, and every vi.mock('.../store/update-operation.js', ...) stub is updated to the renamed exports. Scenarios that only made sense under the old filter's short-circuit rules (e.g. "identity.watcher absent skips the lookup") have no equivalent under single-key equality and are replaced with tests of the new stricter behavior. * refactor(store): key backups by container identity Backups move off name-based ownership onto the durable identity key (roadmap 7-STORE, slice 10, spec 2.3): getBackupsForContainer and pruneOldBackups now query WHERE container_identity_key = ? directly instead of filtering a by-name result set through the includeLegacy heuristic. createContainerBackupScope drops the includeLegacy computation and its sameNamedContainers parameter entirely - isBackupInScope is now a plain identity-key comparison with no legacy branch. A backup made under an identity before a rename or recreate is still found; a legacy backup carrying no identity is never matched by any scope, deliberately. Every caller drops the now-unnecessary getContainers() call that fed the old heuristic: Docker.ts's resolveContainerBackupScope and api/backup.ts's getContainerBackupScope both call createContainerBackupScope(container) directly. HealthMonitor.ts and RollbackMonitor.ts only carry the ContainerBackupScope type through unchanged, since neither constructs one. The backups importer backfills identity for legacy rows: a containerName that matches exactly one imported container resolves to that container's identity_key; zero or multiple matches stay NULL and are counted in one summary log line. This importer moves to run after containersImporter in the registry so the backfill query sees the imported rows. The dd-v1.7.json fixture gains a resolvable legacy backup (matches the single 'full-app' container) and a genuinely ambiguous one (matches two 'shared-svc' containers under different watchers), both covered in index.first-start-import.test.ts. * feat(mqtt)!: derive topics and unique_id from container identity MQTT state topics and the Home Assistant discovery unique_id were both built from the container's current name, so a rename or a Compose recreate changed them and orphaned the HA entity behind a duplicate "Unknown" ghost. State topics are now `${baseTopic}/${watcher}/${identitySlug}`, where identitySlug is the Compose project-service pair when the container carries com.docker.compose.* labels (getContainerIdentitySlug in naming.ts, backed by the existing getComposeProjectService extracted from model/container.ts's deriveContainerIdentityKey), falling back to the sanitized container name otherwise. unique_id is now dd_ + the first 12 hex characters of sha256(identity_key) (getHassUniqueId in Hass.ts), independent of the topic entirely, so it survives both a rename and a Compose recreate. A one-time post-upgrade sweep (Hass.cleanupLegacyIdentityTopics, run from resyncDiscovery) publishes an empty retained message on every pre-v1.8 name-based discovery topic so Home Assistant prunes the old entity instead of duplicating it. It is guarded by a store_metadata marker (app/store/mqtt-hass.ts) so it runs at most once, reusing the same generic key/value table the legacy-JSON import marker already uses rather than adding a table or a column. BREAKING CHANGE: hand-written subscriptions to drydock's MQTT state topics must be updated to the new identity-based shape. * docs: record the MQTT topic change and the identity cut Document the breaking MQTT/Home Assistant identity change from the previous commit: a DEPRECATIONS.md entry describing the new topic and unique_id shape, the automatic one-time discovery cleanup, and the migration path for hand-written subscriptions; the mqtt trigger doc page updated with the new topic shape and an upgrade callout; and CHANGELOG.md's v1.8 Unreleased section gets the breaking Changed bullet plus two Fixed bullets for the rename/recreate bugs it closes (backups unreachable after a rename, HA entities orphaned by one). * test(mqtt): pin unique_id stability across a rename and a recreate Adds the direct unique_id-stability assertion the identity cut needed: addContainerSensor for a compose-identified container three times (an id, the same id renamed, then a new id after a recreate) publishes the same unique_id all three times. * test(store): select the store logger by component instead of call order * fix(store): upsert imported update-operation rows instead of a plain insert A second import of the same legacy snapshot (a restarted first-start import, a re-run migration) threw a UNIQUE constraint error on `id`. insertImportedUpdateOperationRow now upserts on conflict, the same shape update-policy-retention-cache's importer already uses. * perf(store): project only id/timestamps for the update-operation retention sweep pruneOperationsForRetention ran a plain SELECT * per terminal status every 100 mutations, hydrating all 35 columns (both JSON columns included) for every terminal row just to read id/created_at/updated_at and decide what to delete. It now selects only those three columns; the JS-side timestamp/sort/retain logic is unchanged. * fix(triggers): only cross-check identity on the identity-based operation lookup getInProgressOperationByContainerId matches on either container_id or new_container_id, so a match found through new_container_id (the post-update container) keeps the operation's own containerId pointed at the pre-update id. The identity cross-check added for the identity-based fallback was applied to that id-based match too, so it always disagreed with container.id and discarded every valid post-update recovery. It now only applies to the identity-based lookup. * fix(triggers): scope hass legacy-topic cleanup marker by route The one-shot MQTT identity-cut cleanup marker was a single global store_metadata key, but whether the sweep already ran depends on the route it ran over (broker URL, base topic, HASS discovery prefix, agent-topic-segment mode). Two discovery-enabled MQTT triggers sharing one store would have the first trigger's run silently suppress the second's forever. Scope the marker by a stable route key instead. The marker was also written even when a removeSensor() publish rejected (the failure is caught and logged, not surfaced), so a failed sweep was never retried. Only write the marker when every container in the sweep cleaned up successfully. * fix(triggers): make the compose identity slug encoding lossless getContainerIdentitySlug joined the Compose project and service components with sanitizeContainerName, which collapses both '.' and '-' to '-'. Project "a.b" and project "a-b" both sanitized to "a-b", so pairing either with service "c" produced the identical slug "a-b-c" -- two different Compose stacks colliding on one MQTT state topic and one discovery topic, with resolveHassCommandContainer then refusing commands for both as ambiguous. Escape each component with encodeIdentitySlugComponent (double a literal '-' before collapsing '.' to '-') before joining on '.', a character the escape never emits. "a.b"+"c" now encodes to "a-b.c" and "a-b"+"c" to "a--b.c" -- distinguishable and lossless. Also corrects the getContainerIdentitySlug and getHassUniqueId doc comments, which claimed a non-Compose container's topic/unique_id don't change on rename -- they do, since the fallback slug IS the container's current name. Rename stability of the topic and (absent a stored identity key) the unique_id is a Compose-only guarantee; this does not add a durable non-Compose identity. * feat(store)!: move sessions onto SQLite and delete LokiJS (#1100) * feat(api): store express sessions in SQLite Sessions now live in the sessions table of the same SQLite database as every other collection, through a new express-session Store (app/api/session-store.ts) backed by app/store/session.ts. auth.ts wires it in place of the pre-1.8 session store package. expires_at is derived from the session's own cookie.expires, falling back to a configured ttlMs only when a session carries neither. An unref'd background timer sweeps expired rows on a schedule; get() also opportunistically drops a row it finds already expired rather than serving it. A new importer (app/store/db/importers/sessions.ts) carries live sessions from dd.json's legacy Sessions collection into the sessions table on first start, skipping anything already expired at import time and skipping malformed records rather than importing them. This is one writer instead of two independent LokiJS instances autosaving the same file, so the DR-121 mutual-clobber hazard (spec 7-store-sqlite section 1.4) cannot recur. * refactor(store)!: drop the LokiJS dual-open and dd.json writes store/index.ts no longer opens a LokiJS instance at all. dd.json is read exactly once, by the first-start importer, then renamed to dd.json.pre-1.8.bak and never written or read again. save() becomes a WAL checkpoint plus permission enforcement instead of a Loki saveDatabase() call, and getDebugSnapshot() is reimplemented over sqlite_schema and per-table COUNT(*) instead of walking Loki collections. Every collection has read and written the SQLite database directly since earlier slices in this roadmap, so this removal is deletion rather than a behavioral change to any of them. store/util.ts (the LokiJS collection factory, dead now that no caller still creates a Loki collection) is deleted along with its test. lokijs and connect-loki are dropped from app/package.json and app/package-lock.json via `npm uninstall`, and the DR-121 mutual-clobber test is rewritten to prove the bug it used to reproduce is now structurally impossible: sessions and every other collection share one SQLite connection instead of two independent LokiJS instances autosaving the same file. BREAKING CHANGE: dd.json is no longer read after the one-time first-start import; a store that has already migrated to dd.sqlite ignores it entirely. * docs(store): document the single-writer SQLite store Records the last leg of the 7-STORE migration: sessions move onto the same dd.sqlite database as everything else, LokiJS and connect-loki are removed, and dd.json is now read exactly once, at first-start import, before being renamed to dd.json.pre-1.8.bak. Updates the CHANGELOG's SQLite-store bullet, DR-121 fix bullet and the stale connect-loki mention on the Passport removal bullet, adds a DEPRECATIONS.md entry for dd.json's retirement as the live store file, and rewrites the storage config page's session and downgrade guidance. * fix(api): propagate touch() store failures to express-session touch() logged a SQLite failure and then called back with no error, which express-session 1.19 reads as success. With resave: false that let a request leave the old session expiry in place while reporting success up the stack. Pass the caught error to the callback instead of swallowing it. * fix(api): return a sid-keyed map from SessionStore.all() all() built { sid, session } wrapper objects and force-cast the array as SessionData[], which isn't what express-session's Store.all() contract allows: the array form has to hold real session objects (unwrapped), or the whole thing has to be a sid-keyed map instead. Return a { [sid]: SessionData } map so consumers get an actual session object per key. No consumer needed changes: normalizeStoredSessions() in app/util/session-limit.ts already branches on Object.entries() for a non-array payload and unwraps a `.session` property defensively, so it handles both the old wrapper array and the new map shape. * docs(store): require a consistent snapshot for dd.sqlite backups Copying dd.sqlite (and its -wal/-shm sidecars) while drydock is running can catch it mid-write and produce a corrupt backup. Point operators at stopping the container first or taking a live snapshot with sqlite3's .backup or VACUUM INTO instead, and say to restore from one complete snapshot rather than a copy taken mid-write. * fix(updates): accept a replacement container's in-progress operation without a persisted new id (#1101) * fix(updates): accept a replacement container's in-progress operation without a persisted new id * docs(changelog): note the replacement recovery fix * refactor(store): drop the unused deleteBackup export (#1102) deleteBackup() at app/store/backup.ts had no caller outside its own test. Backups are pruned by retention, not deleted individually. * feat(updates): run container updates concurrently with a bounded semaphore (#1104) * test(agent): pin digest watch across Portwing reports DR-38 traced dd.watch.digest=true as dead for controller-Docker-transport (Portwing) containers because preserveControllerDockerEnrichment did not restore image.digest.watch across a Portwing runtime-state report. That fix already landed in 7276699ad (#1067); this adds an independent end-to-end regression guard driven through two real handleContainerSync calls (not a pre-seeded existing-container mock) asserting both digest.watch and digest.repo survive the second report, since image-comparison.ts's digest-comparison gate requires both. Confirmed passing on current code — DR-38 is not refuted, it was already fixed; the roadmap entry predates that commit. * feat(updates): add a concurrency semaphore around action execution DD_UPDATE_CONCURRENCY (default 1) and a per-action DD_ACTION_<TYPE>_<NAME>_CONCURRENCY override now bound how many update operations the docker, dockercompose and command actions run at once, replacing Docker's hardcoded TRIGGER_BATCH_CONCURRENCY=3. Docker.triggerBatch and Dockercompose.triggerBatch both resolve the same value through the new updates/action-concurrency.ts helper and apply it with p-limit at their own per-container / per-compose-file-group fan-out point; Command.runCommand holds a lock-primitives Semaphore for the duration of its child process, since its batches don't fan out. Each compose-file group still runs its own withContainerUpdateLocks() critical section to completion as one unit, so a compose-file-once batch keeps its existing serial ordering guarantees; concurrency only unlocks work across independent compose files, which is safe because their lock keys and compose object/document caches are both keyed by file path. * feat(ui): show batch update progress Automatic and scan-triggered fleet updates already carry a real batchId end to end (enqueueContainerUpdates -> operation store via SSE), but nothing in the UI surfaced it. The existing "Updating stack" text in ContainersGroupHeader only covers manually-clicked group batches via separate UI-side bookkeeping. Add getActiveBatchProgress() to the operation store: derives the set of in-flight multi-container batches (2+ containers, at least one non-terminal) from the existing byId operation map, no new SSE event needed. UiBatchProgress gains activeContainerNames so the banner can name what's currently running, not just the counts. useFleetUpdateProgress composable wraps the store call in a computed so it self-cleans once a batch finishes, and falls back to installing its own Pinia instance when none is active (matching the pattern already used by useToast and useUpdateBatches). FleetUpdateProgressBanner renders one line per active batch above the container list, reusing the existing muted-primary banner style already used for the list's error state. Caps named running containers at 3 and folds the rest into a "+N more" suffix so the line stays bounded on a large fleet. New i18n keys added to all 17 locales (English source text, Crowdin fills real translations later) to satisfy the key-parity gate. * fix(updates): bound action concurrency across independent trigger() calls The per-call pLimit added in 7094f5b75 only bounded concurrency within one triggerBatch() invocation. That covers the automatic scan-triggered digest batch flow, which calls triggerBatch() once with the whole ready set, but not the manual bulk "Update All" endpoint, dependency-chain updates, or startup recovery: all three dispatch through runAcceptedContainerUpdates()'s own wave-worker pool, which calls trigger() once per container with no shared batch call for a per-call limiter to bound. Each of those trigger() calls created its own throwaway pLimit(concurrency) sized for exactly one task, so DD_UPDATE_ CONCURRENCY and the per-action override had no effect on the primary large-fleet scenario the roadmap item exists for. Docker and Dockercompose (which extends Docker) now hold a persistent per-instance Semaphore, created lazily on first use and sized once from resolveActionConcurrency(). trigger() acquires and releases it around the real update; triggerBatch() no longer needs its own limiter, since every trigger() call it fans out to draws from the same permit pool as every other caller on that instance. Dockercompose's triggerBatch() gates at the same compose-file-group granularity it already used, just through the shared semaphore instead of a call-scoped pLimit, so compose-file-once ordering is unchanged. Docker.test.ts, Docker.trigger-prune-progress.test.ts, and Dockercompose.test.ts had concurrency tests that spied on trigger() itself, which now bypasses the gate that lives inside it; they're rewritten to spy on runContainerUpdateLifecycle/processComposeFile instead, and each file gains a test driving several independent trigger() calls concurrently (mirroring runAcceptedContainerUpdates's per-container dispatch) to prove the persistent semaphore actually bounds them. Docker.test.helpers.ts resets the semaphore alongside configuration in its shared beforeEach, since the instance it exports is reused across every test in the six files that import it. * test(load): cover concurrent updates in the load-test scenario The Artillery harness under test/test.yml only asserts HTTP-level correctness (status codes, latency, 429/5xx counts) against a live container built and run through docker-compose (scripts/run-load- test.sh); it has no way to see whether update-operation store writes stayed consistent under concurrency, and this task's environment has no way to build or run that compose stack. This adds the fleet-scale scenario the roadmap item's "Done when" line actually asks for as a vitest integration test instead, run in the normal unit test pass and in CI with no container runtime required. fleet-update-concurrency.integration.test.ts drives the real dispatch orchestration (runAcceptedContainerUpdates, the wave-worker pool a manual bulk "Update All", a dependency-chain update, or startup recovery goes through) against a real SQLite update-operation store, with a fake action gated by the same persistent per-instance Semaphore primitive Docker/Dockercompose/Command use in production. A 12- container fleet is run at concurrency 1 and concurrency 4: both prove every operation reaches a terminal, successful status with no lost operation, and that each stored row's containerId/containerName still match the operatio…
* feat(store): move containers onto SQLite with a whole-record write shim (#1096)
* feat(store): move containers onto SQLite
Moves container.ts onto the containers table slice 1 already created, with
public function signatures unchanged. Every read (getContainer,
getContainers, getContainerCount and their raw/stats variants) queries SQL
instead of a LokiJS collection. updateContainer is reimplemented as a
diff-then-patch: SELECT the current row, run the existing merge logic
unchanged, then UPDATE it in place if it exists or INSERT it if it doesn't,
replacing Loki's remove-and-reinsert fallback with a real update. The
in-memory query cache and its reverse index are unchanged, since neither
depended on Loki. Adds two columns the initial schema (slice 1) planned the
containers table around but never got right - source_repo and
current_release_notes - as migration 3, since both are nullable and need no
backfill. store/index.ts wires container.ts's createCollections call to
sqliteDb instead of the LokiJS db.
container.test.ts now runs every case against a real in-memory migrated
database instead of a hand-rolled LokiJS collection double, exercising the
same buildImportedContainerRow/insertImportedContainerRow helpers a live
import uses to seed fixtures. Loki-internals assertions (collection.find/
update call spies) are replaced with behavioral assertions, cache-key
assertions against the existing _getContainersQueryCacheForTests hook, or
db.prepare call-count spies against the real driver. A few cases relied on
Loki quirks that have no SQL equivalent: a literal override of a
Joi-derived field (updateAvailable) can't survive a real write, and a Map/
RegExp/Date value in labels can't survive the JSON TEXT column round trip
LokiJS never required - both are covered against cloneContainer directly
instead. AgentClient.container-reconcile.test.ts and
registry/index.container-reconcile.test.ts, which deliberately exercise the
real store module instead of mocking it, move from a real LokiJS collection
to a real migrated SQLite database the same way.
* feat(store): add a SQLite importer for containers
Unlike every other importer in this registry, this one reuses
container.ts's own buildImportedContainerRow/insertImportedContainerRow
helpers instead of hand-writing the column mapping a second time: the
containers table has by far the largest column count of any table in the
schema, most of it grouped JSON rather than flat scalars, and every column
is derived from validateContainer() exactly the way a fresh
insertContainer() would derive it. A document that fails validation is
skipped, the same as every other importer's convention for an unusable
document. Extends the dd-v1.7.json fixture and the first-start import test
with a container row, and the import rowsByTable expectations with the
containers table.
* docs(store): note containers' move to SQLite
Extends the v1.8 SQLite store CHANGELOG entry and the storage config docs
to name containers among the tables DD_STORE_DB_FILE now holds, matching
how slice 7 documented the two update caches.
* test(store): move the session-file and recovery integration tests onto the SQLite containers table
* docs(store): point the schema comment at migration 4
* fix(store): patch container fields instead of writing whole records (#1097)
* feat(store): add field-level container writes (roadmap 7-STORE slice 9)
Add updateContainerFields(id, patch) to write only the caller's named
fields inside one transaction, inheriting everything else from a fresh
read of the current row instead of a caller's possibly-stale in-memory
copy. Recomputes the derived lifecycle fields and the security hash
inside the same transaction, and emits containerUpdated/containerRemoved
the same way updateContainer does for a whole-record write.
Covers the per-field patch, multi-field patch, the !db and
missing-row guards, the derived-field recompute, a name-only delta
emitting containerUpdated exactly once (DR-24), the no-op no-emit
case, a health transition independent of the rest of the patch, the
security hash recompute (patched vs untouched), and both rollback
transitions.
Also adds the two interleave acceptance tests from spec 4.3: a rename
applied by the event path mid-scan survives the scan's own write, and
the scan's result survives a rename applied after it, using the real
updateContainerFromInspect and mapContainerToContainerReport against
an in-memory SQLite store. Both failed before this slice, since
updateContainer's whole-record write let whichever writer finished
last silently revert the other's fields.
* fix(watchers): move Docker event and scan writes onto field-level patches
Move the two whole-record writers named in spec-7-store-sqlite.md 4.3
onto updateContainerFields, so an event-path rename and a watch-cycle
scan result can interleave without one clobbering the other.
container-event-update.ts's updateContainerFromInspect now builds a
patch of only the fields it actually changed (status, health, name,
labels plus the label-derived fields, details, display name) and calls
dependencies.updateContainer(id, patch) instead of handing over the
whole in-memory container. container-processing.ts's
mapContainerToContainerReport patches only the fields a scan cycle
owns: result, image, error, and the release notes derived from result.
Docker.ts's event-path dependency wiring is updated to match.
container-init.ts's separate updateContainer call for a stopped
container kept in watch scope is out of scope for this slice and is
unchanged.
Updates the affected watcher tests for the new call signature.
* docs(changelog): note the container write clobber fix (v1.8, slice 9)
* fix(watchers): persist scan-observed runtime state at inspect time
Slice 9's narrower scan patch (mapContainerToContainerReport) writes only
result/image/error/currentReleaseNotes, so the runtime fields the stored-
container discovery branch refreshes from a fresh inspect/summary (name,
displayName, health, details, status) stopped reaching the store once the
whole-record write went away. A health flip seen only by that branch (the
cron #198 fallback, or a targeted POST /api/v1/containers/:id/watch refresh)
was computed in memory but never persisted, since findNewVersion's registry
lookup can run long enough for the observation to go stale before any write
happens.
Write those observed fields immediately after they're computed, before the
registry lookup starts, so the inspect-to-write gap stays negligible per
spec 4.3. image is left out of this write; it's still being resolved by
refreshStoredContainerImageFields and lands via the scan patch once that
settles.
* fix(store): stop a stray patch id from redirecting updateContainerFields
Partial<Container> let a patch carry a different id than the one the caller
looked the row up by. Since that id would win the merge and land in
WHERE id = ?, a stray id on the patch (an untyped object, `as any`, whatever
bypasses the type) could write a different row, or report a change under an
id nothing here actually wrote.
Type the patch as Omit<Partial<Container>, 'id'> (both here and on the
event-path callback's type in container-event-update.ts) and restore the
looked-up id after the merge as a runtime backstop.
* fix(watchers): persist declarative update-policy fields on label changes
LABEL_DERIVED_PATCH_FIELDS omitted updatePolicy/updatePolicyDeclarative/
updatePolicyOverrides/updatePolicySources, but applyEffectiveDockerConfigFromLabels
(via applyDockerDeclarativeUpdatePolicy -> applyDeclarativeUpdatePolicy) mutates
exactly those four fields on the container whenever labels change. Since the
event path's patch is diffed off LABEL_DERIVED_PATCH_FIELDS, a label change
that only touched the declarative update policy updated memory but never
reached the store.
Add the four fields to the constant. The pre-slice-9 updateContainer
whole-record write did persist them (it received the whole mutated
container object, and updateContainer's own hasOwn checks pick the
caller's value over the stored row's whenever the property is present) —
this closes a gap slice 9's field-level write introduced, not a
longer-standing one.
* feat(store)!: move update operations onto SQLite and cut container identity over to identity keys (#1099)
* feat(store): move update operations onto SQLite
Moves update-operation.ts onto the update_operations table (roadmap
7-STORE, slice 10) and makes the identity cut: every by-name lookup
becomes by-identity, taking a single durable identityKey (agent::
watcher::name, or the Compose-aware project/service form) instead of
a container name plus an optional agent/watcher filter object.
getActiveOperationByContainerName, getInProgressOperationByContainerName,
getOperationsByContainerName, getRecentTerminalSucceededOperationByContainerName
and hasOtherActiveOperationByContainerName are renamed to their
...ByContainerIdentity forms and take exactly one identityKey argument,
doing strict SQL equality against the row's own container_identity_key.
The old two-tier "match by name, then optionally narrow by agent/watcher"
ContainerIdentityFilter mechanism is gone - this is an intentional
behavior change, not just a rename: an identity that fails to resolve,
or a row with none, simply never matches, with no bare-name fallback.
classifyDuplicateOpTerminalStatus (updates/duplicate-op-classification.ts)
follows the same shape: identityKey moves to a single positional
argument ahead of windowMs/excludeOperationId.
Every caller is updated to match: request-update.ts, the API list/crud/
actions handlers, sse-container-enrichment.ts, ContainerUpdateExecutor.ts,
Docker.ts, Portainer.ts, and self-update-operation.ts. Adds a SQLite
importer (store/db/importers/update-operations.ts) reusing update-
operation.ts's own buildImportedUpdateOperationRow/
insertImportedUpdateOperationRow helpers, extends the dd-v1.7.json
fixture and first-start-import test with update-operation rows (one
with a resolvable identity, one legacy row with none), and wires
store/index.ts's createCollections call to the SQLite database.
Test files across store/, api/, updates/, triggers/providers/docker/,
triggers/providers/dockercompose/, triggers/providers/portainer/, and
model/ move off hand-rolled LokiJS-shaped test doubles onto
createMigratedMemoryDatabase() and real SQL assertions, and every
vi.mock('.../store/update-operation.js', ...) stub is updated to the
renamed exports. Scenarios that only made sense under the old filter's
short-circuit rules (e.g. "identity.watcher absent skips the lookup")
have no equivalent under single-key equality and are replaced with
tests of the new stricter behavior.
* refactor(store): key backups by container identity
Backups move off name-based ownership onto the durable identity key
(roadmap 7-STORE, slice 10, spec 2.3): getBackupsForContainer and
pruneOldBackups now query WHERE container_identity_key = ? directly
instead of filtering a by-name result set through the includeLegacy
heuristic. createContainerBackupScope drops the includeLegacy
computation and its sameNamedContainers parameter entirely -
isBackupInScope is now a plain identity-key comparison with no legacy
branch. A backup made under an identity before a rename or recreate is
still found; a legacy backup carrying no identity is never matched by
any scope, deliberately.
Every caller drops the now-unnecessary getContainers() call that fed
the old heuristic: Docker.ts's resolveContainerBackupScope and
api/backup.ts's getContainerBackupScope both call
createContainerBackupScope(container) directly. HealthMonitor.ts and
RollbackMonitor.ts only carry the ContainerBackupScope type through
unchanged, since neither constructs one.
The backups importer backfills identity for legacy rows: a
containerName that matches exactly one imported container resolves to
that container's identity_key; zero or multiple matches stay NULL and
are counted in one summary log line. This importer moves to run after
containersImporter in the registry so the backfill query sees the
imported rows. The dd-v1.7.json fixture gains a resolvable legacy
backup (matches the single 'full-app' container) and a genuinely
ambiguous one (matches two 'shared-svc' containers under different
watchers), both covered in index.first-start-import.test.ts.
* feat(mqtt)!: derive topics and unique_id from container identity
MQTT state topics and the Home Assistant discovery unique_id were both
built from the container's current name, so a rename or a Compose
recreate changed them and orphaned the HA entity behind a duplicate
"Unknown" ghost.
State topics are now `${baseTopic}/${watcher}/${identitySlug}`, where
identitySlug is the Compose project-service pair when the container
carries com.docker.compose.* labels (getContainerIdentitySlug in
naming.ts, backed by the existing getComposeProjectService extracted
from model/container.ts's deriveContainerIdentityKey), falling back to
the sanitized container name otherwise. unique_id is now
dd_ + the first 12 hex characters of sha256(identity_key)
(getHassUniqueId in Hass.ts), independent of the topic entirely, so it
survives both a rename and a Compose recreate.
A one-time post-upgrade sweep (Hass.cleanupLegacyIdentityTopics, run
from resyncDiscovery) publishes an empty retained message on every
pre-v1.8 name-based discovery topic so Home Assistant prunes the old
entity instead of duplicating it. It is guarded by a store_metadata
marker (app/store/mqtt-hass.ts) so it runs at most once, reusing the
same generic key/value table the legacy-JSON import marker already
uses rather than adding a table or a column.
BREAKING CHANGE: hand-written subscriptions to drydock's MQTT state
topics must be updated to the new identity-based shape.
* docs: record the MQTT topic change and the identity cut
Document the breaking MQTT/Home Assistant identity change from the
previous commit: a DEPRECATIONS.md entry describing the new topic and
unique_id shape, the automatic one-time discovery cleanup, and the
migration path for hand-written subscriptions; the mqtt trigger doc
page updated with the new topic shape and an upgrade callout; and
CHANGELOG.md's v1.8 Unreleased section gets the breaking Changed
bullet plus two Fixed bullets for the rename/recreate bugs it closes
(backups unreachable after a rename, HA entities orphaned by one).
* test(mqtt): pin unique_id stability across a rename and a recreate
Adds the direct unique_id-stability assertion the identity cut needed:
addContainerSensor for a compose-identified container three times (an
id, the same id renamed, then a new id after a recreate) publishes the
same unique_id all three times.
* test(store): select the store logger by component instead of call order
* fix(store): upsert imported update-operation rows instead of a plain insert
A second import of the same legacy snapshot (a restarted first-start
import, a re-run migration) threw a UNIQUE constraint error on `id`.
insertImportedUpdateOperationRow now upserts on conflict, the same
shape update-policy-retention-cache's importer already uses.
* perf(store): project only id/timestamps for the update-operation retention sweep
pruneOperationsForRetention ran a plain SELECT * per terminal status
every 100 mutations, hydrating all 35 columns (both JSON columns
included) for every terminal row just to read id/created_at/updated_at
and decide what to delete. It now selects only those three columns;
the JS-side timestamp/sort/retain logic is unchanged.
* fix(triggers): only cross-check identity on the identity-based operation lookup
getInProgressOperationByContainerId matches on either container_id or
new_container_id, so a match found through new_container_id (the
post-update container) keeps the operation's own containerId pointed
at the pre-update id. The identity cross-check added for the
identity-based fallback was applied to that id-based match too, so it
always disagreed with container.id and discarded every valid
post-update recovery. It now only applies to the identity-based
lookup.
* fix(triggers): scope hass legacy-topic cleanup marker by route
The one-shot MQTT identity-cut cleanup marker was a single global
store_metadata key, but whether the sweep already ran depends on the
route it ran over (broker URL, base topic, HASS discovery prefix,
agent-topic-segment mode). Two discovery-enabled MQTT triggers sharing
one store would have the first trigger's run silently suppress the
second's forever. Scope the marker by a stable route key instead.
The marker was also written even when a removeSensor() publish
rejected (the failure is caught and logged, not surfaced), so a failed
sweep was never retried. Only write the marker when every container in
the sweep cleaned up successfully.
* fix(triggers): make the compose identity slug encoding lossless
getContainerIdentitySlug joined the Compose project and service
components with sanitizeContainerName, which collapses both '.' and
'-' to '-'. Project "a.b" and project "a-b" both sanitized to "a-b",
so pairing either with service "c" produced the identical slug
"a-b-c" -- two different Compose stacks colliding on one MQTT state
topic and one discovery topic, with resolveHassCommandContainer then
refusing commands for both as ambiguous.
Escape each component with encodeIdentitySlugComponent (double a
literal '-' before collapsing '.' to '-') before joining on '.', a
character the escape never emits. "a.b"+"c" now encodes to "a-b.c"
and "a-b"+"c" to "a--b.c" -- distinguishable and lossless.
Also corrects the getContainerIdentitySlug and getHassUniqueId doc
comments, which claimed a non-Compose container's topic/unique_id
don't change on rename -- they do, since the fallback slug IS the
container's current name. Rename stability of the topic and (absent
a stored identity key) the unique_id is a Compose-only guarantee;
this does not add a durable non-Compose identity.
* feat(store)!: move sessions onto SQLite and delete LokiJS (#1100)
* feat(api): store express sessions in SQLite
Sessions now live in the sessions table of the same SQLite database as
every other collection, through a new express-session Store
(app/api/session-store.ts) backed by app/store/session.ts. auth.ts
wires it in place of the pre-1.8 session store package.
expires_at is derived from the session's own cookie.expires, falling
back to a configured ttlMs only when a session carries neither. An
unref'd background timer sweeps expired rows on a schedule; get() also
opportunistically drops a row it finds already expired rather than
serving it.
A new importer (app/store/db/importers/sessions.ts) carries live
sessions from dd.json's legacy Sessions collection into the sessions
table on first start, skipping anything already expired at import
time and skipping malformed records rather than importing them.
This is one writer instead of two independent LokiJS instances
autosaving the same file, so the DR-121 mutual-clobber hazard (spec
7-store-sqlite section 1.4) cannot recur.
* refactor(store)!: drop the LokiJS dual-open and dd.json writes
store/index.ts no longer opens a LokiJS instance at all. dd.json is
read exactly once, by the first-start importer, then renamed to
dd.json.pre-1.8.bak and never written or read again. save() becomes a
WAL checkpoint plus permission enforcement instead of a Loki
saveDatabase() call, and getDebugSnapshot() is reimplemented over
sqlite_schema and per-table COUNT(*) instead of walking Loki
collections. Every collection has read and written the SQLite database
directly since earlier slices in this roadmap, so this removal is
deletion rather than a behavioral change to any of them.
store/util.ts (the LokiJS collection factory, dead now that no caller
still creates a Loki collection) is deleted along with its test.
lokijs and connect-loki are dropped from app/package.json and
app/package-lock.json via `npm uninstall`, and the DR-121
mutual-clobber test is rewritten to prove the bug it used to reproduce
is now structurally impossible: sessions and every other collection
share one SQLite connection instead of two independent LokiJS
instances autosaving the same file.
BREAKING CHANGE: dd.json is no longer read after the one-time
first-start import; a store that has already migrated to dd.sqlite
ignores it entirely.
* docs(store): document the single-writer SQLite store
Records the last leg of the 7-STORE migration: sessions move onto the
same dd.sqlite database as everything else, LokiJS and connect-loki
are removed, and dd.json is now read exactly once, at first-start
import, before being renamed to dd.json.pre-1.8.bak. Updates the
CHANGELOG's SQLite-store bullet, DR-121 fix bullet and the stale
connect-loki mention on the Passport removal bullet, adds a
DEPRECATIONS.md entry for dd.json's retirement as the live store
file, and rewrites the storage config page's session and downgrade
guidance.
* fix(api): propagate touch() store failures to express-session
touch() logged a SQLite failure and then called back with no error,
which express-session 1.19 reads as success. With resave: false that
let a request leave the old session expiry in place while reporting
success up the stack. Pass the caught error to the callback instead
of swallowing it.
* fix(api): return a sid-keyed map from SessionStore.all()
all() built { sid, session } wrapper objects and force-cast the
array as SessionData[], which isn't what express-session's Store.all()
contract allows: the array form has to hold real session objects
(unwrapped), or the whole thing has to be a sid-keyed map instead.
Return a { [sid]: SessionData } map so consumers get an actual session
object per key.
No consumer needed changes: normalizeStoredSessions() in
app/util/session-limit.ts already branches on Object.entries() for a
non-array payload and unwraps a `.session` property defensively, so it
handles both the old wrapper array and the new map shape.
* docs(store): require a consistent snapshot for dd.sqlite backups
Copying dd.sqlite (and its -wal/-shm sidecars) while drydock is
running can catch it mid-write and produce a corrupt backup. Point
operators at stopping the container first or taking a live snapshot
with sqlite3's .backup or VACUUM INTO instead, and say to restore from
one complete snapshot rather than a copy taken mid-write.
* fix(updates): accept a replacement container's in-progress operation without a persisted new id (#1101)
* fix(updates): accept a replacement container's in-progress operation without a persisted new id
* docs(changelog): note the replacement recovery fix
* refactor(store): drop the unused deleteBackup export (#1102)
deleteBackup() at app/store/backup.ts had no caller outside its own
test. Backups are pruned by retention, not deleted individually.
* feat(updates): run container updates concurrently with a bounded semaphore (#1104)
* test(agent): pin digest watch across Portwing reports
DR-38 traced dd.watch.digest=true as dead for controller-Docker-transport
(Portwing) containers because preserveControllerDockerEnrichment did not
restore image.digest.watch across a Portwing runtime-state report. That
fix already landed in 7276699ad (#1067); this adds an independent
end-to-end regression guard driven through two real handleContainerSync
calls (not a pre-seeded existing-container mock) asserting both
digest.watch and digest.repo survive the second report, since
image-comparison.ts's digest-comparison gate requires both. Confirmed
passing on current code — DR-38 is not refuted, it was already fixed;
the roadmap entry predates that commit.
* feat(updates): add a concurrency semaphore around action execution
DD_UPDATE_CONCURRENCY (default 1) and a per-action
DD_ACTION_<TYPE>_<NAME>_CONCURRENCY override now bound how many update
operations the docker, dockercompose and command actions run at once,
replacing Docker's hardcoded TRIGGER_BATCH_CONCURRENCY=3.
Docker.triggerBatch and Dockercompose.triggerBatch both resolve the same
value through the new updates/action-concurrency.ts helper and apply it
with p-limit at their own per-container / per-compose-file-group fan-out
point; Command.runCommand holds a lock-primitives Semaphore for the
duration of its child process, since its batches don't fan out. Each
compose-file group still runs its own withContainerUpdateLocks() critical
section to completion as one unit, so a compose-file-once batch keeps its
existing serial ordering guarantees; concurrency only unlocks work across
independent compose files, which is safe because their lock keys and
compose object/document caches are both keyed by file path.
* feat(ui): show batch update progress
Automatic and scan-triggered fleet updates already carry a real
batchId end to end (enqueueContainerUpdates -> operation store via
SSE), but nothing in the UI surfaced it. The existing "Updating
stack" text in ContainersGroupHeader only covers manually-clicked
group batches via separate UI-side bookkeeping.
Add getActiveBatchProgress() to the operation store: derives the set
of in-flight multi-container batches (2+ containers, at least one
non-terminal) from the existing byId operation map, no new SSE event
needed. UiBatchProgress gains activeContainerNames so the banner can
name what's currently running, not just the counts.
useFleetUpdateProgress composable wraps the store call in a computed
so it self-cleans once a batch finishes, and falls back to installing
its own Pinia instance when none is active (matching the pattern
already used by useToast and useUpdateBatches).
FleetUpdateProgressBanner renders one line per active batch above the
container list, reusing the existing muted-primary banner style
already used for the list's error state. Caps named running
containers at 3 and folds the rest into a "+N more" suffix so the
line stays bounded on a large fleet.
New i18n keys added to all 17 locales (English source text, Crowdin
fills real translations later) to satisfy the key-parity gate.
* fix(updates): bound action concurrency across independent trigger() calls
The per-call pLimit added in 7094f5b75 only bounded concurrency within
one triggerBatch() invocation. That covers the automatic scan-triggered
digest batch flow, which calls triggerBatch() once with the whole ready
set, but not the manual bulk "Update All" endpoint, dependency-chain
updates, or startup recovery: all three dispatch through
runAcceptedContainerUpdates()'s own wave-worker pool, which calls
trigger() once per container with no shared batch call for a per-call
limiter to bound. Each of those trigger() calls created its own
throwaway pLimit(concurrency) sized for exactly one task, so DD_UPDATE_
CONCURRENCY and the per-action override had no effect on the primary
large-fleet scenario the roadmap item exists for.
Docker and Dockercompose (which extends Docker) now hold a persistent
per-instance Semaphore, created lazily on first use and sized once from
resolveActionConcurrency(). trigger() acquires and releases it around
the real update; triggerBatch() no longer needs its own limiter, since
every trigger() call it fans out to draws from the same permit pool as
every other caller on that instance. Dockercompose's triggerBatch()
gates at the same compose-file-group granularity it already used,
just through the shared semaphore instead of a call-scoped pLimit, so
compose-file-once ordering is unchanged.
Docker.test.ts, Docker.trigger-prune-progress.test.ts, and
Dockercompose.test.ts had concurrency tests that spied on trigger()
itself, which now bypasses the gate that lives inside it; they're
rewritten to spy on runContainerUpdateLifecycle/processComposeFile
instead, and each file gains a test driving several independent
trigger() calls concurrently (mirroring runAcceptedContainerUpdates's
per-container dispatch) to prove the persistent semaphore actually
bounds them. Docker.test.helpers.ts resets the semaphore alongside
configuration in its shared beforeEach, since the instance it exports
is reused across every test in the six files that import it.
* test(load): cover concurrent updates in the load-test scenario
The Artillery harness under test/test.yml only asserts HTTP-level
correctness (status codes, latency, 429/5xx counts) against a live
container built and run through docker-compose (scripts/run-load-
test.sh); it has no way to see whether update-operation store writes
stayed consistent under concurrency, and this task's environment has
no way to build or run that compose stack. This adds the fleet-scale
scenario the roadmap item's "Done when" line actually asks for as a
vitest integration test instead, run in the normal unit test pass and
in CI with no container runtime required.
fleet-update-concurrency.integration.test.ts drives the real dispatch
orchestration (runAcceptedContainerUpdates, the wave-worker pool a
manual bulk "Update All", a dependency-chain update, or startup
recovery goes through) against a real SQLite update-operation store,
with a fake action gated by the same persistent per-instance Semaphore
primitive Docker/Dockercompose/Command use in production. A 12-
container fleet is run at concurrency 1 and concurrency 4: both prove
every operation reaches a terminal, successful status with no lost
operation, and that each stored row's containerId/containerName still
match the operation it was queued for, with no interleaving from a
sibling container that ran concurrently alongside it. A separate case
runs the same 16-container fleet at concurrency 1 and 4 and asserts
the concurrent run is meaningfully faster, which is the property the
feature exists to deliver, not just that it doesn't corrupt anything.
* docs: document update concurrency
Add the DD_UPDATE_CONCURRENCY / DD_ACTION_<TYPE>_<NAME>_CONCURRENCY
feature to the docs and changelog.
content/docs/current/configuration/actions/index.mdx gets a new
"Update concurrency" section ahead of the existing "Global concurrency
cap" one, explaining the default, the per-action override, how it
relates to compose-file-once ordering, and the new fleet update
progress banner in the UI. The existing "Global concurrency cap"
section's opening claim that drydock runs updates concurrently by
default is no longer true now that DD_UPDATE_CONCURRENCY defaults to
1, so that framing sentence is corrected and the section now points
back at the new one instead of restating it. A callout spells out how
the two settings interact: DD_UPDATE_MAX_CONCURRENT (unchanged) bounds
the whole controller's simultaneous update lifecycles across every
action, DD_UPDATE_CONCURRENCY bounds one action's own concurrent
executions, and the effective concurrency is whichever is tighter.
The per-provider CONCURRENCY row is added to the docker, docker-compose,
and command trigger reference tables, each linking back to the shared
explanation instead of repeating it.
CHANGELOG.md gets an Added bullet under [Unreleased] in this repo's
usual dense narrative style, covering the default, the override, the
persistent-semaphore mechanism, compose-file-once ordering, the
relationship to DD_UPDATE_MAX_CONCURRENT, and the UI progress banner.
README.md is unchanged: it does not enumerate action trigger options.
* test(ui): mock the active batch progress getter in the ContainersView specs
* fix(updates): read the update concurrency setting through the configuration module
DD_UPDATE_CONCURRENCY was read from process.env at action-concurrency.ts
module evaluation instead of through ddEnvVars, breaking the
configuration module's role as the single source of truth for DD_
settings and making the concurrency default untestable in isolation.
getGlobalUpdateConcurrency() now reads ddEnvVars.DD_UPDATE_CONCURRENCY
lazily on each call; per-instance callers (Docker.ts, Command.ts) already
memoize the result at semaphore construction, so no caller needed a memo
of its own. Updated the affected tests to control ddEnvVars directly
instead of depending on the process environment.
* feat(config): load a drydock.yml beneath the environment (#1103)
* feat(config): load a drydock.yml beneath the environment
* fix(config): reject scalar keys that flatten to the __FILE suffix
A scalar key segment ending in __FILE (e.g. token__file) would flatten
to a DD_*__FILE env var and be silently treated as a secret-file
pointer by replaceSecrets. Reject it at flatten time, naming the YAML
path, and reserve the suffix for a real "_file" mapping.
Also adds a direct test that flattenConfigTree accepts a null-prototype
mapping, covering isPlainObject's prototype === null branch explicitly.
* fix(config): tighten configuration file permission checks
Reject group-writable config files, not just world-writable ones, and
warn only when group or other read bits are set. Also closes the
time-of-check race between the permission check and the read: discovery
still uses stat to pick a path, but every check that gates what gets
read (regular file, size, permissions) now runs against a single open
file handle, which is what actually gets read.
* fix(config): flush the bootstrap error before exiting
process.exit(1) right after process.stderr.write could truncate the
message when stderr is a pipe, since the write completes asynchronously.
Set process.exitCode and return instead of forcing an immediate exit.
Nothing keeps the event loop alive on this failure path (main.js is
only imported on success), so Node exits on its own once stderr drains.
* fix(config): refuse file keys that only direct process.env readers consume
Per spec-7.1-config-file.md section 1.2, drydock.yml only reaches
ddEnvVars/get() consumers. 21 files across the app read 65 DD_* vars
straight from the real environment instead, so a file-only value for
one of them would merge into ddEnvVars and then be silently ignored by
the code that actually consumes it (e.g. a file-only agent.secret would
leave agent mode still asking for DD_AGENT_SECRET). Reject those keys at
flatten time instead, naming the YAML path.
UNSUPPORTED_FILE_KEYS excludes DD_SELF_UPDATE_* entirely: every one of
those is a handoff value the app writes itself as environment for a
helper container it spawns, never something an operator configures.
A recompute test in configuration/index.test.ts derives the list from
the same 21 files, minus DD_SELF_UPDATE_*, so drift shows up as a
failing assertion.
* test(config): build the missing-path case inside a mkdtemp directory
* fix(config): reserve __FILE in every position of a flattened key
* docs: refresh the version table, add an anchor check, and settle the web app version (#1105)
* docs(readme): refresh the docs version mapping table
* docs: fix three anchors broken by double-hyphen headings
* docs(web): state why apps/web has its own version
* fix(web): extract doc links from the MDX tree and normalise trailing slashes
* ci: narrow scorecard permissions, bound the ui coverage step, and time-box the soak-override test (#1107)
* ci: declare least-privilege permissions in every workflow
Every workflow already declared permissions at the top level with
jobs narrowing further where needed, except security-scorecard.yml's
top-level read-all, which zizmor's pedantic persona flags as
excessive-permissions. The analysis job already grants every scope it
needs explicitly, so narrow the top level to {} like the rest of the
workflows in this repo.
* ci(verify): bound the ui coverage step so the runner cannot kill it
* test(workflows): declare a timeout for the soak-override test
* test(workflows): assert the exact ui coverage heap and worker limits
* feat(config): interpolate, validate, and add the config CLI for drydock.yml (#1106)
* feat(config): interpolate ${NAME} in the configuration file
Decision D1 (spec-7.1-config-file.md, section 8.3): a scalar whose entire
value matches ^\${([A-Za-z_][A-Za-z0-9_]*)(?::-(.*))?}$ is replaced by that
environment variable, or by the default after :- when it is unset; unset
with no default is a load error naming the YAML path and the variable.
No partial substitution, no recursion, and a _file node's own path can be
interpolated the same way its value's contents are never touched by this.
interpolate.ts runs as a pre-pass ahead of flatten.ts, on the raw parsed
tree, so flatten stays a pure function with no environment dependency of
its own. loader.ts threads an optional interpolatedKeys out-param through
so index.ts can attribute a file-sourced key that came from interpolation
to the env source instead of file, even though it physically reached
ddEnvVars through the file layer.
* feat(config): validate the file against the component schemas
Adds validateConfiguration() (configuration/file/validate.ts), which walks
the same five component discoverers registry.init() uses, constructs each
configured provider through a new shared constructComponent() helper
(registry/component-resolution.ts, also now used by registerComponent) and
calls the provider's own validateConfiguration() without ever starting it -
no register(), no init(), no I/O beyond resolving and importing the module.
An unknown provider reuses registerComponent's getHelpfulErrorMessage; a
Joi rejection carries the underlying message plus the offending YAML path
and its DD_* equivalent.
configuration/index.ts exposes this as validateStartupConfiguration(),
dynamically imported to avoid a circular import back into itself, and gated
on configFileSources actually containing a file-sourced key so a pure
env-only deployment's startup behavior is unchanged - every one of its
validation paths already runs today at its existing call site (a bad
trigger logged and skipped, a bad section schema already thrown from
wherever it's first read). app/index.ts calls it before registry.init() and
fails startup with each error's path/envKey/message instead of a stack
trace.
Fixes an aliasing bug found while wiring the real startup call: passing
ddEnvVars itself as the candidate map deleted the candidate along with the
singleton before it could be reassigned, since they were the same object.
withCandidateEnv now snapshots candidate first.
* test(config): route the drydock.yml integration tests through the real file layer
The dev/v1.8 restructuring (7721755ee) moved file loading out of
configuration/index.ts and into app/index.ts's bootstrap, which populates
file/layer.ts via loadConfigFileIntoLayer before dynamically importing
main.js. The ${NAME} interpolation and validateStartupConfiguration
integration tests still wrote a real drydock.yml, pointed DD_CONFIG_FILE
at it, and imported configuration/index.ts directly expecting it to load
the file itself, so they silently exercised nothing after the rebase onto
that restructuring.
Update both withConfigFile helpers to run the file through the real
loadConfigFileIntoLayer (matching what the bootstrap does) before
importing a fresh configuration/index.ts. Drop the now-impossible "unset
${NAME} fails on import" test in favor of a comment pointing at its real
coverage: loader.test.ts's fatal-load-failure case and index.test.ts's
bootstrap exit-1 case.
* feat(cli): add config validate and config export
Adds config validate and config export CLI subcommands (roadmap 7.1,
slice 3), sharing the same loadConfigFile/validateConfiguration path
startup uses rather than a second implementation. Both are dispatched
from app/index.ts ahead of the bootstrap's own drydock.yml load, so a
broken default file surfaces as a validate failure instead of crashing
the process before validate gets a chance to report on it; config
migrate is unaffected and keeps its existing dispatch site in main.ts.
Ships drydock.example.yml as a ready-to-copy starting file.
* style(config): format the layer and main tests
* test(config): stub a known variable in the export fallback test
* fix(config): keep export path errors inside the CLI and normalise the provider path
A whitespace-only --out value threw out of resolveConfiguredPath before
the try/catch in runConfigExportCommand, escaping as an uncaught
exception instead of an Error: line and exit 1. Move path resolution
inside the try and fall back to the raw --out value in the message when
resolution itself fails.
constructComponent built the convention-file path with capitalize(provider)
while the directory segment used providerLowercase; use
capitalize(providerLowercase) so both segments derive from the same
normalized value.
* fix(watcher): re-derive digest watching on every scan so stale rows flag updates (#1111)
image.digest.watch was only written at first discovery, and inside the
shouldRepairStoredImageReference branch that only fires for an
unknown/sha256 tag or an unknown registry. isDigestToWatch's default
flipped from !isDockerHubDomain(domain) to "watch when the tag is
meaningful" in v1.5.0-rc.17, so any container first seen before that
release still carries the old false default forever, and
findNewVersion silently skips the digest comparison for it.
refreshStoredContainerImageFields now re-resolves
resolveContainerImageState every cycle, outside the repair branch,
and writes its watchDigest result back the same way isLocalImage and
digest.repoDigests are already refreshed every cycle for #669. An
explicit dd.watch.digest label or imgset value still wins, since
resolveContainerImageState reads it ahead of the auto-derived
default.
Forward-port of #1108 from dev/v1.7.
Fixes: #1070
(cherry picked from commit 5aad7333df5e82ddaf3416be51b2a47491e7ca73)
* feat(api): expose the effective configuration and validate candidates without applying them (#1112)
* feat(api): expose the effective configuration
* feat(api): validate a candidate configuration without applying it
Adds POST /api/v1/config/validate (roadmap 7.1 slice 5): runs a candidate
drydock.yml document (raw YAML text or a JSON tree) through the same
parse/interpolate/flatten and validateConfiguration path real startup and
"config validate" already use, merged beneath the real environment so env
still wins, without touching disk or constructing any component past
schema validation. Response carries the error list plus a diff of which
keys would change and which sections would reload versus need a restart.
Scoped admin (not SESSION_ONLY, since the response carries no
configuration value) and rate-limited the same as the read routes.
* fix(config): keep computed config keys off CodeQL's property-injection path
Three js/remote-property-injection alerts on PR #1112 traced a key
derived from the request body of POST /api/v1/config/validate into a
bracket-notation or Object.defineProperty write:
- sources.ts's mergeConfigLayers wrote fileLayer keys into envVars and
sources with plain bracket assignment. Every key ever present in
fileLayer already matches ^DD_[A-Z0-9_]+$ (flatten.ts rejects
anything else before a file layer is ever built), so this adds that
same regex as an explicit guard right before the envVars write, and
switches sources itself to a Map converted via Object.fromEntries at
the end, matching the existing pattern in
triggers/providers/docker/update-runtime-context.ts.
- interpolate.ts's setOwnProperty used Object.defineProperty to make a
literal "__proto__" YAML key round-trip as an own property (so
flatten.ts's reserved-key check can still reject it) rather than
silently repointing the accumulator's prototype. defineProperty
itself is the flagged sink. Object.fromEntries has the same
own-property behavior for a "__proto__" entry (verified:
Object.fromEntries([['__proto__', 1]]) yields an own data property,
prototype untouched), so interpolateMapping now accumulates into a
Map and converts with Object.fromEntries instead.
No behavior changes: fileLayer keys always matched the charset guard
already, and the __proto__ round-trip still works the same way through
Object.fromEntries.
* docs(tags): document the tag transform grammar (#1114)
* docs(watchers): document dd.link.template and the link placeholders (#1117)
* feat(web): add the Arcane comparison page (#1116)
* feat(web): add the Arcane comparison page
* docs(web): narrow the Arcane rollback claim to auto-rollback
* docs(rollback): document the backup and rollback endpoints in full (#1118)
Add the missing 409/501/500 rollback failure modes, list the per-container
backups and rollback routes in the endpoint overview table, and note that
DD_ACTION_DOCKERCOMPOSE_*_BACKUPCOUNT works the same as the Docker variant
since Docker Compose inherits its trigger configuration schema from Docker.
* feat(config): reload the configuration file and write sections through the API (#1115)
* feat(config): reconcile components when the configuration reloads
Adds POST /api/v1/config/reload (roadmap 7.1 slice 6): re-reads
drydock.yml, validates the merged result exactly like /validate, and
refuses the whole reload on any load or validation error so nothing
partial is ever applied. On success, only a reloadable-section key
(watcher, registry, action, notification) moves; a restart-only key
(server port, store path, log settings, and other module-load-read
values) is reported in diff.restart and left untouched even when it
changed alongside a reloadable key in the same file.
registry/reconcile.ts adds a pure diff over raw (pre-Joi) component
configuration, keyed by canonical JSON so key order never produces a
false change, and registry/index.ts's reconcileComponentsWithConfiguration
applies it by difference: unchanged components are left running,
removed or changed ones are deregistered, and added or changed ones
are constructed, validated, and registered in their place. Orphan
container pruning is suppressed for the pass so a reload can't be
mistaken for a real watcher cycle.
configuration/file/diff.ts extracts the candidate-env/diff builder
config-validate.ts already had (slice 5) so /reload can reuse it
without a configuration/ -> api/ dependency. configuration/index.ts
gains applyConfigurationReload to move only the changed keys' env and
source attribution. The whole read-validate-apply-reconcile sequence
runs inside the same exclusive update-lock gate a self-update already
uses, so a reload can't interleave with an in-flight update lifecycle.
Every attempt writes a config-reloaded audit entry with the outcome
and, when applied, the added/changed/removed/unchanged/error counts.
* feat(config): watch the configuration file when DD_CONFIG_WATCH is set
Adds an opt-in, debounced fs.watch on the drydock.yml discovered at
boot (roadmap 7.1 slice 6, decision D2), gated by DD_CONFIG_WATCH
(default false, checked in main.ts once configuration validation has
passed). POST /api/v1/config/reload stays available regardless of the
flag; this only automates calling it.
configuration/file/watch.ts's startConfigFileWatch coalesces a burst
of fs.watch events (an editor's write-then-truncate save produces more
than one) into a single reloadConfiguration() call via a debounce
timer, and ignores a change signal that arrives while a reload it
triggered is still in flight rather than queueing it. Neither a reload
that comes back refused nor one that rejects, and neither an
underlying watch 'error' event, is allowed to escape as an unhandled
rejection or crash the process - each is logged and left for the next
change or the next manual reload. The watch handle and its debounce
timer are both unref()'d so neither can hold the process open on its
own. fs.watch itself is imported dynamically inside the function that
starts the watch, never at module load, matching every other module
under configuration/.
The DD_CONFIG_WATCH gate lives in main.ts, not in watch.ts, so the
watcher module stays a pure, fully-testable state machine with no env
read of its own.
* feat(config): report notification rules orphaned by a reload
A reload that renames or removes a trigger leaves DB notification rules
pointing at an id that no longer resolves. reloadConfiguration now checks
every rule's trigger references against the reconciled registry state and
returns them as orphanedRules (ruleId + triggerId), logging each one too;
the rule itself is never deleted or rewritten. Surfaced in the reload
route's response, audit details, and OpenAPI schema.
* feat(api): write a configuration section through the API
Adds PUT /api/v1/config/:section (roadmap 7.1 slice 7): validates the
candidate section the same way /validate does, mutates the parsed
drydock.yml yaml.Document in place so comments and key order survive
everywhere except the replaced section, writes it atomically (temp
file, fsync, chmod 0600, rename), then reloads through the slice 6
engine. Refuses with 409 for an env-sourced key, a DB-owned section,
or no config file present; refuses with 400 and Joi-shaped errors for
an invalid candidate. Concurrent writes serialize through a
module-level promise chain. Audits config-written with the section
and changed key names, never values.
* fix(config): harden reload, watch, and write paths after review
Six issues found in review of the config-file reload/watch/write slice:
- diff.ts: an interpolated file key attributed as 'env' in
configFileSources was indistinguishable from a genuinely
environment-owned key, so a reload never saw it change or get removed.
configuration/index.ts now exports a mutable configFileInterpolatedKeys
set, kept current by applyConfigurationReload after each reload, that
buildCandidateEnvAndDiff consults to tell the two apart.
- watch.ts: a file-change event arriving mid-reload was dropped instead of
queued, so a second edit made while a reload was in flight was silently
lost. It's now queued and runs once the in-flight reload settles.
- watch.ts: fs.watch(filePath) watches the inode, which write.ts's
temp-file-plus-rename atomic save (and most editors) replaces on the
first save, killing the watch. Now watches the file's directory and
filters events to its basename.
- watch.ts: watch() can throw synchronously (e.g. ENOENT); now caught,
logged, and returns undefined instead of crashing startup.
- write.ts: writeFileAtomically could skip the temp-file unlink cleanup
when handle.writeFile/sync/close failed, since the close() finally block
sat outside the unlink try/catch. Restructured so close() runs inside the
outer try/catch.
- registry/index.ts: buildDesiredEntriesForKind passed {} to the
watcher/trigger config builders instead of the options init() actually
ran with, so a reload in agent mode could reconcile in a controller-only
docker.local watcher or a trigger outside the agent allow-list.
* build(deps): forward-port the v1.7 Renovate batches to dev/v1.8 (#1120)
* chore(deps): update npm minor/patch () (#1083)
* chore(deps): update npm minor/patch ()
* chore(config): match the biome schema to 2.5.12
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: scttbnsn <[email protected]>
(cherry picked from commit 8f12c87fa19f2c811339eda58cc36a23736b594c)
* chore(deps): update npm minor/patch (apps/demo) (#1084)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
(cherry picked from commit 4af335fcfd22bc186f7237bd14a452107e42ac9e)
* chore(deps): update github-actions (#1082)
* chore(deps): update github-actions
* test(ci): update the harden-runner and crowdin pin assertions
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: scttbnsn <[email protected]>
(cherry picked from commit c901689e931e45a9145fc6cb3f9d9c2731f1cde5)
* fix(deps): update npm minor/patch (apps/web) (#1085)
* fix(deps): update npm minor/patch (apps/web)
* test(web): expect posthog-js 1.426.2
* test(web): expect the sharp override at 0.35.4
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: scttbnsn <[email protected]>
(cherry picked from commit 66c566236a944934cb645bf44e17620d2be29ee6)
* fix(deps): update npm minor/patch (ui) (#1087)
* fix(deps): update npm minor/patch (ui)
* refactor(ui): stop exporting the now-unused LoadUpdateModeOptions type
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: scttbnsn <[email protected]>
(cherry picked from commit 2c524ab7497f47ee7e0e8a75656d37af567d5137)
* chore(deps): update npm minor/patch (e2e) (#1088)
* chore(deps): update npm minor/patch (e2e)
* test(e2e): expect the picomatch override at 4.0.7
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: scttbnsn <[email protected]>
(cherry picked from commit e232d6fd08b7b528dba2118c3857b20c555cd430)
* fix(deps): update npm minor/patch (app) (#1089)
* fix(deps): update npm minor/patch (app)
* fix(app): fix knip and dependency-pin test drift from the npm bump
Stop exporting DockerScannerHardeningOptions now that nothing outside
security/backends/docker.ts imports it, and update the fast-xml-parser
pin assertions to the 5.11.1 override this bump installs.
* test(app): expect the picomatch override at 4.0.7
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: scttbnsn <[email protected]>
(cherry picked from commit 7d6f2d729573b5ea9c16b3cd7ba8b60bdeda0ec4)
* fix(deps): update npm minor/patch (apps/web) (#1098)
* fix(deps): update npm minor/patch (apps/web)
* test(web): pin posthog-js assertion to 1.427.2
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: scttbnsn <[email protected]>
(cherry picked from commit 72d046a47668ba0dbbb7898ca3ed6440501d3587)
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* docs(notifications): document the debug log fields for a missed notification (#1119)
* docs(notifications): document the debug log fields for a missed notification
* docs(notifications): separate trigger skips from detection and delivery failures
* test(api): make the integration tests deterministic under load (#1123)
* test(api): make the session-persistence and rate-limit integration tests deterministic under load
Both files started their HTTP servers with `server.listen(0)`, which binds the
IPv6 wildcard dual-stack. libuv sets SO_REUSEADDR on every listening socket, and
that makes the kernel's ephemeral-port picker check for an exact address+port
conflict only, so a wildcard listener can be handed a port another process
already holds on 127.0.0.1. Both bindings then coexist and the more specific one
wins every connection to 127.0.0.1, so the tests' requests answer from a foreign
server. The app suite has two loopback binders, healthcheck.binary.test.ts and
agent/PortwingDockerBridge.ts, which is why this only ever showed up with a
second gate running: DR-57 read it as `expected 404 to be 200` on a protected
route, DR-74 as an empty RateLimit header set. Binding 127.0.0.1 makes each test
server the most specific match for the address the tests fetch, and an exact
conflict is the one case the picker does skip.
The rate-limit case also compared RateLimit-Reset across two separately timed
probes. It counts whole seconds down from its window's first request, so the two
read 60 and 59 whenever contention put more than a second between one pair's
priming request and its probe. Freezing Date, and only Date, pins both windows
without taking real timers away from the sockets; the added assertion on the
reset value fails if the freeze ever stops working.
* test(api): bind every test listener to loopback
* test(store): kill the compose lock and startup migration mutants (#1122)
* test(store): kill the compose lock and startup migration mutants
* test(dockercompose): assert the failed write targets the temp file
* ci(release): label the image with the cut's source commit (#1127)
ci(release): label the image with the cut's source commit (#1126)
(cherry picked from commit a1536383dd44b7d91ca1ed1cc632e28b2e4aa7d0)
* docs(config): document the configuration file (#1121)
* docs(config): document the configuration file
Adds the config-file docs page (roadmap 7.1 slice 8): the one env-tree
mapping rule, the _file secret convention, ${NAME}/${NAME:-default}
interpolation, precedence and why the environment wins, DD_CONFIG_FILE
discovery, file permissions, the restart-required table, the handful of
tuning knobs the file can't carry, the underscore/nesting ambiguity,
config validate/export, DD_CONFIG_WATCH, and the full /api/v1/config
surface (scopes, response shapes, the two write 409s, orphanedRules on
reload). Links it from the configuration index and meta.json, and notes
on the agents page that an agent reads its own file.
Regenerates apps/web's checked-in analytics route manifest for the new
page.
* test(config): pin the docs example to drydock.example.yml
Asserts the root drydock.example.yml parses, flattens and validates
through the real loadConfigFile/validateConfiguration path, and that
the fenced YAML block on the new config-file docs page is byte-identical
to it. The docs page is located by a marker comment directly above the
fence rather than a line number, so the test survives reordering the
page around it.
* test(e2e): cover GET /api/v1/config
Adds api-config.feature exercising GET /api/v1/config and
GET /api/v1/config/:section against the QA compose instance: file
presence and path, a value sourced from the file, that key's reported
source, and the 404 for an unknown section. Mounts a small
test/qa-drydock.yml fixture at /config/drydock.yml, setting the one
value (DD_SERVER_NAME) nothing else in qa-compose.yml already sets, so
the assertions distinguish a file-sourced value from an env one.
* docs: add the config file to DEPRECATIONS and the README roadmap
Notes in DEPRECATIONS.md that the config file's two trigger sections
are action: and notification:, mirroring DD_ACTION_*/DD_NOTIFICATION_*,
and that there is no trigger: section — the removed DD_TRIGGER_* prefix
cannot come back through the file. Marks "YAML config" shipped in the
README roadmap table's v1.8.0 row. Adds the docs-page CHANGELOG entry
for roadmap 7.1 slice 8.
* docs(config): describe the unsupported-key rejection as it ships
* docs(config): list DD_CONFIG_WATCH among the env-only keys
* docs(config): satisfy markdownlint on the config file page
* test(e2e): mount the config file fixture in the CI start script
* style(e2e): format the start script test
* docs(config): agents still take the secret from the environment
* fix(config): load the file layer before the config CLI can evaluate the configuration
A static import of configuration/config-cli.ts in app/index.ts reached configuration/index.ts through file/validate.ts, so the env/file merge ran before loadConfigFileIntoLayer had populated the file layer. The file reported as present but none of its values reached the runtime configuration. The CLI is now imported only when a config subcommand is requested; a test pins that the configuration singleton is not evaluated before the file layer loads. Caught by e2e api-config.feature on #1121.
* test(qa): drop the unregisterable Dex OIDC block from the QA stack
The OIDC schema only accepts an https discovery URL and the QA Dex serves http, so the DD_AUTH_OIDC_DEX_* block never registered; the registry logged the error and carried on. Now that the config file layer loads, startup validation is strict across the merged configuration and that error became fatal, which is what the Playwright QA stack hit on this PR. The docs now state the strict-once-a-file-is-present rule.
* feat(api): answer UI paths with a JSON body in headless mode (#1128)
* feat(api): answer UI paths with a JSON body in headless mode
* fix(api): keep API, health and metrics paths out of the UI-disabled fallback
* feat(ntfy): route topics and priorities per event and add action buttons (#1130)
* feat(ntfy): route topics and priorities per event and add action buttons
* fix(ntfy): route digest batches by event kind and render actions with the template context
* feat(ui): explain unassociated triggers and show queued group updates (#1129)
* feat(ui): explain why a trigger is unassociated on the Actions tab
* feat(ui): show a queued state for containers waiting in a grouped update
* fix(api): derive the unassociated trigger reason from the real association order
* refactor(api): keep the unassociated trigger types file-local
* test(api): expect the unassociatedTriggers field in the container triggers response
* fix(ui): read associated and unassociated triggers from one response
getContainerTriggers and getUnassociatedContainerTriggers each hit
GET /api/v1/containers/:id/triggers separately, so a trigger/agent/label
change between the two round trips could briefly show a trigger in both
the associated and unassociated lists, or neither. Add
getContainerTriggersWithReasons to read both from a single response, and
have useContainerTriggers's load path use it, dropping a response that
arrives after the selected container has changed.
* ci: cache npm dependencies across workflow jobs (#1131)
* ci: cache npm dependencies across workflow jobs
* test(ci): assert each npm ci job caches its own lockfile
* fix(docker): sanitize inherited runtime config when recreating a container for rollback (#1132)
* fix(docker): sanitize inherited runtime config when recreating a container for rollback
DR-126: Docker.recreateContainer passed logContainer as cloneContainer's
runtime-config options instead of resolving them through
getCloneRuntimeConfigOptions, the way the update path does. sourceImageConfig,
targetImageConfig and runtimeFieldOrigins were always undefined on rollback,
so sourceImageKnown was false and the UNKNOWN-origin sanitization never
dropped a runtime field the daemon materialized from the newer image (e.g.
Entrypoint), cloning it verbatim onto the older image on auto-rollback and
manual restore.
* test(docker): prove rollback keeps only runtime fields the target image defines
* fix(watcher): require an exact variant suffix match when climbing tag families (#1133)
* fix(watcher): require an exact variant suffix match when climbing tag families
* test(watcher): cover loose family matching with include filters and digit precision suffixes
* fix(watcher): require a digit placeholder in precision-only suffix extensions (#1136)
* feat(watcher): detect Podman sockets and warn about compatibility limits at startup (#1135)
* feat(watcher): detect Podman sockets and warn about compatibility limits at startup
Roadmap 10.4, basic Podman support first slice. When a local watcher's
socket is left at the schema default and that default path doesn't
exist, resolveDockerSocketPath() now probes /run/podman/podman.sock
(rootful) and $XDG_RUNTIME_DIR/podman/podman.sock (rootless) before
falling back to the unchanged "socket not found" behavior. An
explicitly configured socket or a host-configured watcher is never
second-guessed.
Separately, detectPodmanCompatibility() inspects the daemon's own
GET /version response at watcher init and logs a one-time warning
naming the Podman version and known limits (rootless networking,
volume driver differences, systemd-managed containers) when the
compat API identifies itself as Podman via Components or
Platform.Name. isPodman/podmanVersion are recorded on the watcher for
future API/UI use but not yet surfaced anywhere. Docker daemons never
trigger the warning.
* refactor(watcher): keep the Podman detection adapter out of Docker.ts
* fix(watcher): only probe Podman sockets when none is configured and verify candidates are sockets
* test(registry): mock the watcher socket explicitness lookup
* fix(watcher): test the socket stat helper directly and warn about Podman once per watcher
* docs(watcher): document the variant suffix and digit precision rule (#1138)
* feat(mqtt): publish Home Assistant update progress from the update lifecycle (#1137)
* feat(mqtt): publish home assistant update progress during an install
Home Assistant's mqtt update platform reads in_progress and update_percentage
from the JSON object the entity's value_template renders, not from the raw
state payload, so the old scalar template meant HA never saw either field and
the Install button showed nothing until the update was already over.
Build the whole HA update object in hass-progress.ts, publish it as the state
payload's update_state key, and re-emit it verbatim from the value_template.
Subscribe the mqtt trigger to updateOperationChanged so every phase transition
republishes the container, and derive progress from the live operation on each
publish so a missed terminal event or a restart mid-update cannot strand an
entity spinning.
Refs #210
* test(mqtt): cast the unmapped phase fixture at the test boundary
* fix(mqtt): publish agent container state on the topic Home Assistant discovery advertises (#1139)
* fix(mqtt): publish agent container state on the topic hass discovery names
The agent/<name> topic segment from #386 was only ever added to Hass.ts.
Discovery advertised <topic>/agent/<agent>/<watcher>/<container> as the
state_topic, latest_version_topic, json_attributes_topic and command-topic
base, while Mqtt.…
Two hardening items from the 1.8 roadmap (DR-38, DR-39).
dd.watch.digest=truewas dead for controller-Docker-transport (Portwing) containers. Portwing hardcodesimage.digest.watch: falseon every runtime-state report, andpreserveControllerDockerEnrichmentrestored a fixed list of controller-owned fields that did not includeimage, so the label-derived value was lost on the first report after discovery. The storedimage.digest.watchis now restored alongside the other controller-owned fields. A test reproduced the loss before the fix; a companion test checks an unlabelled container still ends up withdigest.watch: false.applyRegistryLookupLabelsduplicated the unexportedresolveLookupImageFromContainerLabels. The helper is now exported and the agent path calls it, keeping its existing precedence where an agent-reported lookup image beats the label. Refactor only, no changelog bullet.Coverage stays at 100%.
Changelog
resolveLookupImageFromContainerLabelsexport for container initialization and agent lookup.image.digest.watchfrom stored container state.image, and unlabelled containers.Concerns