Skip to content

fix(GIT-1370): ADR cleanup pass for coverage-report Bucket 4#1432

Open
WilcoLouwerse wants to merge 1 commit intodevelopmentfrom
fix/GIT-1370/adr-cleanup-coverage-bucket-4
Open

fix(GIT-1370): ADR cleanup pass for coverage-report Bucket 4#1432
WilcoLouwerse wants to merge 1 commit intodevelopmentfrom
fix/GIT-1370/adr-cleanup-coverage-bucket-4

Conversation

@WilcoLouwerse
Copy link
Copy Markdown
Contributor

Summary

Closes #1370. Addresses the Bucket 4 findings from openspec/coverage-report.md generated 2026-04-30 (parent: ConductionNL/.github#27).

  • SchemaMapper.php:892 — replaced print_r($value, true) with json_encode($value) for the error-message string conversion (ADR-003 / forbidden-debug-calls).
  • Audit of all 10 raw db->prepare() sites — each now carries an inline comment explaining why QueryBuilder cannot express the query and noting MariaDB compatibility status.

The audit also surfaced two real MariaDB-incompat bugs that were fixed in the same pass since the codebase already contained portable counterparts to mirror:

  1. ReferentialIntegrityService.php:372 used current_schema() unconditionally — that function is PostgreSQL-only and would fail on MariaDB. Now branches on the database platform (DATABASE() for MySQL/MariaDB, current_schema() for PostgreSQL), mirroring the established pattern in MagicMapper.php:1697-1707.
  2. RegisterService.php:418 used CAST(... AS VARCHAR) unconditionally — VARCHAR (without length) is non-standard on MariaDB. Now branches on platform (CAST AS CHAR for MariaDB/MySQL, CAST AS VARCHAR for PostgreSQL), mirroring MagicMapper.php:1346-1349.

Audit findings (per site)

File Line Why raw SQL MariaDB status
RegisterService.php 442 UNION ALL across N dynamically-named magic tables ✅ after CAST fix
ReferentialIntegrityService.php 373 information_schema.tables metadata query ✅ after current_schema() fix
ReferentialIntegrityService.php 902 Platform-conditional JSON_CONTAINS / jsonb @> operators ✅ already platform-aware
LinkedEntityEnricher.php 121 Foreign Mail-app table (oc_mail_messages)
LinkedEntityEnricher.php 161 Foreign DAV/Contacts table (oc_cards)
LinkedEntityEnricher.php 247 Foreign DAV/Calendar table (oc_calendarobjects)
LinkedEntityEnricher.php 301 Foreign DAV/Calendar table (oc_calendarobjects)
LinkedEntityEnricher.php 347 Foreign Talk-app table (oc_talk_rooms)
LinkedEntityEnricher.php 400 Foreign Deck-app tables (joined cards/stacks/boards)
CacheHandler.php 1770 Runtime-resolved magic table + name column from fixed allowlist

The issue body summary said "8" but the table actually lists 10 occurrences — all 10 are covered.

Test plan

  • php -l clean on all five edited files (verified locally)
  • phpcs produces no new warnings beyond pre-existing long-line warnings (verified locally)
  • CI pipeline passes
  • Manual verification on MariaDB target: RegisterService::getSchemaObjectCounts() and ReferentialIntegrityService::buildSchemaRegisterMap() no longer raise SQL syntax errors

🤖 Generated with Claude Code

Address Bucket 4 findings from openspec/coverage-report.md:

- SchemaMapper.php:892 — replace print_r() debug helper with json_encode()
  (ADR-003 / forbidden-debug-calls).

- ReferentialIntegrityService.php:372 — fix MariaDB incompatibility:
  current_schema() is PostgreSQL-only. Now branches on database platform
  using DATABASE() for MySQL/MariaDB and current_schema() for PostgreSQL,
  mirroring MagicMapper.php:1697-1707.

- RegisterService.php:418 — fix MariaDB incompatibility: CAST AS VARCHAR
  is non-standard on MariaDB. Now branches on platform using CAST AS CHAR
  for MariaDB/MySQL and CAST AS VARCHAR for PostgreSQL, mirroring
  MagicMapper.php:1346-1349.

- All 10 db->prepare() raw-SQL sites now carry an explanatory comment
  describing why QueryBuilder cannot express the query (UNION ALL across
  dynamic magic tables, information_schema metadata access, foreign
  cross-app tables, platform-specific JSON-array operators, runtime-
  resolved table/column names) and noting MariaDB compatibility status.

Refs: #1370, ConductionNL/.github#27
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Quality Report — ConductionNL/openregister @ cf1f4f5

Check PHP Vue Security License Tests
lint
phpcs
phpmd
psalm
phpstan
phpmetrics
eslint
stylelint
composer ✅ 147/147
npm ✅ 598/598
PHPUnit
Newman
Playwright ⏭️

Quality workflow — 2026-05-05 22:11 UTC

Download the full PDF report from the workflow artifacts.

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