Skip to content

Bugfix Issue 2128 Authored Compatibility Chapter

github-actions[bot] edited this page Nov 29, 2026 · 1 revision

Bugfix — Issue #2128: authored Compatibility Testing chapter text

editor before fix

editor after fix

saved note in the Test Strategy report

Symptom

Chapter 26 (Non-Functional: Compatibility Testing) was a read-only reference page. With a freshly imported 2.0.1 database and fixture project 1 (smoke, prefix SMK), opening gui/templates/strategy/nfrCompatibility.html?tproject_id=1 returned HTTP 200 but the live DOM had 0 textareas and 0 Save buttons. Its network panel showed ten static/shell requests and no call to api/strategychapter. With no editor, a project could not record its OS/browser/device matrix prose, and the generated Test Strategy report had no chapter-note text to aggregate. Before the fix, an authenticated GET /api/strategychapter/index.php?action=init&tproject_id=1&chapter=compatibility returned HTTP 400 bad_chapter while chapter=intro returned 200.

Root cause

  • api/strategy/index.php:83 correctly links chapter 26 to gui/templates/strategy/nfrCompatibility.html; lib/functions/common.php:3580 exposes the same URL as $actions->testStrategyCompatibility. Navigation was never the problem.
  • The page rendered only two translated static cards (nfrCompatibility.html:40-57); its script (:61-70) loaded jQuery and TLi18n but nothing else. Unlike the #2104, #2129 and #2130 siblings, it had no #compatText textarea, no #btnSave, and no loadNotes() / saveNotes() wiring.
  • The shared persistence BFF was gated by schapterCodes() at api/strategychapter/index.php:78-81, which allowed only intro, reliability and maintainability. Both the read validation (:273) and the save validation (:294) rejected compatibility with HTTP 400 bad_chapter.
  • Storage and reporting were already chapter-agnostic: testproject_strategy_chapters has a UNIQUE (testproject_id, chapter_code) key and an atomic upsert (api/strategychapter/index.php:89-106, :303-311), and api/strategyreport/index.php:461-494 aggregates every chapter row for the project. Only chapterTitle() in gui/templates/results/strategyReport.html:314-321 lacked a compatibility entry, so a saved note would have been shown under the raw code.

This is not a regression from a recent commit: legacy 1.9.20 shipped all NFR chapter pages as static guidance, and the 2.0.1 authored-chapter series (#2104, #2129, #2130) simply never included chapter 26.

Approach chosen

  1. Extend the existing allowlist, not the schema. Adding compatibility to schapterCodes() reuses the same rights-guarded read/write endpoints, 20 000-character cap, atomic upsert and STRATEGY_CHAPTER_SAVE AUDIT event as the three sibling chapters. No new table, endpoint or migration was needed: chapter_code is already a free VARCHAR(64) value keyed per project.
  2. Mirror the established Dashio editor in the existing chapter page. The page now has a teal-topped .editor card with a labeled #compatText textarea (maxlength=20000), #compatMeta author/update line, #btnSave and a localized #compatStatus region. GET init fills the stored text, resolves the project context from ?tproject_id= / ?tprojectId= (falling back to the BFF session project), and disables the textarea/button when context.can_modify is false; POST save persists and reloads. 401 redirects to login, 403 shows a read-only message, 400 shows the no-project message, and other failures show a localized load/save error. Four new ts.compatNotes* keys were added to all ten bundles; the nine status/meta keys are the shared ts.rel* keys already used by the sibling chapters, and all thirteen are now pinned in ai/required_i18n_keys.txt against the #2131 clobber pattern.
  3. Add only the missing report title mapping. chapterTitle() maps compatibility to the pre-existing ts.chapterCompatibility key. That map is shared by report panel 11 and by buildMarkdown() used by the Markdown/HTML export. The rendered page printed to PDF through window.print() also shows panel 11, so all three surfaces show the chapter name rather than the raw code. No strategy-report BFF change was required.

Alternatives rejected

  • Adding a tenth section to testproject_strategy_docs would break the fixed nine-section #2101 document contract and require ten new sdoc.sec_* keys per bundle; it would also hide the chapter-code dimension that the report already understands.
  • A compatibility-only table/API would duplicate auth, same-origin protection, rights, upsert, audit and report aggregation that api/strategychapter already provides.
  • A client-only textarea with localStorage would not be project-scoped, rights-guarded, audited or exported into the report/PDF.

Files changed

  • api/strategychapter/index.php — compatibility added to schapterCodes() and route docs.
  • gui/templates/strategy/nfrCompatibility.html — Dashio editor markup + load/save wiring.
  • gui/templates/results/strategyReport.html — compatibility chapter title mapping.
  • gui/templates/i18n/{de,en,es,fr,it,ja,pt,ro,ru,zh}.json — four ts.compatNotes* keys per locale.
  • ai/required_i18n_keys.txt — four new keys plus nine reused ts.rel* keys pinned.
  • tmp/TLU_Test_Cases.md — suite Regression — Issue #2128.
  • CHANGELOG — [KEY BUGFIX] - #2128 entry.
  • docs/screenshots/issue-2128-compatibility-{before,after}.png and docs/screenshots/issue-2128-strategy-report-compatibility.png — evidence.

Verification

  • Pre-fix: 0 textareas, 0 Save buttons, zero chapter-BFF requests; API 400 bad_chapter.
  • Post-fix: GET init 200 (can_modify:true), POST save 200, reload restored the exact two-line UTF-8 text with author/timestamp; DB row 1 | 1 | compatibility | admin.
  • Report panel 11 showed Compatibility Testing · Last author: admin · Updated: 2026-11-29 19:54:57 plus both text lines; buildMarkdown() contained ### Compatibility Testing and the same text in the Markdown/HTML export, and the rendered panel 11 used by Export PDF / Print showed the same content.
  • Rights matrix: read-only user saw a disabled textarea/Save and POST returned 403 no_right with the DB unchanged; anonymous GET returned 401 session_expired; anonymous POST with a foreign Origin returned 403 CSRF guard; chapter=bogus returned 400 and unknown project 404. The intro, reliability and maintainability siblings still returned 200.
  • Gates: php -l, extracted-JS node --check for both pages, python3 -m json.tool for all ten bundles, bash ai/verify_i18n_coverage.sh PASS (9/9, 0 missing, 28 pinned keys), and TLU_REQUIRE_SUITE="Issue #2128" bash ai/verify_test_suites.sh PASS (34/0/0).
  • Event Viewer: LOGIN:4, LOGOUT:1, STRATEGY_CHAPTER_SAVE:1; 0 Error/Warning rows.
  • Code review: no MUST-FIX findings; the two SHOULD-FIX items (pin reused ts.rel* keys and avoid overstating title translation) were applied before commit.

Clone this wiki locally