> 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/phase27-session02-deterministic-derived-signals-and-risk-flags/tasks.md).

# Task Checklist

**Session ID**: `phase27-session02-deterministic-derived-signals-and-risk-flags` **Total Tasks**: 20 **Estimated Duration**: 3-4 hours **Created**: 2026-06-12

***

## 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     | 5      | 5      | 0         |
| Implementation | 8      | 8      | 0         |
| Testing        | 5      | 5      | 0         |
| **Total**      | **20** | **20** | **0**     |

***

## Setup (2 tasks)

Initial configuration and environment preparation.

* [x] T001 \[S2702] \[P] Verify analyzer state, Session 01 completion, and Session 02 source stub before implementation (`.spec_system/PRD/phase_27/session_02_deterministic_derived_signals_and_risk_flags.md`)
* [x] T002 \[S2702] \[P] Inspect scoring, source-breakdown, schema, card, Hidden Gems, and Signal Workbench baselines before edits (`scripts/lib/ai-runtime/scoring.ts`)

***

## Foundation (5 tasks)

Core structures and base implementations.

* [x] T003 \[S2702] Extend Trend Finder topic schema with additive saturation, hidden-gem score, consensus ratio, role-share, builder-signal, and risk-flag defaults with exhaustive enum handling (`src/extensions/trend-finder/schema.ts`)
* [x] T004 \[S2702] Add deterministic risk flag helper for single-source, low-quality-dominated, stale-evidence, and placement-adjacent flags with schema-validated input and explicit error mapping (`scripts/lib/ai-runtime/risk-flags.ts`)
* [x] T005 \[S2702] Add saturation and continuous hidden-gem score derivation without changing opportunity score weights and with explicit unavailable states (`scripts/lib/ai-runtime/scoring.ts`)
* [x] T006 \[S2702] Extend topic source breakdown derivation with healthy-source consensus ratio, source role shares, and builder signal share with bounded pagination, validated filters, and deterministic ordering (`scripts/lib/ai-runtime/source-breakdown.ts`)
* [x] T007 \[S2702] Add derived-signal view-model helpers for labels, bands, unavailable copy, risk chips, and Hidden Gems ordering with exhaustive enum handling (`src/extensions/trend-finder/view-model.ts`)

***

## Implementation (8 tasks)

Main feature implementation.

* [x] T008 \[S2702] Wire risk flag derivation into scored topics using existing evidence/source/source-local context with no new source or AI calls (`scripts/lib/ai-runtime/scoring.ts`)
* [x] T009 \[S2702] Preserve derived fields through collector source-breakdown, historical summary, and source-local signal attachment with failure-path handling (`scripts/extensions/trend-finder/collector.ts`)
* [x] T010 \[S2702] Render saturation, hidden-gem score, consensus, builder share, and risk chips on trend cards with explicit loading, empty, error, and offline states (`src/extensions/trend-finder/components/trend-card.tsx`)
* [x] T011 \[S2702] Render consensus and role-share summaries in source breakdown rows with platform-appropriate accessibility labels, focus management, and input support (`src/extensions/trend-finder/components/source-breakdown.tsx`)
* [x] T012 \[S2702] Sort Hidden Gems by continuous hidden-gem score and update visible copy while preserving deterministic tie-breakers (`src/extensions/trend-finder/views/hidden-gems-view.tsx`)
* [x] T013 \[S2702] Project saturation/risk/builder fields into Signal Workbench rows, filters, facets, search, and sort values with state reset or revalidation on re-entry (`src/extensions/trend-finder/signal-workbench-model.ts`)
* [x] T014 \[S2702] Add compact labeled Signal Workbench saturation and risk filter controls with reset behavior and no layout overflow (`src/extensions/trend-finder/components/signal-workbench-controls.tsx`)
* [x] T015 \[S2702] Surface saturation, risk, and builder values in the Workbench table with stable column sizing and accessible chip labels (`src/extensions/trend-finder/components/signal-workbench-table.tsx`)

***

## Testing (5 tasks)

Verification and quality assurance.

* [x] T016 \[S2702] \[P] Add scoring and risk-flag tests for saturation, hidden-gem score, each risk flag, no-evidence, stale, and unchanged weighted score cases (`scripts/lib/ai-runtime/__tests__/scoring.test.ts`)
* [x] T017 \[S2702] \[P] Add source-breakdown tests for healthy-source consensus denominator, role shares, builder signal, offline exclusion, and low-quality dominance (`scripts/lib/ai-runtime/__tests__/source-breakdown.test.ts`)
* [x] T018 \[S2702] \[P] Add schema and fixture regression tests proving legacy payloads parse when derived fields are omitted (`src/lib/__tests__/trend-finder-schema.test.ts`)
* [x] T019 \[S2702] \[P] Add view-model, Hidden Gems, and Signal Workbench model tests for labels, filters, facets, sorting, unavailable states, and non-mutation (`src/extensions/trend-finder/__tests__/signal-workbench-model.test.ts`)
* [x] T020 \[S2702] Run focused Trend Finder tests, typechecks, full test command as feasible, and ASCII validation (`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 perform independent validation.


---

# 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/phase27-session02-deterministic-derived-signals-and-risk-flags/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.
