Skip to content

Bugfix Issue 2107 Authored Scope Chapter

CI Agent edited this page Nov 30, 2026 · 1 revision

Bugfix — Issue #2107: authored Scope chapter text

Symptom

Chapter 3 (Scope) of the Test Strategy was a read-only page. gui/templates/strategy/scope.html had no textarea and no Save action, so teams could not record the in-scope/out-of-scope boundary and exclusions their project actually applies. Measured before the fix: grep -c '<textarea>' = 0, live DOM textareas: 0, no api/strategychapter request in the page Network list, and an authenticated BFF init call for chapter=scope returned 400 bad_chapter.

Root cause

The page was still a static translated page. Unlike the already authored chapters (intro, objectives, security, usability, accessibility, compatibility, reliability, maintainability), it was never wired to api/strategychapter/index.php: schapterCodes() at api/strategychapter/index.php:81-83 had no scope entry, so both init (:275) and save (:296) rejected it before any persistence. The report title map in gui/templates/results/strategyReport.html:314-326 also lacked scope, so a stored row would have been rendered with the raw code as its heading. The chapter itself was published by api/strategy/index.php:60, and the storage table (testproject_strategy_chapters) plus api/strategyreport/index.php:466-494 are generic over chapter_code — no schema change was needed. This is an unfinished rollout of the #2101 mechanism, not a regression in report generation.

Approach (why this fix)

The fix extends the existing per-project chapter infrastructure rather than introducing a parallel storage path. Adding scope to the BFF allowlist is additive: every other chapter keeps the same rights checks, atomic upsert and AUDIT event. The chapter page mirrors the verified #2125/#2126 Dashio editor, and the report map gains one key so HTML, Markdown, PDF and print exports show the localized ts.chapterScope title instead of the raw code. Two alternatives were rejected: localStorage text (not project-scoped, no rights, absent from the report/PDF) and a new BFF/table (duplicates working infrastructure). A live console audit also showed the inherited pattern assigned the textarea id after DOM parse; the textarea now carries a static id/maxlength so the <label for> resolves immediately.

Files changed

  • api/strategychapter/index.php: added scope to schapterCodes() and to the documented route contract, so init, list and save use the same per-project persistence and rights checks as every other authored chapter.
  • gui/templates/strategy/scope.html: added the Dashio editor card with a textarea, author/timestamp metadata, Save button, localized status messages, project-context footer and the standard 401/403/400 error handling. Read-only project roles get a disabled textarea and Save button; the existing static in-scope/out-of-scope lists are unchanged.
  • gui/templates/results/strategyReport.html: added scope: 'ts.chapterScope' to chapterTitle() so report panel 11, Markdown and the PDF/print path use the localized chapter title.
  • gui/templates/i18n/*.json: added ts.scopeNotesTitle, ts.scopeNotesHint, ts.scopeNotesLabel and ts.scopeNotesSave to all ten bundles, translated in the nine non-English bundles; the existing generic ts.rel* keys provide status/metadata text.
  • CHANGELOG: one 2.0.1 KEY BUGFIX line for #2107.
  • tmp/TLU_Test_Cases.md: numbered regression suite with measured results.

Screenshots

Scope chapter before the fix — static page without editor

Scope chapter after the fix — editor with the saved note

German Test Strategy report panel showing the Scope note

Verification

  • php -l api/strategychapter/index.php: no syntax errors.
  • Extracted page JavaScript passed node --check; grep -c '<textarea>' → 1.
  • python3 -m json.tool passed for all ten bundles; bash ai/verify_i18n_coverage.sh: 9 bundles passed, 0 missing.
  • Admin UI: fixture project 1 (I2107); saved Scope note saved for #2107 verification: API integrations and legacy reports are in scope; third-party portals are excluded. and reloaded → Updated: 2026-11-30 03:49:58 by admin with the text preserved verbatim and an empty browser console.
  • BFF: init returned code=scope, author/timestamps and canModify=true; list returned codes=["scope"]; unknown chapter → 400 bad_chapter, unknown project → 404, unauthenticated → 401, PUT → 405. Absent Origin on a POST is still refused by the shared CSRF guard.
  • Read-only user scope_readonly (role 5, mgt_view_tc only): init returned can_view=true, can_modify=false, direct POST save → 403 no_right.
  • Report: payload contained the scope row; panel showed Scope · Last author: admin · Updated: 2026-11-30 03:49:58 plus the note; buildMarkdown() contained ### Scope and #btnExportPdf exists. In German the re-rendered panel read Umfang · Letzter Autor: admin · Aktualisiert: ....
  • Event Viewer (events table): 3 rows, all log_level=16 (two LOGIN + one STRATEGY_CHAPTER_SAVE scope (project 1)) → 0 Error/Warning entries.
  • Suite gate: TLU_REQUIRE_SUITE="Issue #2107" bash ai/verify_test_suites.sh → 34 PASS / 0 FAIL / 0 SKIP; 1038 → 1039 suites, no suite lost.

Result

PASS — Fixes #2107. Refs #2101.

Clone this wiki locally