Skip to content

Tech-debt: production code depends on lib/demo/ (Theme Studio + demo infra) #1169

Description

@AustinChangLinksys

Problem

Production (non-demo) code structurally imports from lib/demo/, so the demo/ directory is no longer demo-only — it is a production dependency. This is confusing for navigation and blocks cleanly separating demo-only scaffolding from shipping code.

Current production → lib/demo/ imports

Production file Imported demo module
lib/app.dart demo/providers/theme_studio_config_provider.dart
lib/app.dart demo/theme_studio/studio_theme_builder.dart
lib/page/shell/usp_dashboard_shell.dart demo/providers/theme_studio_config_provider.dart
lib/page/shell/usp_dashboard_shell.dart demo/providers/demo_ui_provider.dart
lib/page/shell/usp_dashboard_shell.dart demo/theme_studio/studio_theme_builder.dart
lib/page/shell/usp_dashboard_shell.dart demo/theme_studio/theme_studio_panel.dart
lib/page/shell/usp_top_bar.dart demo/providers/theme_studio_config_provider.dart
lib/page/shell/usp_top_bar.dart demo/theme_studio/studio_theme_builder.dart
lib/page/dashboard/mascot/mascot_providers.dart demo/providers/demo_ui_provider.dart

So production depends on this demo-resident set:

  • theme_studio_config_provider.dart (the Theme Studio config ThemeStudioConfig / provider)
  • studio_theme_builder.dart (buildStudioThemeData / mergeStudioConfigJson)
  • theme_studio_panel.dart (the panel, gated by GlobalConfig.feature.enableThemeStudio)
  • demo_ui_provider.dart

Why now

While fixing the Theme Studio theme-clobber bug (nullable style/visualEffects so device/THEME_JSON theme is honored), the symbols were renamed DemoThemeConfigThemeStudioConfig etc. The naming no longer matches the demo/ location, which surfaced this layering issue. Moving files was intentionally deferred to keep that fix focused.

Proposed direction (to be scoped)

Extract the production-consumed pieces out of lib/demo/ into a production home, e.g.:

  • theme_studio_config_provider.dart + studio_theme_builder.dartlib/theme/ (or lib/providers/)
  • theme_studio_panel.dart → a lib/theme/studio/ (it is a real feature gated by enableThemeStudio, not demo-only)
  • Re-evaluate demo_ui_provider.dart: split the production-needed parts from the demo-only parts.

Leave genuinely demo-only code (demo_app.dart, demo/usp/, demo/pages/, scenario picker) in lib/demo/.

Notes

  • DemoLinksysApp (lib/demo/demo_app.dart) is genuinely demo-only and should stay in lib/demo/.
  • This is a behavior-preserving move + import-path update; guard with flutter analyze and the full functional suite.
  • Related: Theme Studio clobber fix on branch feat/e2e-usp-transport.

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.xLabeled for 2.x versionconfidence:lowInsufficient evidence; body-only speculation (not posted)refactorBehavior-preserving cleanup / tech-debt (Sweeper mode)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions