Skip to content

fix: prevent slow FAQ parsing, stale drafts, and dropped responsibilities - #8

Merged
OKAN-SOFTWARE merged 1 commit into
mainfrom
fix/faq-processing-and-stale-drafts
Oct 26, 2026
Merged

OKAN-SOFTWARE merged 1 commit into
mainfrom
fix/faq-processing-and-stale-drafts

Conversation

@OKAN-SOFTWARE

Copy link
Copy Markdown
Owner

Whitespace-heavy text within the 50,000-character limit could cause excessive regex backtracking. A pending draft request could also restore old results after the source or mode changed, and topic deduplication dropped provider responsibilities when client responsibilities were already present.

This change:

  • Checks the question ending separately and matches only the supported prefix, avoiding overlapping whitespace/question captures.
  • Discards draft responses and errors after source edits, mode changes, example loading, or successful text imports, including edits that restore the original source.
  • Tracks client and provider responsibility topics separately while preserving duplicate filtering for the same party.
  • Adds regression tests and an Unreleased changelog entry.

Validation:

  • mvn -B -ntp verify: 38 Java tests passed.
  • node --test src/test/js/*.test.cjs: 12 JavaScript tests passed.
  • The new tests reproduced four Java failures and four JavaScript failures against the original code before the fixes.
  • Additional DOM checks passed for draft editing, reordering, search, imports, exports, HTML escaping, and stale-result handling.
  • Packaged-app HTTP checks returned both client and provider FAQs. The whitespace-heavy probe took approximately 14–15 ms on both endpoints after the fix; the original preview request took 7.8 seconds in the same local review environment. These are individual local measurements, not a load benchmark.

Public-hosting controls such as overall JSON body limits, rate limiting, response security headers, and isolated document parsing remain follow-up work.

Avoid regex backtracking on whitespace-heavy input, discard stale draft responses and errors after source or mode changes, and distinguish client/provider responsibilities during topic deduplication. Add regression coverage and an unreleased changelog entry.
@OKAN-SOFTWARE
OKAN-SOFTWARE marked this pull request as ready for review October 26, 2026 21:20
@OKAN-SOFTWARE
OKAN-SOFTWARE merged commit 859e845 into main Oct 26, 2026
2 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.

1 participant