Skip to content

Bugfix Issue 2106 Authored Quality Objectives Chapter

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

Bugfix — Issue #2106: authored Quality Objectives chapter text

Quality Objectives editor before the fix

Quality Objectives editor after the fix with authored text

Authored Quality Objectives note in the Test Strategy report

Symptom

Chapter 2 (Quality Objectives) of the modern Test Strategy was a read-only reference page. With a freshly imported 2.0.1 database and fixture project 1 (Strategy Objectives Repro, prefix SOBJ), opening gui/templates/strategy/objectives.html?tproject_id=1 returned HTTP 200 but its a11y snapshot had only the two static columns (Quality objectives, Service levels) and the footer: the live DOM contained 0 textareas and 0 buttons, and there was no Save action for project-specific prose. An authenticated GET /api/strategychapter/index.php?action=init&tproject_id=1&chapter=objectives returned HTTP 400 bad_chapter, and api/strategyreport/index.php?action=init exposed no chapter-note text for this chapter. Evidence screenshots: docs/screenshots/issue-2106-objectives-before.png, docs/screenshots/issue-2106-objectives-after.png, docs/screenshots/issue-2106-report-after.png.

Root cause

  • gui/templates/strategy/objectives.html:40-57 rendered only two translated static cards; the original script (:61-70) loaded jQuery and TLi18n but never called the chapter BFF. Unlike the fixed siblings (intro, compatibility, reliability, maintainability), it had no editor card, no textarea, no Save button and no loadNotes() / saveNotes() wiring.
  • api/strategychapter/index.php:80-82 — schapterCodes() allowed only intro, compatibility, reliability and maintainability. Both the read gate (:274) and the write gate (:295) rejected objectives with HTTP 400 bad_chapter (measured live before the fix), although the atomic upsert (:307-312) and payload mapper (:193-202) are code-agnostic.
  • api/strategyreport/index.php:462-494 already aggregates every row of testproject_strategy_chapters for the addressed project behind the strategy-document read right, so the report BFF needed no change. The only missing reporting hop was chapterTitle() in gui/templates/results/strategyReport.html:314-322, which lacked an objectives entry even though ts.chapterObjectives already existed in every locale bundle.
  • No ts.objectivesNotes* labels existed: the editor needed four new keys in each of the ten bundles plus entries in ai/required_i18n_keys.txt (the #2131 reference-level guard against silent key removal).

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

Approach chosen

  1. Extend the existing allowlist, not the schema. Adding objectives to schapterCodes() reuses the session/same-origin BFF, project-scoped rights (mgt_view_tc to read, mgt_modify_tc to write), 20 000-character cap, lazy schema, atomic UNIQUE (testproject_id, chapter_code) upsert and STRATEGY_CHAPTER_SAVE AUDIT event. No new table, endpoint or migration was needed.
  2. Mirror the established Dashio editor in the existing chapter page. The page now has a teal-topped .editor card with a labeled #objectivesText textarea (maxlength=20000), #objectivesMeta author/update line, #btnSave and a localized #objectivesStatus region. GET init fills the stored text, resolves the project from ?tproject_id= / ?tprojectId= and rewrites the back link accordingly, and disables the textarea/button when context.can_modify is false. POST save persists and reloads; 401 redirects to login, 403 shows the shared read-only message, 400 shows the no-project message, and other failures show a localized load/save error. Four new ts.objectivesNotes* keys were added to all ten bundles; the status/meta labels reuse the shared ts.rel* keys and all four new keys are pinned in ai/required_i18n_keys.txt.
  3. Add only the missing report title mapping. chapterTitle() maps objectives to the pre-existing ts.chapterObjectives key. That map is shared by report panel 11 and by buildMarkdown() used by the Markdown/HTML export; the rendered page printed via the existing Export PDF / Print path shows the same content. 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 one new sdoc.sec_* key in each of the ten bundles, while hiding the chapter-code dimension the report already understands.
  • An objectives-only table/API would duplicate auth, rights, upsert, audit and report aggregation already provided by api/strategychapter.
  • A client-only textarea using localStorage would not be project-scoped, rights-guarded, audited or exported into the report/PDF.

Files changed

  • api/strategychapter/index.php — objectives added to schapterCodes() and route docs.
  • gui/templates/strategy/objectives.html — Dashio editor markup + load/save wiring.
  • gui/templates/results/strategyReport.html — objectives chapter title mapping.
  • gui/templates/i18n/{de,en,es,fr,it,ja,pt,ro,ru,zh}.json — four ts.objectivesNotes* keys per locale.
  • ai/required_i18n_keys.txt — four new keys pinned against the #2131 clobber pattern.
  • CHANGELOG — [KEY BUGFIX] - #2106 entry.
  • tmp/TLU_Test_Cases.md — suite Regression — Issue #2106.
  • docs/screenshots/issue-2106-{objectives-before,objectives-after,report-after}.png — browser evidence (wiki page only, no image lines in this mirror).

Verification

  • Pre-fix: 0 textareas, 0 Save buttons, no chapter-BFF requests; API 400 bad_chapter; report chapters.length = 0.
  • Post-fix: GET init 200 (can_modify:true), UI POST save 200, reload restored the exact two-line UTF-8 text (Objetivo: ... / Mācība: glyphs äöü — 日本語) with author admin and timestamp 2026-11-29 21:59:57; DB row testproject_id=1, chapter_code=objectives, author_id=1 held the verbatim text and one STRATEGY_CHAPTER_SAVE AUDIT event was logged.
  • Report panel 11 showed Quality Objectives · Last author: admin · Updated: 2026-11-29 21:59:57 plus both text lines; buildMarkdown() contained ### Quality Objectives and the same text, so Markdown/HTML export and the PDF print path carry it as well.
  • Rights/error matrix: no tproject_id → 400 no_testproject; role-3 no-rights user → BFF init/save 403 no_right and, in a second browser context, a disabled editor with localized permission/read-only messages; intro, compatibility, reliability and maintainability siblings still returned 200 with unchanged text.
  • Gates: php -l api/strategychapter/index.php OK; inline JS compile for both changed pages OK; python3 -m json.tool OK for all ten bundles; bash ai/verify_i18n_coverage.sh PASS (9/9, 0 missing, 14242 keys, 32 pinned keys); TLU_REQUIRE_SUITE="Issue #2106" bash ai/verify_test_suites.sh PASS (34/0/0).
  • Event Viewer: after the run the events table held only AUDIT rows (log_level=16: two logins, project create, chapter save, user create) — 0 Error/Warning entries.
  • Code review: subagent verdict APPROVE with no confirmed findings before the fix commit.

Clone this wiki locally