Skip to content

docs(lessons): explain current state only; rename API title to 'Script Studio'#182

Merged
tyrahappy merged 1 commit into
mainfrom
docs/lessons-current-state-only
Apr 20, 2026
Merged

docs(lessons): explain current state only; rename API title to 'Script Studio'#182
tyrahappy merged 1 commit into
mainfrom
docs/lessons-current-state-only

Conversation

@0b00101111

Copy link
Copy Markdown
Contributor

Summary

Two linked changes in one PR:

  1. Rewrite five lesson documents so they describe the system as it is today — design decisions, architecture, tools, how they work — without narrating prior versions. The 28-article teaching series still walks a learner from novice to mid-level architect; it just stops comparing a no-longer-relevant V1.
  2. Rename the backend FastAPI title from AI Campaign Studio to AI Script Studio to match the frontend/deck rename that already shipped. This is visible at /docs and in the OpenAPI spec.

Lessons touched

# File Change
01 01-why-this-system-exists.md Remove V1→V2 table. Refresh product description: ten scripts, 42 personas, 260 LLM calls.
02 02-the-deployed-architecture.md Drop Gemini→Kimi and OpenAI→Anthropic migration narratives. Keep docs-drift meta-point and current Kimi wiring summary.
04 04-the-api-layer.md Update the quoted main.py code block to match the rename.
14 14-the-provider-abstraction.md Reframe around why the Protocol shape exists today (domain-dictated interface, churn confinement). Drop the 'payoff story' that narrated a past swap.
15 15-kimi-and-openai-compatibility.md Biggest rewrite. Was built around 'two migrations in one project.' Now frames around the current wiring: Anthropic Messages API endpoint, base_url quirks, UA allowlist, content-block flattening, lazy client construction, retry separation.
23 23-the-frontend-stack.md Drop the V1 design-language PR narrative; explain the current design-tokens + Tailwind split. Show the actual crypto.randomUUID fallback code.
README.md Update lesson 15 index row to match its new title.

Backend

  • backend/app/main.py:37: title="Flair2 — AI Campaign Studio"title="Flair2 — AI Script Studio".

