feat(libcairo): implement fifteen graphics-state and dash exports #15317

Merged
hyvvs merged 1 commit from upstream-pr/15317 into main 2026-11-10 03:37:10 +00:00
hyvvs commented 2026-11-02 23:44:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hyvvs on 2026-11-02T23:44:35Z.


What

Implement 15 Cairo graphics-state and dash exports, owned arrays and save/restore; validate sticky INVALID_DASH, native NaN and contextual nil target. Merge after #15315 and before #15324.

Tested

Windows MinGW C++20 -DNDEBUG DLL-linked context/graphics tests PASS (4,096 dash lifetimes); Ubuntu WSL -DNDEBUG ASan+UBSan/leak check PASS; 1,024 randomized native Cairo1.18 state sequences PASS; headers/progress/conventions PASS. Full integrated CMake/CTest and PS5 console not tested.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #15315 (and preceding Cairo #14327/#14328/#14329)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

Detailed implementation and verification notes

Summary

Implement 15 additional, formerly throwing Cairo graphics-state exports for antialias, fill rule, line cap/join, line width, miter limit and dash arrays:

  • cairo_set/get_antialias
  • cairo_set/get_fill_rule
  • cairo_set/get_line_cap
  • cairo_set/get_line_join
  • cairo_set/get_line_width
  • cairo_set/get_miter_limit
  • cairo_set_dash, cairo_get_dash, cairo_get_dash_count.

Context state owns and deep-copies dash arrays across nested save/restore, preserves normal getters, clamps negative line width to 0, and rejects invalid dash arrays with sticky error. Matches native Cairo's very short dash-cycle normalization.

Validation

  • Windows MinGW GCC C++20 -O2 -Wall -Wextra -Werror -pedantic actual DLL/import-library and linked guest executable: graphics-state and parent context tests PASS; 4096 dash/save/restore lifetime iterations.
  • Ubuntu WSL GCC ASan+UBSan with leak detection: focused guest test PASS.
  • Native Cairo 1.18.0 differential: 1024 randomized combinations of state setters/getters, variable-length dash arrays, offsets, save/restore sequences PASS. Found and corrected negative-width and tiny-dash-cycle mismatches.
  • Header audit 405 libraries/27906 declarations PASS; 59 progress tests PASS (one skipped); strict conventions and git diff --check PASS.
  • Scanner on combined branch: 46/161 -> 61/161, exactly +15 new exports.

Dependencies and limitations

Stacked: #14327 (surfaces) -> #15315 (context & CTM) -> this PR (graphics state). This PR currently includes the predecessor histories, so land upstream parents first and refresh this PR's base/merge order. #14258 matrix functions already merged. No export claimed by other Cairo contributor's #15208 gradient-pattern PR.

This is a real observable/owned graphics-state implementation, not a claim of rendering: no path, clipping, strokes/fills, rasterizer or PS5 firmware differential. Those remain unimplemented. Does not increase main's scanner count until merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5129251845 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15317). Originally posted by [hyvvs](https://github.com/hyvvs) on 2026-11-02T23:44:35Z. --- ### What Implement 15 Cairo graphics-state and dash exports, owned arrays and save/restore; validate sticky INVALID_DASH, native NaN and contextual nil target. Merge after #15315 and before #15324. ### Tested Windows MinGW C++20 -DNDEBUG DLL-linked context/graphics tests PASS (4,096 dash lifetimes); Ubuntu WSL -DNDEBUG ASan+UBSan/leak check PASS; 1,024 randomized native Cairo1.18 state sequences PASS; headers/progress/conventions PASS. Full integrated CMake/CTest and PS5 console not tested. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #15315 (and preceding Cairo #14327/#14328/#14329) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes ### Detailed implementation and verification notes ## Summary Implement 15 additional, formerly throwing Cairo graphics-state exports for antialias, fill rule, line cap/join, line width, miter limit and dash arrays: - cairo_set/get_antialias - cairo_set/get_fill_rule - cairo_set/get_line_cap - cairo_set/get_line_join - cairo_set/get_line_width - cairo_set/get_miter_limit - cairo_set_dash, cairo_get_dash, cairo_get_dash_count. Context state owns and deep-copies dash arrays across nested save/restore, preserves normal getters, clamps negative line width to 0, and rejects invalid dash arrays with sticky error. Matches native Cairo's very short dash-cycle normalization. ## Validation - Windows MinGW GCC C++20 -O2 -Wall -Wextra -Werror -pedantic actual DLL/import-library and linked guest executable: graphics-state and parent context tests PASS; 4096 dash/save/restore lifetime iterations. - Ubuntu WSL GCC ASan+UBSan with leak detection: focused guest test PASS. - Native Cairo 1.18.0 differential: 1024 randomized combinations of state setters/getters, variable-length dash arrays, offsets, save/restore sequences PASS. Found and corrected negative-width and tiny-dash-cycle mismatches. - Header audit 405 libraries/27906 declarations PASS; 59 progress tests PASS (one skipped); strict conventions and git diff --check PASS. - Scanner on combined branch: 46/161 -> 61/161, exactly +15 new exports. ## Dependencies and limitations **Stacked: #14327 (surfaces) -> #15315 (context & CTM) -> this PR (graphics state).** This PR currently includes the predecessor histories, so land upstream parents first and refresh this PR's base/merge order. #14258 matrix functions already merged. No export claimed by other Cairo contributor's #15208 gradient-pattern PR. This is a real observable/owned graphics-state implementation, not a claim of rendering: no path, clipping, strokes/fills, rasterizer or PS5 firmware differential. Those remain unimplemented. Does not increase main's scanner count until merged.
MarcZX10 commented 2026-11-02 23:58:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T23:58:26Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The reviewed head has three Cairo behavior mismatches and does not retain the repository’s required pull request template.

