> 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/phase33-session02-freeze-public-fixtures/spec.md).

# Session Specification

**Session ID**: `phase33-session02-freeze-public-fixtures` **Phase**: 33 - Cloudflare Pages Real Product Fixtures **Status**: Not Started **Created**: 2026-06-25

***

## 1. Session Overview

This session converts the reviewed Phase 33 Session 01 local capture candidate into deterministic committed Pages fixture files through the existing `demo:snapshot` exporter. It verifies the selected local `src/data/live-data.json` input, runs the snapshot dry-run before writing, updates fixture metadata and the review manifest, and records count-based evidence for Trend Finder and Dream Review without copying private payload bodies.

The session is next because Session 01 completed the local capture and manual review work, while Phase 33 Session 02 is the earliest unfinished executable stub. It preserves the static-only Pages boundary: Cloudflare Pages consumes committed fixtures and must not run collectors, schedulers, local bridge reads, Dream runtime, account auth, uploads, or admin mutations.

The work intentionally stops at fixture freezing and metadata review. Deeper Trend Finder projection coherence belongs to Session 03, and the allowlisted Dream Review projection belongs to Session 04.

***

## 2. Objectives

1. Verify the reviewed local capture candidate and current public snapshot gap using count-only inspections.
2. Add minimal manifest metadata for fixture count review and Dream field policy without changing the full projection policy.
3. Run `bun run demo:snapshot --dry-run` before any final fixture write.
4. Write deterministic committed fixture files through `bun run demo:snapshot` only after dry-run and privacy checks pass.
5. Record fixture write results, count deltas, provenance, caveats, and static Pages boundary evidence in implementation notes.

***

## 3. Prerequisites

### Required Sessions

* [x] `phase33-session01-capture-local-demo-runs` - Produced and reviewed the selected local Trend Finder and Dream Review capture candidate.

### Required Tools Or Knowledge

* Bun 1.3.14 from `.bun-version`.
* Existing snapshot exporter command: `bun run demo:snapshot`.
* Fixture-only privacy scan command: `bun run demo:scan:pages --fixtures`.
* Count-only JSON inspection with `jq` or equivalent structured inspection.

### Environment Requirements

* `src/data/live-data.json` exists locally and remains gitignored.
* Public fixture paths exist under `demo-website/public/demo/`.
* No Cloudflare deploy credentials are required for this session.

***

## 4. Scope

### In Scope (MVP)

* As an operator, freeze the reviewed local capture into committed Pages fixtures using the existing snapshot exporter.
* As a reviewer, compare input and output counts for Trend Finder topics, evidence, sources, watchlist rows, advanced run artifacts, Engine Replay state, and Dream prescriptions.
* As a reviewer, confirm `snapshot-metadata.json` and `snapshot-manifest.json` identify the frozen public demo fixture source, route coverage, redaction counts, scan result, and field policies.
* As a maintainer, keep Pages builds centered on committed static fixtures and separate from `demo:snapshot`, collectors, schedulers, and Dream runtime.
* As a maintainer, run focused exporter tests and committed-fixture privacy scan before treating the fixture write as ready for implementation review.

### Out Of Scope (Deferred)

* Full Trend Finder projection hardening - Reason: Session 03 owns retained reference coherence, Engine Replay preservation, and advanced artifact projection.
* Full Dream Review allowlist projection - Reason: Session 04 owns Dream projection code and positive/negative privacy coverage.
* Cloudflare Pages build, budget, route smoke, and deployment - Reason: Session 06 owns release verification and deploy.
* Hosted runtime, Pages Functions, collectors, schedulers, source setup writes, uploads, analytics, or admin mutations - Reason: the public demo remains static-only.

***

## 5. Technical Approach

### Architecture

Use `scripts/lib/pages-demo-snapshot.ts` as the single fixture projection and metadata boundary. The command should first run in dry-run mode against `src/data/live-data.json`, then perform the final write through the exporter's atomic write path. The committed fixture files remain:

* `demo-website/public/demo/live-data.snapshot.json`
* `demo-website/public/demo/snapshot-metadata.json`
* `demo-website/public/demo/graphs/index.json`
* `demo-website/public/demo/graphs/ai-os.json`
* `demo-website/snapshot-manifest.json`

The implementation should add only metadata that helps review the frozen fixture: count summaries and Dream field policy. It must not create separate committed Trend Finder-only or Dream-only manifests.

