Bugfix Issue 830 Reporting Joins Project Scope - sebiboga/testlink-upgraded GitHub Wiki
Bugfix / Completion — Issue #830: reporting joins scoped to plan's project
Summary
Issue #830 is the "reports.class.php + testcase.class.php + object.class.php
reporting joins" sub-task of #503 (builds scoped to the Test Project). Its
implementation was landed in commit eb5b4f8ef but the issue was left OPEN.
This run re-verified the Definition of Done empirically and closed it.
Scope (what #830 implemented)
-
lib/functions/reports.class.php—get_count_builds()now resolves the plan's project and countsbuilds.testproject_id = {tproject}instead ofbuilds.testplan_id = {plan}. Builds are project-scoped, so a build shared across several plans of the same project is counted once, project-wide. -
lib/functions/testcase.class.php—get_last_execution()dropped the now-harmfulAND builds.testplan_id = {tplan}from theLEFT OUTER JOIN builds(the execution is already scoped viae.testplan_id). -
lib/functions/object.class.phpregisters thelatest_exec_by_buildview ('latest_exec_by_build' => null→ prefixed view name), used for the future #835 cross-plan per-build report.
Root Cause
No new code defect was found in this run. The issue was simply never closed
after the fix (also verified in eb5b4f8ef) was pushed, so the issue remained
OPEN despite a complete Definition of Done.
Why this fixes the plan-scope bug
Because builds no longer carry a meaningful testplan_id (they are scoped to
the project), any reporting join keyed on builds.testplan_id would miss builds
created for a sibling plan of the same project. get_count_builds() is used by
resultsNavigator.php build counters — plan-scoped counting would under-count
the total builds for a project.
Files Changed (this run)
| File | Change |
|---|---|
tmp/TLU_Test_Cases.md |
Added regression suite TC-830.1–830.7 (verification of #830 DoD) |
tmp/repro_830_verify.php |
Local (untracked, tmp/ is gitignored) repro exercising get_count_builds() project scope via the real class — rebuild it from the TC-830.3–830.5 steps to re-run |
Note: the implementation files themselves (reports.class.php,
testcase.class.php, object.class.php) were changed in the earlier commit
eb5b4f8ef; the remaining builds.testplan_id joins in testplan.class.php
(lines 4153–5677) and tlTestPlanMetrics.class.php:2567 are explicitly
deferred to sub-task #835 (cross-plan per-build report) — not part of #830.
Verification
- DB/view:
SHOW CREATE VIEW latest_exec_by_build→ exists, groups bytcversion_id, build_id, platform_id; registered atobject.class.php:341. - Code grep: no
builds.testplan_idremains inreports.class.phportestcase.class.php(the #830 scope files). - Runtime (repro):
php tmp/repro_830_verify.php→ 3/3 PASS; both plans of project 2000 correctly report the 2 project-scoped builds. - Event Viewer: no new Error/Warning rows from the verified flows.
Definition of Done — Confirmed
- reports resolve builds by project ✓
latest_exec_by_buildavailable to queries ✓- no join reference dropped
testplan_idcolumn within the #830 scope files ✓