What I ran

Reviewed all 12 changed files at head 373ab8699984c4d9a76594f7f0ac74de40a1e7a3 against base 5cb015caaaaf83f8ee431414ee6a457b5b307d49; the exact head merges cleanly into that base. Environment: Debian Linux x86_64, Python 3.11.2, GCC 12.2.0. No build or C++ test binary was run.

git diff --check 5cb015caaaaf83f8ee431414ee6a457b5b307d49...373ab8699984c4d9a76594f7f0ac74de40a1e7a3
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 15317
python3 tools/pr_abi_audit.py --base 5cb015caaaaf83f8ee431414ee6a457b5b307d49 --head 373ab8699984c4d9a76594f7f0ac74de40a1e7a3 --json
python3 tools/pr_stack_check.py 15317 --repo boykopovar/AnyPS5
gh pr checks 15317 --repo boykopovar/AnyPS5

Results

Check Result Note
Diff check passed No whitespace errors.
Export and declaration audit passed No lexical export inconsistencies found.
Base merge preview passed Clean against the stated base.
Conventions and PR template failed Required template headings and checklist are missing.
Hosted CI not run All six applicable checks were queued at refresh.
Build and C++ tests not run No exact-head local binaries; initial review does not build.
Check output
PR precheck: /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15317-373ab8699984/report.md
Conclusion: checks failed

(pull request): error: [pr-template] Fill in the pull request template: add the '### What' heading of the template
(pull request): error: [pr-template] Fill in the pull request template: add the '### Tested' heading of the template
(pull request): error: [pr-template] Fill in the pull request template: add the '### Checklist' heading of the template
3 findings, 3 errors

The precheck’s isolated snapshot did not contain pr_abi_audit.py or pr_test_quality.py; I ran the ABI audit directly in the workspace. Its JSON result was status: passed, with no findings. The stack report said the exact head merged cleanly against the current base. The six hosted checks (labels, intake, conventions, eligibility, report and library-portability) were queued on this head.

Negative control

Not run. The new C++ tests require a build, and this review remained in the no-build pass.

Findings

Blocking

  1. cairo_surface_create_similar changes the requested dimensions. At Surface.cpp lines 270–280, it multiplies width and height by the target scale, then assigns that scale to the result. For example, scale 2 and requested dimensions 10×5 produce a 20×10 backing image, although Cairo specifies these arguments in device-space units and passes them unchanged to its similar-surface backend. Pass the requested dimensions unchanged; handle any scale metadata separately.

  2. Rectangle surfaces report the image type. cairo_surface_create_for_rectangle marks the surface as non-image, but cairo_surface_get_type always returns the image enum. Cairo defines CAIRO_SURFACE_TYPE_SUBSURFACE for surfaces created by this API. Store and return the subsurface type for these surfaces.

  3. cairo_get_target returns a normal or wrong-status surface after context failure. After cairo_restore sets kInvalidRestore, cairo_get_target still returns the original target. Also, the static null-pointer context is initialized with a kNoMemory target. Cairo requires an error (“nil”) surface carrying the context’s status whenever the context is in an error state. Return an error surface matching the context status and make the null-pointer context’s target status kNullPointer.

  4. The PR description omits required template fields. The repository checker reports missing ### What, ### Tested and ### Checklist; the description also omits the required checklist entries, including Depends on, Unblocks, GPUs tested and AI-assisted. Restore the full template and fill every item.