### Design Patterns

* Static fixture boundary: keeps Pages builds deterministic and credential-free.
* Allowlist projection: keeps private fields, paths, tokens, prompts, provider bodies, logs, and bridge URLs out of committed output.
* Count-only review: proves product data presence without copying private source or Dream payload bodies into session notes.
* Schema-valid labels first: use accepted state values in fixture payloads and carry frozen-real meaning through labels, notes, and manifest metadata until schema migration is explicitly scoped.

***

## 6. Deliverables

### Files To Create

| File                                                                                  | Purpose                                                                                             | Est. Lines |
| ------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | ---------- |
| `.spec_system/specs/phase33-session02-freeze-public-fixtures/implementation-notes.md` | Record commands, count deltas, fixture write results, caveats, scans, and static-boundary evidence. | \~220      |

### Files To Modify

| File                                                | Changes                                                                                             | Est. Lines |
| --------------------------------------------------- | --------------------------------------------------------------------------------------------------- | ---------- |
| `scripts/lib/pages-demo-snapshot.ts`                | Add minimal snapshot count summary and Dream field policy metadata to the existing manifest output. | \~80       |
| `scripts/lib/__tests__/pages-demo-snapshot.test.ts` | Assert deterministic manifest metadata, count summary, Dream policy, and privacy-safe output.       | \~80       |
| `demo-website/public/demo/live-data.snapshot.json`  | Frozen public demo LiveData fixture generated by `bun run demo:snapshot`.                           | generated  |
| `demo-website/public/demo/snapshot-metadata.json`   | Snapshot metadata generated by `bun run demo:snapshot`.                                             | generated  |
| `demo-website/snapshot-manifest.json`               | Review manifest generated by `bun run demo:snapshot`.                                               | generated  |
| `demo-website/public/demo/graphs/index.json`        | Graph registry fixture regenerated by `bun run demo:snapshot`.                                      | generated  |
| `demo-website/public/demo/graphs/ai-os.json`        | Graph fixture regenerated by `bun run demo:snapshot`.                                               | generated  |

***

## 7. Success Criteria

### Functional Requirements

* [ ] `bun run demo:snapshot --dry-run` passes against the selected local input.
* [ ] `bun run demo:snapshot` writes only the expected committed fixture files.
* [ ] `demo-website/public/demo/live-data.snapshot.json` parses as valid JSON and contains a populated Trend Finder branch.
* [ ] Input and output counts for Trend Finder topics, evidence, sources, watchlist rows, Engine Replay state, advanced artifacts, and Dream prescriptions are recorded without raw payload bodies.
* [ ] `snapshot-metadata.json` and `snapshot-manifest.json` record frozen fixture provenance, route coverage, redaction counts, scan status, count summary, and field policy metadata.
* [ ] Cloudflare Pages build scripts still consume committed fixture files and do not invoke snapshot authoring or local runtime commands.

### Testing Requirements

* [ ] Focused snapshot exporter tests pass.
* [ ] Fixture-only privacy scan passes.
* [ ] JSON parse and count inspections pass for committed fixture outputs.

### Non-Functional Requirements

* [ ] No credential values, token-shaped strings, local private paths, raw prompts, provider bodies, source dumps, scheduler logs, private Dream output, or local bridge URLs are committed.
* [ ] The session does not add hosted runtime behavior, Pages Functions, analytics, local bridge calls, source setup writes, uploads, or admin mutations.
* [ ] The fixture write remains deterministic for the same inputs, captured timestamp, and source commit.

### Quality Gates

* [ ] All files ASCII-encoded.
* [ ] Unix LF line endings.
* [ ] Code follows project conventions.
* [ ] Primary user-facing surfaces contain product-facing copy only.

***

## 8. Implementation Notes

### Working Assumptions

* Session 02 is the next executable session: the initial analyzer output for this `plansession` run reported `current_phase` 33, `current_session` null, Session 01 complete, and `session_02_freeze_public_fixtures` as the earliest unfinished Phase 33 candidate.
* The selected local input is available: Session 01 validation confirmed `src/data/live-data.json` exists and the current count inspection reports 9 Trend Finder topics, 199 evidence items, 12 sources, 3 watchlist rows, sanitized Engine Replay state, and 4 Dream prescriptions.
* The current committed public snapshot proves the freeze gap: count inspection reports Dream `null`, 8 Trend Finder topics, 16 evidence items, 12 sources, 3 watchlist rows, and no exported Engine Replay decisions.
* Planning can proceed because the snapshot exporter already provides dry-run, JSON summary, privacy scanning, and atomic fixture writes.

