> 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-session05-polish-public-demo-ui-states/code-review.md).

# Code Review and Repair Report

**Session ID**: `phase33-session05-polish-public-demo-ui-states` **Reviewed**: 2026-06-25 **Scope**: All uncommitted changes in the working tree before this report was created **Result**: RESOLVED

## Review Surface

**Files reviewed** (all pre-report uncommitted changes):

* `.spec_system/state.json` - tracked-modified
* `.spec_system/specs/phase33-session05-polish-public-demo-ui-states/implementation-notes.md` - untracked
* `.spec_system/specs/phase33-session05-polish-public-demo-ui-states/spec.md` - untracked
* `.spec_system/specs/phase33-session05-polish-public-demo-ui-states/tasks.md` - untracked
* `scripts/lib/__tests__/pages-demo-routes.test.ts` - tracked-modified
* `scripts/lib/pages-demo-routes.ts` - tracked-modified
* `src/components/__tests__/dream-run-button.test.tsx` - tracked-modified
* `src/components/app-sidebar.tsx` - tracked-modified
* `src/components/dream-run-button.tsx` - tracked-modified
* `src/components/home/__tests__/dream-hero.test.tsx` - tracked-modified
* `src/components/home/dream-hero.tsx` - tracked-modified
* `src/extensions/trend-finder/components/__tests__/signal-workbench-view.test.tsx` - tracked-modified
* `src/extensions/trend-finder/views/__tests__/brief-view.test.tsx` - tracked-modified
* `src/extensions/trend-finder/views/brief-view.tsx` - tracked-modified
* `src/extensions/trend-finder/views/engine-replay-view.tsx` - tracked-modified
* `src/extensions/trend-finder/views/hidden-gems-view.tsx` - tracked-modified
* `src/extensions/trend-finder/views/signal-workbench-view.tsx` - tracked-modified
* `src/extensions/trend-finder/views/sources-view.tsx` - tracked-modified
* `src/extensions/trend-finder/views/trends-view.tsx` - tracked-modified
* `src/extensions/trend-finder/views/watchlist-view.tsx` - tracked-modified
* `src/lib/__tests__/public-demo.test.ts` - tracked-modified
* `src/lib/__tests__/trend-finder-dashboard.test.tsx` - tracked-modified
* `src/lib/__tests__/trend-finder-engine-replay.test.tsx` - tracked-modified
* `src/lib/__tests__/use-dream-run.test.tsx` - tracked-modified
* `src/lib/public-demo.ts` - tracked-modified
* `src/lib/use-dream-run.ts` - tracked-modified
* `tests/e2e/pages-demo-mobile.spec.ts` - tracked-modified
* `tests/e2e/pages-demo-routes.spec.ts` - tracked-modified

**Inventory commands**: `git status --short`, `git diff HEAD`, `git diff --cached`, `git ls-files --others --exclude-standard`

## Findings by Severity

### Critical

* None.

### High

* None.

### Medium

* `src/extensions/trend-finder/views/sources-view.tsx:235` - Public-demo Sources reused the local source setup view-model detail, which could surface local setup labels such as `Private config loaded` and `Credential present` in the hosted demo. This weakened the public-demo product-surface boundary even though no secret values were exposed. | Fix: replaced the detail with a public-safe reviewed-source summary that says operator setup details stay off the hosted demo, and added assertions that `Private config` and `Credential present` are absent in public-demo Sources. | Status: FIXED

### Low

* `scripts/lib/pages-demo-routes.ts:245` - Engine Replay rendered the new `AI runtime disabled` public-demo label, but the shared Pages route matrix did not assert it, leaving desktop/mobile smoke weaker than the route UI. | Fix: added the label to the Engine Replay route surface checks and updated the registry test to require it. | Status: FIXED
* Repository formatting drift - `bun run lint` and `bun run format:check` reported Prettier drift across changed code and session Markdown. | Fix: ran Prettier on the changed files and reran lint/format checks successfully. | Status: FIXED

## Assumptions and Deliberate Non-Fixes

* Remaining `local bridge`, local scheduler command, and `/__*` strings found by text search were left unchanged when they belonged to local-mode routes, tests, scripts, or explicit no-bridge assertions. Evidence: public-demo hooks still short-circuit local fetches, and Pages smoke passed with no `/__*` route requests.

## Behavior Changes

* Public-demo Sources no longer shows private setup or credential status labels in the read-only hosted-demo summary card.
* Pages demo smoke now requires the Engine Replay `AI runtime disabled` label in addition to frozen snapshot and reviewed media labels.

