> 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/phases/phase_29/session_08_required_derived_field_closeout_gate.md).

# Session 08: Required-Derived-Field Closeout Gate

**Session ID**: `phase29-session08-required-derived-field-closeout-gate` **Status**: Not Started **Estimated Tasks**: \~12-25 **Estimated Duration**: 2-4 hours

***

## Objective

Prevent blank or misleading surfaces by failing loudly when ranked topics lack the derived fields their surfaces expect. Maps the Tier 3 staleness/field gate idea.

***

## Scope

### In Scope (MVP)

* Add a closeout assertion after topic projection and before browser/static export.
* Gate only fields that have schema defaults and deterministic fallback support. Where Sessions 02-06 have shipped, include `attentionPattern`, `receptionSignal`, `corroboration`, `evidenceRationale`, and run narratives as applicable.
* Emit sanitized validation issues that identify the missing field and topic ID, not raw source content.

### Out of Scope

* Gating fields without schema defaults or deterministic fallback.
* Exposing raw source content in validation issues.

***

## Prerequisites

* [ ] Sessions 02-06 complete (derived fields exist with defaults and fallback).

***

## Deliverables

1. Closeout assertion before browser/static export.
2. Sanitized field/topic-ID validation issues.
3. Unit/e2e tests for missing-field failure and legacy-payload safety.

***

## Success Criteria

* [ ] A fixture topic missing a required derived field fails the closeout check before rendering.
* [ ] A legacy payload relying on schema defaults still parses safely.
* [ ] Validation issues name the field and topic ID without raw content.
* [ ] Payload budget and privacy scans remain green.

***

## Key Files

* `scripts/extensions/trend-finder/collector.ts`
* `src/extensions/trend-finder/schema.ts`
* `scripts/extensions/trend-finder/static-brief-qa.ts`
* `scripts/extensions/trend-finder/measure-payload-size.ts`
* `tests/e2e/trend-finder-static-brief.spec.ts`
* `tests/e2e/trend-finder-engine-replay.spec.ts`

***

## Comparison Notes (folded from comparison plan)

**Effort:** Low-Medium. **Boundary risk:** None. Tier 3 polish. **Depends on Sessions 02-06** (the derived fields it gates must exist first).

**Staleness/field gate.** In TrendingAI a blocking check ensures every confirmed feature has the expected sentiment row before render. Trend Finder adoption: add a closeout assertion that ranked topics have required derived fields before browser/static export. Gate only fields that have schema defaults and deterministic fallback support - when Sessions 02-06 have shipped, include `attentionPattern`, `receptionSignal`, `corroboration`, `evidenceRationale`, and run narratives as applicable.

**TrendingAI source pointers.** `scripts/validate-synthesis.ts`, `.claude/skills/TrendingAI/Workflows/Run.md`.


---

# 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/phases/phase_29/session_08_required_derived_field_closeout_gate.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.