### Conflict Resolutions

* The Session 02 stub asks for non-null Dream and retained Engine Replay in the public snapshot, while the current exporter sets `dream: null` and omits Engine Replay, and Sessions 03 and 04 explicitly own those projection changes. This plan treats Session 02 as deterministic fixture freezing plus manifest/count review, not full projection hardening. Missing Dream or Engine Replay output must be recorded as a count gap for Sessions 03 and 04, not silently described as final release readiness.
* Phase 33 preferred provenance strings include frozen public states that the current Trend Finder schema may not accept. This session keeps payload state values schema-valid and carries frozen-demo meaning through labels, notes, metadata, and manifest fields unless implementation explicitly updates schema and tests within the metadata-only boundary.

### Key Considerations

* Fixture generation is an explicit local operator action; Pages builds consume committed fixture files.
* Session notes must record counts and states, not raw evidence snippets, private Dream prescription bodies, credential names with values, local paths, or command output containing private material.
* No separate committed side manifests should be introduced.

### Potential Challenges

* Current exporter gaps: Record missing Dream or advanced Trend Finder output as structured count evidence and leave full projection work to Sessions 03 and 04.
* Privacy scan failures: Stop fixture writes until the unsafe field or string is redacted through the existing exporter boundary.
* Generated JSON churn: Review generated fixture diffs for intentional captured timestamp, source commit, route coverage, redaction counts, and fixture content changes.

### Relevant Considerations

* \[P31/P32] **Pages demo stays static-only**: Use committed fixtures and static Pages output; do not add Functions, hosted collectors, analytics, or writes.
* \[P31/P32] **Route smoke is a privacy gate**: Preserve no-bridge assumptions for later release smoke tests.
* \[P31/P32] **Public-demo release gates stay bundled**: Keep build, scan, budget, route smoke, private scans, dependency audit, and route evidence together for the final release session.
* \[P02] **Extension payloads and labels stay bounded**: Keep explicit fixture, fallback, degraded, blocked, and unavailable states within payload limits.

### Behavioral Quality Focus

Checklist active: Yes Top behavioral risks for this session:

* Snapshot write path must remain dry-run-first, atomic, and recoverable on privacy or write failure.
* External input from `src/data/live-data.json` must be schema-validated before projection and must not leak private fields into browser fixtures.
* Review metadata must not claim live hosted collection, hosted AI analysis, Dream runtime, or mutable fixture behavior.

***

## 9. Testing Strategy

### Unit Tests

* Update and run `scripts/lib/__tests__/pages-demo-snapshot.test.ts` for deterministic manifest metadata, count summary, Dream field policy, privacy scan, and expected write targets.

### Integration Tests

* Run `bun run demo:snapshot --dry-run` and confirm the projected output passes in-memory privacy scan.
* Run `bun run demo:snapshot` and confirm generated committed fixture files parse and remain inside the allowed output boundary.

### Runtime Verification

* Run `bun run demo:scan:pages --fixtures` against committed fixture files.
* Inspect `package.json`, `scripts/demo/assemble-pages-dist.ts`, and `scripts/lib/pages-demo-build.ts` to confirm Pages builds consume committed fixtures only.

### Edge Cases

* Local input missing or rejected: exporter should fall back only to the documented example input or report `input_invalid` without writing partial fixtures.
* Privacy issue found: exporter or fixture scan should fail with path-specific issue details and no final release claim.
* Existing projection omits Dream or Engine Replay: implementation notes should record the count gap and route follow-up to Sessions 03 and 04.

***

## 10. Dependencies

### Other Sessions

* Depends on: `phase33-session01-capture-local-demo-runs`
* Depended by: `phase33-session03-harden-trend-finder-projection`, `phase33-session04-harden-dream-projection`, `phase33-session05-polish-public-demo-ui-states`, `phase33-session06-scan-build-and-deploy`

***

## Next Steps

Run the `implement` workflow step to begin 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/phase33-session02-freeze-public-fixtures/spec.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.