Non-blocking

  • The invalid-dash test cases set bad dash arrays and then destroy their contexts without asserting an observable sticky error result. Add an assertion when the status/error-surface path is available so the test checks the behavior named in its comment.

Sources

Not verified

I did not build or run the C++ tests, run the negative control, or verify behavior on Windows, PS5 firmware or a console. The author-reported MinGW, sanitizer and Cairo differential runs were not independently reproduced. Hosted checks were still queued at the final refresh.

To get this to a good state

Correct the three surface/context behaviors, restore and complete the PR template, and add an observable invalid-dash assertion. On the new head I will rerun the diff check, precheck, ABI audit, stack check and applicable hosted checks, then review the updated diff and tests.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5745144787 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15317#pullrequestreview-5745144787). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-02T23:58:26Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The reviewed head has three Cairo behavior mismatches and does not retain the repository’s required pull request template. ## What I ran Reviewed all 12 changed files at head `373ab8699984c4d9a76594f7f0ac74de40a1e7a3` against base `5cb015caaaaf83f8ee431414ee6a457b5b307d49`; the exact head merges cleanly into that base. Environment: Debian Linux x86_64, Python 3.11.2, GCC 12.2.0. No build or C++ test binary was run. ```sh git diff --check 5cb015caaaaf83f8ee431414ee6a457b5b307d49...373ab8699984c4d9a76594f7f0ac74de40a1e7a3 python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 15317 python3 tools/pr_abi_audit.py --base 5cb015caaaaf83f8ee431414ee6a457b5b307d49 --head 373ab8699984c4d9a76594f7f0ac74de40a1e7a3 --json python3 tools/pr_stack_check.py 15317 --repo boykopovar/AnyPS5 gh pr checks 15317 --repo boykopovar/AnyPS5 ``` ## Results | Check | Result | Note | |---|---|---| | Diff check | passed | No whitespace errors. | | Export and declaration audit | passed | No lexical export inconsistencies found. | | Base merge preview | passed | Clean against the stated base. | | Conventions and PR template | failed | Required template headings and checklist are missing. | | Hosted CI | not run | All six applicable checks were queued at refresh. | | Build and C++ tests | not run | No exact-head local binaries; initial review does not build. | <details><summary>Check output</summary> ```text PR precheck: /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15317-373ab8699984/report.md Conclusion: checks failed (pull request): error: [pr-template] Fill in the pull request template: add the '### What' heading of the template (pull request): error: [pr-template] Fill in the pull request template: add the '### Tested' heading of the template (pull request): error: [pr-template] Fill in the pull request template: add the '### Checklist' heading of the template 3 findings, 3 errors ``` The precheck’s isolated snapshot did not contain `pr_abi_audit.py` or `pr_test_quality.py`; I ran the ABI audit directly in the workspace. Its JSON result was `status: passed`, with no findings. The stack report said the exact head merged cleanly against the current base. The six hosted checks (labels, intake, conventions, eligibility, report and library-portability) were queued on this head. </details> ## Negative control Not run. The new C++ tests require a build, and this review remained in the no-build pass. ## Findings ### Blocking 1. **`cairo_surface_create_similar` changes the requested dimensions.** At `Surface.cpp` lines 270–280, it multiplies width and height by the target scale, then assigns that scale to the result. For example, scale 2 and requested dimensions 10×5 produce a 20×10 backing image, although Cairo specifies these arguments in device-space units and passes them unchanged to its similar-surface backend. Pass the requested dimensions unchanged; handle any scale metadata separately. 2. **Rectangle surfaces report the image type.** `cairo_surface_create_for_rectangle` marks the surface as non-image, but `cairo_surface_get_type` always returns the image enum. Cairo defines `CAIRO_SURFACE_TYPE_SUBSURFACE` for surfaces created by this API. Store and return the subsurface type for these surfaces. 3. **`cairo_get_target` returns a normal or wrong-status surface after context failure.** After `cairo_restore` sets `kInvalidRestore`, `cairo_get_target` still returns the original target. Also, the static null-pointer context is initialized with a `kNoMemory` target. Cairo requires an error (“nil”) surface carrying the context’s status whenever the context is in an error state. Return an error surface matching the context status and make the null-pointer context’s target status `kNullPointer`. 4. **The PR description omits required template fields.** The repository checker reports missing `### What`, `### Tested` and `### Checklist`; the description also omits the required checklist entries, including `Depends on`, `Unblocks`, `GPUs tested` and `AI-assisted`. Restore the full template and fill every item. ### Non-blocking - The invalid-dash test cases set bad dash arrays and then destroy their contexts without asserting an observable sticky error result. Add an assertion when the status/error-surface path is available so the test checks the behavior named in its comment. ## Sources - [Similar-surface implementation at this head](https://github.com/boykopovar/AnyPS5/blob/373ab8699984c4d9a76594f7f0ac74de40a1e7a3/core/libs/prx/libcairo/Surface.cpp#L261-L282) and [Cairo’s pinned implementation, which forwards the supplied device-space dimensions](https://chromium.googlesource.com/chromiumos/third_party/cairo/+/9669b300a06eb793bb112737cb9085ff020de682/src/cairo-surface.c#L474-L516). - [Surface type and rectangle construction at this head](https://github.com/boykopovar/AnyPS5/blob/373ab8699984c4d9a76594f7f0ac74de40a1e7a3/core/libs/prx/libcairo/Surface.cpp#L234-L303) and [Cairo’s pinned surface-type declarations](https://chromium.googlesource.com/chromiumos/third_party/cairo/+/9669b300a06eb793bb112737cb9085ff020de682/src/cairo.h). - [Context error and target paths at this head](https://github.com/boykopovar/AnyPS5/blob/373ab8699984c4d9a76594f7f0ac74de40a1e7a3/core/libs/prx/libcairo/Context.cpp#L59-L70) and [Cairo’s pinned `cairo_get_target` behavior](https://chromium.googlesource.com/chromiumos/third_party/cairo/+/94612bc0323a0af0053ebec769040a7506fc5c22/src/cairo.c#L4002-L4025). - [Repository template requirements at the reviewed base](https://github.com/boykopovar/AnyPS5/blob/5cb015caaaaf83f8ee431414ee6a457b5b307d49/CONTRIBUTING.md#L55-L76) and [the template at that base](https://github.com/boykopovar/AnyPS5/blob/5cb015caaaaf83f8ee431414ee6a457b5b307d49/.github/pull_request_template.md). ## Not verified I did not build or run the C++ tests, run the negative control, or verify behavior on Windows, PS5 firmware or a console. The author-reported MinGW, sanitizer and Cairo differential runs were not independently reproduced. Hosted checks were still queued at the final refresh. ## To get this to a good state Correct the three surface/context behaviors, restore and complete the PR template, and add an observable invalid-dash assertion. On the new head I will rerun the diff check, precheck, ABI audit, stack check and applicable hosted checks, then review the updated diff and tests.
MarcZX10 commented 2026-11-03 01:37:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T01:37:08Z.

