Repository navigation
shell-docs tech-debt: CR-surfaced deferred findings from #4109 - #4112
Merged
Merged
Conversation
… + cross-tab storage listener Previously readStoredFramework returned null for both "never set" and "localStorage unavailable" — consumers couldn't distinguish a fresh visitor from a private-mode browser. Introduce a tri-state: keep storedFramework: string | null for the value, and add storageAvailable: boolean so UIs can branch on "we can't persist your pick" separately from "you haven't picked yet". Also subscribe to window `storage` events so that when another tab clears or changes selectedFramework, this tab's stored state stays in sync (StoredFrameworkHighlight badge + RouterPivot redirect react immediately without a reload). Strengthens the comment above the URL-persistence effect explaining why `stored` is intentionally excluded from the deps array (prevents a setState ping-pong loop), and adds behavioral "Covered by:" notes above each non-trivial fix.
…Hydrated flag Both FrameworkGuardedContent and RouterPivot used to render against `storedFramework` on the very first client render, when it is always null (localStorage is read in a mount effect inside FrameworkProvider). A returning user who picked LangChain would briefly see the full pivot grid + MDX body flash in before storedFramework flipped from null to "langgraph-python" and the redirect fired. Gate both components behind a local `hasHydrated` flag flipped in a mount useEffect. Pre-hydration we render null (for the MDX body) or a minimal "Loading…" placeholder (for the pivot itself), so returning users go straight to the redirect placeholder instead of flashing content that's about to disappear. Fresh visitors see the pivot on the next tick — imperceptible in practice.
…ted collapsable propagation
React.Children.map only visits *direct* children. When an author
wraps nested <PropertyReference> in a <div> or <Fragment> (a common
MDX pattern), the nested references silently lost `collapsable:
true` propagation because the walk stopped at the wrapper.
Replace the single-level `React.Children.map` with
`deepMapPropertyReferences`, a recursive helper that:
- clones + enhances any PropertyReference at any depth with
`collapsable: true`
- preserves arbitrary wrapper elements (div, Fragment, other
components) and recurses into their children
- stops recursing once it hits a PropertyReference — that
reference's own render will deep-walk ITS children on its turn,
which is the correct nesting semantic
Updates the JSDoc above the enhanced-children block to reflect the
new behavior — nested wrappers are now supported.
…yering + drop dead props - activeBrandFromPath now matches /ag-ui exactly or /ag-ui/..., not any path starting with those six chars — prevents misclassifying a future /ag-ui-* slug as AG-UI. - Mobile menu panel z-index bumped to z-[51] so layering above the z-50 backdrop doesn't rely on DOM sibling order. - BrandNavProps (frameworkOptions, frameworkCategoryOrder) were unused dead API — removed from the interface and function signature. Call site passes no props, so no caller changes.
Silent fallback to 'info' masked typos in MDX authors' type props. Now emit a dev-only console.warn listing the known types when an unknown one slips past TypeScript (e.g. from raw MDX string literals).
…ist a11y Previously any valid child element received the injected __index/__total props — stray non-Step valid elements (e.g. spacer divs) would have those props passed straight to the DOM, triggering React warnings. Now filter to elements whose type === Step before cloning. Also add role='list' to the Steps container and role='listitem' to each Step so assistive tech can enumerate the sequence.
… stale active - Dev-only console.warn when author-supplied items.length diverges from the number of <Tab> children — silent drop of extra entries hid bugs. - Dev-only console.warn on duplicate labels — React keys on label below so duplicates broke reconciliation. - Tab button keys now include the index so duplicate labels don't cause React key collisions. - Added a useEffect that re-seeds the active tab when the set of labels changes (e.g. MDX edit swaps titles, HMR reload). Previously useState initialized once on mount, so a tab whose label disappeared left the panel stuck empty.
…tside handler iOS Safari does not reliably fire mousedown for taps landing outside focusable UI, so the panel stayed open on mobile. Mirror the existing click-outside handler on touchstart and widen the handler type to MouseEvent | TouchEvent. stripFrameworkPrefix already restricts its match to the first path segment (docstring makes this explicit).
…nal + documented cell and region are authored on the interface for MDX usage + tooling but the component doesn't consume them at runtime — the parent MDX renderer pre-renders one <Snippet> per framework on the server and emits them as children. Mark them optional and document the contract. Also filter React.Children.toArray output to valid elements before the index→framework map, so stray whitespace text nodes injected by MDX don't shift the mapping and render the wrong snippet.
…ref props + update callers Both props were accepted but ignored (underscore-destructured). scope was originally intended to switch resolution logic, but both branches collapsed to the same href rule. fallbackHref was a pre-hydration placeholder that became unnecessary once the provider made framework URL-derived. Remove them from the public SidebarLinkProps and from the only caller (docs-page-view), which was computing a scope based on slugHrefPrefix solely to pass it through.
readTitle/readMeta are backed by process-scoped Maps. Without a dev bypass, editing an MDX title or meta.json required a server restart to see the change — the nav sidebar would keep showing the old title. Match the convention already used in reference-items.ts: gate both the read and write paths on isProd() so `next dev` re-reads the source on every request. Production behaviour is unchanged.
The inlineSnippets regex deliberately only matches strict self-closing
JSX with an optional `components={...}` attr, which confused readers
into thinking tags like `<Snippet region="x" />` fall through by
accident. Document the two-path design (SNIPPET_MAP inlining vs MDX
component map) so future edits don't try to "fix" the selectivity.
No behaviour change. SNIPPET_MAP aliases were already documented
in-place (finding noted earlier); this commit covers the regex comment
only.
…; validate iframe src; Link detects external href Three loosely-coupled shim hardenings in one commit (all in mdx-registry.tsx): - Tooltip / TooltipProvider were children-only shims that silently dropped Radix-style `content` / `label` props. Route through stub() so dev gets a one-shot warning with the dropped prop names. - YouTubeVideo + IframeSwitcher now validate author-controlled URLs via a shared validateIframeSrc() helper: only https:// is accepted, malformed URLs fall back to rendering nothing, and dev gets a targeted warning. YouTubeVideo also enforces the 11-char video-id shape so a stray value can't traversal-inject query params into the embed URL. - Link shim now detects external hrefs (https://..., mailto:..., etc.) and routes them through a plain <a> with sensible defaults (target=_blank, rel=noopener noreferrer). Internal hrefs continue to use next/link for client-side navigation. next/link should never be used for external URLs — it spuriously prefetches them.
The __itemsCache has no invalidation hook and lives for the life of the Node process. That's correct for the current `next start` deployment but silently fragile if we ever add ISR to /reference — the cache would serve stale items forever. Replace the two-line inline comment with a JSDoc block that spells out the prod vs dev behaviour and the ISR caveat, so future changes know where the assumption lives.
…es + maps tsx/jsx/sh/bash to hljs langs
Two additions in snippet.tsx:
1. parseLineRange now accepts comma-separated segments like
`lines="1-5,10-15"`. Each segment is validated and sliced
independently; discontinuous sections are stitched with a visible
`// ...` gap marker so readers see the jump. Invalid segments fail
the whole prop (clear error beats partial rendering). Single-range
and open-ended ("A-") forms continue to work unchanged.
2. resolveHljsLanguage now has explicit entries for tsx (→ typescript),
jsx (→ javascript), and sh / bash / shell (→ bash). These are the
common bundler-emitted hints that previously returned null and
fell through to highlightAuto — producing noisy one-shot warnings
and non-deterministic highlighting.
…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 #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 #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 #5).
…null-alt filter, registry-gated landing cards - Reject RESERVED_ROUTE_SLUGS at the handler as defense-in-depth. Next.js already prefers exact-match top-level routes over this catch-all, so /docs, /ag-ui, etc. never reach here under normal routing — but if the registry ever ships an integration whose slug collides with a reserved segment, the handler now short-circuits with notFound() rather than rendering garbage (finding #6). - Import the shared findFrameworksWithCell helper instead of a duplicated local copy (finding #3 follow-through). - Filter out unresolved alternative-framework slugs BEFORE mapping to React fragments so the ", " separator aligns with the final rendered count. The pre-filter index previously emitted stray commas when an entry dropped to null mid-sequence (finding #7). - FrameworkLandingPage's four hardcoded LandingCards are now gated by registry integration.features presence: strands (no HITL support) no longer shows a dead "Human-in-the-Loop" card. The card definitions are hoisted into a module-level constant with a TODO pointing at the eventual feature-id → doc-slug mapping (finding #8). - Declare export const dynamicParams = true explicitly so a future migration to output: "export" fails loudly here (under static export dynamicParams must be false) rather than silently 404ing every /<framework>/<slug> URL (finding #9).
…v titles - titleFromSlug now Title-Cases the result (multimodal-inputs → Multimodal Inputs) instead of returning a lowercased fallback. The lowercase labels previously clashed with the docs-render and reference-breadcrumb conventions elsewhere (finding #10). - Wrap getTitleForSlug in a process-scoped cache with dev-mode invalidation, mirroring reference-items.ts. Previously every entry in NAV_DEFINITION re-opened and re-parsed its MDX file on every request — multiply across ~20 nav entries per render and it added noticeable fs churn (finding #11).
…list derived from items - Replace the className="capitalize" breadcrumb span (which only cased the first character, rendering my-component as My-component) with an explicit titleCase helper that splits on hyphens and capitalizes each segment (finding #12). - Derive the sidebar category list from loadAllReferenceItems instead of hardcoding ["Components", "Hooks"]. A new REFERENCE_SUBDIRS entry in reference-items.ts now shows up automatically without a second edit here (finding #13).
…evel error wrappers
Extract the near-identical card markup from both route-level
error.tsx files into src/components/error-boundary-card.tsx. The
route-level handlers remain required (Next.js discovers them per
route segment) but are now one-line wrappers that forward props
with a scope label ("docs" / "ag-ui") so console.error entries
stay distinguishable per route segment (finding #14).
…uncate_csv - Add a comment to the prior-deploy Railway GraphQL query explaining that deployments(first: 1) relies on the API default of createdAt DESC ordering. Railway has no explicit orderBy argument on this field; documenting the assumption means a future schema change (or an operator reading the file cold) has something to point at before debugging stale-deployment guard regressions (finding #15). - Harden both truncate_csv shell helpers (one per run block): disable pathname globbing via set -f for the iteration so a slug containing a glob char (*, ?, [) cannot expand against the filesystem, and lock IFS to whitespace for deterministic word-splitting regardless of caller env. Restore the prior glob state on the way out so other shell blocks see no side effect (finding #16).
… SIZE validation - Extend the binary-extension regex to cover .class, .jar, .pyd, .pyc, .node, .bin, .pdb, .zip, .whl — any of which a build tool can drop into a PR and none of which the previous regex caught. - Add set -euo pipefail at the top of the run block. Previously a transient wc failure (file deleted mid-diff) produced an empty SIZE, which then failed [ "$SIZE" -gt ... ] with "integer expression expected" on stderr while the script marched on — silent false-green possible. Now errors fail the job loudly. - Guard the wc -c call with an explicit numeric-regex check on SIZE. A non-numeric or blank result now emits a ::warning:: and skips the file rather than falling into the arithmetic comparison and crashing under set -e (finding #17, #18).
…rate-registry manifest.slug assertion - bundle-demo-content: reject highlight: paths that resolve outside the package root. The bundle output is committed to the repo and consumed by both shells at build time, so a malicious or mistake-riddled manifest could otherwise smuggle arbitrary filesystem contents (../../secrets, absolute paths) into demo-content.json. Resolve relative to pkgRoot and throw on escape (finding #19). - generate-registry: add a runtime guard that manifest.slug is a non-empty string before path.join(PACKAGES_DIR, manifest.slug). Schema validation upstream already enforces this, but a silently-undefined slug fed to path.join yields "<packages-dir>/undefined" and would produce an empty docs_links without surfacing any error. Fail loudly instead (finding #20).
…nlineSnippets
MDX authors pass component-map overrides via doubled-brace object
syntax, e.g. `<SharedContent components={{ Foo: Bar }} />`. The
previous regex used `[^}]*` which truncates at the inner `}`, so
the tag never matched and the snippet was never inlined. Match the
doubled-brace object form explicitly with `\{\{...\}\}` and
`[\s\S]*?` so multi-line prop objects still match.
…ip only on match The title resolution path had two correctness bugs: - readTitle and loadDoc both ran the H1 fallback regex against the raw file, so a YAML comment like `# ...` inside frontmatter could be picked up as the page's H1. Run the regex against the parsed body (frontmatter stripped) instead. Also log a console.error when frontmatter parsing blows up so a malformed file doesn't silently yield a garbage title. - docs-page-view unconditionally stripped the leading body H1, which dropped distinct H1 headings whenever the MDX body didn't match the frontmatter title. Mirror the ag-ui route: only strip when the body H1 equals the FM title after whitespace normalization, and use `\r?\n` so CRLF-authored MDX parses correctly too.
…ia scheme allowlist MDX-authored hrefs flow into <a> and <Link> without scheme filtering. `rel="noopener noreferrer"` does not neutralize script-URL schemes like `javascript:`, `data:text/html`, or `vbscript:`, so a malicious snippet could land in the rendered page as an XSS vector. Add sanitizeHref() with an allowlist of http/https/mailto/tel plus relative / protocol-relative / fragment / query forms. Anything else returns null and the A/Link overrides render a <span> with the same visible content instead of an anchor. Also add a protocol-relative (`//`) early-return in isExternalHref so those URLs correctly route through a plain <a> rather than next/link.
…boxes and validate InlineDemo src Per MDN, combining `allow-scripts` with `allow-same-origin` lets the framed page remove its own sandbox attribute at runtime — that is a sandbox escape regardless of how much we trust the origin. Drop `allow-same-origin` from all three iframe sandboxes (InlineDemo, author-supplied IFrame, YouTube embed). None of them need same-origin semantics with the parent docs host to function. Also validate InlineDemo's computed demo URL at the sink instead of trusting the registry blindly — a malformed backend_url should render a visible error placeholder, not a silently broken iframe.
…rrides The img and video overrides spread props, then replaced style wholesale with the layout defaults — silently discarding any author-provided style keys from MDX. Merge author style first and layout defaults last so we preserve author intent (e.g. custom max-width, filters) while still enforcing our rounded-corner + marginBottom guards.
…mismatched item sets When the tab item array contains duplicate values or has a length that doesn't match the items prop, looking up the active index by value conflates tabs. Find the active tab by position instead so each rendered tab has a stable identity regardless of duplicated or drifted values.
…works prop change, drop unused props Framework-tabs assumed the items array always matched the frameworks prop one-to-one. A count mismatch wedged the active index at a stale value that could fall outside the new frameworks array, rendering a blank tab. Add a length-mismatch guard that re-syncs state when the frameworks prop changes between renders, and remove props that were threaded through but never read so the surface matches what the component actually uses.
…t and cross-tab storage events localStorage can hold a value from a previous deploy that no longer exists in the current frameworks list (package renames, undeploy, etc.), which pins the provider to a bogus framework identity until the user manually picks another. Validate the stored value against the current list both at mount and on cross-tab `storage` events, and fall back to the default when it doesn't match.
… in dropdown The selector dropdown previously rendered every framework entry as a clickable option, including ones that had been marked as not deployed. Selecting an undeployed entry routed to a blank page. Disable the button for those entries so the dropdown matches the surrounding tab behavior, which already hides them.
A cluster of UX correctness fixes across the page handlers and the shared brand nav: - Filter out undeployed frameworks before rendering so the route doesn't produce blank pages that users can reach via stale links. - Strip the leading body H1 with a CRLF-safe regex that only matches when the body H1 equals the frontmatter title — mirrors ag-ui route behavior so two stacked titles never render. - Reference routes now titleCase the slug and resolve via the index.mdx fallback, matching the directory-plus-index layout the docs source uses. - ag-ui title resolver gains a fallback so deep slugs without a matching registry entry still produce a reasonable title instead of crashing. - brand-nav builds the mobile link href dynamically so it points at the current framework rather than a hard-coded placeholder.
…and error.digest The log effect depended on the error object identity, which changes on every render even when the underlying error is the same — so the effect fired repeatedly and spammed the log. Depend on error.message and error.digest (primitive, stable across renders of the same error) instead. React's exhaustive-deps check is still satisfied because those are the fields the effect actually reads.
…ion, Linux watch warning, Windows paths Correctness and portability fixes in the demo-content bundler: - Track contributor snippets per-file so edits to multiple files in one commit all get attributed, not just the last one walked. - Extend endLine when the same file is seen again rather than dropping the earlier slice — previously a later, smaller region overwrote a larger one. - Warn when the watch flag is set on Linux without the recursive fs.watch support matrix, so the user sees why nothing is firing instead of assuming silent success. - Normalize path separators for Windows so bundle manifests use POSIX paths regardless of the host OS.
…th flat-file collision guard Directory-plus-index.mdx layout produced two reference entries for the same logical page: one at `foo/` (the index) and one at `foo` (a flat sibling if it existed). Collapse index.mdx into the parent slug so the generated list has a single canonical entry, and bail out with a clear error when a flat-file collision would shadow the index. Prevents silently dropping one of the two pages at build time.
Regenerate after the bundler fix so the committed bundle reflects the multi-file contributor tracking and endLine extension behavior.
jpr5
force-pushed
the
jpr5/shell-docs-tech-debt
branch
from
April 21, 2026 05:21
07c9907 to
4e3a231
Compare
This was referenced Apr 21, 2026
jpr5
added a commit
that referenced
this pull request
Apr 21, 2026
…#4117) ## Summary - Docs Sync workflow has been failing since 2026-04-21 with `fatal: pathspec 'showcase/shell/src/content/' did not match any files` (exit 128) on the "Create PR for docs sync" step (example: run 24726678848). - The path was moved by the shell platform restructure (#4109, #4112) — the docs content now lives under `showcase/shell-docs/src/content/`, and the sync marker at `showcase/shell-docs/.docs-sync-sha`. The sync script (`showcase/scripts/sync-docs-from-main.ts`) already writes to those locations; only the workflow's `git add` was still referencing the old monolithic `showcase/shell/` path. - One-line path fix. ## Test plan - [ ] Verify yaml parses. - [ ] Confirm next docs-sync run succeeds end-to-end (opens a sync PR for the 11 pending review items from run 24726678848).
pull Bot
pushed a commit
to TheRakeshPurohit/CopilotKit
that referenced
this pull request
Apr 21, 2026
The "Showcase: Docs Sync" workflow has been failing with `fatal: pathspec 'showcase/shell/src/content/' did not match any files` since the shell platform restructure (CopilotKit#4109, CopilotKit#4112) split the monolithic `showcase/shell/` package into `showcase/shell-docs/`, `showcase/shell-dashboard/`, and `showcase/shell-dojo/`. The sync-docs-from-main.ts script already writes to `showcase/shell-docs/src/content/` and maintains the sync marker at `showcase/shell-docs/.docs-sync-sha`. Update the "Create PR for docs sync" step to stage from the new location so the workflow can commit synced content again.
jpr5
added a commit
that referenced
this pull request
Apr 22, 2026
…dening (#4064) Rebased onto `feat/showcase-ops`. 10 commits, ~210 files, +8,200 / -2,150 (approximate — see `git log`). ## Summary Omnibus cleanup on top of `feat/showcase-ops`: QA parity, `interrupts-langraph` → `interrupts-langgraph` typo rename, `hitl` → `hitl-in-chat` catalog id rename, showcase documentation pass, workflow filename standardization, plus hardening across showcase scripts, shell components, and the LangGraph interrupts starter. ## Scope ### Bundle 0 — QA markdown parity (15 packages) Stubs so every package has checklists for all 9 demos. Final inventory: 17 × 9 = 153 QA files. `langgraph-python` is intentionally excluded because it migrated its HITL demo into `hitl-in-chat` + `hitl-in-app` cells. ### Bundle 1 — `interrupts-langraph` → `interrupts-langgraph` typo rename Full directory rename plus internal Nx / pnpm / lockfile consistency. Starter published at 0.1.5 with dep bumps (`@types/node ^22.19.11`, `typescript ^5.9.3`, `zod ^3.25.76`, `@langchain/langgraph 1.1.5`, `@langchain/core ^1.1.26`) and hardening below. ### Bundle 2 — `hitl` → `hitl-in-chat` catalog id rename Catalog id renamed across 17 package manifests, shell registry, feature registry, constraints (YAML + JSON). QA markdown and e2e specs renamed. URL route `/demos/hitl` is intentionally retained (id vs route split documented in the validator). Exposed + fixed two real bugs in the legacy `hitl.spec.ts`: phantom `data-role="assistant"` selector (matched nothing), and an always-passing approval assertion. Rewrote per-package HITL README content across all 17 packages (was describing the wrong "warm sunset gradient" flow instead of StepSelector). ### Bundle 5 — Showcase documentation pass Four new / updated docs consolidated here, subsuming sibling PR #4021: - `showcase/TESTING.md` — canonical test-gating matrix across every testing workflow, now using the `test_<layer>-<target>` names from Bundle 6 - `showcase/aimock/README.md` — aimock fixture-sync docs - `showcase/FRONTEND-STRATEGY.md` — multi-shell consolidation rationale; inventory table uses current shell names (`shell`, `shell-dojo`, `shell-docs`, `shell-dashboard`). The sibling branch's `shell-dojolike` references were all audited and replaced - `showcase/INTEGRATION-CHECKLIST.md` — adds two new sections: - "Source of Truth: `examples/integrations/*` vs `showcase/packages/*`" - "LangGraph: Prebuilt vs Node-Based" `showcase/README.md` from the sibling branch is **not** pulled — main's post-#4109 version is canonical with a different premise. ### Bundle 6 — Workflow filename standardization Renames 7 testing workflows to the `test_<layer>-<target>` naming scheme with CI UI `name:` fields normalized to `test / <layer> / <target>`. Subsumes sibling PR #4020: - `e2e_dojo.yml` → `test_e2e-dojo.yml` - `e2e_examples.yml` → `test_e2e-legacy-v1.yml` - `showcase_aimock-e2e.yml` → `test_e2e-showcase-on-demand.yml` - `test_doc-examples.yml` → `test_integration-docs.yml` - `test_runtime-servers.yml` → `test_integration-runtime.yml` - `starter_deployed_smoke.yml` → `test_smoke-starter-deployed.yml` - `starter-smoke.yml` → `test_smoke-starter.yml` The 8th rename in the source branch (`showcase_smoke-monitor.yml` → `test_smoke-showcase-deployed.yml`) is **skipped** — `feat/showcase-ops` (#4113) deletes that workflow entirely in favor of runtime probes. For `test_e2e-showcase-on-demand.yml`, `git mv` uses main's current content (preserving 5 hardening commits for readiness probes, trust-gate layers, pip wheel fallback, and CR5–CR8 security fixes); only the `name:` field is pulled from the rename branch. Consumer references updated in `examples/e2e/AGENTS.md`, `showcase/QA-COVERAGE.md`, `showcase/TESTING.md`, `showcase/aimock/README.md`, `showcase/scripts/create-integration/index.ts`, and `showcase/scripts/__tests__/create-integration.test.ts`. ## Hardening ### `showcase/scripts/lib/manifest.ts` - Tagged-union `ParsedManifest` parser (`ok` / `missing` / `malformed{syntax|shape}` / `unreadable`) with deep-frozen output - `DemoId` branded type with smart constructor - `/demos/` route-prefix validation, empty-tail guard, duplicate-id detection - `backend_url` shape validation - `ENOENT` / `EACCES` discrimination via `statSync` ### `showcase/scripts/validate-parity.ts` - `routeToDirName` helper for id-vs-route resolution - 13-variant `PackageIssue` discriminated union, `deriveMessage` as single render source - Typed error classes (`ManifestMalformedError`, `ManifestUnreadableError`, `InvalidBaselineError`) - `ValidateParityExitCode` literal union taxonomy - `formatErrorChain` with cycle guard + depth cap - Per-slug crash isolation: one malformed manifest no longer aborts the batch - Cooperates with `feat/showcase-ops`'s `auditableDemos` filter (informational demos carrying a `command:` field are excluded from parity checks) ### `showcase/scripts/create-integration/index.ts` - Strict `parseArgs`: duplicate-flag rejection, `--slug` regex guard (path-traversal protection), `--name` character allowlist (XSS guard on generated JSX) - `probePath` `statSync`-based fs probe replacing all `existsSync` call sites - Feature registry elementwise validation - `updateWorkflows` exported for unit testing; uses `WORKFLOWS_DIR` constant - `showcase_drift-detection.yml` edit removed — superseded by the `showcase-ops` service's `aimock_wiring` / image-drift probes which enumerate services from Railway at runtime - Generated health/debug routes distinguish `unconfigured` (env unset) from `down` (reachable but error) - Smoke route `AbortSignal.timeout` classification (Node 18+ `TimeoutError`) - Fail-fast rejection of `--language dotnet` (no .NET generator branches exist) - Dropped invalid `X-Frame-Options: ALLOWALL` from generated `next.config.ts` ### `showcase/scripts/__tests__/create-integration.test.ts` - Hardening regression suite migrated off `execSync` + `CREATE_INTEGRATION_SKIP_WORKFLOWS` onto `runGenerator()` so every test writes entirely inside a per-suite tmpdir and never touches the real `packages/` tree - Direct-import coverage for `loadFeatureRegistry` failure modes (ENOENT / invalid JSON / shape-invalid) and `parseArgs` guard coverage ### `showcase/scripts/capture-previews.ts` - `CaptureResult` tagged union replacing boolean+optional shape - Strict `parseArgs`: hex/float/negative/zero `--concurrency` rejection, unknown flag rejection, duplicate-flag rejection - `readAllManifests` ENOENT/EACCES/EPERM discrimination - `execFileSync` replacing template-interpolated `execSync` (no shell injection) - Filtered empty-targets exit-nonzero - Response-timeout tagged as `CaptureFailure` - Renamed `hitl` → `hitl-in-chat` config key; parses manifest via shared `lib/manifest.ts` `parseManifest` instead of ad-hoc `YAML.parse` ### `showcase/shell/src/components/guided-flow.tsx` - `isGuidedAnswers` runtime type guard on localStorage payload (validates shape before trusting `JSON.parse` output; prior code did a blind `as GuidedAnswers` cast) - `StoredGuidedAnswers` accepts legacy `undefined` `language` from pre-language-field versions while the in-memory shape stays strict - `restoredRef` gate preventing persist effect from clobbering restored data on initial render - `persistWarnedRef` / `cleanupWarnedRef` warn-once refs for localStorage diagnostics - Module-load invariants throw on `FEATURE_OPTIONS`/`LANGUAGE_OPTIONS` drift from their maps - `FEATURE_MAP.tools` → `frontend-tools` (was `frontend-tools-sync` which doesn't exist in the catalog), `FEATURE_MAP.hitl` → `hitl-in-chat` ### `examples/v2/interrupts-langgraph` (new starter) - `ApprovalResumeSchema` zod validation at resume boundary (prevents silent fall-through to cancelled) - `isAIMessage` type predicate replacing unchecked cast - `shouldContinue` multi-tool-call routing (mixed frontend + backend batches) - `bindTools` presence guard replacing non-null `!` - Production `LANGGRAPH_DEPLOYMENT_URL` fail-fast at module load; dev warn-fallback - Production error-detail redaction in POST handler ### Infra - `lefthook.yml`: `lint-fix` scoped to staged files via `oxlint --fix` / `oxfmt --write` on `{staged_files}` (guarded against empty expansion), replacing monorepo-wide `pnpm run lint && pnpm run format` on every commit - `showcase/.gitignore`: `**/tsconfig.tsbuildinfo` + `packages/test-integration-tmp/` (fixture directory leaked by `create-integration.test.ts` when the suite is killed before cleanup) - Untracked 6 accidentally-committed `tsconfig.tsbuildinfo` files ## Base Rebased onto `feat/showcase-ops` (was `main`). Dropped paths that `feat/showcase-ops` or PR #4112 (`shell-docs` tech-debt) already addressed differently: - `showcase/shell/src/app/docs/[[...slug]]/page.tsx` — superseded by the `shell-docs` split in #4112 - `showcase/shell/src/content/docs/frontend-tools.mdx` / `human-in-the-loop.mdx` — don't exist on current main - `showcase/shell/src/data/{constraints,demo-content,registry}.json` — auto-generated; `feat/showcase-ops` has fresher generation - `showcase/shell-dojolike/*` — directory deleted upstream ## Test plan - [x] `pnpm -C showcase/scripts test` — 1095 tests green locally (21 files) - [x] `pnpm -F @copilotkit/showcase-ops test` — 261 tests green locally (24 files) - [x] `pnpm exec oxfmt --check` on all changed files — clean - [x] `pnpm exec oxlint` on all changed code files — 0 errors (pre-existing warnings, none new) - [x] `pnpm exec tsc --noEmit` on `showcase/shell-docs`, `showcase/scripts`, `showcase/ops` — clean - [x] YAML sanity: all 26 `.github/workflows/*.yml` parse - [ ] CI green on PR
zeekay
pushed a commit
to Dream-AI-4444/CopilotKit
that referenced
this pull request
Sep 11, 2026
(CopilotKit#4112) ## Summary Tech-debt follow-up to CopilotKit#4109. This PR fixes a batch of production-relevant issues across the shell-docs runtime, the shared showcase deploy workflow, and the content bundler scripts — MDX rendering correctness, XSS hardening on author-controlled sinks, UI component invariants under edge cases, route-level content handling, and CI reliability. ## Why CopilotKit#4109 restructured shell-docs and landed a lot of new shared surface area. Reviewing that landing surfaced real bugs that weren't in scope to fix inline: Slack failure alerts that silently never posted, MDX regex bugs that mangled nested `<Tabs>`, XSS vectors via `javascript:` hrefs, iframe sandboxes that negated themselves, undeployed integrations rendered as clickable dead links, a framework-selector that trapped users in redirect loops, and a few bundler correctness bugs that produced captions pointing at the wrong file. All of it is user-visible or deploy-visible, so none of it can stay deferred. ## What changed ### CI workflow (`showcase_deploy.yml`) Hygiene on the shared deploy pipeline so failures are reported and concurrent runs don't race. - Slack failure notification was gated on a step-local `env:` it couldn't read from its own `if:`, so alerts never posted. Promoted `SLACK_WEBHOOK_URL` to job-level env. - Concurrency group included the service name, so a push event and a manual `workflow_dispatch service=all` run could race on the same Railway service. Dropped the suffix. - Shared-module copy step ran for every service context and polluted build contexts for shell-family services that already have the full repo. Scoped to a `showcase/packages/*` allowlist. - `shell-dashboard` and `shell-docs` path filters didn't watch `showcase/shared/**` or `showcase/scripts/**`, so shared-code changes rebuilt `shell` but not its siblings. Extended the filters. - Dropped a redundant `fromJSON()` on an already-numeric matrix value and a dead `HTTP_CODE="000"` sentinel. ### MDX renderer correctness (`showcase/shell-docs/src/lib/docs-render.tsx` + friends) Regex and rendering bugs that either mangled output or opened XSS holes. - `convertTablesInJSX` used non-backref alternation on close tags, and JS alternation is leftmost-first — so `<Tabs>…</Tab>` closed the outer container with the inner tag. Added a backref and sorted the tag alternation longest-first. - `inlineSnippets` matched `components=` props with `[^}]*`, truncating doubled-brace MDX object literals. Replaced with an explicit `\{\{…\}\}` match. - Frontmatter H1 fallback ran against the raw file including the YAML block, so a `# comment` line inside frontmatter could become the page title. Moved the match to `matter(raw).content` and surfaced the previously-silent parse catch as a log. - XSS: `<A>` and `<Link>` rendered any href scheme verbatim, making `javascript:` / `data:text/html` a live vector from MDX. Added a scheme allowlist; unsafe schemes render as inert text. - Iframe sandboxes in `InlineDemo`, `IframeSwitcher`, and `YouTubeVideo` combined `allow-scripts` with `allow-same-origin`, which per MDN lets the iframe remove its own sandbox. Dropped `allow-same-origin`. - `<InlineDemo>` piped registry `backend_url` into `src` without running it through `validateIframeSrc` like the other iframe sinks do. Harmonized. - `<img>` and `<video>` style-prop handling spread caller props and then clobbered `style` wholesale, dropping author-supplied keys. Now merges, with component-enforced layout overrides winning. - `docs-page-view` rendered the FM title as an `<h1>` and then let the MDX body's duplicate `# Title` render again, producing stacked H1s. Strips the body H1 only when it matches the FM title after whitespace normalization; CRLF-safe. ### Component invariants Tabs, framework-tabs, framework-provider, framework-selector — edge cases around duplicate labels, mismatched lengths, and stale state. - `docs-tabs` picked the active panel via `.filter(label === active)`, which double-rendered on duplicate labels and blanked out when `items` length diverged from children. Replaced with a positional `findIndex` so pairing is strictly by index. - `framework-tabs` paired `frameworks[i]` with children by index; a child rendering null shifted the array and every subsequent tab showed the wrong framework's content. Added a count-mismatch guard with dev warn. Seeded `active` only at mount, so swapping `frameworks` left it stale — added a re-sync effect. Removed never-consumed `cell`/`region` interface props. - `framework-provider` hydrated `stored` from localStorage without validating against the registry, so a stale slug (framework removed from registry) kept redirecting users to a dead route. Added the same `knownFrameworks.includes(...)` check used elsewhere, including the cross-tab `storage` handler. - `framework-selector` dropdown rendered undeployed options as clickable; clicking persisted the undeployed slug and `router.replace`'d into a dead route, trapping users in a `RouterPivot` redirect loop. Gated undeployed options with `disabled`, aria, and a click-handler guard. ### Route-level content handling Ag-ui page, docs root, framework route, reference route, brand-nav — duplicate H1s, stale sidebars, dead links, wrong cross-links. - `ag-ui/[[...slug]]` H1 strip wasn't CRLF-safe and unconditionally removed the first body H1 even when it didn't match the FM title (silent content loss). Now extracts body H1 separately and strips only on whitespace-normalized match. - `readTitleForSlug` only read `${slug}.mdx`, but the page handler already falls back to `${slug}/index.mdx`. Sidebar titles drifted from actual page content. Mirrored the page handler's precedence. - Docs overview integration grid rendered undeployed integrations as active `<Link>`s, handing users dead-link cards. Undeployed now render as non-link `<div>` with preserved visual treatment. Also filtered `findFrameworksWithCell` and `previewUrl` derivation to `deployed === true`. - `[framework]/[[...slug]]` alternative-framework banner pulled from all integrations unfiltered; `slice(0, 3)` could pad with undeployed. Filtered before slice. - `reference/[...slug]` fallback `<h1>` showed the raw hyphenated slug while the breadcrumb was `titleCase`d. Wrapped the fallback too. Added an `index.mdx` route fallback matching `loadDoc`'s convention. - `brand-nav` mobile menu's cross-brand link was hardcoded to `/ag-ui`, so on an ag-ui page the link pointed at itself. Now branches on `activeBrandFromPath()`. ### Error boundary The log effect re-fired on every render because the `error` object identity is fresh each pass, filling console with duplicate reports. Dep array now tracks `error.message` + `error.digest` (stable strings); the raw `error` is still passed through in the body for stack preservation. ### Bundler scripts (`bundle-demo-content.ts`, `reference-items.ts`) Correctness and platform parity. - Multi-file regions (same region name in multiple files) kept the first file's span while appending code from all contributors — the caption said `foo.tsx · L5–L20` while showing content from elsewhere. Track contributors per region; relabel `file` to `(multiple: a, b, c)` when more than one. - Same-file multi-slice regions never extended `endLine`, so captions under-reported the span. - `fs.watch({ recursive: true })` is silently ignored on Linux; watch mode claimed to be watching while missing nested edits. Added a loud startup warning on Linux. - Watch-mode path filter used forward slashes only, so on Windows `fs.watch`'s backslashed paths matched no directory pattern. Normalized before testing. - `walkMdx` emitted `<parent>/index` for `parent/index.mdx`, inconsistent with `loadDoc`'s collapsing to `parent`. Collapsed, and added a collision guard preferring the flat file when `parent.mdx` also exists. ### Regenerated `demo-content.json` Both the shell and shell-docs bundles, carrying the new `(multiple: ...)` caption format and previously-stale committed state. ## Test plan - [ ] Local typecheck passes on `showcase/shell-docs` and `showcase/scripts` - [ ] CI matrix green (Python, Vercel previews, check-binaries, format, oxlint, package-quality, unit 20/22/24, commitlint) - [ ] Manual spot-check: MDX pages with nested `<Tabs>` render correctly (no stranded close tags) - [ ] Manual spot-check: framework-selector dropdown — undeployed entries are disabled - [ ] Manual spot-check: docs overview page — undeployed integration cards are non-clickable - [ ] Manual spot-check: trigger showcase_deploy on a path-filter test change touching `showcase/shared/**` — confirm shell, shell-dashboard, AND shell-docs rebuild
zeekay
pushed a commit
to Dream-AI-4444/CopilotKit
that referenced
this pull request
Sep 11, 2026
The "Showcase: Docs Sync" workflow has been failing with `fatal: pathspec 'showcase/shell/src/content/' did not match any files` since the shell platform restructure (CopilotKit#4109, CopilotKit#4112) split the monolithic `showcase/shell/` package into `showcase/shell-docs/`, `showcase/shell-dashboard/`, and `showcase/shell-dojo/`. The sync-docs-from-main.ts script already writes to `showcase/shell-docs/src/content/` and maintains the sync marker at `showcase/shell-docs/.docs-sync-sha`. Update the "Create PR for docs sync" step to stage from the new location so the workflow can commit synced content again.
zeekay
pushed a commit
to Dream-AI-4444/CopilotKit
that referenced
this pull request
Sep 11, 2026
…CopilotKit#4117) ## Summary - Docs Sync workflow has been failing since 2026-04-21 with `fatal: pathspec 'showcase/shell/src/content/' did not match any files` (exit 128) on the "Create PR for docs sync" step (example: run 24726678848). - The path was moved by the shell platform restructure (CopilotKit#4109, CopilotKit#4112) — the docs content now lives under `showcase/shell-docs/src/content/`, and the sync marker at `showcase/shell-docs/.docs-sync-sha`. The sync script (`showcase/scripts/sync-docs-from-main.ts`) already writes to those locations; only the workflow's `git add` was still referencing the old monolithic `showcase/shell/` path. - One-line path fix. ## Test plan - [ ] Verify yaml parses. - [ ] Confirm next docs-sync run succeeds end-to-end (opens a sync PR for the 11 pending review items from run 24726678848).
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tech-debt follow-up to #4109. This PR fixes a batch of production-relevant issues across the shell-docs runtime, the shared showcase deploy workflow, and the content bundler scripts — MDX rendering correctness, XSS hardening on author-controlled sinks, UI component invariants under edge cases, route-level content handling, and CI reliability.
Why
#4109 restructured shell-docs and landed a lot of new shared surface area. Reviewing that landing surfaced real bugs that weren't in scope to fix inline: Slack failure alerts that silently never posted, MDX regex bugs that mangled nested
<Tabs>, XSS vectors viajavascript:hrefs, iframe sandboxes that negated themselves, undeployed integrations rendered as clickable dead links, a framework-selector that trapped users in redirect loops, and a few bundler correctness bugs that produced captions pointing at the wrong file. All of it is user-visible or deploy-visible, so none of it can stay deferred.What changed
CI workflow (
showcase_deploy.yml)Hygiene on the shared deploy pipeline so failures are reported and concurrent runs don't race.
env:it couldn't read from its ownif:, so alerts never posted. PromotedSLACK_WEBHOOK_URLto job-level env.workflow_dispatch service=allrun could race on the same Railway service. Dropped the suffix.showcase/packages/*allowlist.shell-dashboardandshell-docspath filters didn't watchshowcase/shared/**orshowcase/scripts/**, so shared-code changes rebuiltshellbut not its siblings. Extended the filters.fromJSON()on an already-numeric matrix value and a deadHTTP_CODE="000"sentinel.MDX renderer correctness (
showcase/shell-docs/src/lib/docs-render.tsx+ friends)Regex and rendering bugs that either mangled output or opened XSS holes.
convertTablesInJSXused non-backref alternation on close tags, and JS alternation is leftmost-first — so<Tabs>…</Tab>closed the outer container with the inner tag. Added a backref and sorted the tag alternation longest-first.inlineSnippetsmatchedcomponents=props with[^}]*, truncating doubled-brace MDX object literals. Replaced with an explicit\{\{…\}\}match.# commentline inside frontmatter could become the page title. Moved the match tomatter(raw).contentand surfaced the previously-silent parse catch as a log.<A>and<Link>rendered any href scheme verbatim, makingjavascript:/data:text/htmla live vector from MDX. Added a scheme allowlist; unsafe schemes render as inert text.InlineDemo,IframeSwitcher, andYouTubeVideocombinedallow-scriptswithallow-same-origin, which per MDN lets the iframe remove its own sandbox. Droppedallow-same-origin.<InlineDemo>piped registrybackend_urlintosrcwithout running it throughvalidateIframeSrclike the other iframe sinks do. Harmonized.<img>and<video>style-prop handling spread caller props and then clobberedstylewholesale, dropping author-supplied keys. Now merges, with component-enforced layout overrides winning.docs-page-viewrendered the FM title as an<h1>and then let the MDX body's duplicate# Titlerender again, producing stacked H1s. Strips the body H1 only when it matches the FM title after whitespace normalization; CRLF-safe.Component invariants
Tabs, framework-tabs, framework-provider, framework-selector — edge cases around duplicate labels, mismatched lengths, and stale state.
docs-tabspicked the active panel via.filter(label === active), which double-rendered on duplicate labels and blanked out whenitemslength diverged from children. Replaced with a positionalfindIndexso pairing is strictly by index.framework-tabspairedframeworks[i]with children by index; a child rendering null shifted the array and every subsequent tab showed the wrong framework's content. Added a count-mismatch guard with dev warn. Seededactiveonly at mount, so swappingframeworksleft it stale — added a re-sync effect. Removed never-consumedcell/regioninterface props.framework-providerhydratedstoredfrom localStorage without validating against the registry, so a stale slug (framework removed from registry) kept redirecting users to a dead route. Added the sameknownFrameworks.includes(...)check used elsewhere, including the cross-tabstoragehandler.framework-selectordropdown rendered undeployed options as clickable; clicking persisted the undeployed slug androuter.replace'd into a dead route, trapping users in aRouterPivotredirect loop. Gated undeployed options withdisabled, aria, and a click-handler guard.Route-level content handling
Ag-ui page, docs root, framework route, reference route, brand-nav — duplicate H1s, stale sidebars, dead links, wrong cross-links.
ag-ui/[[...slug]]H1 strip wasn't CRLF-safe and unconditionally removed the first body H1 even when it didn't match the FM title (silent content loss). Now extracts body H1 separately and strips only on whitespace-normalized match.readTitleForSlugonly read${slug}.mdx, but the page handler already falls back to${slug}/index.mdx. Sidebar titles drifted from actual page content. Mirrored the page handler's precedence.<Link>s, handing users dead-link cards. Undeployed now render as non-link<div>with preserved visual treatment. Also filteredfindFrameworksWithCellandpreviewUrlderivation todeployed === true.[framework]/[[...slug]]alternative-framework banner pulled from all integrations unfiltered;slice(0, 3)could pad with undeployed. Filtered before slice.reference/[...slug]fallback<h1>showed the raw hyphenated slug while the breadcrumb wastitleCased. Wrapped the fallback too. Added anindex.mdxroute fallback matchingloadDoc's convention.brand-navmobile menu's cross-brand link was hardcoded to/ag-ui, so on an ag-ui page the link pointed at itself. Now branches onactiveBrandFromPath().Error boundary
The log effect re-fired on every render because the
errorobject identity is fresh each pass, filling console with duplicate reports. Dep array now trackserror.message+error.digest(stable strings); the rawerroris still passed through in the body for stack preservation.Bundler scripts (
bundle-demo-content.ts,reference-items.ts)Correctness and platform parity.
foo.tsx · L5–L20while showing content from elsewhere. Track contributors per region; relabelfileto(multiple: a, b, c)when more than one.endLine, so captions under-reported the span.fs.watch({ recursive: true })is silently ignored on Linux; watch mode claimed to be watching while missing nested edits. Added a loud startup warning on Linux.fs.watch's backslashed paths matched no directory pattern. Normalized before testing.walkMdxemitted<parent>/indexforparent/index.mdx, inconsistent withloadDoc's collapsing toparent. Collapsed, and added a collision guard preferring the flat file whenparent.mdxalso exists.Regenerated
demo-content.jsonBoth the shell and shell-docs bundles, carrying the new
(multiple: ...)caption format and previously-stale committed state.Test plan
showcase/shell-docsandshowcase/scripts<Tabs>render correctly (no stranded close tags)showcase/shared/**— confirm shell, shell-dashboard, AND shell-docs rebuild