Skip to content

Keep full-app demo on semantic providers - #57

Merged
simongonzalezdc merged 1 commit into
mainfrom
proactive-risk-hardening
Apr 22, 2026
Merged

simongonzalezdc merged 1 commit into
mainfrom
proactive-risk-hardening

Conversation

@simongonzalezdc

Copy link
Copy Markdown
Member

Summary

  • prevents the full-app browser demo from exposing internal semantic prompt/context text
  • requires at least one semantic provider for the demo path instead of treating generic MT providers as demo-ready
  • prevents fallback from a failed semantic provider to generic providers in the demo path
  • adds regression tests for prompt leakage, non-semantic providers, and generic fallback refusal
  • updates test counts to 716

Why

Based on recent failures, the highest-probability next class of bugs is product-surface misrepresentation: the UI/API looks like it works while either leaking implementation details or silently using a weaker provider. The demo is supposed to prove semantic dialect behavior, so it must require semantic providers and keep internal prompts server-side.

Verification

  • pnpm build
  • pnpm test
  • pnpm audit --audit-level low
  • focused web-demo-service tests
  • focused demo-server tests
  • git diff --check
  • npm pack dry-run guard for publishable packages

The previous full-app demo path still had two high-risk launch surfaces: it returned the internal semantic prompt/context to the browser and it could fall through to generic non-semantic providers if those were the only configured providers. This keeps the public API result clean and requires semantic providers for the demo.

Constraint: Public browser APIs must not expose internal prompt contracts or silently downgrade from semantic LLM behavior.

Rejected: Allow LibreTranslate/MyMemory in the demo path | repeats the fake-working product-surface problem when users expect semantic dialect behavior

Confidence: high

Scope-risk: narrow

Directive: The browser demo is a semantic-provider proof surface; do not reintroduce generic provider fallback or prompt/context leakage.

Tested: pnpm build; pnpm test; pnpm audit --audit-level low; focused web-demo and demo-server tests; npm pack dry-run guard
@kilo-code-bot

kilo-code-bot Bot commented Apr 22, 2026 •

Copy link
Copy Markdown

Code Review Roast 🔥

Verdict: No Issues Found | Recommendation: Merge

Oh wait, this PR is actually clean. I had my flamethrower warmed up and everything.

This is rare security-minded work: you're blocking internal prompts from leaking into browser-visible responses, requiring semantic providers only for the demo path, AND preventing fallback to weaker MT providers when the fancy ones fail. That's three layers of defense against product-surface misrepresentation. Chef's kiss.

📊 Overall: Like finding a unicorn in production — I didn't think secure-by-default PRs existed anymore, but here we are.

Files Reviewed (6 files)
  • README.md - test count update
  • docs/index.html - test count update
  • index.html - test count update
  • packages/cli/src/tests/web-demo-service.test.ts - 3 new regression tests
  • packages/cli/src/lib/web-demo-service.ts - security hardening implementation
  • scripts/tests/demo-server.test.mjs - contract test updates

Reviewed by minimax-m2.5 · 335,877 tokens

@simongonzalezdc
simongonzalezdc merged commit e8daafd into main Apr 22, 2026
6 checks passed
@simongonzalezdc
simongonzalezdc deleted the proactive-risk-hardening branch April 22, 2026 19:46

@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: 1790dd5641

ℹ️ 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 on lines +147 to +148
for (const [attemptIndex, name] of providers.entries()) {
try {

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 Skip circuit-open providers in semantic demo fallback

translateWithSemanticDemoProviders iterates every semantic provider name it is given without checking registry.isAvailable(name), so circuit-breaker state is ignored in the demo path. When a semantic provider is already open/failing, requests still call provider.translate and wait on repeated failing network attempts instead of short-circuiting; this regresses resilience compared with the previous translateWithFallback flow, which filtered with isAvailable before attempting providers.

Useful? React with 👍 / 👎.

Comment on lines +90 to +91
if (!providerStatus.ready) {
throw new Error(providerStatus.message);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Classify non-semantic readiness failures as 503

The new !providerStatus.ready branch throws a message for “configured but not semantic enough” providers, but scripts/demo-server.mjs:123-127 only maps /No provider configured|No translation providers|Provider not available/ to HTTP 503. This new readiness failure now falls through as HTTP 500, so a normal setup/unavailability condition is reported as an internal server error and clients lose the expected service-unavailable semantics.

Useful? React with 👍 / 👎.

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