Skip to content

feat: test contents of mapper.json#2854

Open
wilsonrivera wants to merge 1 commit into
mainfrom
wilson/eng-9543
Open

feat: test contents of mapper.json#2854
wilsonrivera wants to merge 1 commit into
mainfrom
wilson/eng-9543

Conversation

@wilsonrivera
Copy link
Copy Markdown
Contributor

@wilsonrivera wilsonrivera commented May 11, 2026

Summary by CodeRabbit

  • Tests
    • Integration test suite expanded to comprehensively validate mapper artifacts, feature-flag configurations, and blob storage contents across multiple artifact types and configurations.
    • New test utilities introduced for mapper verification with cryptographic hash-based integrity checks and entry count assertions to ensure data consistency across different storage indexes and artifact structures.

Review Change Stack

Checklist

  • I have discussed my proposed changes in an issue and have received approval to proceed.
  • I have followed the coding standards of the project.
  • Tests or benchmarks have been added or updated.
  • Documentation has been updated on https://github.com/wundergraph/docs-website.
  • I have read the Contributors Guide.

Open Source AI Manifesto

This project follows the principles of the Open Source AI Manifesto. Please ensure your contribution aligns with its principles.

The goal of this PR is to add tests to ensure that the contents of the generated mapper.json file is correct.

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 11, 2026

Walkthrough

This PR adds a new test utility assertMapperContentIsCorrect to validate mapper blob contents and integrity within test storage, then integrates it into thirteen feature-flag integration test scenarios to assert mapper correctness across state transitions, compositions, and updates.

Changes

Feature-Flag Mapper Content Validation Test Helper

Layer / File(s) Summary
Test Utility Implementation
controlplane/test/test-util.ts
Added createHash to node:crypto imports and implemented assertMapperContentIsCorrect that validates mapper JSON structure, entry counts, computes SHA-256 hashes of referenced blob contents, and verifies integrity against stored hash values.
Test Utility Adoption
controlplane/test/feature-flag/feature-flag-integration.test.ts
Imported assertMapperContentIsCorrect and integrated it into thirteen split-config-loading feature-flag tests covering enabled/disabled transitions, contract composition, deletions, subgraph updates, and label changes; label-update test uses -1 parameter to bypass feature-flag count validation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change—adding tests to verify mapper.json contents—which is the primary focus of the entire changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

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.

🧹 Nitpick comments (1)
controlplane/test/test-util.ts (1)

891-895: ⚡ Quick win

Add explicit types to the new helper signature.

Please type expectedNumberOfFeatureFlags explicitly and add an explicit Promise<void> return type to match the repo’s TypeScript rules.

♻️ Suggested diff
 export async function assertMapperContentIsCorrect(
   blobStorage: InMemoryBlobStorage,
   expectedMapperKeysCount: number,
-  expectedNumberOfFeatureFlags = 1,
-) {
+  expectedNumberOfFeatureFlags: number = 1,
+): Promise<void> {

As per coding guidelines, **/*.{ts,tsx} requires explicit type annotations for function parameters and return types in TypeScript.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@controlplane/test/test-util.ts` around lines 891 - 895, Update the helper
function signature for assertMapperContentIsCorrect to include an explicit
return type and explicit type for the optional parameter: keep blobStorage:
InMemoryBlobStorage and expectedMapperKeysCount: number as-is, add
expectedNumberOfFeatureFlags: number (explicitly typed) and annotate the
function to return Promise<void>; modify the function declaration
(assertMapperContentIsCorrect) accordingly so it satisfies the repo’s TypeScript
explicit-typing rule.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@controlplane/test/test-util.ts`:
- Around line 891-895: Update the helper function signature for
assertMapperContentIsCorrect to include an explicit return type and explicit
type for the optional parameter: keep blobStorage: InMemoryBlobStorage and
expectedMapperKeysCount: number as-is, add expectedNumberOfFeatureFlags: number
(explicitly typed) and annotate the function to return Promise<void>; modify the
function declaration (assertMapperContentIsCorrect) accordingly so it satisfies
the repo’s TypeScript explicit-typing rule.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 64394ebc-4506-4c68-b91f-ed62470bbde0

📥 Commits

Reviewing files that changed from the base of the PR and between 1c7bc8c and 216f625.

📒 Files selected for processing (2)
  • controlplane/test/feature-flag/feature-flag-integration.test.ts
  • controlplane/test/test-util.ts

@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.38%. Comparing base (893ff72) to head (216f625).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2854      +/-   ##
==========================================
- Coverage   65.01%   64.38%   -0.63%     
==========================================
  Files         573      317     -256     
  Lines       71938    44985   -26953     
  Branches     4862     4862              
==========================================
- Hits        46767    28964   -17803     
+ Misses      23724    15996    -7728     
+ Partials     1447       25    -1422     

see 256 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant