Skip to content

reame - #5

Merged
ataibarkai merged 2 commits into
mainfrom
atai/0720/more_readme
Jul 20, 2023
Merged

ataibarkai merged 2 commits into
mainfrom
atai/0720/more_readme

Conversation

@ataibarkai

Copy link
Copy Markdown
Contributor

No description provided.

@ataibarkai ataibarkai changed the title copilotkit reame Jul 20, 2023
@ataibarkai
ataibarkai merged commit 04c21c9 into main Jul 20, 2023
@ataibarkai
ataibarkai deleted the atai/0720/more_readme branch July 20, 2023 20:09
johnprg pushed a commit that referenced this pull request Dec 23, 2025
jpr5 added a commit that referenced this pull request Apr 18, 2026
…ip + isMainPath catch coverage

R17-3 #4: validateAll EACCES test now asserts r.status === 3 strictly. The prior expect([1,3]).toContain defeated the fix it was meant to guard — accepting the pre-fix behavior (1). Restructured the fixture to chmod the parent dir (not the file) so statSync in collectDepsFromDir fails EACCES → infra: true → UnreadableInputError → EXIT_UNREADABLE (3) actually fires. chmod'ing the file routed through readFileSync (not-infra parseError → EXIT_DRIFT), never exercised the fix.

R17-3 #2: parseRequirementsTxt dropped-line test uses '==1.0.0' — an operator-leading line with no package name is GUARANTEED to be dropped by parseRequirementsLine (leading [A-Za-z0-9] required). Replaced the silent early-return guard with an invariant assertion that fails loudly if the fixture ever stops producing a drop.

R17-3 #3: parsePyprojectToml skipped-entry test drops the early-return guard; the Poetry git-only inline table deterministically hits the skipped branch. Added an invariant assertion on detailed.skipped.length.

R17-3 #11: printReport within-stream order tests now compare findLastIndex(earlier-group) vs findIndex(later-group). findIndex-only compared first-match only, which would pass even with interleaving. Fixture includes 2 OK + 2 SKIP (and 2 WARN + 2 FAIL) so the stronger assertion has teeth.

R17-3 #5: EACCES tests' silent `return;` on root replaced with `it.skipIf(isRoot)` at declaration time. The runtime 'filesystem does not enforce chmod' branch now emits a console.warn so the skip is visible in test output rather than a silent green.

R17-3 #6: Added isMainPath catch-branch test. vi.spyOn(path, 'resolve') throws once; asserts result is false, process.exitCode === EXIT_INTERNAL (2), and stderr log contains '[isMainPath] path.resolve failed'. Previously this branch had no coverage — a bare catch {} regression would pass all existing tests.
jpr5 added a commit that referenced this pull request Apr 18, 2026
… route EXIT_UNREADABLE

R19-2 #5: parsePackageJson (and parseRequirementsTxtDetailed /
parsePyprojectTomlDetailed) call fs.readFileSync without a try/catch.
The stat guard in collectDepsFromDir only catches errno at stat time;
TOCTOU or a mode-0000 file on a readable parent (whose stat uses
parent-dir metadata, not the file inode) slips past stat and errors
on the content read instead. That error surfaced to the catch block
and was recorded in parseErrors without infra: true, routing to
report.fail -> EXIT_DRIFT (1) instead of UnreadableInputError ->
EXIT_UNREADABLE (3).

Fix: inspect errno at the catch site. EACCES/EIO/ENOTDIR/ELOOP/EPERM
are classified as infra, matching the set accepted by the stat-time
branch and by collectDepsFromDir's own classification comments.

Also adds a test that exercises exactly this path: statable mode-0000
file on a readable parent dir, asserting exit 3 (not 1).
jpr5 added a commit that referenced this pull request Apr 18, 2026
Replace `R19-2 #1` / `R19-2 #5` headers with behavioral descriptions of
what the tests actually exercise. Review-round identifiers only make
sense inside the review thread they came from; in the test file they
add noise without adding information.
jpr5 added a commit that referenced this pull request Apr 20, 2026
…und agno SDK success-path hang

Reimplements the approach from the now-closed PR #4093 (which I closed
after #4095 merged the agno 2.5.17 upgrade, on the belief that the SDK
bump had fixed the underlying SSE termination bug).

Follow-up evidence collected 2026-04-19 showed the SDK upgrade only
addressed the error path — production /api/smoke with real API keys
still hangs because the agno SDK does not reliably emit TEXT_MESSAGE_END
/ RUN_FINISHED on the success path. Documented in Notion page
3473aa381852815b9765fd28fa53275a, item #5.

Change: instead of `await res.text()` (which only resolves when the
server closes the stream), read res.body incrementally with
getReader() + TextDecoder. Short-circuit as soon as the buffer contains
`"type":"TEXT_MESSAGE_CONTENT"` with `"OK"` — the agent has produced
the expected output, so we cancel the reader and return a 200 success
envelope without awaiting a terminal event that may never arrive. If
the stream closes cleanly without confirmation, return a diagnostic
502 with stage="response_incomplete" so regressions surface clearly.
Keep the existing 45s AbortSignal timeout as a final safety net.

Response envelope shape is preserved for the smoke monitor parser.

This is a client-side mitigation, not a fix. The real fix belongs
upstream in the agno SDK's AG-UI interface. Keep this PR open until
upstream is addressed and verified in production with real keys.
jpr5 added a commit that referenced this pull request Apr 20, 2026
…und agno SDK success-path hang (#4105)

## Summary

Reimplements the SSE incremental reader workaround from the now-closed
PR #4093 on a fresh branch off `main`.

## Background

PR #4093 was closed under the assumption that PR #4095 (agno SDK upgrade
to 2.5.17) had fixed the underlying SSE stream termination bug at the
source. Follow-up diagnostics on 2026-04-19 revealed that the SDK
upgrade only addressed the **error path**; production `/api/smoke` with
real API keys still hangs because the agno SDK does not reliably emit
`TEXT_MESSAGE_END` / `RUN_FINISHED` on the **success path**.

Documented in Notion page `3473aa38-1852-815b-9765-fd28fa53275a`, item
#5.

## Change

`showcase/packages/agno/src/app/api/smoke/route.ts` — swap `await
res.text()` for an incremental reader:

- Read `res.body` via `getReader()` + `TextDecoder` + string buffer
accumulator.
- On each chunk, check whether the accumulated buffer contains
`"type":"TEXT_MESSAGE_CONTENT"` along with `"OK"` in the delta. Once
seen, cancel the reader and return a 200 success envelope — do not await
a terminal event that the SDK may never send on the success path.
- If the stream closes cleanly without ever producing the confirmation
payload, return a 502 with `stage:"response_incomplete"` so regressions
surface clearly in the smoke monitor.
- Keep `AbortSignal.timeout(45000)` as the final safety net.
- Response envelope shape preserved for the smoke monitor parser.

