Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions addon-edge/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 0.0.0-edge.12

- Show assigned and unclaimed task summaries on Overview with exact authorized totals.
- Open a selected task through the existing protected Tasks detail in English and Spanish.

## 0.0.0-edge.11

- Use singular English and Spanish stock units when the displayed quantity is exactly one.
Expand Down
8 changes: 4 additions & 4 deletions addon-edge/DOCS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Installation and operation

Edge 0.0.0-edge.11 packages the immutable runtime declared in
[artifact.json](artifact.json). It upgrades supported owned databases to
schema 30 and exposes storage locations and balanced stock transfers in
Inventory. Retain a compatible image and data backup before upgrading.
Edge 0.0.0-edge.12 packages the immutable runtime declared in
[artifact.json](artifact.json). Overview shows the current member's assigned
work and unclaimed household tasks. This preview uses SQLite schema 30.
Retain a compatible image and data backup before upgrading.
A separate Supervisor repository source creates an independent app and data
directory. Check the source, installed version and app slug before using
a preview.
Expand Down
8 changes: 4 additions & 4 deletions addon-edge/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# The Supervisor builds this folder. Fetch only the reviewed immutable runtime and UI.
FROM ghcr.io/astral-sh/uv:0.11.29@sha256:eb2843a1e56fd9e30c7276ce1a52cba86e64c7b385f5e3279a0e08e02dd058fc AS uv
FROM python:3.14.6-slim-trixie@sha256:7bec7ddcddeff7975d6ba9b4be7dd6f6b2f55e7491539145e2978f7f97ce9144 AS source
ARG DOMUS_SOURCE_COMMIT=7e869ff0d1755def7d06046ba5ea48150a26ccfb
ARG DOMUS_SOURCE_SHA256=a65ec787de95548bbce7e70f834e9101055bba335301e22fb18d17c424b79200
ARG DOMUS_SOURCE_COMMIT=3a803ddce3092abcd9da48c8533c65d24e2e0e37
ARG DOMUS_SOURCE_SHA256=6eaaf75c60a7582e21da627dc17f9cb9dcad007e0ab90c433d61d311cbf8363b
ADD https://codeload.github.com/vypdev/domus/tar.gz/${DOMUS_SOURCE_COMMIT} /tmp/source.tar.gz
RUN printf '%s /tmp/source.tar.gz\n' "$DOMUS_SOURCE_SHA256" | sha256sum --check - \
&& mkdir /app \
Expand All @@ -24,9 +24,9 @@ RUN uv sync --frozen --no-dev --package domus-server --no-editable
RUN .venv/bin/python -c "from pathlib import Path; import domus; from domus.entrypoints.ui_bundle import load_bundle; assert load_bundle(Path(domus.__file__).parent / 'ui') is not None"

FROM python:3.14.6-slim-trixie@sha256:7bec7ddcddeff7975d6ba9b4be7dd6f6b2f55e7491539145e2978f7f97ce9144
ARG BUILD_VERSION=0.0.0-edge.11
ARG BUILD_VERSION=0.0.0-edge.12
ARG BUILD_ARCH
ARG DOMUS_SOURCE_COMMIT=7e869ff0d1755def7d06046ba5ea48150a26ccfb
ARG DOMUS_SOURCE_COMMIT=3a803ddce3092abcd9da48c8533c65d24e2e0e37
LABEL io.hass.type="app" \
io.hass.version="${BUILD_VERSION}" \
io.hass.arch="${BUILD_ARCH}" \
Expand Down
6 changes: 3 additions & 3 deletions addon-edge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Development preview of Domus installed as a Home Assistant app. Open it through
HA's Open Web UI using your existing Home Assistant session.

Edge 0.0.0-edge.11 includes the current household work, Family, Inventory and
Shopping workspaces. Inventory shows storage locations and exact stock
transfers, with English and Spanish labels and original-request recovery.
Edge 0.0.0-edge.12 shows assigned and unclaimed household tasks on Overview.
Each group has an exact count and links into the protected Tasks workspace.
The summary is available in English and Spanish.