Review: CHANGES_REQUESTED


Re-checked — new head, changes requested

The new head fixes the earlier surface findings, but it still returns the wrong error status for error targets, mishandles zero-containing dash patterns, and adds a code comment forbidden by the repository rules.

What I ran

  • Reviewed head c91c64ec211aee03dfa5cd34df846d08398edf8e against PR base 5cb015caaaaf83f8ee431414ee6a457b5b307d49; the exact head had a clean individual merge preview against current main 7feb37ee3e30e10139b483fb4df689d5b5b69ab8.
  • All 12 changed files were read across three independent review partitions. I also checked the Cairo 1.18.0 source at commit 3909090108bb2db55330e3eb148aebe664735363.
  • Environment: Debian Linux 6.1.0-54-amd64, glibc 2.36, Python 3.11.2, Git 2.39.5, GCC 12.2.0. No C++ build was run.
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 15317
python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base 5cb015caaaaf83f8ee431414ee6a457b5b307d49 --head c91c64ec211aee03dfa5cd34df846d08398edf8e --json
python3 tools/pr_test_quality.py --root /marc/AnyPS5 --json core/libs/tests/GuestCairoContext.cpp core/libs/tests/GuestCairoGraphicsState.cpp core/libs/tests/GuestCairoSurface.cpp
git diff --check 5cb015caaaaf83f8ee431414ee6a457b5b307d49...c91c64ec211aee03dfa5cd34df846d08398edf8e
python3 tools/pr_stack_check.py 15317 --repo boykopovar/AnyPS5