## Scope

Only the agno `/api/smoke/route.ts` is touched. The other 16 showcase
starters use the same `await res.text()` pattern but none have exhibited
the hang in production — no speculative fixes.

## Caveat — this is a mitigation, not a fix

The real fix belongs upstream in the agno SDK's AG-UI interface. **Do
not merge-and-forget.** Keep this PR open until upstream is addressed
and the fix is verified in production with real API keys, then revisit
whether this client-side workaround can be removed.

## Test plan

- [x] Visual inspection of the diff matches the pattern from PR #4093
- [x] Standalone `tsc --noEmit` against `route.ts` with DOM + ES2017
libs — clean (only missing `@types/node` for `process`, expected in
dry-run; code compiles cleanly otherwise)
- [ ] Production curl sanity check against
`https://showcase-agno-production.up.railway.app/api/smoke` once
deployed
- [ ] Monitor next 12h of `Showcase: Smoke Monitor` runs for agno
stability

Closes/replaces the approach from #4093.
shaneholloman pushed a commit to shaneholloman/copilotkit that referenced this pull request Apr 21, 2026
…te integration slug; sort-ordered preview selection

- Extract findFrameworksWithCell into @/lib/docs-render so the docs
  catch-all and framework-scoped catch-all share one implementation
  instead of carrying a near-identical local copy in each (finding CopilotKit#3).
- Validate /docs/integrations/<slug> against the registry with
  notFound() when the slug is unknown. Previously a crafted URL like
  /docs/integrations/fake-framework silently fell through to an empty
  nav tree, indistinguishable from a valid integration with no scoped
  content (finding CopilotKit#4).
- Sort integrations by sort_order then slug before picking the
  animated preview URL. Registry iteration order alone isn't
  deterministic w.r.t. the visual priority the docs UI shows
  everywhere else, so the preview now matches (finding CopilotKit#5).
@jpr5 jpr5 mentioned this pull request May 6, 2026
5 tasks done
tylerslaton added a commit that referenced this pull request May 9, 2026
## Summary

- 3 new D5 probes (multi-turn, agentic-chat-style) for
`/demos/{interrupt-headless, shared-state-read,
tool-rendering-reasoning-chain}` — closes the demo↔probe coverage gap so
every langgraph-python demo now has its own dashboard cell.
- Driver retry-once in `e2e-deep.ts` — transient `goto-error` /
`conversation-error` failures (≥2s on attempt 1) get one retry before
recording red, cutting ~10× the dashboard flap rate. Persistent
assertion-style fails skip retry.
- Drops the legacy dual-claim where `d5-shared-state.ts` owned both
`shared-state-read` AND `shared-state-write` for a single bidirectional
probe — `shared-state-read` now belongs to the standalone recipe-editor
probe.

## Scope rationale

LGP is the north-star integration; this PR codifies its current demo
surface in the test infra. **Other integrations may flip red on the new
probes — that's expected and welcome.** Cross-integration parity follows
in a separate wave; we're using LGP as the template.

## Files

- `showcase/harness/src/probes/scripts/d5-interrupt-headless.ts` (new) —
`useHeadlessInterrupt` flow: chip → interrupt popup → slot pick →
resume.
-
`showcase/harness/src/probes/scripts/d5-tool-rendering-reasoning-chain.ts`
(new) — combines reasoning-block slot + per-tool renderer (WeatherCard /
FlightListCard).
- `showcase/harness/src/probes/scripts/d5-shared-state-read.ts` (new) —
recipe-editor with neutral default agent, asserts `recipe-card` form
mounts AND agent references recipe context across turns.
- `showcase/harness/src/probes/drivers/e2e-deep.ts` — retry-once loop
around `runFeature`.
- `d5-registry.ts` / `d5-feature-mapping.ts` / `live-status.ts`
(dashboard) / LGP `manifest.yaml` / `feature-registry.json` /
`constraints.yaml` — wire the new featureTypes and features end-to-end.
- `d5-shared-state.ts` (+test) — drops dual-claim.
- 2 pre-existing test fixes folded in: `d5-gen-ui-interrupt.test.ts`
(mock updated to current evaluate-poll resume signal) and
`conversation-runner.test.ts` (preFill ordering assertion now matches
actual deferred-cascade contract).
- aimock `d5-all.json` — +2 shared-state-read fixtures.
interrupt-headless and tool-rendering-reasoning-chain reuse existing
fixtures whose substrings already match their chip prompts.

## Test plan

- [x] `pnpm vitest run` in `showcase/harness/` → **1588 / 1588 passing**
(was 1585 / 1588 with 3 pre-existing fails before this PR; 2 are fixed
here, 1 was an obsolete-mock issue).
- [x] `npx tsx showcase/scripts/validate-fixture-tool-surface.ts` →
clean (282 fixtures × 627 demos, no drift).
- [x] `npx tsx showcase/scripts/generate-registry.ts` → clean (18
integrations, 38 wired LGP features, 756 catalog cells).
- [x] `pnpm typecheck` in `showcase/harness/` → clean.
- [x] `d5-mapping-drift.test.ts` → green (CATALOG_TO_D5_KEY mirrors
REGISTRY_TO_D5).
- [ ] After merge: watch the e2e-deep dashboard rotation — the 3 new LGP
cells should write rows on first tick (no red zombies — these are
first-time emissions).

## Known follow-up (NOT in this PR)

`auth.spec.ts` test #5 ("signing back in re-mounts a fresh chat
surface") fails on Railway. Symptom: after sign-out → sign-in cycle, the
second `Hello again` send doesn't produce an assistant response within
30s. Looks like a `react-core/v2` ref-handling regression on
`<CopilotKit>` unmount/remount — deserves its own focused investigation
rather than expanding this PR.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
tylerslaton added a commit that referenced this pull request May 9, 2026
…rom LGP view (#4744)

Follow-up to [#4743](#4743)
to close the 2 remaining LGP D5 red cells and clean up the dashboard so
it reflects the LGP gold standard.

## Summary

- **Fix `tool-rendering-reasoning-chain` probe** — added `reasoning`
field to the weather/Tokyo + SFO/JFK first-leg fixtures so aimock emits
REASONING_MESSAGE_* events; without them the v2 `<ReasoningBlock
data-testid="reasoning-block">` never mounted (mirrors the convention
from `reasoning-display.json`).
- **Mirror `gen-ui-interrupt` source fixture with the bundle** — source
file was missing the resume-leg toolCallId entries that already exist in
`d5-all.json`. Cosmetic correction so re-bundling stays consistent. Same
toolCallIds as `interrupt-headless.json` (both probes share the same
agent + chip prompts).
- **Filter deprecated features from LGP dashboard view** — 4 legacy
features (`agentic-chat-reasoning`, `hitl`, `hitl-in-chat-booking`,
`reasoning-default-render`) used to render as X-marked rows for LGP
because LGP intentionally doesn't implement them (consolidated into
modern shape: `reasoning-custom`+`reasoning-default`, `hitl-in-chat`
with `useHumanInTheLoop`). Other 17 integrations still serve those
legacy demos so we don't yank the features entirely — instead marked
them `deprecated: true` and updated `generate-registry.ts` to skip cells
where a deprecated feature is unshipped for an integration. **LGP cells:
43 → 39** (the 4 X rows disappear). Other integrations: unchanged (audit
trail preserved).

## Verification all 39 LGP demos render

> *user concern: "make sure we're not missing any demos in the new
dashboard"*

Confirmed — every LGP `manifest.yaml` feature has a feature-registry
entry and renders a cell. After this PR, the LGP-focused view shows
exactly the 39 gold-standard demos — no missing demos, no spurious
legacy X rows.

| Category | LGP cells |
|---|---|
| Dev Ex | 2 (cli-start, beautiful-chat) |
| Chat & UI | 7 |
| Platform | 4 (auth, multimodal, voice, agent-config) |
| Controlled Generative UI | 5 |
| Declarative Generative UI | 2 |
| Open-Ended Generative UI | 3 |
| Operational Generative UI | 5 (incl. tool-rendering-reasoning-chain) |
| Interactivity | 3 |
| Agent State | 4 (incl. shared-state-read) |
| Multi-Agent | 1 |
| BYOC | 2 |
| **Plus**: interrupt-headless, headless-* variants | 1 |
| **Total** | **39 ✓** |

## Test plan

- [x] `pnpm vitest run` in `showcase/harness/` → **1588 / 1588 passing**
- [x] `pnpm vitest run` in `showcase/scripts/__tests__/` → **19 / 19
passing** (new `deprecated features are emitted only for integrations
that declare them` test added)
- [x] `npx tsx showcase/scripts/validate-fixture-tool-surface.ts` →
clean (282 fixtures × 627 demos, no drift)
- [x] `npx tsx showcase/scripts/generate-registry.ts` → 18 integrations,
38 wired LGP features, 770 catalog cells (38 + 1 stub = 39 LGP)
- [ ] After merge: confirm `tool-rendering-reasoning-chain` flips green
on next e2e-deep tick. Confirm dashboard LGP view no longer shows
X-marked rows for the 4 deprecated features.

## Known follow-ups (NOT in this PR)

- `gen-ui-interrupt` cell — still red on prod with `post-pick signal
never landed within 30s`. The bundle already had the right resume-leg
fixture, so the failure is in the inline `useInterrupt` resume flow
rather than aimock matching. Same class as the `auth.spec.ts` test #5
framework regression. Both deserve a focused investigation rather than
expanding this PR.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
marthakelly pushed a commit to MalaikaAbb/CopilotKit that referenced this pull request May 9, 2026
Closes the demo↔probe coverage gap for /demos/{interrupt-headless,
shared-state-read, tool-rendering-reasoning-chain} so every demo
under langgraph-python (the north-star integration) now has a D5
probe writing to its own PocketBase cell — not relying on cross-
demo umbrella records.

New probes (multi-turn, mirroring the agentic-chat structure):
  - d5-interrupt-headless: exercises useHeadlessInterrupt — chip
    prompt → backend interrupt(...) → app-surface popup → slot pick
    → resume → assistant confirmation. Distinct from gen-ui-interrupt
    (which uses inline useInterrupt).
  - d5-tool-rendering-reasoning-chain: combines reasoning-block slot
    + per-tool renderer (WeatherCard, FlightListCard) on the same
    chat surface. Catches a regression in either side.
  - d5-shared-state-read: recipe-editor demo (neutral default agent,
    no tools) — verifies recipe-card form mounts AND agent reads
    shared state across turns. Drops the dual-claim that
    d5-shared-state.ts had on `shared-state-read` (now write-only).

Driver retry-once (e2e-deep.ts):
  Probes that fail with a transient class (`goto-error` /
  `conversation-error`) AND took ≥2s on the first attempt now retry
  once before recording red. Persistent assertion-style failures
  (sub-2s) and intentional aborts/feature-timeouts skip retry —
  retrying a deterministic mismatch just burns clock and obscures
  the signal. Cuts ~10× the dashboard flap rate.

Plumbing:
  - D5FeatureType enum: +interrupt-headless, +tool-rendering-reasoning-chain.
  - REGISTRY_TO_D5 (harness) + CATALOG_TO_D5_KEY (dashboard) mirror
    the new mappings; d5-mapping-drift test enforces this.
  - LGP manifest features + demos entries + constraints allowlist.
  - feature-registry.json: +shared-state-read.
  - aimock d5-all.json: +2 shared-state-read fixtures (interrupt-
    headless + tool-rendering-reasoning-chain reuse existing fixtures
    that already match their chip prompts).

Tests: 1588/1588 harness vitest green. validate-fixture-tool-surface
clean (282 fixtures × 627 demos, no drift). Two pre-existing test
fixes folded in — d5-gen-ui-interrupt assertion mock updated to
match the current evaluate-poll resume signal; conversation-runner
preFill ordering test now asserts the actual deferred-cascade
contract instead of a stricter pre-preFill ban that the runner
never enforced.

Known follow-up (not in this PR): auth.spec.ts test CopilotKit#5 ("signing
back in re-mounts a fresh chat surface") fails on Railway — second
sign-in's "Hello again" never produces an assistant response. Looks
like a react-core/v2 ref-handling regression on <CopilotKit>
unmount/remount; deserves its own focused investigation.

Other integrations may flip red on the new probes — that's
expected. We're treating LGP as the template; cross-integration
parity follows in a separate wave.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
jpr5 added a commit that referenced this pull request Jun 12, 2026
…n + one zero-warmable warn per tick (CF7 #5)

A warm-configured deployment whose enumerator stopped threading backendUrl
silently lost all #72 cold-start coverage with no trace at any log level.
jpr5 added a commit that referenced this pull request Jun 12, 2026
…— supplemental signal fetch for aggregate rows (CF7-F3 #1)

decodeCellCommError (cell-model.ts) derives the REQ-B unreachable/
pending overlay from row.signal, but the bulk initial fetch projects
STATUS_LIST_FIELDS, which omits signal (useLiveStatus.ts /
live-status.ts:STATUS_LIST_FIELDS) — so on every page refresh rows
materialized with signal undefined and ACTIVE overlays vanished until
an SSE delta happened to re-deliver that row.

Fix option (a) — matching the projection's data-volume rationale (the
signal blob is ~61% of the bulk payload): useLiveStatus now issues a
SUPPLEMENTAL initial fetch, concurrent with the bulk pages, of ONLY
the comm-error candidate aggregate rows (key has no /<featureId>
segment) for the four mirror dimensions, WITH signal, and merges them
over their projected bulk twins by key. That is ~4 rows per
integration, so the bulk projection's first-paint win is preserved.
Per-cell rows under the same dimensions carry heavy parity-diff
signals and are deliberately not re-fetched (a stale per-cell comm
error is only a same/lower-severity tie-break candidate against the
aggregate mirror).

- live-status.ts: new FLEET_COMM_AGGREGATE_DIMENSIONS single source of
  truth (d6/d4/e2e-demos/d5-single-pill-e2e); STATUS_LIST_FIELDS doc
  updated to the truth (buildCellModel reads signal per cell at render;
  the old "only ever read in the drilldown" claim was false).
- cell-model.ts: decodeCellCommError derives its aggregate candidates
  from the shared constant (scan order preserved; pinned by the
  equal-timestamp tie-break tests).
- useLiveStatus.ts: fetchCommAggregateRows + by-key merge; skipped
  entirely for dimension scopes outside the aggregate set; supplemental
  failure retries through the same connect() chain (fail loud).
- useLiveStatus.test.tsx: the PB mock now honours the fields projection
  (returning full rows for the projected bulk fetch is exactly how this
  bug stayed invisible to the suite) and serves the supplemental fetch
  from a dedicated fixture; new cold-fetch red-green tests assert the
  overlay renders end-to-end with NO SSE delta, the narrow filter
  shape, the out-of-set skip, and the in-set narrowing.
- live-status.test.ts: formatter pass on the CF7-F3 #5 test added in
  the previous commit (oxfmt).
jpr5 added a commit that referenced this pull request Jun 12, 2026
…ise + comment truth (CF7-F3 #5)

- mergeRowsToMap's disjoint-key divergence warn no longer fires on a
  signal undefined⇄defined flip between row groups (live-status.ts:
  coreRowFieldsEqual split out of rowsAreNoop): the initial fetch
  projects signal away while SSE deltas deliver full rows, so the flip
  is expected provenance, not a keyspace violation. upsertByKey's
  reducer keeps treating the flip as observable (existing tests pin it).
- __tests__/cell-model.test.ts destructure comment no longer claims
  noUncheckedIndexedAccess is enabled (it is not in this package's
  tsconfig) nor that the sibling matched (it did not).
- src/lib/cell-model.test.ts row() helper aligned to the
  destructure-with-fallback shape the comment describes.
- cell-model.ts:29-31 re-export rationale now cites the actual
  importer (__tests__/cell-model.test.ts).
huangyingting pushed a commit to repomesh/CopilotKit that referenced this pull request Jun 12, 2026
…-side parity (SU7-F1/F2/F3)

SU7-F1 — backend host pattern hardening:
- F1.1  Reject bare trailing ?/# in the backend host pattern
- F1.2  Strip internal tab/CR/LF from the backend host pattern
- F1.3  Warn when ignoring an empty-string local backend override
- F1.4  Reject empty-userinfo @ in the backend host pattern authority
- F1.5  Keep __proto__ keys as data in local-backend maps
- F1.6  Commit the local-backends memo key only after the value computes
- F1.7  Trim local backend overrides before validation and name the real
        rejection
- F1.8  Honest FATAL when the pattern host is a stray scheme fragment
- F1.9  Canonicalize the pattern authority for parity with the override
        path
- F1.10 Acknowledge the staging-to-prod fail-open in the pattern fallback
- F1.11 Harden backend-url/local-backends-env test hygiene

SU7-F2 — runtime-config & client-config edge cases:
- F2.1  Branch POSTHOG_HOST rejection reasons (scheme/degenerate/parse-
        failure) instead of the catch-all mislabel
- F2.2  Reject loopback BASE_URL/DOCS_HOST in production instead of the
        silent http:// prepend
- F2.3  Key the DOCS_HOST fallback once-guard on (mode, shellHost, value)
        and mode-prefix all value-only guard keys
- F2.4  Reject a present-but-empty posthogKey in the client config reader
- F2.5  Drop the trailing slash from SSR_PLACEHOLDER_URL for structural
        parity with server values
- F2.6  Attribute the DOCS_HOST slash-strip to readDocsHost itself
- F2.7  Normalize trailing-dot FQDN spellings in the docs self-host loop
        guard (both compare sides)
- F2.8  Harden console spies to capture all log args; pin the full all-env
        config shape; converge SSR simulation on vi.stubGlobal

SU7-F3 — script-side parity, table classification & test isolation:
- F3 CopilotKit#1  Handle a missing reference integration per the error contract
- F3 CopilotKit#2  Port the runtime backend-host-pattern normalization into the
         generator — scheme/trailing-slash strip, degenerate fallback,
         NEXT_PUBLIC fallback
- F3 CopilotKit#3  Treat non-mapping manifest parses (empty/null/scalar/array YAML)
         as validation errors, not TypeErrors
- F3 CopilotKit#4  Label a missing/unreadable constraints.yaml per the stderr+exit(1)
         error contract
- F3 CopilotKit#5  Align atomic-write tmp naming with the test harness straggler-
         sweep convention; guard main() on direct invocation
- F3 CopilotKit#6  Correct the determineCellStatus unshipped docstring; replace
         stale hardcoded cell counts with formulas
- F3 CopilotKit#7  Isolate the pattern suite on a per-suite tmpdir harness; snapshot
         the generator's full write set
- F3 CopilotKit#8  Classify discarded duplicate wildcards as duplicates — hoist the
         owner check above the destination warns
- F3 CopilotKit#9  Reject a root ("/") EXACT seo-redirect source — homepage-hijack
         twin of the root-wildcard guard
- F3 CopilotKit#10 Reject seo-redirect entries with non-printable-ASCII source/
         destination — close the silent-dead-entry class
- F3 CopilotKit#11 Strip trailing slashes in normalizePosthogHost before the scheme
         test
- F3 CopilotKit#12 Message-filter the empty-slug-set error count; pin the single
         matcher entry
jpr5 added a commit that referenced this pull request Jun 25, 2026
… (claim audit) (#5704)

## Summary

Claim-by-claim accuracy audit of the three showcase ops docs surfaced 32
WRONG + 2 STALE factual claims. This PR fixes every actionable one,
surgically and consistent with each doc's tone. Each fix was re-verified
against the repo / live Railway before writing (RED = current text
wrong; GREEN = new text matches reality). UNVERIFIABLE claims were left
unchanged.

**Supersedes #5702** — that PR only corrected the aimock recursion
warning; this PR applies BOTH that correction AND the §5 startCommand
code-block fix.

### showcase/TESTING.md (15 fixes)
- QA file count: ~498 across **20** packages (was "153 files, 17
packages"). `ls showcase/integrations/*/qa/*.md | wc -l` => 498.
- "PASS 17 packages" → "PASS 20 packages" (9 cells). `ls -d
showcase/integrations/*/ | grep -v _shared | wc -l` => 20.
- Per-package E2E: ~33–41 specs/package (was "9"); removed fabricated
`renderer-selector.spec.ts` claim + Known-gap #5.
- Aimock fixtures: removed non-existent `feature-parity.json`; fixed
`smoke.json` → `shared/smoke.json`.
- python-sdk: Python 3.10–3.14 matrix (was 3.12).
- Removed `.changeset` from `test_e2e-dojo` and `test_e2e-legacy-v1`
path filters (not in triggers).
- Corrected `showcase_validate.yml` path filter.
- Removed non-existent `test_smoke-starter-deployed.yml` matrix row +
footnote.
- **test/unit paths-ignore reversal:** `test/unit` does NOT fire on
`showcase/**` or `sdk-python/**` PRs — both ARE in `test_unit.yml`
paths-ignore (the doc claimed the opposite). Added `static/quality` to
the sdk-python PR list; fixed danger path to
`sdk-python/copilotkit/langgraph_agent.py`.
- Classic branch protection is fully **disabled** (API returns 404) —
there is no live `required_status_checks.contexts` array.
- Depot footnote: runner is `depot-ubuntu-24.04-4` and most workflows
(not just dojo) run on Depot.

### showcase/RAILWAY.md (8 fixes)
- **Pending Service Provisioning section was fully stale:**
`built-in-agent` is provisioned with real `railway_id f4f8371a-...` in
the `ALL_SERVICES` matrix in `showcase_build.yml`; `grep
PLACEHOLDER-CREATE-RAILWAY-SERVICE` => 0 matches repo-wide. Rewrote
section, removed the fail-loud paragraph.
- Fabricated `generate-starters.ts` → real `extract-starter.ts` /
`provision-starter-fleet.ts`.
- **autoUpdates 41→24/40:** live prod env (b14919f4) has 40 services,
only **24** with `autoUpdates.type=minor`, 16 with none; minor services
carry an all-day/every-day `schedule` array (not "no schedule").
- **showcase_build-vs-deploy attribution:** `serviceInstanceRedeploy`
(via `redeploy-env.ts`) runs from `showcase_build.yml` ("Build & Push");
`showcase_deploy.yml` ("Verify Deploy") only health-checks it. Fixed in
Auto-Updates section, Known Quirks, and the "Add to ALL_SERVICES matrix"
step.
- `smoke.yml` is auto-discovery driven — no edit needed to add a
`showcase-*` service.

### showcase/aimock/RAILWAY.md (6 fixes)
- §1: runs the `showcase-aimock` wrapper image (not the bare
`@copilotkit/aimock` container).
- §3: published `linux/amd64` only (arm64 not published).
- §4 browser-pool: `BROWSER_POOL_MAX_CONTEXTS=24` (was 40); D5 peak
4×4=16 contexts ~4.8 GB; knob is `FEATURE_CONCURRENCY_D6` in
`d6-all-pills.ts` (no `e2e-deep.ts` exists).
- **§5 startCommand:** both live prod (b14919f4) and staging (8edfef02)
aimock instances run a single `--fixtures /fixtures` (before the
provider flags), not three subdir flags. Replaced the code block + flag
table row and **corrected the recursion warning** (a single `--fixtures
/fixtures` loads the whole baked tree — verified live, healthy).
- §7: verify curl payload `"ping"` → `"Respond with exactly: OK"` (the
actual `smoke.json` match string).

## RED→GREEN evidence (highest-impact)
- **qa count:** `ls showcase/integrations/*/qa/*.md | wc -l` => 498; 20
packages.
- **test/unit paths-ignore:** `test_unit.yml` paths-ignore includes both
`showcase/**` and `sdk-python/**` — directly reverses the doc's
parenthetical.
- **showcase_build vs deploy:** `showcase_build.yml:810 npx tsx
showcase/scripts/redeploy-env.ts staging ...`; `showcase_deploy.yml`
name = "Showcase: Verify Deploy", no redeploy call.
- **autoUpdates 24/40:** live GraphQL on prod env b14919f4 — 40
services, 24 minor, 16 none; minor schedule = 7 days, startHour 0 /
endHour 24.
- **aimock §5 startCommand:** live GraphQL on prod + staging — `node
/app/dist/cli.js --proxy-only --fixtures /fixtures --provider-openai ...
--validate-on-load --host 0.0.0.0 --port 4010`.

Audit ref: claim-by-claim audit @ commit 99f24fa. Full fix-log
retained out-of-tree at `aimock-docs-fix-log.md`.

## Test plan
- [ ] `oxfmt --check` passes on the three docs (verified locally).
- [ ] Docs-only change; no code/CI behavior affected.
jerelvelarde added a commit to jerelvelarde/CopilotKit that referenced this pull request Jul 28, 2026
Smoke: app shell/branding, chat, removed starter SVGs. The agent-seeded
kanban test is .fixme pending the threadId/run-flow fix (Ben's review CopilotKit#5) —
runs do not complete in the local mock stack (BFF THREAD_NOT_FOUND).
mxmzb added a commit that referenced this pull request Aug 12, 2026
Follow-up to the previous commit, which fixed the two beat-maps' headers and their
flagged risks but left the body still speaking in the future tense about work that
has landed. Comment/doc only.

src/skins/airline/data/beat-map.md
- § "It is ADDITIVE" claimed `use-data.ts` (`useAirlineData`) "is untouched and
  still drives the trip, loyalty and disruption pages". Both are DELETED; every
  component reads `useAirlineLedger()` through `components/concierge-view.ts`.
- Risk #5, "Two substrates, one passenger — they must not disagree on stage", told
  a later slot to "migrate BOTH readings" and not to touch either seed's AV1423
  without the other. Marked RESOLVED, with the answer it actually got: the
  duplicate reading was DELETED rather than kept in sync, because a hand-synced
  pair of seeds was never going to survive a reseed and is a pair of figures that
  can contradict each other on a projector with nothing checking.
- The beat table's four "(later slot)" cells, the beat-4 seed note, and the route
  list's "memory re-seed: later slot" — all shipped.

src/skins/keel/data/beat-map.md
- Beat 4's "the seeded memory (a later slot writes the file)" — written, and the
  scope it was written at (`user`, never `project`) named, since that is the choice
  the next author most needs and the one CLAUDE.md and demo-beats.md now flag.

Skill impact: none beyond the previous commit. These two files are per-skin design
records, not part of `.claude/skills/reskin/`, and the generalisable lessons in
them (the two-substrates seed, the second clock) were already lifted into
demo-beats.md § "Seeding memories" and SKILL.md § step 3 in that commit.

Verified: pnpm lint, pnpm exec tsc --noEmit, pnpm test:unit (197 files / 2227
tests), pnpm build — all green.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
tylerslaton added a commit that referenced this pull request Sep 10, 2026
Replace the existing Copy Prompt controls in their current docs hero and
article page-tools spots with the approved #5 button: a white control
with docs-native corner radii, copy, Claude Code, and Codex actions,
plus View prompt on hover, keyboard focus, and touch. Provider logos
have no surrounding circles. The four existing hero render callsites and
one page-tools callsite stay in place; this PR adds no new placements.
MarkdownCopyButton and ViewOptionsPopover implementations and menu
contents remain unchanged. Minimal adjacent trigger/container styling
lets the replacement fit the former combined control.

The component uses the existing docs control radius token (14px at the
default font size), including its preview and modal controls.

The primary action only copies. App actions request native launch before
awaiting the clipboard; repeated app clicks share an in-flight payload.
Denied clipboard access and overlong Claude prompts leave selectable
text in a modal. Existing framework/frontend/page context and onboarding
run analytics remain intact.

Telemetry records one
`docs.intelligence_onboarding_prompt_action_clicked` event per direct
action: `copy`, `open_claude`, `open_codex`, `view_prompt`, or
`copy_preview`. The existing successful-copy event retains its context
and gains `action`. Intent precedes native handoff or clipboard work;
failures never claim success. Preview copy reuses the displayed run ID.
Both events are covered by the docs telemetry fragment extractor,
including optional framework/frontend context. Prompt contents are
excluded.

Validation: 67 focused component tests and the docs telemetry extraction
test passed, standalone docs typecheck/lint passed, and production build
passed. Chromium checks passed for exact clipboard contents, raw prompt
copy, Escape/focus return, denied clipboard recovery, article hover, and
touch preview at 390px and 320px. All controls fit the page-tools
container at 320px. The real PostHog SDK browser transport also passed
capture assertions using a dummy key and locally intercepted requests.
Native URL generation/dispatch is covered by tests; the native apps were
not launched during browser checks.

The full docs suite has eight unrelated failures in BrandNav layout and
Angular/Mastra/Microsoft Agent docs content. All eight reproduce in a
separate unchanged origin/main worktree; affected control tests pass.

Exact validation commands (docs commands run from
`showcase/shell-docs`):

```sh
npm exec -- vitest run src/components/__tests__/hero-onboarding-prompt-button.test.tsx src/components/__tests__/page-actions-onboarding-prompt.test.tsx src/components/__tests__/prompt-pill.test.tsx src/components/__tests__/docs-page-tools.test.tsx src/lib/__tests__/launch-prompt.test.ts src/components/content/landing-pages/__tests__/framework-overview.test.tsx src/components/content/landing-pages/__tests__/intelligence-overview.test.tsx
npm run typecheck
npm run lint
npm run build
npm exec -- vitest run --maxWorkers=4
```

Repository-root extraction checks (temporary config resolves TypeScript
from the standalone docs dependencies):

```sh
showcase/shell-docs/node_modules/.bin/vitest run scripts/__tests__/docs-prompt-telemetry.test.ts --config /tmp/docs-telemetry-vitest.config.mjs
NODE_PATH="$PWD/showcase/shell-docs/node_modules" node showcase/shell-docs/node_modules/tsx/dist/cli.mjs scripts/telemetry/emit-fragment.ts --surface docs --out /tmp/docs-prompt-telemetry-fragment.json
git diff --check
```

Asset storage: the Claude and Codex WebP logos are Git LFS objects. Demo
screenshots are not included in the branch's file changes.

Asset-fix validation: the restored logo bytes match the previous files
exactly; `npm run typecheck`, `npm run lint`, and `npm run build`
passed. No component code changed in this follow-up. Both logos were
downloaded from remote LFS into a fresh cache and matched their expected
SHA-256 hashes. The unrelated dashboard suite hit a five-second import
timeout on its first CI run and passed on rerun.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Added a unified prompt action pill for copying prompts, viewing full
prompts, and opening them directly in Claude Code or Codex.
  - Added responsive layouts for desktop, mobile, and touch devices.
  - Added a prompt preview dialog with an easy copy option.
- Added support for launching prompts through Claude and Codex app
links.

- **Bug Fixes**
- Improved copy feedback and error handling, including clearer status
messages when copying succeeds or fails.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
zeekay pushed a commit to Dream-AI-4444/CopilotKit that referenced this pull request Sep 11, 2026
…und agno SDK success-path hang

Reimplements the approach from the now-closed PR CopilotKit#4093 (which I closed
after CopilotKit#4095 merged the agno 2.5.17 upgrade, on the belief that the SDK
bump had fixed the underlying SSE termination bug).

Follow-up evidence collected 2026-04-19 showed the SDK upgrade only
addressed the error path — production /api/smoke with real API keys
still hangs because the agno SDK does not reliably emit TEXT_MESSAGE_END
/ RUN_FINISHED on the success path. Documented in Notion page
3473aa381852815b9765fd28fa53275a, item CopilotKit#5.

Change: instead of `await res.text()` (which only resolves when the
server closes the stream), read res.body incrementally with
getReader() + TextDecoder. Short-circuit as soon as the buffer contains
`"type":"TEXT_MESSAGE_CONTENT"` with `"OK"` — the agent has produced
the expected output, so we cancel the reader and return a 200 success
envelope without awaiting a terminal event that may never arrive. If
the stream closes cleanly without confirmation, return a diagnostic
502 with stage="response_incomplete" so regressions surface clearly.
Keep the existing 45s AbortSignal timeout as a final safety net.

Response envelope shape is preserved for the smoke monitor parser.

This is a client-side mitigation, not a fix. The real fix belongs
upstream in the agno SDK's AG-UI interface. Keep this PR open until
upstream is addressed and verified in production with real keys.
zeekay pushed a commit to Dream-AI-4444/CopilotKit that referenced this pull request Sep 11, 2026
…und agno SDK success-path hang (CopilotKit#4105)

## Summary

Reimplements the SSE incremental reader workaround from the now-closed
PR CopilotKit#4093 on a fresh branch off `main`.

## Background

PR CopilotKit#4093 was closed under the assumption that PR CopilotKit#4095 (agno SDK upgrade
to 2.5.17) had fixed the underlying SSE stream termination bug at the
source. Follow-up diagnostics on 2026-04-19 revealed that the SDK
upgrade only addressed the **error path**; production `/api/smoke` with
real API keys still hangs because the agno SDK does not reliably emit
`TEXT_MESSAGE_END` / `RUN_FINISHED` on the **success path**.

Documented in Notion page `3473aa38-1852-815b-9765-fd28fa53275a`, item
CopilotKit#5.

## Change

`showcase/packages/agno/src/app/api/smoke/route.ts` — swap `await
res.text()` for an incremental reader:

- Read `res.body` via `getReader()` + `TextDecoder` + string buffer
accumulator.
- On each chunk, check whether the accumulated buffer contains
`"type":"TEXT_MESSAGE_CONTENT"` along with `"OK"` in the delta. Once
seen, cancel the reader and return a 200 success envelope — do not await
a terminal event that the SDK may never send on the success path.
- If the stream closes cleanly without ever producing the confirmation
payload, return a 502 with `stage:"response_incomplete"` so regressions
surface clearly in the smoke monitor.
- Keep `AbortSignal.timeout(45000)` as the final safety net.
- Response envelope shape preserved for the smoke monitor parser.

## Scope

Only the agno `/api/smoke/route.ts` is touched. The other 16 showcase
starters use the same `await res.text()` pattern but none have exhibited
the hang in production — no speculative fixes.

## Caveat — this is a mitigation, not a fix

The real fix belongs upstream in the agno SDK's AG-UI interface. **Do
not merge-and-forget.** Keep this PR open until upstream is addressed
and the fix is verified in production with real API keys, then revisit
whether this client-side workaround can be removed.

## Test plan

- [x] Visual inspection of the diff matches the pattern from PR CopilotKit#4093
- [x] Standalone `tsc --noEmit` against `route.ts` with DOM + ES2017
libs — clean (only missing `@types/node` for `process`, expected in
dry-run; code compiles cleanly otherwise)
- [ ] Production curl sanity check against
`https://showcase-agno-production.up.railway.app/api/smoke` once
deployed
- [ ] Monitor next 12h of `Showcase: Smoke Monitor` runs for agno
stability

Closes/replaces the approach from CopilotKit#4093.
zeekay pushed a commit to Dream-AI-4444/CopilotKit that referenced this pull request Sep 11, 2026
…te integration slug; sort-ordered preview selection

- Extract findFrameworksWithCell into @/lib/docs-render so the docs
  catch-all and framework-scoped catch-all share one implementation
  instead of carrying a near-identical local copy in each (finding CopilotKit#3).
- Validate /docs/integrations/<slug> against the registry with
  notFound() when the slug is unknown. Previously a crafted URL like
  /docs/integrations/fake-framework silently fell through to an empty
  nav tree, indistinguishable from a valid integration with no scoped
  content (finding CopilotKit#4).
- Sort integrations by sort_order then slug before picking the
  animated preview URL. Registry iteration order alone isn't
  deterministic w.r.t. the visual priority the docs UI shows
  everywhere else, so the preview now matches (finding CopilotKit#5).
JadeCong pushed a commit to CloudEngineHub/CopilotKit that referenced this pull request Oct 10, 2026
…-time review

Addresses 5 Important review findings on the Task 5 commit plus 2
controller rulings.

1. CopilotChat.tsx's run-activity effect listed `copilotkit.headers` in
   its deps. A builder's snapshot object churns on every resolve, so a
   run followed by any re-render tore down and rebuilt the standalone
   run-activity store's subscription for no reason (extra
   setContext/stop/start, and a detachActiveRun when wake-reconnect was
   active). Fixed to `copilotkit.ɵheadersGeneration`, matching
   use-threads.tsx's existing pattern.

   Controller ruling: `HeaderSourceResolver.accept()` (core) now keeps
   the previous snapshot object when a resolve's normalized result is
   shallow-equal to it (same keys, same values), so `core.headers`
   only gets a new reference when a header value actually changed --
   this is what makes headers-as-a-dep safe anywhere in react-core/vue/
   angular, not just in the one call site fixed above.

2. The 20-rerenders memo-stability test had no `publicApiKey`, so
   `ɵwithHeaderDefaults`'s empty-defaults passthrough masked a
   deps-only mutation (adding `headersProp` to the deps without
   touching the factory). Added a `publicApiKey` row: with real
   defaults present, `ɵwithHeaderDefaults` wraps in a NEW closure on
   every call, so a deps-only "obvious fix" now genuinely breaks it.

3. The R3 annotation test was circular: the mock had no
   `copilotkit.headers` snapshot, and the mock `ɵruntimeFetch` wrote
   its header AFTER spreading `init.headers`, so a reintroduced stale
   spread would have been silently overwritten either way. Rewrote it
   to give the mock a snapshot with a key the current source cannot
   produce, and assert that key is ABSENT from the sent request (the
   mock no longer masks a regression). Added the missing
   use-learning-containers coverage: both Effect 1's mount emit and
   Effect 2's cleanup/reset emit now have their own snapshot-absence
   test.

4. StrictMode rows only asserted `/info` called once. Added: the
   connection actually reaches Connected, the `/info` request's
   Authorization matches the builder's resolved value (including the
   async row), a `connect()` spy proving the mount effect really
   double-invoked (2 calls), a 4th row (inline builder + publicApiKey),
   and a 50ms (not 30ms) settle window.

5. Controller ruling: `headersRef.current = headersProp` is now
   assigned during render, not inside a passive `useEffect`. React
   fires a child's effects before its parent's own effects
   (bottom-up); if only the provider's effect updated the ref, a child
   effect that fires a request in the SAME commit as a new builder
   closure would still read the previous commit's closure. Verified
   with a plain (non-proxied) HttpAgent -- deliberately NOT wrapped
   with `ɵruntimeFetch`, so `prepareAgentHeadersForRun`'s one
   synchronous resolution is the only place the token can land, with
   no send-time safety net to mask the race.

Mutation checks (all restored after confirming failure):
- CopilotKit#1: CopilotChat.tsx dep reverted to `copilotkit.headers` -> new
  run-activity test failed (3 unwanted setContext/start/stop calls
  instead of 0).
- CopilotKit#1 (core ruling): `accept()` reverted to always replace the
  snapshot -> both new core-header-source tests failed (`toBe` on
  object identity).
- CopilotKit#2: `headersProp` added to the deps array only (factory untouched)
  -> the "with publicApiKey" row failed (20 setHeaders calls); the
  "no publicApiKey" row still passed, exactly as the review predicted.
- CopilotKit#3: put `copilotkit.headers ?? {}` back in use-learn-from-user-action
  and in both use-learning-containers effects -> all three new
  snapshot-absence tests failed.
- CopilotKit#4: commented out `copilotkit.connect()` in the reconnect effect ->
  all 4 StrictMode rows failed on the new Connected-status assertion.
  (A `setHeaders({})` or `setRuntimeUrl` toggle in the effect's own
  cleanup, as the review suggested by example, does NOT reproduce a
  failure here: the effect's setup unconditionally re-applies every
  setter before calling `connect()` again on the second StrictMode
  invoke, so anything a mutation confined to cleanup changes gets
  healed by the very next setup pass. Documented so a future pass
  doesn't re-attempt the same example expecting it to fail.)
- CopilotKit#5: moved `headersRef.current = headersProp` back into a passive
  `useEffect` -> the new same-commit test failed (`agent.headers`
  carried the stale "Bearer tok-1" instead of "Bearer tok-2").

Verification:
- `NX_NO_CLOUD=true pnpm nx run @copilotkit/react-core:test --skip-nx-cache`
  -> 159 files / 1747 tests, all green.
- `NX_NO_CLOUD=true pnpm nx run @copilotkit/core:test --skip-nx-cache`
  -> 81 files / 1002 tests, all green.
- `NX_NO_CLOUD=true pnpm nx run @copilotkit/core:check-types --skip-nx-cache`
  and `NX_NO_CLOUD=true pnpm nx run @copilotkit/react-core:check-types --skip-nx-cache`
  -> both clean.
- Core dist rebuilt (`nx run @copilotkit/core:build --skip-nx-cache`)
  after the header-source.ts change, before re-running react-core.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
BenTaylorDev added a commit that referenced this pull request Nov 6, 2026
…lterable (#8244)

Item #3 of the PostHog cost-reduction plan (Notion: "PostHog cost
reduction — decisions").

## Problem

`showcase/shell-docs/src/middleware.ts` sends one `docs_pageview` per
ordinary docs page request, about 7.1M events a month. The event carried
only `path`:

- No `$process_person_profile`, so every event created or updated a
person profile and billed at the identified rate.
- Bots and agents never return the `ph_distinct_id` cookie, so each of
their hits minted a new person.
- No user agent, so PostHog's bot filter classified 100% of these events
as `no_user_agent` (Automation).
- No `$ip`, so GeoIP located our server, not the visitor.

## Change

- `docs_pageview` now sends `$process_person_profile: false`, `$ip`
(from the existing `clientIp(request)`), `$raw_user_agent` (capped at
512 characters, like the llm-text path), `environment` and `referrer`.
`captureLlmTextFetch` is the model. `$geoip_disable` is NOT set: with
`$ip` set to the visitor's address, GeoIP is now correct.
- The id cookie is renamed from `ph_distinct_id` to `ph_docs_id`, so
every visitor gets a new id. This is required. PostHog upgrades a
distinct_id that already has a person back to identified processing even
when the flag is false (`person_mode = force_upgrade`). Without the
rotation, the flag saves almost nothing. A grep of this repo,
Intelligence and oss-path-to-production found no other reader of
`ph_distinct_id` (posthog-js bootstraps only `sessionID` from a URL
param).
- `seo_redirect` gets the same flag, `$ip` and `$raw_user_agent`. Its
fixed distinct_id changes from `seo-redirect-tracker` to `seo-redirect`,
for the same `force_upgrade` reason: the old id already has a person
profile.

Unchanged: the event names, the `docs_pageview` `path` property (five
saved insights read them: rBWKLsAB, lZHWczTd, dD6IV5x1, qJGVQswb,
KIQFqFvp), posthog-js and the browser `$pageview`, and the prefetch,
llm-text and redirect behavior.

## Expected effects

- Event counts are unchanged.
- Unique-person counts on `docs_pageview` drop. There is a one-time
break at cutover because of the cookie rotation. This is expected.

## Follow-up (#5)

After this deploys, enable PostHog's "Filter Bot Events" transformation
on `$raw_user_agent`. Do not enable it before this ships: today no event
carries a user agent, so the filter would drop everything.

## Testing

New tests in `showcase/shell-docs/src/middleware.test.ts`:

- Cookie minted: `docs_pageview` body has the flag, `$ip`,
`$raw_user_agent`, `referrer`, `environment`, no `$geoip_disable`.
`Set-Cookie` sets `ph_docs_id` to the event's distinct_id.
- Cookie present (`ph_docs_id`): the id is reused, the same properties
are sent, and no cookie is set.
- Retired cookie (`ph_distinct_id` only): ignored, and a new
`ph_docs_id` is minted.
- User agent capped at 512 on the pageview path.
- `seo_redirect`: flag, `$ip`, `$raw_user_agent`, and the old
distinct_id is no longer used.

```
$ vitest run src/middleware.test.ts
 Test Files  1 passed (1)
      Tests  18 passed (18)
```

Mutation check: each mutation reddens the new tests.

```
# cookie name reverted to "ph_distinct_id"
      Tests  3 failed | 15 passed (18)
# $process_person_profile and the pageview caller properties removed
      Tests  4 failed | 14 passed (18)
```

Full shell-docs suite: all 432 tests that ran pass. Six suites fail to
load because the local `node_modules` lacks `jsdom`, `@clerk/nextjs`,
`embla-carousel-wheel-gestures` and a built `@copilotkit/react-core/v2`.
None of them import the middleware.

```
 Test Files  6 failed | 61 passed (67)
      Tests  432 passed (432)
```

`oxlint` (0 warnings, 0 errors), `oxfmt --check` (clean) and
`scripts/validate-intelligence-env-names.ts` (pass) were run by hand on
the changed files. `tsc --noEmit` reports no errors in the middleware
files. Its only errors are the same missing-package errors listed above.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Updates**
* Documentation pageviews and SEO redirects now include request context,
including caller IP and a user-agent value capped at 512 characters.
* Pageview tracking preserves referrer and environment details, and
redirect tracking records the relevant paths.
* Documentation pageviews now use a dedicated cookie for visitor IDs.
Existing IDs in the previous cookie are no longer reused.
  * Person-profile processing is disabled for these tracking events.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

1 participant