## Verification

* Tests: `bun run test -- src/lib/__tests__/public-demo.test.ts src/lib/__tests__/use-dream-run.test.tsx src/components/__tests__/dream-run-button.test.tsx src/components/home/__tests__/dream-hero.test.tsx src/lib/__tests__/trend-finder-dashboard.test.tsx src/lib/__tests__/trend-finder-engine-replay.test.tsx src/extensions/trend-finder/components/__tests__/signal-workbench-view.test.tsx src/extensions/trend-finder/views/__tests__/brief-view.test.tsx scripts/lib/__tests__/pages-demo-routes.test.ts src/components/__tests__/app-sidebar.test.tsx` - PASS - 10 files, 167 tests.
* E2E: `bun run test:e2e -- tests/e2e/pages-demo-routes.spec.ts tests/e2e/pages-demo-mobile.spec.ts --project=pages-demo-chromium` - PASS - 48 tests.
* Type checker: `bun run typecheck` - PASS.
* Script type checker: `bun run typecheck:scripts` - PASS.
* Playwright spec type checker: `bunx tsc --ignoreConfig --noEmit --target ES2022 --module ESNext --moduleResolution Bundler --lib ES2022,DOM,DOM.Iterable --types node --skipLibCheck tests/e2e/pages-demo-routes.spec.ts tests/e2e/pages-demo-mobile.spec.ts` - PASS.
* Linter: `bun run lint` - PASS.
* Formatter: `bun run format:check` - PASS.
* Whitespace: `git diff --check` - PASS.
* ASCII: `LC_ALL=C rg -n "[^[:ascii:]]" ...changed files...` - PASS.
* LF endings: `rg -n $'\r' ...changed files...` - PASS.
* Final diff re-read: PASS - no unresolved findings found in the final changed hunks.

## Validation Repair Addendum

**Reviewed**: 2026-06-25 **Scope**: Test expectation repairs made during `validate` after the first full `bun run test` surfaced stale public-demo copy assertions. **Result**: RESOLVED

**Additional files reviewed**:

* `src/routes/__tests__/extensions-routes.test.tsx` - updated public-demo Trend Finder and Engine Replay route expectations from old generic copy to the new frozen real snapshot copy.
* `src/routes/__tests__/root-component.test.tsx` - updated top-bar public-demo run button expectation from old frozen-snapshot label to `AI runtime disabled`.
* `src/extensions/trend-finder/components/__tests__/source-setup-panel.test.tsx`
  * updated read-only public-demo source setup expectation to the new reviewed public-source snapshot message.

**Findings**:

* None. The addendum changes are test-only contract alignment with the session copy changes and do not alter runtime behavior.

**Verification**:

* `bun run test -- src/routes/__tests__/extensions-routes.test.tsx src/routes/__tests__/root-component.test.tsx src/extensions/trend-finder/components/__tests__/source-setup-panel.test.tsx` - PASS - 3 files, 57 tests.
* `bun run test` - PASS - 378 files, 4296 tests.
* `bun run typecheck` - PASS.
* `bun run typecheck:scripts` - PASS.
* `bun run lint` - PASS.
* `bun run format:check` - PASS.
* `git diff --check` - PASS.
* ASCII/LF changed-file check - PASS - 32 files.
* `bun run test:e2e -- tests/e2e/pages-demo-routes.spec.ts tests/e2e/pages-demo-mobile.spec.ts --project=pages-demo-chromium` - PASS - 48 tests.
* `bunx tsc --ignoreConfig --noEmit --target ES2022 --module ESNext --moduleResolution Bundler --lib ES2022,DOM,DOM.Iterable --types node --skipLibCheck tests/e2e/pages-demo-routes.spec.ts tests/e2e/pages-demo-mobile.spec.ts` - PASS.

## Summary

1. Reviewed 28 pre-report files across session specs, public-demo copy/helpers, Dream Review UI, Trend Finder routes, route matrix, unit tests, and Pages smoke tests.
2. Resolved 1 medium finding, 2 low findings, and verified the fixes with focused unit tests plus desktop/mobile Pages smoke.
3. Reviewed and resolved the validation-discovered stale test expectations in 3 additional test files.
4. Deliberately left local-mode runtime copy and endpoint strings unchanged where they are not public-demo product surfaces.
5. Tests, e2e smoke, lint, format, type checks, whitespace, ASCII, and LF checks all passed.


---

# 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-session05-polish-public-demo-ui-states/code-review.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.