Results

Check Result Note
Diff and conventions passed No whitespace or template errors.
ABI lexical audit passed 151 symbols; no lexical findings.
Test registration passed All three new test files have CMake registrations.
Test-quality heuristic failed Three possible-registration warnings; manual CMake inspection confirms they are false positives.
Dependency preview passed Individual heads preview cleanly against current main; transitive stack ancestry is incomplete.
Hosted policy checks not run Five checks remain queued on this head.
Local C++ tests not run These tests require building the exact head.
Precheck report table (unedited)
Check Status Command / reason
build_and_compile not_applicable The precheck deliberately does not configure, build, or compile AnyPS5.
diff_check passed git diff --check 5cb015caaaaf83f8ee431414ee6a457b5b307d49...c91c64ec211aee03dfa5cd34df846d08398edf8e
conventions_and_pr_template passed /usr/bin/python3 tools/check_conventions.py --base 5cb015caaaaf83f8ee431414ee6a457b5b307d49 --head c91c64ec211aee03dfa5cd34df846d08398edf8e --title feat(libcairo): implement fifteen graphics-state and dash exports --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15317-c91c64ec211a/pr-body.md
changed_export_abi_audit failed /usr/bin/python3 tools/pr_abi_audit.py --base 5cb015caaaaf83f8ee431414ee6a457b5b307d49 --head c91c64ec211aee03dfa5cd34df846d08398edf8e --json
python_syntax not_applicable No changed Python implementation files.
related_python_unit_tests not_applicable No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.
python_test_registration not_applicable No changed test_*.py files.
live_dependency_and_mergeability_check passed /usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 15317 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15317-c91c64ec211a/stack
build_dependent_cpp_tests not_applicable Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.
test_quality_heuristics failed /usr/bin/python3 /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15317-c91c64ec211a/head-c91c64ec211a-13d645a7/tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15317-c91c64ec211a/head-c91c64ec211a-13d645a7 --json core/libs/prx/libcairo/CMakeLists.txt core/libs/prx/libcairo/Context.cpp core/libs/prx/libcairo/Export.cpp core/libs/prx/libcairo/Surface.cpp core/libs/prx/libcairo/include/Context.hpp core/libs/prx/libcairo/include/InventoryExports.hpp core/libs/prx/libcairo/include/Surface.hpp core/libs/prx/libcairo/libcairo.hpp core/libs/tests/GuestCairoContext.cpp core/libs/tests/GuestCairoGraphicsState.cpp core/libs/tests/GuestCairoSurface.cpp docs/dev/debt/libcairo.md
negative_controls not_applicable No changed Python test module in tools/ can be run as a no-build base-source control.
Raw outputs (unedited)

Precheck command:

/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15317-c91c64ec211a/report.md
/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15317-c91c64ec211a/report.json
Conclusion: checks failed

Conventions stdout:

All conventions checks passed.

Missing helper stderr:

/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15317-c91c64ec211a/head-c91c64ec211a-13d645a7/tools/pr_abi_audit.py': [Errno 2] No such file or directory
/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15317-c91c64ec211a/head-c91c64ec211a-13d645a7/tools/pr_test_quality.py': [Errno 2] No such file or directory

Direct ABI summary:

{
  "status": "passed",
  "symbols": 151,
  "findings": [],
  "limitations": [
    "This lexical audit does not parse C++ fully, prove calling-convention or binary ABI correctness, verify runtime version tables, or replace compilation.",
    "An absent source declaration or explicit alias can be intentional for assembly exports, conditional platform code, or generated interfaces; inspect findings before treating them as defects."
  ]
}

Direct test-quality output:

{
  "findings": [
    {
      "path": "core/libs/tests/GuestCairoContext.cpp",
      "line": 1,
      "kind": "possible-unregistered-cpp-test",
      "message": "Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage."
    },
    {
      "path": "core/libs/tests/GuestCairoGraphicsState.cpp",
      "line": 1,
      "kind": "possible-unregistered-cpp-test",
      "message": "Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage."
    },
    {
      "path": "core/libs/tests/GuestCairoSurface.cpp",
      "line": 1,
      "kind": "possible-unregistered-cpp-test",
      "message": "Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage."
    }
  ],
  "negative_control_candidates": [],
  "limits": [
    "Heuristics can miss weak assertions and can flag valid tests; inspect every finding.",
    "A test that passes against base is not by itself proof that the PR test is inadequate.",
    "Negative controls are only candidates until the test actually runs against base and fails by assertion rather than import/setup error."
  ]
}