This candidate upgrades supported owned data to SQLite schema 30. Keep a
compatible image and cold data backup before upgrading a previous preview.
Expand Down
26 changes: 13 additions & 13 deletions addon-edge/artifact.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"schemaVersion": 1,
"version": "0.0.0-edge.11",
"sourceCommit": "7e869ff0d1755def7d06046ba5ea48150a26ccfb",
"sourceArchiveSHA256": "a65ec787de95548bbce7e70f834e9101055bba335301e22fb18d17c424b79200",
"storageSchema": 30,
"wheelSHA256": "1606135b747a4705bb741c557c51ea4f224fc1fa8114284058a4ca984a75ebda",
"version": "0.0.0-edge.12",
"sourceCommit": "3a803ddce3092abcd9da48c8533c65d24e2e0e37",
"sourceArchiveSHA256": "6eaaf75c60a7582e21da627dc17f9cb9dcad007e0ab90c433d61d311cbf8363b",
"pythonFiles": {
"domus/__init__.py": "7182c88b92234b4328f94497f4e70222d4390d8093e4b62893dfa78ac5530ac6",
"domus/application/__init__.py": "1e8c0c87bf2a8ca947112543070583c0cc55d9d40b56eab0d86ed59a4ec1e82c",
Expand Down Expand Up @@ -82,8 +80,8 @@
"domus/application/task_material_scope.py": "f1d44c700578da0681872e4fac42d1ebb801e33fa843065b9dabb397f69888d1",
"domus/application/task_material_views.py": "1f4e1b52c17064b73e3c6502b38fc578a7589d68044279312c783b656e5aa5bf",
"domus/application/task_materials.py": "caa132a7b16fca293770deba3da149cf9bda2e24d4719abe9de39470d686698e",
"domus/application/task_ports.py": "20b4d6ecc29cce45a0df48c35e6c50889934bf2a239fa149e951932f0eb0c6ae",
"domus/application/task_queries.py": "577c50a09be8205cd836680b757693320d26ec6a0afd88effa49105e14fdc430",
"domus/application/task_ports.py": "fca67b4b08fedfdf2c61a9acdd58535620d0c6a8c7de283debb8eb27a12535b2",
"domus/application/task_queries.py": "7c810bcec8a5c0f16bda47d577cce5f060976b348b96bacad737c65da91d8101",
"domus/application/task_requests.py": "2e9ead8f5458d45335ec55bad50f5f7e12b42ee9b00ff54634f3ff681b320897",
"domus/application/task_reviews.py": "dcc288cda6cdcf5073bad4f24133b9d3496c0b0cf1272e8328e6df38129f3328",
"domus/composition/__init__.py": "a902d8faf7dd19da6829fb730d81e32d34ec38ee6cfafd676966a95d0ad31366",
Expand Down Expand Up @@ -161,7 +159,7 @@
"domus/entrypoints/schedule_creation_http.py": "f5bc369e5135229e9eb62ad1ac1046c3fb2d0c9c53e6acad6bd61631c2a7042e",
"domus/entrypoints/task_category_http.py": "e5443015f5e5cb2684eb6807e0a3bac5116703b5611508281afd7d1addee9672",
"domus/entrypoints/task_dto.py": "df12654a0917a06742ea4605f0aca552d339df610ecb0f7467f69aa89b5a7c9d",
"domus/entrypoints/task_http.py": "b56e13323473176d0cb2e6e6b03438dbaabb54c70f3c62db397ce2252f1ef6d5",
"domus/entrypoints/task_http.py": "bf62f9424c0352e08d5f67fcaf1a39ff34dd556ddccfaf163d9a9004ef8f39f2",
"domus/entrypoints/task_response.py": "618c0b07680e35db446428e06fdf9d6baeba33e117f8168a234c68e01eba31f7",
"domus/entrypoints/ui_bundle.py": "beae3d4a7a57375ee195cca81efccdbc899d9db4286029d53eabaf30de6e14f7",
"domus/entrypoints/ui_http.py": "b6c47baa742f3862173a93e4121dc9914fd972eb6287ffffb9ffccecbf2ebe4a",
Expand Down Expand Up @@ -217,15 +215,17 @@
"domus/infrastructure/sqlite_task_records.py": "ec46d74954b62b6f4618b2b12198c4587d829c1d711ec8f67b5adc125989d988",
"domus/infrastructure/sqlite_task_reviews.py": "96984dc6f02f6e7a4cf88a328da94cac20ebc9ce405134859b141290ff1bd7ed",
"domus/infrastructure/sqlite_task_schema.py": "25e3241cb6c30ceb1701c854c7c88a4051085cabc255b03e78847beda525214a",
"domus/infrastructure/sqlite_tasks.py": "f3785700505045ccf6f3e63dbb122c210166027ac296f85729c32d97b16d1126",
"domus/infrastructure/sqlite_tasks.py": "9ebbf88c1ac1bd75e6832c8e25c595d28b124110c4076639d226097164ef3cc1",
"domus/infrastructure/standalone_sessions.py": "ec3fd7a848c2c2a57e416bc7361e416c823d76706b474d08120cdd9e1534655a",
"domus/infrastructure/task_cursor.py": "b21dbb915ce874b51008689d05abb4480cb7a65aabc5851f9500e51238bb6b5f",
"domus/infrastructure/task_materials.py": "d5d2934e36f290c7bf44b473392f014eab8749f1f3b3d26a3402079e65d2818f"
},
"storageSchema": 30,
"uiFiles": {
".vite/manifest.json": "40360e01a5c4d65902058c0f719644bb3a135a3283e2b3135d1c6f29a822c9aa",
"assets/index-CacQb2hQ.js": "c9e4d9642fa6990c9c8c53941f2c53abeb55ee873480ac3da73bd72b3dd1b137",
".vite/manifest.json": "4ed436146d05865e5e60e2ef76b99a611b35208a39db3b770b4c039e1de0fb7f",
"assets/index-CjJnHZzV.css": "0f2c8c2e31576c0b64fe60373150f09390dafb896df6c07777b2a220ad430e48",
"index.html": "e6c4761e022f08f0e32d1bfe9cc4eaa6646d5ef1c2816c3dff1d0dba4b2e3c11"
}
"assets/index-Co1HI4BR.js": "cf08dbc51e03912c2762adf261f770bf6fa5deaca70d55d0a06ddf902f5157ca",
"index.html": "ac2712a0405457448fb205d0de452f7a50f2f9c2a10e0772578a2fd18adef47a"
},
"wheelSHA256": "c91bccef222b5206e61829c090b9719a969d2705ea8339c86b896ec39f30d328"
}
2 changes: 1 addition & 1 deletion addon-edge/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Domus Edge
version: "0.0.0-edge.11"
version: "0.0.0-edge.12"
slug: domus_edge
description: Development preview of the local Domus household application
url: https://github.com/vypdev/domus
Expand Down
14 changes: 14 additions & 0 deletions backend/src/domus/application/task_ports.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ class TaskReviewEvidence:
acknowledgements: tuple[OperationEvidence, ...] = ()


