Skip to content

Commit 8ec11fe

Browse files
Tidy comments across the project: professional and concise
Remove scaffolding and phase markers, step-by-step narration, and comments that restate the code; keep and tighten the ones that explain a real reason, invariant, or gotcha. Comments only, no code changes. Agent-facing @appfunction / DTO KDocs (the descriptions the model reads) are left intact.
1 parent 173d01f commit 8ec11fe

50 files changed

Lines changed: 222 additions & 415 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/src/main/kotlin/io/github/tonytonycoder11/agentictaskmanager/AtmApplication.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ import javax.inject.Inject
1414
/**
1515
* Application entry point and Hilt root.
1616
*
17-
* It also implements [AppFunctionConfiguration.Provider]: because the @AppFunction classes have
18-
* constructor dependencies (the domain use cases), the system can't instantiate them itself, so we
19-
* provide a factory that hands it the Hilt-built instances. This is the Hilt <-> AppFunctions bridge.
17+
* Bridges Hilt and AppFunctions: since the @AppFunction classes take constructor dependencies, the
18+
* system can't instantiate them, so [appFunctionConfiguration] hands it the Hilt-built instances.
2019
*/
2120
@HiltAndroidApp
2221
class AtmApplication : Application(), AppFunctionConfiguration.Provider {
@@ -28,7 +27,6 @@ class AtmApplication : Application(), AppFunctionConfiguration.Provider {
2827
@ApplicationScope
2928
lateinit var applicationScope: CoroutineScope
3029

31-
// Built by Hilt with all their use-case dependencies; the factory below hands them to the system.
3230
@Inject
3331
lateinit var taskQueryFunctions: TaskQueryFunctions
3432

app/src/main/kotlin/io/github/tonytonycoder11/agentictaskmanager/agent/TaskActionFunctions.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ import kotlinx.coroutines.withContext
2727
import javax.inject.Inject
2828

2929
/**
30-
* Write AppFunctions (create / complete / delete). Thin adapters over the domain use cases: they
31-
* parse agent input, call the use case, and map the result back — no domain logic lives here.
32-
* Errors are surfaced as the AppFunctions exceptions the agent understands
33-
* ([AppFunctionInvalidArgumentException], [AppFunctionElementNotFoundException]) rather than crashes.
30+
* Write AppFunctions (create, complete, delete). Thin adapters over the domain use cases: parse agent
31+
* input, call the use case, map the result back. Failures surface as AppFunctions exceptions the agent
32+
* understands ([AppFunctionInvalidArgumentException], [AppFunctionElementNotFoundException]).
3433
*/
3534
class TaskActionFunctions @Inject constructor(
3635
private val addTaskUseCase: AddTaskUseCase,
@@ -66,7 +65,7 @@ class TaskActionFunctions @Inject constructor(
6665
recurrence = params.recurrence.toRecurrenceOrDefault(),
6766
)
6867
val result = addTaskUseCase(command)
69-
// Report the new task with its real, graph-derived actionability.
68+
// Report the new task with its graph-derived actionability.
7069
val createdDto = getTaskInsightUseCase(result.createdTask.id)?.toDto()
7170
?: result.createdTask.toDto(isActionable = false)
7271
AddTaskResultDto(

app/src/main/kotlin/io/github/tonytonycoder11/agentictaskmanager/agent/TaskQueryFunctions.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ import kotlinx.coroutines.withContext
1212
import javax.inject.Inject
1313

1414
/**
15-
* Read-only AppFunctions that traverse the dependency graph. These are thin adapters: each one just
16-
* calls the matching domain use case and maps the result to a DTO — there is no domain logic here.
17-
* Hilt builds this class (constructor injection); the Application's AppFunctionConfiguration hands
18-
* the instance to the system (see AtmApplication).
19-
*
20-
* AppFunctions run on the UI thread by default, so each one moves to [Dispatchers.IO] for the work.
15+
* Read-only AppFunctions over the dependency graph. Thin adapters: each calls a domain use case and
16+
* maps the result to a DTO. Hilt constructs the class; the Application's AppFunctionConfiguration
17+
* hands the instance to the system. Work runs on [Dispatchers.IO], since AppFunctions dispatch on the
18+
* main thread by default.
2119
*/
2220
class TaskQueryFunctions @Inject constructor(
2321
private val getActionableTasksUseCase: GetActionableTasksUseCase,

app/src/main/kotlin/io/github/tonytonycoder11/agentictaskmanager/agent/mapper/AgentMappers.kt

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@ import java.time.LocalDate
1212
import java.time.ZoneOffset
1313

1414
/**
15-
* Translation between the agent DTOs and domain types, plus tolerant parsing of agent-supplied
16-
* strings. Agents pass imperfect input, so parsing is forgiving where it safely can be (enums are
17-
* case-insensitive and fall back to a default) and explicit where it cannot (an unparseable date or
18-
* a blank id is reported as an [AppFunctionInvalidArgumentException] rather than silently mishandled).
15+
* Translation between agent DTOs and domain types, plus tolerant parsing of agent-supplied strings.
16+
* Parsing is forgiving where it safely can be (enums fall back to a default) and explicit where it
17+
* cannot (a bad date or blank id raises [AppFunctionInvalidArgumentException] rather than mishandling).
1918
*/
2019

21-
/** Rich mapping from a graph insight (the normal path for query results). */
20+
/** Rich mapping from a graph insight; the normal path for query results. */
2221
fun TaskInsight.toDto(): TaskDto = TaskDto(
2322
id = task.id.value,
2423
title = task.title,
@@ -31,10 +30,7 @@ fun TaskInsight.toDto(): TaskDto = TaskDto(
3130
blocksTaskIds = blocks.map { it.value },
3231
)
3332

34-
/**
35-
* Mapping from a bare [Task] when the actionability is already known by the caller (e.g. a just
36-
* completed task is not actionable; a freshly unblocked task is).
37-
*/
33+
/** Mapping from a bare [Task] when the caller already knows its actionability. */
3834
fun Task.toDto(
3935
isActionable: Boolean,
4036
blockedBy: List<TaskId> = emptyList(),
@@ -66,9 +62,8 @@ fun String?.toRecurrenceOrDefault(): Recurrence =
6662
this?.trim()?.uppercase()?.let { runCatching { Recurrence.valueOf(it) }.getOrNull() } ?: Recurrence.NONE
6763

6864
/**
69-
* Parses an optional due date. Accepts a full ISO-8601 instant ("2026-07-01T09:00:00Z") or a plain
70-
* ISO date ("2026-07-01", interpreted as start of day UTC). Null stays null; anything else is an
71-
* invalid argument the agent should correct.
65+
* Parses an optional due date: an ISO-8601 instant, or a plain ISO date taken as start of day UTC.
66+
* Null stays null; anything else is an invalid argument.
7267
*/
7368
fun parseDueDate(value: String?): Instant? {
7469
val raw = value?.trim()?.takeIf { it.isNotEmpty() } ?: return null

app/src/main/kotlin/io/github/tonytonycoder11/agentictaskmanager/data/AtmDatabase.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ import io.github.tonytonycoder11.agentictaskmanager.data.dao.TaskDao
77
import io.github.tonytonycoder11.agentictaskmanager.data.entity.DependencyEntity
88
import io.github.tonytonycoder11.agentictaskmanager.data.entity.TaskEntity
99

10-
/**
11-
* The Room database. Two tables — tasks and their dependency edges — which together persist the
12-
* dependency graph. Schema export is disabled for Phase 1 (no migrations yet, version 1).
13-
*/
10+
/** Room database persisting tasks and their dependency edges. */
1411
@Database(
1512
entities = [TaskEntity::class, DependencyEntity::class],
1613
version = 1,

app/src/main/kotlin/io/github/tonytonycoder11/agentictaskmanager/data/DatabaseSeeder.kt

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,10 @@ import javax.inject.Inject
1111
import javax.inject.Singleton
1212

1313
/**
14-
* Seeds a small, fully SYNTHETIC scenario the first time the app runs (security rule #5: no real
15-
* personal data). The data is intentionally shaped to exercise every domain feature so the app —
16-
* and later the agent — has something interesting to reason about:
17-
*
18-
* - "Prepare slides" and "Book venue" both block "Present at the GDG meetup" (so it is blocked);
19-
* - "Book venue" is already overdue and blocking, so it surfaces in getBlockingOverdue();
20-
* - "Buy milk" is free (actionable); "Water the plants" is a weekly recurring task.
21-
*
22-
* Seeding goes through the real [AddTaskUseCase] (not raw inserts), so the dependency links are
23-
* created and validated exactly as they would be at runtime.
14+
* Seeds a small synthetic scenario on first run; the data is intentionally shaped to exercise
15+
* every domain feature (dependencies, overdue, recurrence). Uses only synthetic data — no real
16+
* personal data. Goes through the real [AddTaskUseCase] so dependency links are validated exactly
17+
* as at runtime.
2418
*/
2519
@Singleton
2620
class DatabaseSeeder @Inject constructor(
@@ -46,10 +40,10 @@ class DatabaseSeeder @Inject constructor(
4640
title = "Book venue",
4741
description = "Reserve the room for the meetup.",
4842
priority = Priority.URGENT,
49-
dueAt = now.minus(1, ChronoUnit.DAYS), // already overdue
43+
dueAt = now.minus(1, ChronoUnit.DAYS),
5044
),
5145
)
52-
// Depends on both of the above by title -> starts blocked.
46+
// Depends on both of the above, so it starts blocked.
5347
addTask(
5448
AddTaskCommand(
5549
title = "Present at the GDG meetup",

app/src/main/kotlin/io/github/tonytonycoder11/agentictaskmanager/data/TaskRepositoryImpl.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ import javax.inject.Inject
1414
import javax.inject.Singleton
1515

1616
/**
17-
* Room-backed implementation of the domain [TaskRepository].
18-
*
19-
* It is the only place that knows about Room. Every method maps between entities and domain
20-
* models so the domain stays Android-free. Deleting a task relies on the ON DELETE CASCADE
21-
* foreign keys to drop its dependency edges, honouring the repository contract.
17+
* Room-backed [TaskRepository]; maps between entities and domain models so the domain stays
18+
* Android-free. Deleting a task relies on ON DELETE CASCADE to drop its dependency edges.
2219
*/
2320
@Singleton
2421
class TaskRepositoryImpl @Inject constructor(

app/src/main/kotlin/io/github/tonytonycoder11/agentictaskmanager/data/dao/TaskDao.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import kotlinx.coroutines.flow.Flow
1111
@Dao
1212
interface TaskDao {
1313

14-
/** Reactive stream of all tasks; re-emits whenever the table changes. */
1514
@Query("SELECT * FROM tasks")
1615
fun observeAll(): Flow<List<TaskEntity>>
1716

app/src/main/kotlin/io/github/tonytonycoder11/agentictaskmanager/data/entity/DependencyEntity.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ import androidx.room.Index
77
/**
88
* Room row for one dependency edge: [dependentId] depends on [prerequisiteId].
99
*
10-
* Both columns are foreign keys onto `tasks.id` with ON DELETE CASCADE. That is what implements
11-
* the repository contract: deleting a task automatically removes every edge that referenced it,
12-
* so the persisted graph can never hold a dangling edge. (Room enables SQLite foreign-key
13-
* enforcement automatically when foreign keys are declared.)
10+
* Both columns are foreign keys onto `tasks.id` with ON DELETE CASCADE, so deleting a task removes
11+
* every edge referencing it and the persisted graph can never hold a dangling edge.
1412
*/
1513
@Entity(
1614
tableName = "dependencies",

app/src/main/kotlin/io/github/tonytonycoder11/agentictaskmanager/data/entity/TaskEntity.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@ import androidx.room.Index
55
import androidx.room.PrimaryKey
66

77
/**
8-
* Room row for a task.
8+
* Room row for a task. Enums and the due instant are stored as primitives (String / nullable Long
9+
* epoch millis) to avoid TypeConverters; conversion lives in the mappers.
910
*
10-
* Enums and the due instant are stored as primitives (String / nullable Long epoch millis) to
11-
* keep the schema simple and avoid TypeConverters in Phase 1. Conversion to/from the domain
12-
* [Task][io.github.tonytonycoder11.agentictaskmanager.domain.model.Task] lives in the mappers.
13-
*
14-
* [parentId] is indexed (sub-task lookups walk it) but intentionally has no foreign key: the
15-
* sub-task subtree deletion is owned by the domain use case, not by a DB cascade.
11+
* [parentId] is indexed but intentionally has no foreign key: sub-task subtree deletion is owned
12+
* by the domain use case, not by a DB cascade.
1613
*/
1714
@Entity(
1815
tableName = "tasks",

0 commit comments

Comments
 (0)