Negative control

Assertion Change to code under test Did the test fail?
Error target preserves the originating Cairo status No mutation run; the current test expects status 1 for null and invalid-dash errors. Could not exercise.
Zero-containing dash patterns normalize as Cairo does No mutation run; the existing {5, 0, 2} test expects three dashes. Could not exercise.

Findings

Blocking

  • Error target status is lost. cairo_create(nullptr) stores a NO_MEMORY target for a context whose status is NULL_POINTER. After a valid context enters an error state, cairo_get_target also returns NO_MEMORY for every error. Cairo constructs the target error surface from the context’s actual status; the current tests instead assert 1 for both null-pointer and invalid-dash errors. Preserve the originating status in both paths and assert 7 for the null-pointer case and 19 for invalid dash.
  • Dash normalization diverges from Cairo. The implementation retains internal zero entries and only converts a pattern to solid when its total period is below 1/256. In Cairo 1.18.0, [5, 0, 2] normalizes to a solid line (dash count 0), while this PR’s test explicitly expects dash count 3; [10, 0] is also degenerate solid. Normalize zero gaps and determine degeneracy from the off portions, then update tests to match the pinned implementation behavior.
  • Repository rule violation. Surface.hpp adds a code comment, contrary to AGENTS.md’s “No comments in code” rule. Remove the comment.

Non-blocking

  • The stack report says the current #14328 and #14329 heads are not included in #15315, despite the PR description listing them as preceding dependencies. Each head individually previews cleanly against main; confirm the intended landing ancestry when updating the dependency stack.

Sources

Not verified

  • No local build or CTest; no native Cairo differential was independently run. Windows tests, Linux sanitizer tests and 1,024 randomized Cairo comparisons are author-reported only.
  • The five hosted policy checks were queued at the final status check; no Linux, console, or rendering behavior was confirmed.
  • The ABI audit is lexical and does not establish binary ABI or runtime correctness. The precheck’s ABI and test-quality steps could not find their helper scripts in its isolated snapshot; direct local runs supplied the audit and heuristic results above.

To get this to a good state