What I did NOT touch

  • Lessons 03, 05–13, 16–22, 24–28: sampled several; they're already current-state-only with real code and design-decision explanations.
  • The docs/homework/demo-script-light.md V1 demo narrative: bigger than a rename; needs its own call.
  • Design docs (design/*), CLAUDE.md, and root experiment reports: internal / historical, out of scope for this PR.

Verification

  • Backend tests: 157 passed, 32 skipped (uv run pytest -x -q).
  • Ruff: clean on app/main.py.
  • Grep sweep: no AI Campaign Studio or Campaign Studio remains in backend/ or docs/lessons/. No V1/V2 comparison phrases in the six touched lessons.

Test plan

  • Skim lessons 01, 02, 14, 15, 23 end-to-end for narrative flow
  • Confirm backend /docs shows Flair2 — AI Script Studio
  • grep -ri campaign backend/ docs/lessons/ returns nothing

🤖 Generated with Claude Code

Per the updated framing, the teaching series should describe the system
as it is today — design decisions, architecture, tools, and how they
work — without narrating prior versions. Also aligns the API metadata
with the public-facing 'Script Studio' rename.

Lessons touched
- 01 Why This System Exists: drop the V1→V2 change table; refresh the
  product description to today's artifact (ten short-form video scripts,
  42 personas, 260 LLM calls).
- 02 Deployed Architecture: drop the 'Gemini → Kimi' and 'OpenAI → Anthropic'
  migration narratives; keep the current Kimi wiring and the docs-drift
  meta-point.
- 14 Provider Abstraction: reframe around why the ReasoningProvider
  Protocol shape exists today (domain-dictated interface, churn
  confinement). Remove the 'payoff story' narrating the past swap.
- 15 Kimi chapter: rewrite from 'two-migrations' arc into 'how the Kimi
  provider is wired today' — Anthropic Messages API endpoint, base_url
  quirks, UA allowlist, content-block responses, lazy client, retry
  separation.
- 23 Frontend Stack: drop the 'V1 design language PR narrative', explain
  the current design-tokens / Tailwind split instead. Keep the
  crypto.randomUUID fallback with the actual fallback code.
- README: update the lesson 15 index row to match the new title.

Backend
- backend/app/main.py: rename FastAPI title from 'AI Campaign Studio' to
  'AI Script Studio' so the OpenAPI metadata (shown at /docs) matches
  the product rename already applied to the frontend and deck.

Verification
- backend: 157 passed, 32 skipped; ruff clean on app/main.py.
- grep: no 'Campaign Studio' or V1/V2 comparison phrases remain in
  backend/ or docs/lessons/.
Copilot AI review requested due to automatic review settings April 20, 2026 17:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Flair2 teaching series to describe the system strictly in its current (April 2026) state, and aligns the backend FastAPI OpenAPI metadata with the shipped “Script Studio” product rename.

Changes:

  • Rewrites multiple lessons to remove V1/V2 migration narratives and focus on current architecture, tooling, and provider wiring.
  • Renames the FastAPI app title from “AI Campaign Studio” to “AI Script Studio” (impacts /docs and OpenAPI spec).
  • Updates the lessons index row for lesson 15 to match its new framing/title.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docs/lessons/README.md Updates lesson 15 title/summary in the curriculum index.
docs/lessons/23-the-frontend-stack.md Reframes frontend design-language discussion and documents the crypto.randomUUID fallback.
docs/lessons/15-kimi-and-openai-compatibility.md Rewrites lesson 15 around current Kimi-for-coding + Anthropic Messages API wiring details.
docs/lessons/14-the-provider-abstraction.md Reframes the provider abstraction rationale around current churn-confinement benefits.
docs/lessons/04-the-api-layer.md Updates the quoted FastAPI title= snippet to “AI Script Studio”.
docs/lessons/02-the-deployed-architecture.md Removes historical migration narrative; focuses on verifying deployed reality vs docs.
docs/lessons/01-why-this-system-exists.md Updates the product description and removes the V1→V2 comparison table.
backend/app/main.py Renames the FastAPI application title shown in Swagger/OpenAPI.

Comment on lines +14 to 22
The docstring on the provider file calls this out for anyone reading the code cold:

```python
"""Kimi (Moonshot AI) reasoning provider via the Anthropic Messages API.

Kimi's coding endpoint migrated to an Anthropic-compatible schema
(see /coding/v1/messages). The legacy OpenAI /chat/completions shim
now returns a misleading "only 0.6 is allowed for this model" error
for every request, regardless of temperature — a dead surface.
Kimi's coding endpoint uses an Anthropic-compatible schema
(see /coding/v1/messages). Requires a coding-agent User-Agent
on the allowlist, or the endpoint returns 403.
"""

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lesson says “The docstring on the provider file calls this out…” and then quotes a docstring that mentions the UA allowlist requirement. In the current backend/app/providers/kimi.py docstring (lines 1–7), it instead discusses the legacy OpenAI /chat/completions shim and doesn’t mention the UA allowlist at all. Please update this quoted docstring (and/or the real provider docstring) so the lesson matches the repository’s actual current-state documentation.

Copilot uses AI. Check for mistakes.
Comment on lines +112 to +126
## The `crypto.randomUUID` fallback

## The `crypto.randomUUID` fix (PR #121)
The frontend generates client-side session IDs with `crypto.randomUUID()`. That API is only available in **secure contexts** (HTTPS or `localhost`). S3 static website hosting serves over plain HTTP unless you put CloudFront in front of it — so on the deployed site, `crypto.randomUUID` is `undefined`.

A fun edge case: the frontend used `crypto.randomUUID()` to generate session IDs. This API is only available in **secure contexts** (HTTPS or localhost). S3 static website hosting serves over HTTP, not HTTPS (unless you add CloudFront). On HTTP, `crypto.randomUUID()` is undefined.
The client-side code guards for that:

PR #121 added a fallback: check if `crypto.randomUUID` exists, and if not, generate a UUID using `Math.random()`. This is less cryptographically secure but sufficient for session IDs in a prototype.
```typescript
function generateSessionId(): string {
if (typeof crypto !== "undefined" && crypto.randomUUID) {
return crypto.randomUUID();
}
// Fallback for non-secure contexts (S3 over HTTP)
return "sess_" + Math.random().toString(36).slice(2) + Date.now().toString(36);
}
```

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The crypto.randomUUID section shows a generateSessionId() implementation that doesn’t match the actual code in frontend/src/lib/api-client.ts (getSessionId() persists to localStorage and uses crypto.randomUUID?.() + a Math.random()+Date.now() fallback without the sess_ prefix). Since this lesson claims to show the real deployed fix, please update the code block and surrounding description to mirror the current implementation (including the SESSION_KEY/persistence behavior).

Copilot uses AI. Check for mistakes.
@tyrahappy tyrahappy merged commit 5fa1f29 into main Apr 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants