Skip to content

refactor(lint): Enable linting for clp_s/Schema.hpp and clp_s/ColumnWriter.hpp; Remove unused ID field from BaseColumnWriter.#2042

Merged
davidlion merged 12 commits intoy-scope:mainfrom
davidlion:lint-stuff0
Apr 8, 2026
Merged

Conversation

@davidlion
Copy link
Copy Markdown
Member

@davidlion davidlion commented Feb 26, 2026

Description

As the title says. These changes have no functional impact.

Part of the changes are to add in class organization comments that have been loosely applied up to this point in the code base. These comments are standardized in our guideline by y-scope/yscope-docs#53.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

CI passing.

Summary by CodeRabbit

  • Refactor

    • Standardized and simplified column writer constructors and interfaces; removed per-node id propagation and streamlined string/dictionary writers.
    • Unified schema to a single Id type, modernized APIs with iterator/view access and improved copy/move semantics.
  • Chores

    • Adjusted lint configuration to exclude two internal headers from static analysis.

@davidlion davidlion requested review from a team and gibber9809 as code owners February 26, 2026 21:49
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 26, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Removed per-column id storage and id-based constructors from column writers; updated writer constructors to accept shared dictionary/log contexts or be no-arg; refactored virtual method signatures to trailing-return style and defaulted base copy/move/assign; introduced Schema::id_t and converted Schema APIs/storage to use it with iterators; excluded two headers from lint checks.

Changes

Cohort / File(s) Summary
Column writer refactor
components/core/src/clp_s/ArchiveWriter.cpp, components/core/src/clp_s/ColumnWriter.hpp
Removed per-column id member and id-taking constructors; updated column writer constructors to be no-arg or accept std::shared_ptr dictionary/log writers; updated virtual method signatures to trailing-return syntax; added/defaulted BaseColumnWriter copy/move/assignment.
Schema API and storage
components/core/src/clp_s/Schema.hpp
Added using id_t = int32_t; replaced int32_t with id_t across API and internal storage; converted many methods to trailing-return and added [[nodiscard]] where appropriate; m_schema now std::vector<id_t>; added iterator accessors.
Lint configuration
taskfiles/lint.yaml
Removed clp_s/ColumnWriter.hpp and clp_s/Schema.hpp from the lint/static-analysis file list.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main changes: enabling linting for two header files and removing the unused ID field from BaseColumnWriter, which are the primary technical modifications across multiple files.
Docstring Coverage ✅ Passed Docstring coverage is 87.10% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@davidlion davidlion changed the title Enable linting for clp_s/Schema.hpp and clp_s/ColumnWriter.hpp; Remove unused ID field from BaseColumnWriter. refactor(lint): Enable linting for clp_s/Schema.hpp and clp_s/ColumnWriter.hpp; Remove unused ID field from BaseColumnWriter. Feb 26, 2026
Copy link
Copy Markdown
Contributor

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@components/core/src/clp_s/Schema.hpp`:
- Around line 125-129: The bounds check in Schema::get_view is overflow-prone
because i + size can wrap; replace it with a safe check such as ensuring size <=
m_schema.size() and i <= m_schema.size() - size (or equivalently i <=
m_schema.size() && size <= m_schema.size() - i) and throw OperationFailed when
the check fails; also construct the span with an explicit template parameter
(use std::span<Id>{m_schema}.subspan(i, size)) to match the style on line 117
and ensure type consistency with subspan.

ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ad6e7b5 and f6255e9.

📒 Files selected for processing (4)
  • components/core/src/clp_s/ArchiveWriter.cpp
  • components/core/src/clp_s/ColumnWriter.hpp
  • components/core/src/clp_s/Schema.hpp
  • taskfiles/lint.yaml
💤 Files with no reviewable changes (1)
  • taskfiles/lint.yaml

Comment thread components/core/src/clp_s/Schema.hpp Outdated
Copy link
Copy Markdown
Contributor

@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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@components/core/src/clp_s/ColumnWriter.hpp`:
- Around line 205-207: The single-argument constructor
VariableStringColumnWriter(std::shared_ptr<VariableDictionaryWriter> var_dict)
should be marked explicit to prevent unintended implicit conversions; update the
VariableStringColumnWriter constructor declaration/definition to add the
explicit specifier (matching the change made for DictionaryFloatColumnWriter) so
the constructor reads as an explicit single-argument constructor.
- Around line 112-114: The single-argument constructor
DictionaryFloatColumnWriter(std::shared_ptr<VariableDictionaryWriter> var_dict)
should be marked explicit to prevent unintended implicit conversions; update the
constructor declaration/definition for DictionaryFloatColumnWriter to add the
explicit keyword (keeping the same parameter and move semantics for m_var_dict)
so the class no longer allows implicit conversions from
std::shared_ptr<VariableDictionaryWriter>.

