Skip to content

docs: add guidance for scaling state - #6898

Open
Alek99 wants to merge 4 commits into
mainfrom
docs/scaling-state
Open

docs: add guidance for scaling state#6898
Alek99 wants to merge 4 commits into
mainfrom
docs/scaling-state

Conversation

@Alek99

@Alek99 Alek99 commented Aug 17, 2026

Copy link
Copy Markdown
Member

What changed

  • add a new Scaling State guide with a decision framework for feature-owned State, cross-State access, inheritance, mixins, ComponentState, decentralized handlers, testing, and performance
  • make the guide the entry point for the State Structure section and reconcile the existing code-structure, State overview, mixin, and ComponentState guidance
  • route agent-readable Markdown, llms.txt, llms-full.txt, Skills, Agent Toolkit, and AGENTS.md guidance through the large-app reading path
  • restore redirects for legacy /substates/* URLs and add regression coverage

Why

The existing docs explain each State primitive separately, but do not give humans or coding agents a normative way to choose and combine them in a scaled, multi-page app. This makes State ownership, coupling, and inheritance decisions under-specified.

Validation

  • uv run --no-sync pytest tests -q — 406 passed, 1 skipped, 1 xfailed
  • targeted Ruff check and format check
  • Codespell across the modified docs
  • git diff --check

uv run --no-sync reflex compile --dry initialized the docs app, but a full compile requires a Reflex Enterprise login in this environment.

Review in cubic

@codspeed-hq

codspeed-hq Bot commented Aug 17, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 26 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing docs/scaling-state (d8a78e6) with main (7e57be7)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@greptile-apps

greptile-apps Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds a comprehensive Scaling State guide and incorporates it into the documentation paths used by developers and coding agents.

  • Reconciles existing State, mixin, ComponentState, and project-structure guidance with the new scaling recommendations.
  • Adds architecture links to generated Markdown assets, llms.txt, llms-full.txt, Skills, Agent Toolkit, and AGENTS.md guidance.
  • Restores legacy substate redirects and adds focused route, sidebar, and generated-agent-file regression coverage.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
docs/state_structure/scaling_state.md Adds the central decision guide for State ownership, composition, cross-State access, testing, and performance.
docs/app/agent_files/_plugin.py Routes generated agent-readable documentation toward the new scaling guide and related architecture pages.
docs/app/reflex_docs/redirects.py Centralizes documentation redirects and restores legacy substate mappings to existing State Structure routes.
docs/app/reflex_docs/templates/docpage/sidebar/sidebar_items/learn.py Adds Scaling State to the State Structure sidebar while retaining the documented section ordering.
docs/app/tests/test_agent_files.py Extends coverage for architecture links in generated Markdown, llms.txt, and llms-full.txt output.
docs/app/tests/test_routes.py Adds regression assertions for the restored legacy substate redirects.
docs/app/tests/test_sidebar.py Verifies the intended placement of Scaling State in the State Structure section.

Reviews (4): Last reviewed commit: "docs: make redirect test platform-safe" | Re-trigger Greptile

@Alek99
Alek99 requested review from FarhanAliRaza and masenf August 17, 2026 20:59
@Alek99
Alek99 marked this pull request as ready for review August 17, 2026 21:03
@Alek99
Alek99 requested a review from a team as a code owner August 17, 2026 21:03
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread docs/app/tests/test_routes.py Outdated
This layout keeps the code that changes together close together:

- `state.py` owns the feature's Vars, computed vars, and small event handlers.
- `events.py` may contain decentralized handlers when the handler set becomes large.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this is the only one that i'm hesitant on because decentralized handlers are defined in a weird way and don't feel very reflexy to me, so idk if we should recommend them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree, decentralized handlers if anything is an anti pattern that masks having too large of a state.

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.

4 participants