Skip to content

Make the browser demo exercise the real app - #54

Merged
simongonzalezdc merged 1 commit into
mainfrom
full-app-web-demo
Apr 22, 2026
Merged

simongonzalezdc merged 1 commit into
mainfrom
full-app-web-demo

Conversation

@simongonzalezdc

Copy link
Copy Markdown
Member

Summary

  • replaces the browser demo's static substitution path with calls to /api/translate
  • adds a local demo backend that serves the page and calls the real DialectOS provider stack
  • adds a reusable CLI web-demo service with semantic dialect context and provider status
  • adds Dockerfile/Compose support with an Ollama sidecar and beginner docs for local-model/container testing
  • adds regression tests proving the page does not silently fall back to static rule substitution

Why

The landing page must be a real test surface. A static rule table cannot prove translation quality, provider behavior, or semantic dialect prompts. This makes the page exercise the full app path while keeping provider keys/server-side model endpoints out of browser JavaScript.

Verification

  • pnpm build
  • pnpm test
  • pnpm audit --audit-level low
  • git diff --check
  • node scripts/demo-server.mjs smoke: /api/status returns provider status and /api/translate returns 503 when no provider is configured
  • docker compose --profile setup config
  • docker compose build demo
  • npm pack dry-run guard for all publishable packages

The public demo needs to prove the actual product path rather than a browser-side rule table. This adds a local demo backend, a reusable web-demo translation service, browser calls to /api/translate, and a Docker Compose path with an Ollama sidecar for local-model testing.

Constraint: Browser JavaScript must not receive provider keys or call paid/local model endpoints directly.

Rejected: Keep a static substitution fallback | it hides provider failures and repeats the original launch-testing problem

Rejected: Bake model weights into the app image | large, slow, and harder to update than a model sidecar plus persistent volume

Confidence: high

Scope-risk: moderate

Directive: Do not reintroduce static translation fallback in docs/index.html; provider errors must stay visible.

Tested: pnpm build; pnpm test; pnpm audit --audit-level low; node demo-server smoke for /api/status and /api/translate 503; docker compose --profile setup config; docker compose build demo; npm pack dry-run guard

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1c7363c7ef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/demo-server.mjs
Comment on lines +50 to +52
const relative = pathname === "/"
? "docs/index.html"
: pathname.replace(/^\/+/, "");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep demo assets addressable when serving /

Mapping / directly to docs/index.html makes the page load from the root directory, so its relative <script src="dialectos-engine.js"> resolves to /dialectos-engine.js and 404s (the file exists at /docs/dialectos-engine.js). In the current flow (http://127.0.0.1:8080 from the README), this leaves DIALECT_METADATA undefined and causes translation rendering to fail even when /api/translate succeeds.

Useful? React with 👍 / 👎.

Comment thread scripts/demo-server.mjs
Comment on lines +53 to +55
const absolute = path.resolve(rootDir, relative);
if (!absolute.startsWith(rootDir + path.sep) && absolute !== rootDir) {
return undefined;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Limit static file serving to intended demo files

The static resolver currently allows any path under the repository root, so requests like /package.json are served as-is (and any local dotfiles under the repo would be exposed too). Because this demo is documented for container/VPS use and can bind publicly, this creates an unintended data exposure surface; static serving should be restricted to the demo asset subtree (or an explicit allowlist).

Useful? React with 👍 / 👎.

@simongonzalezdc
simongonzalezdc merged commit 5e2e265 into main Apr 22, 2026
6 checks passed
@simongonzalezdc
simongonzalezdc deleted the full-app-web-demo branch April 22, 2026 16:38
simongonzalezdc added a commit that referenced this pull request Nov 11, 2026
Brings GitHub main level with Forgejo main (ef214e5), the canonical
repo, so GitHub carries what v0.3.2 is cut from.

- **Roast fixes:** dictionary accents and meaning-safe swaps (#50),
accented words in the register, voseo, gender and grammar checks (#51),
the file sandbox and patched dependencies (#52), honest claims and a
pinned toolchain (#53), and adjective agreement, MCP vosotros parity,
the real engine in the demo, and no more "first" claim (#55).
- **Branding:** the Hermes plugin icon (#54).
- **Release:** every version and install path moves to 0.3.2 (#56).
- **Security:** the voseo quote regex CodeQL flagged on this PR now runs
in linear time (#57).
- **Pages:** `docs/CNAME` is removed. The site already serves from
kyanitelabs.github.io/DialectOS/ without a redirect.

After this merges, both mains have the same files.

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

https://claude.ai/code/session_01RXhEX6WJsRZUyGhsp5WgGe

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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