@dataclass(frozen=True, slots=True)
class TaskOccurrenceGroup:
total: int
items: tuple[TaskOccurrence, ...]


class TaskRepository(Protocol):
def lifecycle_sources(
self, household_id: str, *, limit: int = 100, after: int = 0
Expand Down Expand Up @@ -94,6 +100,14 @@ def occurrences(
assignee_id: str | None = None,
open_only: bool = False,
) -> tuple[TaskOccurrence, ...]: ...
def occurrence_group(
self,
household_id: str,
states: tuple[OccurrenceState, ...],
assignee_id: str | None,
*,
limit: int = 25,
) -> TaskOccurrenceGroup: ...
def cycle(self, household_id: str, cycle_id: str) -> TaskCycle | None: ...
def save_cycle(self, value: TaskCycle, expected_revision: int) -> None: ...
def cycles(
Expand Down
44 changes: 43 additions & 1 deletion backend/src/domus/application/task_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
resolved_rules,
)
from domus.application.task_material_views import MaterialOutcome, material_outcome
from domus.application.task_ports import TaskCursors
from domus.application.task_ports import TaskCursors, TaskOccurrenceGroup
from domus.application.task_reviews import DependencyReviewView, review_cycle, review_items
from domus.domain.errors import Conflict, Forbidden, InvalidInput, NotFound, StorageFailure
from domus.domain.identity import HumanIdentity, Permission, validate_revision
Expand Down Expand Up @@ -103,6 +103,35 @@ class OccurrenceSummary:
current_cycle_id: str | None


@dataclass(frozen=True, slots=True)
class TaskOverviewItem:
occurrence_id: str
title: str
state: OccurrenceState


@dataclass(frozen=True, slots=True)
class TaskOverviewGroup:
total: int
items: tuple[TaskOverviewItem, ...]


@dataclass(frozen=True, slots=True)
class TaskOverview:
assigned: TaskOverviewGroup
unclaimed: TaskOverviewGroup


def _overview_group(group: TaskOccurrenceGroup) -> TaskOverviewGroup:
return TaskOverviewGroup(
group.total,
tuple(
TaskOverviewItem(item.occurrence_id, item.definition_snapshot.content.title, item.state)
for item in group.items
),
)


CompletionPoints = Literal["automatic", "manual", "manager_required"]


Expand Down Expand Up @@ -316,6 +345,19 @@ def occurrences(
)
return self._page(summaries, limit, binding, lambda item: item.occurrence_id)

def overview(self) -> TaskOverview:
with self.transactions.read() as unit:
actor = self._read(unit)
assigned = unit.tasks.occurrence_group(
self.household_id,
(OccurrenceState.ASSIGNED, OccurrenceState.IN_PROGRESS, OccurrenceState.BLOCKED),
actor.member.member_id,
)
unclaimed = unit.tasks.occurrence_group(
self.household_id, (OccurrenceState.AVAILABLE,), None
)
return TaskOverview(_overview_group(assigned), _overview_group(unclaimed))

def occurrence(self, occurrence_id: str) -> TaskDetail:
with self.transactions.read() as unit:
actor = self._read(unit)
Expand Down
5 changes: 5 additions & 0 deletions backend/src/domus/entrypoints/task_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
OccurrenceSummary,
TaskHistoryItem,
TaskMaterialsView,
TaskOverview,
TaskPage,
TaskPolicyView,
TaskQueries,
Expand Down Expand Up @@ -136,6 +137,10 @@ def create_task_router(
def workspace(request: Request, query: Annotated[_EmptyQuery, Query()]) -> TaskWorkspaceView:
return context(request).queries().workspace()

@router.get("/overview", response_model=TaskOverview)
def overview(request: Request, query: Annotated[_EmptyQuery, Query()]) -> TaskOverview:
return context(request).queries().overview()

@router.get("/policy", response_model=TaskPolicyView)
def policy(request: Request, query: Annotated[_EmptyQuery, Query()]) -> TaskPolicyView:
return context(request).queries().policy()
Expand Down
36 changes: 34 additions & 2 deletions backend/src/domus/infrastructure/sqlite_tasks.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Scoped task repositories with compare-and-swap writes and strict stored-header checks."""

import sqlite3
from collections.abc import Callable
from collections.abc import Callable, Iterable
from dataclasses import dataclass
from typing import cast

from domus.application.task_ports import TaskRepository, TaskReviewEvidence
from domus.application.task_ports import TaskOccurrenceGroup, TaskRepository, TaskReviewEvidence
from domus.domain.errors import Conflict, InvalidInput, StorageFailure
from domus.domain.restoration import OperationEvidence, RetainedOperation
from domus.domain.storage import validate_identifier
Expand Down Expand Up @@ -410,6 +410,38 @@ def occurrences(
+ " ORDER BY occurrence_id LIMIT ?",
(*parameters, limit),
)
return self._occurrence_rows(rows)

def occurrence_group(
self,
household_id: str,
states: tuple[OccurrenceState, ...],
assignee_id: str | None,
*,
limit: int = 25,
) -> TaskOccurrenceGroup:
where, parameters = _page(household_id, limit, None, "occurrence_id")
placeholders = ",".join("?" for _ in states)
where.append(f"state IN ({placeholders})")
parameters.extend(state.value for state in states)
if assignee_id is None:
where.append("json_array_length(document,'$.assignee_ids')=0")
else:
where.append(
"EXISTS (SELECT 1 FROM json_each(task_occurrences.document,'$.assignee_ids') "
"AS assigned WHERE assigned.value=?)"
)
parameters.append(assignee_id)
selection = " FROM task_occurrences WHERE " + " AND ".join(where)
total = cast(
int, self.connection.execute("SELECT COUNT(*)" + selection, parameters).fetchone()[0]
)
rows = self.connection.execute(
"SELECT *" + selection + " ORDER BY occurrence_id LIMIT ?", (*parameters, limit)
)
return TaskOccurrenceGroup(total, self._occurrence_rows(rows))

def _occurrence_rows(self, rows: Iterable[sqlite3.Row]) -> tuple[TaskOccurrence, ...]:
return tuple(
cast(
TaskOccurrence,
Expand Down
Loading
Loading