Skip to content

feat: test contents of mapper.json - #2854

Merged
wilsonrivera merged 2 commits into
mainfrom
wilson/eng-9543
Jul 16, 2026
Merged

feat: test contents of mapper.json#2854
wilsonrivera merged 2 commits into
mainfrom
wilson/eng-9543

Conversation

@wilsonrivera

@wilsonrivera wilsonrivera commented May 11, 2026

Copy link
Copy Markdown
Contributor

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.

@claude claude Bot left a comment

Copy link
Copy Markdown

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

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

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.

@coderabbitai coderabbitai Bot left a comment

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.

🧹 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

codecov Bot commented May 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.12%. Comparing base (88c188e) to head (9817e9e).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2854      +/-   ##
==========================================
+ Coverage   62.01%   71.12%   +9.10%     
==========================================
  Files         261      335      +74     
  Lines       30773    49350   +18577     
  Branches        0     6038    +6038     
==========================================
+ Hits        19085    35100   +16015     
- Misses      10176    14224    +4048     
+ Partials     1512       26    -1486     

see 596 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.

@github-actions

Copy link
Copy Markdown

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions Bot added Stale and removed Stale labels May 26, 2026
@github-actions

Copy link
Copy Markdown

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions Bot added Stale and removed Stale labels Jun 10, 2026
@github-actions

Copy link
Copy Markdown

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions Bot added Stale and removed Stale labels Jun 26, 2026
@github-actions

Copy link
Copy Markdown

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions Bot added Stale and removed Stale labels Jul 12, 2026
# Conflicts:
#	controlplane/test/feature-flag/feature-flag-integration.test.ts
@wilsonrivera
wilsonrivera requested a review from a team as a code owner July 16, 2026 16:29
@wilsonrivera
wilsonrivera merged commit 4a56b39 into main Jul 16, 2026
11 checks passed
@wilsonrivera
wilsonrivera deleted the wilson/eng-9543 branch July 16, 2026 16:55
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.

2 participants