> 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/phase24-session04-source-setup-target-configuration/tasks.md).

# Task Checklist

**Session ID**: `phase24-session04-source-setup-target-configuration` **Total Tasks**: 25 **Estimated Duration**: 3.5-4 hours **Created**: 2026-06-08

***

## 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          | 3      | 3      | 0         |
| Foundation     | 7      | 7      | 0         |
| Implementation | 11     | 11     | 0         |
| Testing        | 4      | 4      | 0         |
| **Total**      | **25** | **25** | **0**     |

***

## Setup (3 tasks)

Initial verification and environment preparation.

* [x] T001 \[S2404] Verify reviewed source compliance and safe target field prerequisites before exposing editable source setup (`docs/sources/apify-source-onboarding.md`)
* [x] T002 \[S2404] Confirm private source config path, sanitized example, and gitignored local file boundaries (`data/trend-finder.apify-actors.example.json`)
* [x] T003 \[S2404] Confirm local bridge token, loopback, body-bound, and redaction patterns to reuse (`vite.config.ts`)

***

## Foundation (7 tasks)

Core contracts and base implementations.

* [x] T004 \[S2404] \[P] Extend Trend Finder source types with setup metadata, editable target field contracts, and target status enums with types matching declared contract and exhaustive enum handling (`scripts/extensions/trend-finder/sources/types.ts`)
* [x] T005 \[S2404] \[P] Attach reviewed source setup metadata and safe target field declarations to static Apify sources with compliance enforced at the boundary closest to the source (`scripts/extensions/trend-finder/sources/apify-source-config.ts`)
* [x] T006 \[S2404] \[P] Create script-side source setup helper for reviewed declarations, private config parsing, redacted summaries, and safe target validation with schema-validated input and explicit error mapping (`scripts/extensions/trend-finder/sources/source-setup.ts`)
* [x] T007 \[S2404] Add atomic private config write and merge behavior that preserves parser-supported fields with idempotency protection, transaction boundaries, and compensation on failure (`scripts/extensions/trend-finder/sources/source-setup.ts`)
* [x] T008 \[S2404] \[P] Extend browser schema with additive source setup summary defaults and bounded arrays with types matching declared contract and exhaustive enum handling (`src/extensions/trend-finder/schema.ts`)
* [x] T009 \[S2404] \[P] Create browser source setup endpoint constants, response schemas, request helpers, and redaction-safe diagnostics with schema-validated input and explicit error mapping (`src/extensions/trend-finder/source-setup.ts`)
* [x] T010 \[S2404] \[P] Create token-gated source setup bridge skeleton with loopback checks, method limits, bounded JSON bodies, no-store responses, and redacted errors (`scripts/lib/trend-finder-source-setup-bridge.ts`)

***

## Implementation (11 tasks)

Main feature implementation.

* [x] T011 \[S2404] Implement source setup bridge GET state loading from declarations, private config, credential presence, and last-run health with timeout, retry/backoff, and failure-path handling (`scripts/lib/trend-finder-source-setup-bridge.ts`)
* [x] T012 \[S2404] Implement source setup bridge mutation handling for add, update, remove, and enable state with duplicate-trigger prevention while in-flight (`scripts/lib/trend-finder-source-setup-bridge.ts`)
* [x] T013 \[S2404] Register the source setup bridge in Vite middleware with explicit private config path, refresh-token authorization, and loopback enforcement (`vite.config.ts`)
* [x] T014 \[S2404] Include safe source setup summaries in generated Trend Finder payloads without exposing raw config paths, credentials, Actor inputs, Dataset rows, or raw source payloads (`scripts/extensions/trend-finder/collector.ts`)
* [x] T015 \[S2404] Project source setup state, credential labels, target summaries, warnings, and setup-required states into view models with exhaustive status handling (`src/extensions/trend-finder/view-model.ts`)
* [x] T016 \[S2404] Create source setup hook for loading, mutating, revalidating, and resetting local setup state with explicit loading, empty, error, and offline states (`src/extensions/trend-finder/use-source-setup.ts`)
* [x] T017 \[S2404] Create compact accessible Source Setup panel with stable source rows, target controls, warning states, pending controls, and focus support (`src/extensions/trend-finder/components/source-setup-panel.tsx`)
* [x] T018 \[S2404] Wire Source Setup panel into Sources view and visibility controls with platform-appropriate accessibility labels, focus management, and input support (`src/extensions/trend-finder/views/sources-view.tsx`)
* [x] T019 \[S2404] Update Trend Finder fixtures with configured, missing-credential, restricted, placeholder, invalid-target, and degraded source setup states (`src/extensions/trend-finder/fixtures.ts`)
* [x] T020 \[S2404] Update committed fallback and sanitized source config example for additive source setup fields and safe editable target examples (`src/data/live-data.example.json`, `data/trend-finder.apify-actors.example.json`)
* [x] T021 \[S2404] Update Trend Finder source, Apify onboarding, and Apify runtime docs for source setup UI, private config writes, target constraints, credential redaction, and unsupported raw Actor edits (`docs/extensions/trend-finder-sources.md`, `docs/sources/apify-source-onboarding.md`, `docs/apify.md`)

***

## Testing (4 tasks)

Verification and quality assurance.

* [x] T022 \[S2404] \[P] Write source setup helper tests for declarations, reviewed IDs, safe targets, config parsing, atomic writes, redaction, and parser compatibility (`scripts/extensions/trend-finder/sources/__tests__/source-setup.test.ts`)
* [x] T023 \[S2404] \[P] Write source setup bridge tests for methods, token, loopback, oversized body, malformed JSON, invalid payloads, write failure, headers, and redacted diagnostics (`scripts/lib/__tests__/trend-finder-source-setup-bridge.test.ts`)
* [x] T024 \[S2404] \[P] Write schema, hook, view-model, and Source Setup panel tests for defaults, loading/error states, credential labels, target controls, pending mutations, and warnings (`src/extensions/trend-finder/components/__tests__/source-setup-panel.test.tsx`)
* [x] T025 \[S2404] Run focused source setup tests, bridge tests, app typecheck, script typecheck, docs formatting, ASCII validation, and git diff check (`package.json`)

***

## 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 validate workflow step to verify session completeness.


---

# 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/phase24-session04-source-setup-target-configuration/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.
