Skip to content

feat(demo): add environment-controlled demo mode - #559

Merged
SantiagoDePolonia merged 4 commits into
mainfrom
feat/demo-mode
Jul 20, 2026
Merged

feat(demo): add environment-controlled demo mode#559
SantiagoDePolonia merged 4 commits into
mainfrom
feat/demo-mode

Conversation

@SantiagoDePolonia

@SantiagoDePolonia SantiagoDePolonia commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add environment-only demo mode through GOMODEL_DEMO_MODEL, disabled by default
  • emit an immediate warning and repeat it every five minutes
  • expose DEMO_MODE through the allowlisted dashboard runtime configuration
  • render a sticky public-demo banner warning against sensitive or personal data
  • update make demo, configuration docs, and OpenAPI schemas

Behavior

GOMODEL_DEMO_MODEL=true enables demo mode. The removed --demo flag is rejected. Demo mode communicates that demo data is reset regularly, but it does not perform storage deletion itself; deployments must schedule resets separately.

Testing

  • go test ./...
  • node --test internal/admin/dashboard/static/js/modules/*.test.cjs
  • repository pre-commit suite, including race tests, lint, fix-check, Mintlify validation, and hot-path performance guards

Summary by CodeRabbit

  • New Features
    • Added public demo mode via GOMODEL_DEMO_MODE=true, including recurring warning logs.
    • Admin dashboard now shows a non-dismissible “Public demo” banner and disallows indexing via a noindex meta tag.
    • Demo mode is exposed through dashboard runtime config as DEMO_MODE, and reflected in the OpenAPI schema.
  • Documentation
    • Documented GOMODEL_DEMO_MODE behavior and runtime config exposure (DEMO_MODE=on).
  • Tests
    • Added/updated unit and E2E tests for banner/noindex behavior and runtime config/warnings.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6d19cd43-73a2-43e6-992a-6b28d3de9f0d

📥 Commits

Reviewing files that changed from the base of the PR and between 87b4d65 and 00226a9.

📒 Files selected for processing (19)
  • Makefile
  • cmd/gomodel/docs/docs.go
  • docs/advanced/configuration.mdx
  • docs/openapi.json
  • internal/admin/dashboard/dashboard.go
  • internal/admin/dashboard/dashboard_test.go
  • internal/admin/dashboard/static/css/dashboard.css
  • internal/admin/dashboard/static/js/modules/workflows.js
  • internal/admin/dashboard/static/js/modules/workflows.test.cjs
  • internal/admin/dashboard/templates/layout.html
  • internal/admin/handler.go
  • internal/admin/handler_test.go
  • internal/app/app.go
  • internal/app/app_test.go
  • run/demo.go
  • run/demo_test.go
  • run/flags_test.go
  • run/run.go
  • tests/e2e/admin_test.go

📝 Walkthrough

Walkthrough

Demo mode is configured through GOMODEL_DEMO_MODE, emits periodic warnings, exposes DEMO_MODE through dashboard runtime configuration, and displays a persistent warning banner in the admin dashboard.

Changes

Demo mode runtime and configuration

Layer / File(s) Summary
Runtime configuration contract
internal/admin/handler.go, internal/app/app.go, internal/admin/handler_test.go, internal/app/app_test.go, cmd/gomodel/docs/docs.go, docs/openapi.json, docs/advanced/configuration.mdx
The dashboard runtime configuration now allowlists, normalizes, exposes, documents, and tests the DEMO_MODE field.
Startup detection and warnings
run/demo.go, run/run.go, run/demo_test.go, run/flags_test.go, Makefile
Startup parses GOMODEL_DEMO_MODE, starts repeated warnings when enabled, passes the flag into application configuration, and enables it from the demo target.
Dashboard warning presentation
internal/admin/dashboard/dashboard.go, internal/admin/dashboard/templates/layout.html, internal/admin/dashboard/static/css/dashboard.css, internal/admin/dashboard/dashboard_test.go, internal/admin/dashboard/static/js/modules/workflows.js, internal/admin/dashboard/static/js/modules/workflows.test.cjs, tests/e2e/admin_test.go
Dashboard construction and template data carry demo mode, conditionally render the warning banner, style responsive layouts, accept DEMO_MODE in workflow runtime configuration, and verify the robots metadata.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Environment
  participant Run
  participant App
  participant DashboardRuntimeConfig
  participant Dashboard
  Environment->>Run: read GOMODEL_DEMO_MODE
  Run->>Run: start periodic demo warnings
  Run->>App: pass DemoMode
  App->>DashboardRuntimeConfig: build DEMO_MODE
  App->>Dashboard: construct demo-mode handler
  Dashboard->>Dashboard: render warning banner
Loading

Possibly related PRs

Poem

A bunny sees the warning glow,
“Keep secret carrots safe below!”
The logs repeat, the banner shines,
Demo mode hops through runtime lines.
A cautious nose, a clearer view—
Public demos know what to do!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding an environment-controlled demo mode.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/demo-mode

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
docs/openapi.json

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mintlify

mintlify Bot commented Jul 20, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
gomodel 🟢 Ready View Preview Jul 20, 2026, 12:09 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 66.66667% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/app/app.go 50.00% 2 Missing ⚠️
internal/admin/dashboard/dashboard.go 75.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@run/demo.go`:
- Around line 13-16: The demo-mode environment variable is misspelled and must
consistently use the `_MODE` suffix. Rename the constant value in run/demo.go,
update the demo target in Makefile, and update the configuration table and
description in docs/advanced/configuration.mdx to reference GOMODEL_DEMO_MODE.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 48b827b8-ff33-4cb6-927b-e4d28f3ba43c

📥 Commits

Reviewing files that changed from the base of the PR and between 503cdae and 243dc7a.

📒 Files selected for processing (18)
  • Makefile
  • cmd/gomodel/docs/docs.go
  • docs/advanced/configuration.mdx
  • docs/openapi.json
  • internal/admin/dashboard/dashboard.go
  • internal/admin/dashboard/dashboard_test.go
  • internal/admin/dashboard/static/css/dashboard.css
  • internal/admin/dashboard/static/js/modules/workflows.js
  • internal/admin/dashboard/static/js/modules/workflows.test.cjs
  • internal/admin/dashboard/templates/layout.html
  • internal/admin/handler.go
  • internal/admin/handler_test.go
  • internal/app/app.go
  • internal/app/app_test.go
  • run/demo.go
  • run/demo_test.go
  • run/flags_test.go
  • run/run.go

Comment thread run/demo.go
@greptile-apps

greptile-apps Bot commented Jul 20, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

Safe to merge with minimal risk.

The change is opt-in and focused on environment parsing, dashboard config, warning logs, and UI messaging. Tests cover env parsing, removed flag rejection, runtime config exposure, and banner visibility.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • The proof shows the admin dashboard was served with demo mode enabled, changing runtime configuration to DEMO_MODE: on and showing a single public demo banner.
  • T-Rex executed the focused JavaScript validation suite for the admin dashboard workflows, which exited with code 0 and produced 64 passing tests.
  • Visual evidence was captured by rendering the Chromium dashboard before and after enabling demo mode, including a screenshot that shows the public-demo banner after enabling demo mode.
  • The runtime configuration change was documented to show the bannerCount increased to 1 and the banner text displayed as the public-demo notice.

View all artifacts

T-Rex Ran code and verified through T-Rex

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Env as GOMODEL_DEMO_MODEL
participant Run as run.Run
participant App as app.New
participant Admin as initAdmin
participant Dashboard as dashboard.Handler
participant UI as Admin dashboard

Env->>Run: Read and parse boolean
alt demo mode enabled
    Run->>Run: Log warning immediately
    Run->>Run: Repeat warning every 5 minutes
end
Run->>App: Config with DemoMode
App->>Admin: Build dashboard runtime config
Admin->>Dashboard: NewWithDemoMode
Dashboard->>UI: Render public-demo banner
UI->>Admin: GET /admin/runtime/config
Admin-->>UI: Return DEMO_MODE
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Env as GOMODEL_DEMO_MODEL
participant Run as run.Run
participant App as app.New
participant Admin as initAdmin
participant Dashboard as dashboard.Handler
participant UI as Admin dashboard

Env->>Run: Read and parse boolean
alt demo mode enabled
    Run->>Run: Log warning immediately
    Run->>Run: Repeat warning every 5 minutes
end
Run->>App: Config with DemoMode
App->>Admin: Build dashboard runtime config
Admin->>Dashboard: NewWithDemoMode
Dashboard->>UI: Render public-demo banner
UI->>Admin: GET /admin/runtime/config
Admin-->>UI: Return DEMO_MODE
Loading

Reviews (1): Last reviewed commit: "feat(demo): add environment-controlled d..." | Re-trigger Greptile

@mintlify

mintlify Bot commented Jul 20, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
gomodel 🟡 Building Jul 20, 2026, 12:08 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@SantiagoDePolonia
SantiagoDePolonia merged commit 03013a9 into main Jul 20, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants