Skip to content

chore: remove dead code, redundant comments, and test bloat#139

Merged
K1ngst0m merged 2 commits intomainfrom
dev/chore-removed-stale
Mar 25, 2026
Merged

chore: remove dead code, redundant comments, and test bloat#139
K1ngst0m merged 2 commits intomainfrom
dev/chore-removed-stale

Conversation

@K1ngst0m
Copy link
Copy Markdown
Collaborator

@K1ngst0m K1ngst0m commented Mar 25, 2026

  • Remove serializer.hpp and test_serializer.cpp (zero production call sites)
  • Inline trivial ResultPtr wrappers at 13 call sites across four modules
  • Audit and strip self-documenting Doxygen comments from public headers
  • Cut queue stress tests, memory ordering benchmarks, and zero-copy patterns
  • Tighten docstring policy §5.4 with concrete MUST/MUST NOT rules

Summary by CodeRabbit

  • Breaking Changes

    • Removed public config helpers load_config() and default_config().
    • Removed binary serializer utilities (reader/writer and file-read helpers).
  • Bug Fixes & Improvements

    • Made startup/backend result and error returns more consistent to improve failure reporting.
  • Documentation

    • Tightened public API docstring rules and removed redundant/verbose Doxygen comments.
  • Chores

    • CI: bumped Pixi tool version to v0.65.0.

- Remove serializer.hpp and test_serializer.cpp (zero production call sites)
- Inline trivial ResultPtr wrappers at 13 call sites across four modules
- Audit and strip self-documenting Doxygen comments from public headers
- Cut queue stress tests, memory ordering benchmarks, and zero-copy patterns
- Tighten docstring policy §5.4 with concrete MUST/MUST NOT rules
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c2d9e3f6-ff31-4f8a-a205-8773191c1ed5

📥 Commits

Reviewing files that changed from the base of the PR and between 2188c12 and 865b64f.

⛔ Files ignored due to path filters (1)
  • pixi.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • .github/workflows/presets-build.yml
✅ Files skipped from review due to trivial changes (2)
  • .github/workflows/presets-build.yml
  • .github/workflows/ci.yml

📝 Walkthrough

Walkthrough

Tightens public docstring policy, removes many Doxygen comments, changes several factory functions to use braced ResultPtr returns and nonstd::make_unexpected for errors, deletes the binary serializer header and its tests, updates a submodule commit, and bumps CI Pixi version.

Changes

Cohort / File(s) Summary
Docs policy
docs/project_policies.md
Version bumped 1.2→1.3; API docstring guidance changed from SHOULD to MUST/MUST NOT with explicit rules and redundant-comment stripping; changelog updated.
Submodule
filter-chain (submodule)
Submodule commit reference updated.
Result / Error construction
src/app/application.cpp, src/compositor/compositor_server.cpp, src/render/backend/vulkan_backend.cpp, src/ui/imgui_layer.cpp
Factory methods now return success via brace-init (return {std::move(...)}) and construct errors with nonstd::make_unexpected(Error{...}) instead of make_result_ptr/make_result_ptr_error.
Doxygen/comment removals (headers)
src/app/application.hpp, src/compositor/compositor_server.hpp, src/render/backend/filter_chain_controller.hpp, src/render/backend/vulkan_backend.hpp, src/render/backend/vulkan_context.hpp, src/render/backend/vulkan_debug.hpp, src/ui/imgui_layer.hpp, src/util/job_system.hpp, src/util/logging.hpp, src/util/paths.hpp, src/util/queues.hpp, src/util/scale_mode.hpp, src/util/unique_fd.hpp
Removed many /// Doxygen @brief/@param/@return blocks and inline comments from public headers; API signatures unchanged.
Public API removals
src/util/config.hpp
Removed declarations: load_config(const std::filesystem::path&) and default_config(); shortened doc for resolve_logging_file_path.
Serializer removal
src/util/serializer.hpp
Deleted entire header: BinaryWriter, BinaryReader, and read_file_binary (binary serialization utilities removed).
Tests & CMake
tests/CMakeLists.txt, tests/util/test_error.cpp, tests/util/test_queues.cpp, tests/util/test_serializer.cpp
Removed serializer tests and their CMake inclusion; deleted many queue-related TEST_CASEs; adjusted some error-code assertions.
CI workflows
.github/workflows/ci.yml, .github/workflows/presets-build.yml
Bumped PIXI_VERSION from v0.63.2v0.65.0 for workflow steps.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

Review effort 4/5, Failed compliance check

Suggested reviewers

  • zhangzhousuper

Poem

🐰 I hopped through headers, trimmed tags with delight,
Braced returns and tidy errors now sit just right,
The serializer packed up and tests took a leap,
CI got a bump, the tree got sleek and neat,
A carrot for cleanup — now time for a nap! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.26% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: remove dead code, redundant comments, and test bloat' directly summarizes the main changes: removal of unused serializer, stripping of self-documenting comments, and removal of test code.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev/chore-removed-stale

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@qodo-code-review
Copy link
Copy Markdown

CI Feedback 🧐

A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

Action: Format Check

Failed stage: Setup Pixi [❌]

Failed test name: ""

Failure summary:

