> For the complete documentation index, see [llms.txt](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/archive/sessions/phase15-session02-live-data-merge-boundary/tasks.md).

# Task Checklist

**Session ID**: `phase15-session02-live-data-merge-boundary` **Total Tasks**: 16 **Estimated Duration**: 3-4 hours **Created**: 2026-05-31

***

## Legend

* `[x]` = Completed
* `[ ]` = Pending
* `[P]` = Parallelizable (can run with other \[P] tasks)
* `[SNNMM]` = Session reference (NN=phase number, MM=session number)
* `TNNN` = Task ID

***

## Progress Summary

| Category       | Total  | Done   | Remaining |
| -------------- | ------ | ------ | --------- |
| Setup          | 2      | 2      | 0         |
| Foundation     | 4      | 4      | 0         |
| Implementation | 6      | 6      | 0         |
| Testing        | 4      | 4      | 0         |
| **Total**      | **16** | **16** | **0**     |

***

## Setup (2 tasks)

Initial configuration and environment preparation.

* [x] T001 \[S1502] Verify Session 01 prerequisites, current live-data writer files, and focused test commands (`.spec_system/specs/phase15-session01-scheduler-config-contract/validation.md`)
* [x] T002 \[S1502] Inventory aggregate-emitted live-data branches and compare them with the planned ownership map (`scripts/aggregate.ts`)

***

## Foundation (4 tasks)

Core structures and base implementations.

* [x] T003 \[S1502] \[P] Finalize typed host/local branch ownership constants with representative root branches (`scripts/lib/aggregate-live-data-write.ts`)
* [x] T004 \[S1502] \[P] Finalize typed extension branch ownership constants for `extensions.items.trend-finder` (`scripts/lib/aggregate-live-data-write.ts`)
* [x] T005 \[S1502] Verify the generated-data lock wrapper uses a private lock path distinct from scheduler run locks with cleanup on scope exit for all acquired resources (`scripts/lib/aggregate-live-data-write.ts`)
* [x] T006 \[S1502] Verify scheduler lock stale-recovery semantics remain reusable for generated-data locking without weakening owner checks (`scripts/lib/scheduler/locks.ts`)

***

## Implementation (6 tasks)

Main feature implementation.

* [x] T007 \[S1502] Implement or refine full-write validation so complete aggregate output fails before write when read-side validation would mutate it (`scripts/lib/aggregate-live-data-write.ts`)
* [x] T008 \[S1502] Implement or refine host/local scoped merge behavior preserving `extensions` with idempotency protection, transaction boundaries, and compensation on failure (`scripts/lib/aggregate-live-data-write.ts`)
* [x] T009 \[S1502] Implement or refine Trend Finder scoped merge behavior preserving host/local root data and other extension items with schema-validated input and explicit error mapping (`scripts/lib/aggregate-live-data-write.ts`)
* [x] T010 \[S1502] Implement or refine invalid existing live-data fallback to `src/data/live-data.example.json` with explicit loading, empty, error, and offline states represented as safe errors (`scripts/lib/aggregate-live-data-write.ts`)
* [x] T011 \[S1502] Route aggregate direct writes through the validated producer gate while preserving `bun run aggregate` compatibility (`scripts/aggregate.ts`)
* [x] T012 \[S1502] Update scheduled aggregate runbook ownership, fallback, lock, and privacy guidance without claiming scoped jobs are runnable yet (`docs/runbooks/scheduled-aggregate.md`)

***

## Testing (4 tasks)

Verification and quality assurance.

* [x] T013 \[S1502] \[P] Add or tighten unit tests for branch preservation, invalid base fallback, missing Trend Finder branch, and private-field rejection (`scripts/lib/__tests__/aggregate-live-data-write.test.ts`)
* [x] T014 \[S1502] \[P] Add or tighten unit tests for shared lock blocking, stale recovery, release cleanup, and distinct generated-data lock path (`scripts/lib/__tests__/aggregate-live-data-write.test.ts`)
* [x] T015 \[S1502] Run focused tests and script typecheck for live-data writer and scheduler lock behavior (`package.json`)
* [x] T016 \[S1502] Run `git diff --check` and validate ASCII-only session artifacts (`.spec_system/specs/phase15-session02-live-data-merge-boundary/tasks.md`)

***

## Completion Checklist

Before marking session complete:

* [x] All tasks marked `[x]`
* [x] All tests passing
* [x] All files ASCII-encoded
* [x] implementation-notes.md updated
* [x] Ready for the validate workflow step

***

## Next Steps

Run the implement workflow step to begin AI-led implementation.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/archive/sessions/phase15-session02-live-data-merge-boundary/tasks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