Preserve each context error status in its target surface, normalize zero-containing/degenerate dash arrays to Cairo 1.18 behavior and correct the associated test expectations, and remove the code comment. Verify the dependency ancestry when the predecessor stack changes. I’ll rerun the same no-build checks and review the full diff on the new head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5745990138 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15317#pullrequestreview-5745990138). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-03T01:37:08Z. **Review:** CHANGES_REQUESTED --- # Re-checked — new head, changes requested The new head fixes the earlier surface findings, but it still returns the wrong error status for error targets, mishandles zero-containing dash patterns, and adds a code comment forbidden by the repository rules. ## What I ran - Reviewed head `c91c64ec211aee03dfa5cd34df846d08398edf8e` against PR base `5cb015caaaaf83f8ee431414ee6a457b5b307d49`; the exact head had a clean individual merge preview against current `main` `7feb37ee3e30e10139b483fb4df689d5b5b69ab8`. - All 12 changed files were read across three independent review partitions. I also checked the Cairo 1.18.0 source at commit `3909090108bb2db55330e3eb148aebe664735363`. - Environment: Debian Linux 6.1.0-54-amd64, glibc 2.36, Python 3.11.2, Git 2.39.5, GCC 12.2.0. No C++ build was run. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 15317 python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base 5cb015caaaaf83f8ee431414ee6a457b5b307d49 --head c91c64ec211aee03dfa5cd34df846d08398edf8e --json python3 tools/pr_test_quality.py --root /marc/AnyPS5 --json core/libs/tests/GuestCairoContext.cpp core/libs/tests/GuestCairoGraphicsState.cpp core/libs/tests/GuestCairoSurface.cpp git diff --check 5cb015caaaaf83f8ee431414ee6a457b5b307d49...c91c64ec211aee03dfa5cd34df846d08398edf8e python3 tools/pr_stack_check.py 15317 --repo boykopovar/AnyPS5 ``` ## Results | Check | Result | Note | |---|---|---| | Diff and conventions | passed | No whitespace or template errors. | | ABI lexical audit | passed | 151 symbols; no lexical findings. | | Test registration | passed | All three new test files have CMake registrations. | | Test-quality heuristic | failed | Three possible-registration warnings; manual CMake inspection confirms they are false positives. | | Dependency preview | passed | Individual heads preview cleanly against current `main`; transitive stack ancestry is incomplete. | | Hosted policy checks | not run | Five checks remain queued on this head. | | Local C++ tests | not run | These tests require building the exact head. | <details><summary>Precheck report table (unedited)</summary> | Check | Status | Command / reason | |---|---|---| | build_and_compile | not_applicable | `The precheck deliberately does not configure, build, or compile AnyPS5.` | | diff_check | passed | `git diff --check 5cb015caaaaf83f8ee431414ee6a457b5b307d49...c91c64ec211aee03dfa5cd34df846d08398edf8e` | | conventions_and_pr_template | passed | `/usr/bin/python3 tools/check_conventions.py --base 5cb015caaaaf83f8ee431414ee6a457b5b307d49 --head c91c64ec211aee03dfa5cd34df846d08398edf8e --title feat(libcairo): implement fifteen graphics-state and dash exports --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15317-c91c64ec211a/pr-body.md` | | changed_export_abi_audit | failed | `/usr/bin/python3 tools/pr_abi_audit.py --base 5cb015caaaaf83f8ee431414ee6a457b5b307d49 --head c91c64ec211aee03dfa5cd34df846d08398edf8e --json` | | python_syntax | not_applicable | `No changed Python implementation files.` | | related_python_unit_tests | not_applicable | `No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.` | | python_test_registration | not_applicable | `No changed test_*.py files.` | | live_dependency_and_mergeability_check | passed | `/usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 15317 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15317-c91c64ec211a/stack` | | build_dependent_cpp_tests | not_applicable | `Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.` | | test_quality_heuristics | failed | `/usr/bin/python3 /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15317-c91c64ec211a/head-c91c64ec211a-13d645a7/tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15317-c91c64ec211a/head-c91c64ec211a-13d645a7 --json core/libs/prx/libcairo/CMakeLists.txt core/libs/prx/libcairo/Context.cpp core/libs/prx/libcairo/Export.cpp core/libs/prx/libcairo/Surface.cpp core/libs/prx/libcairo/include/Context.hpp core/libs/prx/libcairo/include/InventoryExports.hpp core/libs/prx/libcairo/include/Surface.hpp core/libs/prx/libcairo/libcairo.hpp core/libs/tests/GuestCairoContext.cpp core/libs/tests/GuestCairoGraphicsState.cpp core/libs/tests/GuestCairoSurface.cpp docs/dev/debt/libcairo.md` | | negative_controls | not_applicable | `No changed Python test module in tools/ can be run as a no-build base-source control.` | </details> <details><summary>Raw outputs (unedited)</summary> Precheck command: ```text /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15317-c91c64ec211a/report.md /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15317-c91c64ec211a/report.json Conclusion: checks failed ``` Conventions stdout: ```text All conventions checks passed. ``` Missing helper stderr: ```text /usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15317-c91c64ec211a/head-c91c64ec211a-13d645a7/tools/pr_abi_audit.py': [Errno 2] No such file or directory /usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-15317-c91c64ec211a/head-c91c64ec211a-13d645a7/tools/pr_test_quality.py': [Errno 2] No such file or directory ``` Direct ABI summary: ```json { "status": "passed", "symbols": 151, "findings": [], "limitations": [ "This lexical audit does not parse C++ fully, prove calling-convention or binary ABI correctness, verify runtime version tables, or replace compilation.", "An absent source declaration or explicit alias can be intentional for assembly exports, conditional platform code, or generated interfaces; inspect findings before treating them as defects." ] } ``` Direct test-quality output: ```json { "findings": [ { "path": "core/libs/tests/GuestCairoContext.cpp", "line": 1, "kind": "possible-unregistered-cpp-test", "message": "Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage." }, { "path": "core/libs/tests/GuestCairoGraphicsState.cpp", "line": 1, "kind": "possible-unregistered-cpp-test", "message": "Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage." }, { "path": "core/libs/tests/GuestCairoSurface.cpp", "line": 1, "kind": "possible-unregistered-cpp-test", "message": "Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage." } ], "negative_control_candidates": [], "limits": [ "Heuristics can miss weak assertions and can flag valid tests; inspect every finding.", "A test that passes against base is not by itself proof that the PR test is inadequate.", "Negative controls are only candidates until the test actually runs against base and fails by assertion rather than import/setup error." ] } ``` </details> ## Negative control | Assertion | Change to code under test | Did the test fail? | |---|---|---| | Error target preserves the originating Cairo status | No mutation run; the current test expects status `1` for null and invalid-dash errors. | Could not exercise. | | Zero-containing dash patterns normalize as Cairo does | No mutation run; the existing `{5, 0, 2}` test expects three dashes. | Could not exercise. | ## Findings ### Blocking - **Error target status is lost.** `cairo_create(nullptr)` stores a `NO_MEMORY` target for a context whose status is `NULL_POINTER`. After a valid context enters an error state, `cairo_get_target` also returns `NO_MEMORY` for every error. Cairo constructs the target error surface from the context’s actual status; the current tests instead assert `1` for both null-pointer and invalid-dash errors. Preserve the originating status in both paths and assert `7` for the null-pointer case and `19` for invalid dash. - **Dash normalization diverges from Cairo.** The implementation retains internal zero entries and only converts a pattern to solid when its total period is below `1/256`. In Cairo 1.18.0, `[5, 0, 2]` normalizes to a solid line (dash count `0`), while this PR’s test explicitly expects dash count `3`; `[10, 0]` is also degenerate solid. Normalize zero gaps and determine degeneracy from the off portions, then update tests to match the pinned implementation behavior. - **Repository rule violation.** `Surface.hpp` adds a code comment, contrary to `AGENTS.md`’s “No comments in code” rule. Remove the comment. ### Non-blocking - The stack report says the current #14328 and #14329 heads are not included in #15315, despite the PR description listing them as preceding dependencies. Each head individually previews cleanly against `main`; confirm the intended landing ancestry when updating the dependency stack. ## Sources - [PR error-context implementation](https://github.com/boykopovar/AnyPS5/blob/c91c64ec211aee03dfa5cd34df846d08398edf8e/core/libs/prx/libcairo/Context.cpp#L60-L72) and [target getter](https://github.com/boykopovar/AnyPS5/blob/c91c64ec211aee03dfa5cd34df846d08398edf8e/core/libs/prx/libcairo/Context.cpp#L167-L173) - [PR dash setter](https://github.com/boykopovar/AnyPS5/blob/c91c64ec211aee03dfa5cd34df846d08398edf8e/core/libs/prx/libcairo/Context.cpp#L319-L365) and [test expectation](https://github.com/boykopovar/AnyPS5/blob/c91c64ec211aee03dfa5cd34df846d08398edf8e/core/libs/tests/GuestCairoGraphicsState.cpp#L82-L105) - [Cairo 1.18.0 target behavior](https://gitlab.freedesktop.org/cairo/cairo/-/blob/3909090108bb2db55330e3eb148aebe664735363/src/cairo.c#L4188-L4194) - [Cairo 1.18.0 dash normalization](https://gitlab.freedesktop.org/cairo/cairo/-/blob/3909090108bb2db55330e3eb148aebe664735363/src/cairo-gstate.c#L539-L611) - [New code comment](https://github.com/boykopovar/AnyPS5/blob/c91c64ec211aee03dfa5cd34df846d08398edf8e/core/libs/prx/libcairo/include/Surface.hpp#L5-L8) and [repository rule](https://github.com/boykopovar/AnyPS5/blob/5cb015caaaaf83f8ee431414ee6a457b5b307d49/AGENTS.md#L7) ## Not verified - No local build or CTest; no native Cairo differential was independently run. Windows tests, Linux sanitizer tests and 1,024 randomized Cairo comparisons are author-reported only. - The five hosted policy checks were queued at the final status check; no Linux, console, or rendering behavior was confirmed. - The ABI audit is lexical and does not establish binary ABI or runtime correctness. The precheck’s ABI and test-quality steps could not find their helper scripts in its isolated snapshot; direct local runs supplied the audit and heuristic results above. ## To get this to a good state Preserve each context error status in its target surface, normalize zero-containing/degenerate dash arrays to Cairo 1.18 behavior and correct the associated test expectations, and remove the code comment. Verify the dependency ancestry when the predecessor stack changes. I’ll rerun the same no-build checks and review the full diff on the new head.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!15317
No description provided.