The action failed during environment setup because pixi install -e lint --locked detected that the
lock file is not in sync with the workspace:
- pixi install -e lint --locked (manifest: pixi.toml)
exited with an error: lock-file not up-to-date with the workspace (log line 206).
- Because the
workflow uses --locked, pixi refuses to resolve/update dependencies and fails the job with exit code
1 (log lines 204-208).

Relevant error logs:
1:  ##[group]Runner Image Provisioner
2:  Hosted Compute Agent
...

191:  �[1m        Environment�[0m: �[35m�[1mlint�[0m
192:  �[1m           Features�[0m: �[36mlint�[0m
193:  �[1m        Solve group�[0m: �[36mlint�[0m
194:  �[1m           Channels�[0m: conda-forge
195:  �[1m   Dependency count�[0m: 2
196:  �[1m       Dependencies�[0m: clang-tools, taplo
197:  �[1m   Target platforms�[0m: linux-64
198:  �[1m    Prefix location�[0m: /home/runner/work/Goggles/Goggles/.pixi/envs/lint
199:  �[1m              Tasks�[0m: �[34mci-format�[0m
200:  ##[endgroup]
201:  ##[group]Restoring project cache
202:  Cache miss
203:  ##[endgroup]
204:  ##[group]pixi install -e lint --locked
205:  [command]/home/runner/.pixi/bin/pixi install -e lint --locked --manifest-path /home/runner/work/Goggles/Goggles/pixi.toml --color always
206:  Error:   �[31m�[0m lock-file not up-to-date with the workspace
207:  ##[endgroup]
208:  ##[error]The process '/home/runner/.pixi/bin/pixi' failed with exit code 1
209:  Post job cleanup.

@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Remove dead code, redundant comments, and test bloat; inline ResultPtr wrappers

✨ Enhancement 🧪 Tests

Grey Divider

Walkthroughs

Description
• Replace make_result_ptr() wrapper calls with direct brace initialization across 6 modules
• Strip redundant Doxygen comments from public headers per updated policy §5.4
• Remove unused serializer.hpp and test_serializer.cpp (zero production call sites)
• Cut queue stress tests, memory ordering benchmarks, and zero-copy patterns
• Tighten docstring policy with explicit MUST/MUST NOT rules for self-documenting code
Diagram
flowchart LR
  A["ResultPtr Wrapper Calls"] -->|"Inline to braces"| B["Direct Initialization"]
  C["Redundant Doxygen Comments"] -->|"Strip per policy"| D["Self-Documenting Code"]
  E["Dead Code Files"] -->|"Remove"| F["Cleaner Codebase"]
  G["Stress/Benchmark Tests"] -->|"Cut"| H["Focused Test Suite"]
  I["Policy §5.4"] -->|"Tighten MUST/MUST NOT"| J["Explicit Guidance"]
Loading

Grey Divider

File Changes

1. src/app/application.cpp ✨ Enhancement +2/-2

Inline ResultPtr wrapper calls to brace initialization

src/app/application.cpp


2. src/app/application.hpp 📝 Documentation +0/-2

Strip redundant Doxygen comments from public methods

src/app/application.hpp


3. src/compositor/compositor_server.cpp ✨ Enhancement +3/-3

Replace make_result_ptr calls with nonstd::make_unexpected

src/compositor/compositor_server.cpp


View more (22)
4. src/compositor/compositor_server.hpp 📝 Documentation +6/-36

Remove verbose Doxygen comments; simplify docstrings

src/compositor/compositor_server.hpp


5. src/render/backend/filter_chain_controller.hpp 📝 Documentation +0/-3

Strip self-documenting Doxygen comment from struct

src/render/backend/filter_chain_controller.hpp


6. src/render/backend/vulkan_backend.cpp ✨ Enhancement +11/-11

Replace make_result_ptr_error with nonstd::make_unexpected

src/render/backend/vulkan_backend.cpp


7. src/render/backend/vulkan_backend.hpp 📝 Documentation +1/-18

Remove redundant Doxygen comments from public API

src/render/backend/vulkan_backend.hpp


8. src/render/backend/vulkan_context.hpp 📝 Documentation +0/-1

Strip verbose struct documentation comment

src/render/backend/vulkan_context.hpp


9. src/render/backend/vulkan_debug.hpp 📝 Documentation +0/-6

Remove redundant Doxygen comments from class methods

src/render/backend/vulkan_debug.hpp


10. src/ui/imgui_layer.cpp ✨ Enhancement +7/-7

Replace make_result_ptr_error with nonstd::make_unexpected

src/ui/imgui_layer.cpp


11. src/ui/imgui_layer.hpp 📝 Documentation +0/-41

Strip verbose Doxygen comments from public API

src/ui/imgui_layer.hpp


12. src/util/config.hpp 📝 Documentation +1/-12

Remove redundant function documentation comments

src/util/config.hpp


13. src/util/job_system.hpp 📝 Documentation +3/-10

Simplify docstrings to essential information only

src/util/job_system.hpp


14. src/util/logging.hpp 📝 Documentation +1/-10

Strip verbose Doxygen comments from logging functions

src/util/logging.hpp


15. src/util/paths.hpp 📝 Documentation +0/-41

Remove redundant documentation from path utility functions

src/util/paths.hpp


16. src/util/queues.hpp 📝 Documentation +0/-13

Simplify SPSCQueue docstrings to essential details

src/util/queues.hpp


17. src/util/scale_mode.hpp 📝 Documentation +0/-4

Remove verbose enum and function documentation

src/util/scale_mode.hpp


18. src/util/serializer.hpp 🐞 Bug fix +0/-151

Remove entire file (zero production call sites)

src/util/serializer.hpp


19. src/util/unique_fd.hpp 📝 Documentation +0/-6

Strip redundant Doxygen comments from methods

src/util/unique_fd.hpp


20. tests/util/test_error.cpp 🧪 Tests +1/-3

Remove redundant ErrorCode::ok test assertions

tests/util/test_error.cpp


21. tests/util/test_queues.cpp 🧪 Tests +0/-229

Cut stress tests, memory ordering benchmarks, zero-copy patterns

tests/util/test_queues.cpp


22. tests/util/test_serializer.cpp 🧪 Tests +0/-142

Remove entire test file (dead code)

tests/util/test_serializer.cpp


23. docs/project_policies.md 📝 Documentation +25/-8

Tighten §5.4 with explicit MUST/MUST NOT docstring rules

docs/project_policies.md


24. filter-chain Miscellaneous +1/-1

Update subproject commit reference

filter-chain


25. tests/CMakeLists.txt ⚙️ Configuration changes +0/-1

Remove test_serializer.cpp from build targets

tests/CMakeLists.txt


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review bot commented Mar 25, 2026

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📎 Requirement gaps (0) 📐 Spec deviations (0)

Grey Divider


Remediation recommended

1. Changelog section numbering broken 🐞 Bug ⚙ Maintainability
Description
docs/project_policies.md renumbers the changelog headings to 12.1, 12.3, and 12.4, leaving 12.2
missing, which makes the policy document internally inconsistent and harder to reference precisely.
Code

docs/project_policies.md[R317-330]

+### 12.1 v1.2 -> v1.3
+
+- Replaced permissive SHOULD guidance in section 5.4 with explicit MUST/MUST NOT rules for Doxygen docstrings.
+- Stripped redundant `///` comments from public headers to align with the updated policy.
+
+### 12.3 v1.1 -> v1.2

- Removed policy text that is now directly gated by Semgrep (`using namespace` in headers, raw `new`/`delete`, banned Vulkan RAII wrappers, render-path thread bans, std-stream/`printf` logging bans).
- Moved identifier naming specifics to the repository `clang-tidy` configuration and kept only the high-level policy contract plus scoped-override allowance.
- Expanded Semgrep logging coverage to include `printf` so the removed overlap remains CI-gated.
- Updated enforcement tags and matrix to call out Semgrep-owned policy checks explicitly.

-### 12.2 v1.0 -> v1.1
+### 12.4 v1.0 -> v1.1
Evidence
The rendered changelog now has headings for 12.1, then jumps to 12.3 and 12.4, with no 12.2 section
present.

docs/project_policies.md[315-333]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`docs/project_policies.md` changelog numbering skips section `12.2` (currently `12.1`, `12.3`, `12.4`). This breaks internal references and makes the document harder to cite.

## Issue Context
The policy document is explicitly described as "authoritative" and uses section numbers for reference. Sequential numbering matters for clarity.

## Fix Focus Areas
- docs/project_policies.md[315-333]

## Suggested fix
Renumber the headings to be sequential (e.g., `12.1 v1.2 -> v1.3`, `12.2 v1.1 -> v1.2`, `12.3 v1.0 -> v1.1`) or add a `12.2` entry if a section was intentionally reserved.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Dropped SPSCQueue concurrency tests 🐞 Bug ⛯ Reliability
Description
The PR deletes the multi-threaded producer/consumer and memory-ordering stress tests for
util::SPSCQueue, reducing coverage for a queue that is used for cross-thread event delivery in the
compositor path.
Code

tests/util/test_queues.cpp[L201-240]

-TEST_CASE("SPSCQueue multi-threaded producer-consumer", "[queues]") {
-    SPSCQueue<int> queue(64); // Larger queue for multi-threaded test
-
-    SECTION("Single producer, single consumer") {
-        constexpr int num_items = 1000;
-        std::atomic<bool> producer_done{false};
-        std::atomic<int> items_consumed{0};
-
-        // Producer thread
-        std::thread producer([&queue, &producer_done]() {
-            for (int i = 0; i < num_items; ++i) {
-                while (!queue.try_push(i)) {
-                    std::this_thread::yield(); // Spin until we can push
-                }
-            }
-            producer_done = true;
-        });
-
-        // Consumer thread
-        std::thread consumer([&queue, &producer_done, &items_consumed]() {
-            int consumed = 0;
-            while (!producer_done.load() || queue.size() > 0) {
-                auto result = queue.try_pop();
-                if (result.has_value()) {
-                    REQUIRE(*result == consumed); // Verify FIFO order
-                    consumed++;
-                } else {
-                    std::this_thread::yield(); // Queue empty, yield briefly
-                }
-            }
-            items_consumed = consumed;
-        });
-
-        producer.join();
-        consumer.join();
-
-        REQUIRE(items_consumed.load() == num_items);
-        REQUIRE(queue.size() == 0);
-    }
-}
Evidence
SPSCQueue is instantiated in CompositorState as event_queue/resize_queue, and events are pushed via
CompositorServer::inject_event and drained in CompositorState::process_input_events, i.e., a classic
producer/consumer pattern across threads. The removed tests specifically exercised multi-threaded
FIFO and stress/memory-ordering behavior, which is the highest-risk aspect of a lock-free queue.

src/compositor/compositor_state.hpp[132-135]
src/compositor/compositor_input.cpp[296-363]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Multi-threaded and memory-ordering stress tests for `util::SPSCQueue` were removed. Since `SPSCQueue` is used for compositor event delivery (producer: `CompositorServer::inject_event`, consumer: `CompositorState::process_input_events`), losing concurrency coverage increases the chance of undetected regressions in atomic ordering or wrap-around logic.

## Issue Context
`SPSCQueue` is a lock-free structure and correctness depends on atomic ordering. Concurrency bugs can be rare and platform-dependent, so dedicated tests are valuable.

## Fix Focus Areas
- tests/util/test_queues.cpp[159-405] (removed sections in this PR)
- src/compositor/compositor_state.hpp[132-135]
- src/compositor/compositor_input.cpp[296-363]

## Suggested fix
Reintroduce a minimal, deterministic multi-threaded producer/consumer test (and optionally a stress test guarded behind a CTest label or build option if runtime/flakiness was the reason for removal). If removal was intentional due to flakiness, replace it with a shorter bounded test and/or add an integration test that drives `CompositorServer::inject_event` concurrently with the compositor loop.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/util/test_error.cpp (1)

7-18: ⚠️ Potential issue | 🟡 Minor

Enum regression coverage is now incomplete.

This now checks only a subset of distinctness; file_not_found can still equal parse_error without failing. It also drops explicit ok invariant coverage (value/name), which weakens safety for common success-code assumptions.

Suggested test patch
 TEST_CASE("ErrorCode enum values are correct", "[error]") {
+    REQUIRE(static_cast<int>(ErrorCode::ok) == 0);
     REQUIRE(ErrorCode::file_not_found != ErrorCode::vulkan_init_failed);
     REQUIRE(ErrorCode::vulkan_init_failed != ErrorCode::parse_error);
+    REQUIRE(ErrorCode::file_not_found != ErrorCode::parse_error);
 }
 
 TEST_CASE("error_code_name returns correct strings", "[error]") {
+    REQUIRE(std::string(error_code_name(ErrorCode::ok)) == "ok");
     REQUIRE(std::string(error_code_name(ErrorCode::file_not_found)) == "file_not_found");
     REQUIRE(std::string(error_code_name(ErrorCode::vulkan_init_failed)) == "vulkan_init_failed");
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/util/test_error.cpp` around lines 7 - 18, The tests in
tests/util/test_error.cpp only assert a few distinct ErrorCode values and drop
checks for the common success code; update the TEST_CASEs to comprehensively
assert distinctness among all enum members and reintroduce explicit checks for
the success/ok invariant: verify ErrorCode::ok has the expected unique value and
that error_code_name(ErrorCode::ok) returns "ok"; also expand the distinctness
assertions to ensure file_not_found != parse_error and all other enum pairs that
must be unique, using the ErrorCode enum and error_code_name helper to locate
the symbols to change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/project_policies.md`:
- Around line 317-329: The changelog headings are misnumbered (you have "###
12.1 v1.2 -> v1.3" followed by "### 12.3 v1.1 -> v1.2"), so update the section
headers to maintain sequential numbering: rename "### 12.3 v1.1 -> v1.2" to "###
12.2 v1.1 -> v1.2" and adjust "### 12.4 v1.0 -> v1.1" to "### 12.3 v1.0 -> v1.1"
(or insert a new "### 12.2" entry if a distinct entry was omitted) so the
headings (12.1, 12.2, 12.3, ...) are consecutive and reflect the intended
versions.

In `@filter-chain`:
- Line 1: A submodule version bump may introduce API/behavior changes affecting
filter_chain_controller, the Vulkan backend, and the UI layer; manually compare
the upstream commit diff between the old and new submodule revisions to identify
any changed function signatures, removed/renamed types, altered semantics, or
performance-related changes, then update call sites in filter_chain_controller,
Vulkan backend integration points, and UI adapters accordingly, adjust or add
unit/integration tests (including test_filter_chain_retarget.cpp and
test_filter_boundary_contracts.cpp) to cover any new behaviors, and run the full
test suite and representative integration scenarios to confirm no regressions
before merging.

---

Outside diff comments:
In `@tests/util/test_error.cpp`:
- Around line 7-18: The tests in tests/util/test_error.cpp only assert a few
distinct ErrorCode values and drop checks for the common success code; update
the TEST_CASEs to comprehensively assert distinctness among all enum members and
reintroduce explicit checks for the success/ok invariant: verify ErrorCode::ok
has the expected unique value and that error_code_name(ErrorCode::ok) returns
"ok"; also expand the distinctness assertions to ensure file_not_found !=
parse_error and all other enum pairs that must be unique, using the ErrorCode
enum and error_code_name helper to locate the symbols to change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7b931961-6450-4ca3-b1a7-948a89ddd9cf

📥 Commits

Reviewing files that changed from the base of the PR and between 8d3389b and bd58702.

⛔ Files ignored due to path filters (1)
  • pixi.lock is excluded by !**/*.lock
📒 Files selected for processing (25)
  • docs/project_policies.md
  • filter-chain
  • src/app/application.cpp
  • src/app/application.hpp
  • src/compositor/compositor_server.cpp
  • src/compositor/compositor_server.hpp
  • src/render/backend/filter_chain_controller.hpp
  • src/render/backend/vulkan_backend.cpp
  • src/render/backend/vulkan_backend.hpp
  • src/render/backend/vulkan_context.hpp
  • src/render/backend/vulkan_debug.hpp
  • src/ui/imgui_layer.cpp
  • src/ui/imgui_layer.hpp
  • src/util/config.hpp
  • src/util/job_system.hpp
  • src/util/logging.hpp
  • src/util/paths.hpp
  • src/util/queues.hpp
  • src/util/scale_mode.hpp
  • src/util/serializer.hpp
  • src/util/unique_fd.hpp
  • tests/CMakeLists.txt
  • tests/util/test_error.cpp
  • tests/util/test_queues.cpp
  • tests/util/test_serializer.cpp
💤 Files with no reviewable changes (13)
  • src/render/backend/vulkan_context.hpp
  • src/util/unique_fd.hpp
  • src/util/scale_mode.hpp
  • src/render/backend/vulkan_debug.hpp
  • src/app/application.hpp
  • src/util/paths.hpp
  • tests/CMakeLists.txt
  • src/render/backend/filter_chain_controller.hpp
  • src/util/queues.hpp
  • src/ui/imgui_layer.hpp
  • tests/util/test_serializer.cpp
  • tests/util/test_queues.cpp
  • src/util/serializer.hpp

Comment on lines +317 to +329
### 12.1 v1.2 -> v1.3

- Replaced permissive SHOULD guidance in section 5.4 with explicit MUST/MUST NOT rules for Doxygen docstrings.
- Stripped redundant `///` comments from public headers to align with the updated policy.

### 12.3 v1.1 -> v1.2

- Removed policy text that is now directly gated by Semgrep (`using namespace` in headers, raw `new`/`delete`, banned Vulkan RAII wrappers, render-path thread bans, std-stream/`printf` logging bans).
- Moved identifier naming specifics to the repository `clang-tidy` configuration and kept only the high-level policy contract plus scoped-override allowance.
- Expanded Semgrep logging coverage to include `printf` so the removed overlap remains CI-gated.
- Updated enforcement tags and matrix to call out Semgrep-owned policy checks explicitly.

### 12.2 v1.0 -> v1.1
### 12.4 v1.0 -> v1.1
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Changelog section numbering is inconsistent.

The changelog sections jump from 12.1 to 12.3, skipping 12.2. This appears to be a copy-paste error from reindexing after adding the new v1.2 → v1.3 entry.

📝 Proposed fix
 ### 12.1 v1.2 -> v1.3

 - Replaced permissive SHOULD guidance in section 5.4 with explicit MUST/MUST NOT rules for Doxygen docstrings.
 - Stripped redundant `///` comments from public headers to align with the updated policy.

-### 12.3 v1.1 -> v1.2
+### 12.2 v1.1 -> v1.2

 - Removed policy text that is now directly gated by Semgrep (`using namespace` in headers, raw `new`/`delete`, banned Vulkan RAII wrappers, render-path thread bans, std-stream/`printf` logging bans).
 - Moved identifier naming specifics to the repository `clang-tidy` configuration and kept only the high-level policy contract plus scoped-override allowance.
 - Expanded Semgrep logging coverage to include `printf` so the removed overlap remains CI-gated.
 - Updated enforcement tags and matrix to call out Semgrep-owned policy checks explicitly.

-### 12.4 v1.0 -> v1.1
+### 12.3 v1.0 -> v1.1

 - Rewrote document to RFC-style normative format.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
### 12.1 v1.2 -> v1.3
- Replaced permissive SHOULD guidance in section 5.4 with explicit MUST/MUST NOT rules for Doxygen docstrings.
- Stripped redundant `///` comments from public headers to align with the updated policy.
### 12.3 v1.1 -> v1.2
- Removed policy text that is now directly gated by Semgrep (`using namespace` in headers, raw `new`/`delete`, banned Vulkan RAII wrappers, render-path thread bans, std-stream/`printf` logging bans).
- Moved identifier naming specifics to the repository `clang-tidy` configuration and kept only the high-level policy contract plus scoped-override allowance.
- Expanded Semgrep logging coverage to include `printf` so the removed overlap remains CI-gated.
- Updated enforcement tags and matrix to call out Semgrep-owned policy checks explicitly.
### 12.2 v1.0 -> v1.1
### 12.4 v1.0 -> v1.1
### 12.1 v1.2 -> v1.3
- Replaced permissive SHOULD guidance in section 5.4 with explicit MUST/MUST NOT rules for Doxygen docstrings.
- Stripped redundant `///` comments from public headers to align with the updated policy.
### 12.2 v1.1 -> v1.2
- Removed policy text that is now directly gated by Semgrep (`using namespace` in headers, raw `new`/`delete`, banned Vulkan RAII wrappers, render-path thread bans, std-stream/`printf` logging bans).
- Moved identifier naming specifics to the repository `clang-tidy` configuration and kept only the high-level policy contract plus scoped-override allowance.
- Expanded Semgrep logging coverage to include `printf` so the removed overlap remains CI-gated.
- Updated enforcement tags and matrix to call out Semgrep-owned policy checks explicitly.
### 12.3 v1.0 -> v1.1
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/project_policies.md` around lines 317 - 329, The changelog headings are
misnumbered (you have "### 12.1 v1.2 -> v1.3" followed by "### 12.3 v1.1 ->
v1.2"), so update the section headers to maintain sequential numbering: rename
"### 12.3 v1.1 -> v1.2" to "### 12.2 v1.1 -> v1.2" and adjust "### 12.4 v1.0 ->
v1.1" to "### 12.3 v1.0 -> v1.1" (or insert a new "### 12.2" entry if a distinct
entry was omitted) so the headings (12.1, 12.2, 12.3, ...) are consecutive and
reflect the intended versions.

@@ -1 +1 @@
Subproject commit 0873141f783efaf5ae8930c52521d14b5786fe76
Subproject commit 6d96a36e2cf9a1f39d643fd6c1049fb41aed0391
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

❓ Verification inconclusive

Script executed:

#!/bin/bash
set -euo pipefail

echo "== Locate submodule URL =="
if [ -f .gitmodules ]; then
  cat .gitmodules
else
  echo ".gitmodules not found; cannot verify submodule remote."
  exit 1
fi

echo
echo "== Extract filter-chain URL =="
sub_url="$(git config -f .gitmodules --get submodule.filter-chain.url || true)"
if [ -z "${sub_url}" ]; then
  echo "Submodule 'filter-chain' URL not found in .gitmodules"
  exit 1
fi
echo "filter-chain URL: ${sub_url}"

echo
echo "== Ensure old/new commits are known in submodule repo =="
old_commit="0873141f"
new_commit="6d96a36e2cf9a1f39d643fd6c1049fb41aed0391"

tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
git clone --filter=blob:none --no-checkout "$sub_url" "$tmpdir/repo" >/dev/null 2>&1

git -C "$tmpdir/repo" rev-parse --verify "${new_commit}^{commit}" >/dev/null
echo "New commit exists: ${new_commit}"

# Old hash is abbreviated in summary; resolve if possible
if git -C "$tmpdir/repo" rev-parse --verify "${old_commit}^{commit}" >/dev/null 2>&1; then
  full_old="$(git -C "$tmpdir/repo" rev-parse "${old_commit}^{commit}")"
  echo "Old commit resolved: ${full_old}"
  echo
  echo "== Upstream commit list between old and new =="
  git -C "$tmpdir/repo" log --oneline "${full_old}..${new_commit}" | sed -n '1,80p'
else
  echo "Could not resolve old abbreviated commit '${old_commit}' in upstream repo."
  echo "Please provide full old hash from base branch gitlink for exact compare."
fi

echo
echo "== Find in-repo references to filter-chain integration points =="
rg -n -C2 'filter-chain|ResultPtr|serializer|zero-copy|memory ordering|queue stress' || true

Repository: goggles-dev/Goggles


Repository: goggles-dev/Goggles
Exit code: 128

stdout:

== Locate submodule URL ==
[submodule "filter-chain"]
	path = filter-chain
	url = git@github.com:goggles-dev/goggles-filter-chain.git

== Extract filter-chain URL ==
filter-chain URL: git@github.com:goggles-dev/goggles-filter-chain.git

== Ensure old/new commits are known in submodule repo ==

Script executed:

rg -l 'filter-chain|FilterChain' --type-list | head -20

Repository: goggles-dev/Goggles


Repository: goggles-dev/Goggles
Exit code: 0

stderr:

error: The argument '<PATTERN>' cannot be used with '--type-list'

USAGE:
    
    rg [OPTIONS] PATTERN [PATH ...]
    rg [OPTIONS] -e PATTERN ... [PATH ...]
    rg [OPTIONS] -f PATTERNFILE ... [PATH ...]
    rg [OPTIONS] --files [PATH ...]
    rg [OPTIONS] --type-list
    command | rg [OPTIONS] PATTERN
    rg [OPTIONS] --help
    rg [OPTIONS] --version

For more information try --help


Script executed:

fd -type f -name '*.rs' -o -name '*.toml' -o -name '*.md' | xargs rg -l 'filter.?chain' 2>/dev/null | head -20

Repository: goggles-dev/Goggles


Repository: goggles-dev/Goggles
Exit code: 0

stdout:

tests/visual/test_shader_basic.cpp
scripts/task/validate-installed-consumers.sh
scripts/task/ci.sh
scripts/generate_shader_report.sh
tests/render/test_vulkan_backend_subsystem_contracts.cpp
tests/render/test_filter_chain_retarget.cpp
tests/render/test_filter_boundary_contracts.cpp
tests/golden/README.md
tests/CMakeLists.txt
src/ui/imgui_layer.hpp
src/render/CMakeLists.txt
src/compositor/compositor_server.hpp
src/ui/CMakeLists.txt
src/ui/imgui_layer.cpp
src/render/backend/CMakeLists.txt
src/render/backend/filter_chain_controller.hpp
src/render/backend/filter_chain_controller.cpp
src/render/backend/vulkan_backend.cpp
src/render/backend/vulkan_context.hpp
src/render/backend/vulkan_backend.hpp

stderr:

error: 'ype' isn't a valid value for '--type <filetype>'
  [possible values: file, directory, symlink, executable, empty, socket, pipe]

For more information try '--help'

Script executed:

head -100 src/render/backend/filter_chain_controller.hpp

Repository: goggles-dev/Goggles


Repository: goggles-dev/Goggles
Exit code: 0

stdout:

`#pragma` once

`#include` <array>
`#include` <atomic>
`#include` <filesystem>
`#include` <functional>
`#include` <future>
`#include` <goggles/filter_chain.h>
`#include` <goggles/filter_chain.hpp>
`#include` <goggles/filter_chain/filter_controls.hpp>
`#include` <vector>
`#include` <vulkan/vulkan.h>
`#include` <vulkan/vulkan.hpp>

namespace goggles::render::backend_internal {

struct FilterChainController {
    struct ControlOverride {
        goggles::fc::FilterControlId control_id = 0;
        float value = 0.0F;
    };

    struct VulkanDeviceInfo {
        VkPhysicalDevice physical_device = VK_NULL_HANDLE;
        VkDevice device = VK_NULL_HANDLE;
        VkQueue graphics_queue = VK_NULL_HANDLE;
        uint32_t graphics_queue_family_index = 0;
        std::string cache_dir;
    };

    struct ChainConfig {
        VkFormat target_format = VK_FORMAT_UNDEFINED;
        uint32_t frames_in_flight = 1;
        uint32_t initial_stage_mask = GOGGLES_FC_STAGE_MASK_ALL;
        uint32_t initial_prechain_width = 0;
        uint32_t initial_prechain_height = 0;
    };

    struct RecordParams {
        VkCommandBuffer command_buffer = VK_NULL_HANDLE;
        VkImage source_image = VK_NULL_HANDLE;
        VkImageView source_view = VK_NULL_HANDLE;
        uint32_t source_width = 0;
        uint32_t source_height = 0;
        VkImageView target_view = VK_NULL_HANDLE;
        uint32_t target_width = 0;
        uint32_t target_height = 0;
        uint32_t frame_index = 0;
        uint32_t scale_mode = GOGGLES_FC_SCALE_MODE_STRETCH;
        uint32_t integer_scale = 1;
    };

    struct AdapterBuildConfig {
        VulkanDeviceInfo device_info;
        ChainConfig chain_config;
    };

    struct OutputTarget {
        vk::Format format = vk::Format::eUndefined;
        vk::Extent2D extent;
    };

    struct PrechainResolutionConfig {
        vk::Extent2D requested_resolution;
    };

    [[nodiscard]] auto recreate_filter_chain(const AdapterBuildConfig& config) -> Result<void>;
    [[nodiscard]] auto retarget_filter_chain(const OutputTarget& output_target) -> Result<void>;
    void shutdown(const std::function<void()>& wait_for_gpu_idle);

    void load_shader_preset(
        const std::filesystem::path& new_preset_path,
        const std::function<void()>& wait_for_safe_rebuild = std::function<void()>{});
    [[nodiscard]] auto reload_shader_preset(std::filesystem::path new_preset_path,
                                            AdapterBuildConfig config) -> Result<void>;

    void advance_frame();
    void check_pending_chain_swap(const std::function<void()>& wait_all_frames);
    void cleanup_retired_adapters();

    void
    set_stage_policy(bool prechain_enabled, bool effect_stage_enabled,
                     const std::function<void()>& wait_for_safe_rebuild = std::function<void()>{});
    void set_prechain_resolution(
        const PrechainResolutionConfig& config,
        const std::function<void()>& wait_for_safe_rebuild = std::function<void()>{});
    [[nodiscard]] auto handle_resize(vk::Extent2D target_extent) -> Result<void>;
    [[nodiscard]] auto record(const RecordParams& record_params) -> Result<void>;

    [[nodiscard]] auto current_prechain_resolution() const -> vk::Extent2D;
    [[nodiscard]] auto current_preset_path() const -> const std::filesystem::path& {
        return preset_path;
    }
    [[nodiscard]] auto has_filter_chain() const -> bool {
        return static_cast<bool>(active_slot.chain);
    }
    [[nodiscard]] auto consume_chain_swapped() -> bool {
        return chain_swapped.exchange(false, std::memory_order_acq_rel);
    }


Script executed:

head -50 src/render/backend/filter_chain_controller.cpp

Repository: goggles-dev/Goggles


Repository: goggles-dev/Goggles
Exit code: 0

stdout:

`#include` "filter_chain_controller.hpp"

`#include` <algorithm>
`#include` <chrono>
`#include` <cstdint>
`#include` <cstring>
`#include` <filesystem>
`#include` <format>
`#include` <goggles/profiling.hpp>
`#include` <limits>
`#include` <string>
`#include` <string_view>
`#include` <util/job_system.hpp>
`#include` <util/logging.hpp>
`#include` <vector>

namespace goggles::render::backend_internal {

namespace {

// ---------------------------------------------------------------------------
// Slot-level helper types
// ---------------------------------------------------------------------------

struct ControlSnapshot {
    goggles::fc::FilterControlId control_id = 0;
    float value = 0.0F;
};

// ---------------------------------------------------------------------------
// Path / encoding helpers
// ---------------------------------------------------------------------------

auto to_utf8_bytes(const std::filesystem::path& path) -> std::string {
    const auto utf8 = path.u8string();
    return {reinterpret_cast<const char*>(utf8.c_str()), utf8.size()};
}

// ---------------------------------------------------------------------------
// Stage / control translation helpers
// ---------------------------------------------------------------------------

auto to_filter_stage(uint32_t fc_stage) -> goggles::fc::FilterControlStage {
    switch (fc_stage) {
    case GOGGLES_FC_STAGE_PRECHAIN:
        return goggles::fc::FilterControlStage::prechain;
    case GOGGLES_FC_STAGE_EFFECT:
    default:
        return goggles::fc::FilterControlStage::effect;
    }

Script executed:

head -50 tests/render/test_filter_chain_retarget.cpp

Repository: goggles-dev/Goggles


Repository: goggles-dev/Goggles
Exit code: 0

stdout:

`#include` "render/backend/filter_chain_controller.hpp"

`#include` <atomic>
`#include` <catch2/catch_approx.hpp>
`#include` <catch2/catch_test_macros.hpp>
`#include` <chrono>
`#include` <filesystem>
`#include` <fstream>
`#include` <limits>
`#include` <optional>
`#include` <spdlog/spdlog.h>
`#include` <string>
`#include` <thread>
`#include` <util/logging.hpp>
`#include` <vector>
`#include` <vulkan/vulkan.hpp>

namespace {

constexpr uint32_t TEST_SYNC_INDICES = 2u;

auto make_cache_dir() -> std::filesystem::path {
    static std::atomic<uint64_t> counter{0u};
    auto path = std::filesystem::temp_directory_path() /
                ("goggles_filter_chain_retarget_" + std::to_string(counter.fetch_add(1u)));
    std::filesystem::create_directories(path);
    return path;
}

auto read_text_file(const std::filesystem::path& path) -> std::optional<std::string> {
    std::ifstream file(path);
    if (!file.is_open()) {
        return std::nullopt;
    }
    return std::string(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>());
}

struct VulkanRuntimeFixture {
    VulkanRuntimeFixture() {
        VkApplicationInfo app_info{};
        app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
        app_info.pApplicationName = "goggles_filter_chain_retarget_tests";
        app_info.applicationVersion = VK_MAKE_VERSION(1, 0, 0);
        app_info.apiVersion = VK_API_VERSION_1_3;

        VkInstanceCreateInfo instance_info{};
        instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
        instance_info.pApplicationInfo = &app_info;
        if (vkCreateInstance(&instance_info, nullptr, &m_instance) != VK_SUCCESS) {
            return;

Script executed:

cat src/render/CMakeLists.txt | grep -A 10 -B 10 filter

Repository: goggles-dev/Goggles


Repository: goggles-dev/Goggles
Exit code: 0

stdout:

target_include_directories(goggles_render PUBLIC
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_SOURCE_DIR}/src
)

# Link deps here so downstream users only need to link goggles_render.
target_link_libraries(goggles_render PUBLIC
    goggles_util
    Vulkan::Vulkan
    SDL3::SDL3
    GogglesFilterChain::goggles-filter-chain
)

target_compile_definitions(goggles_render PUBLIC
    VULKAN_HPP_NO_EXCEPTIONS
    VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1
)

goggles_enable_clang_tidy(goggles_render)
goggles_enable_sanitizers(goggles_render)
goggles_enable_profiling(goggles_render)

Verify submodule bump impact before merge.

This single-line pointer change introduces a dependency update with multiple integration points in the codebase (filter_chain_controller, Vulkan backend, UI layer). Please manually review the upstream commit diff between the old and new versions to identify any API, behavior, or performance changes, and confirm that existing tests cover the impacted surfaces.

While the test suite (test_filter_chain_retarget.cpp, test_filter_boundary_contracts.cpp) provides some assurance against obvious breakage, manual upstream inspection is needed to catch semantic or subtle compatibility issues.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@filter-chain` at line 1, A submodule version bump may introduce API/behavior
changes affecting filter_chain_controller, the Vulkan backend, and the UI layer;
manually compare the upstream commit diff between the old and new submodule
revisions to identify any changed function signatures, removed/renamed types,
altered semantics, or performance-related changes, then update call sites in
filter_chain_controller, Vulkan backend integration points, and UI adapters
accordingly, adjust or add unit/integration tests (including
test_filter_chain_retarget.cpp and test_filter_boundary_contracts.cpp) to cover
any new behaviors, and run the full test suite and representative integration
scenarios to confirm no regressions before merging.

@K1ngst0m K1ngst0m force-pushed the dev/chore-removed-stale branch from 2188c12 to a14a1bd Compare March 25, 2026 05:57
@K1ngst0m K1ngst0m force-pushed the dev/chore-removed-stale branch from a14a1bd to 865b64f Compare March 25, 2026 06:16
@K1ngst0m K1ngst0m merged commit 2f00089 into main Mar 25, 2026
5 checks passed
@K1ngst0m K1ngst0m deleted the dev/chore-removed-stale branch March 25, 2026 06:39
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