In `@components/core/src/clp_s/Schema.hpp`:
- Around line 125-130: The bounds check in get_view is inverted and can
underflow; change the guard so it throws when the requested range is invalid by
checking that size is not greater than m_schema.size() and that i + size does
not exceed m_schema.size() (e.g. use a safe check like "if (size >
m_schema.size() || i > m_schema.size() - size) throw
OperationFailed(ErrorCodeOutOfBounds, ...)" or equivalently "if (i + size >
m_schema.size())" using a safe pre-check), keeping the throw of
OperationFailed(ErrorCodeOutOfBounds, __FILENAME__, __LINE__) and then return
the subspan from m_schema as before.

ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f6255e9 and 1241f08.

📒 Files selected for processing (2)
  • components/core/src/clp_s/ColumnWriter.hpp
  • components/core/src/clp_s/Schema.hpp

Comment thread components/core/src/clp_s/ColumnWriter.hpp
Comment thread components/core/src/clp_s/ColumnWriter.hpp
Comment thread components/core/src/clp_s/Schema.hpp Outdated
@davidlion davidlion marked this pull request as draft February 27, 2026 15:20
@davidlion davidlion marked this pull request as ready for review February 28, 2026 15:30
Copy link
Copy Markdown
Contributor

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@components/core/src/clp_s/Schema.hpp`:
- Around line 66-67: Ensure m_num_ordered cannot exceed the schema size before
creating the ordered view: validate and clamp or reject the value set by
set_num_ordered(size_t) (or perform the check right before creating the ordered
span in the code that uses m_num_ordered), comparing m_num_ordered against
m_schema.size(); if it is larger, either reduce it to m_schema.size() or
return/throw an error so the span creation that uses m_num_ordered cannot go out
of bounds (references: set_num_ordered, m_num_ordered, m_schema, and the
ordered-span creation code that reads m_num_ordered).

ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1241f08 and b8f92d3.

📒 Files selected for processing (2)
  • components/core/src/clp_s/ColumnWriter.hpp
  • components/core/src/clp_s/Schema.hpp

Comment on lines +66 to 67
auto set_num_ordered(size_t num_ordered) -> void { m_num_ordered = num_ordered; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Validate ordered-length before creating the ordered view.

Line 66 allows any m_num_ordered, but Line 117 uses it directly as span length. If it exceeds m_schema.size(), downstream access can go out of bounds.

Suggested fix
-    [[nodiscard]] auto get_ordered_schema_view() -> std::span<Id> {
-        return std::span<Id>{m_schema.data(), m_num_ordered};
-    }
+    [[nodiscard]] auto get_ordered_schema_view() -> std::span<Id> {
+        if (m_num_ordered > m_schema.size()) {
+            throw OperationFailed(ErrorCodeOutOfBounds, __FILENAME__, __LINE__);
+        }
+        return std::span<Id>{m_schema.data(), m_num_ordered};
+    }

Also applies to: 116-118

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

In `@components/core/src/clp_s/Schema.hpp` around lines 66 - 67, Ensure
m_num_ordered cannot exceed the schema size before creating the ordered view:
validate and clamp or reject the value set by set_num_ordered(size_t) (or
perform the check right before creating the ordered span in the code that uses
m_num_ordered), comparing m_num_ordered against m_schema.size(); if it is
larger, either reduce it to m_schema.size() or return/throw an error so the span
creation that uses m_num_ordered cannot go out of bounds (references:
set_num_ordered, m_num_ordered, m_schema, and the ordered-span creation code
that reads m_num_ordered).

@junhaoliao junhaoliao added this to the March 2026 milestone Mar 7, 2026
@junhaoliao junhaoliao modified the milestones: March 2026, Mid-April 2026 Apr 1, 2026
Copy link
Copy Markdown
Contributor

@gibber9809 gibber9809 left a comment

Choose a reason for hiding this comment

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

LGTM. Sorry for taking a long time to get to this, I must have missed this PR in my notifications some time ago. PR title is fine as well.

@davidlion davidlion merged commit 63c2164 into y-scope:main Apr 8, 2026
28 checks passed
@davidlion davidlion deleted the lint-stuff0 branch April 8, 2026 03:31
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.

3 participants