Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: delta do not return archived as changed #9062

Merged
merged 5 commits into from
Jan 6, 2025
Merged

fix: delta do not return archived as changed #9062

merged 5 commits into from
Jan 6, 2025

Conversation

sjaanus
Copy link
Contributor

@sjaanus sjaanus commented Jan 6, 2025

Our delta API was returning archived feature as updated. Now making sure we do not put archived-feature event into updated event array.
Also stop returning removed as complex object.

Copy link

vercel bot commented Jan 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 6, 2025 0:35am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Jan 6, 2025 0:35am

Copy link
Contributor

github-actions bot commented Jan 6, 2025

@sjaanus, core features have been modified in this pull request. Please review carefully!

Copy link
Contributor

github-actions bot commented Jan 6, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

(feature) =>
projects.includes('*') || projects.includes(feature.project),
)
.map((feature) => feature.name);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was an actual big bug. We were returning the removed as complex object, but to API it should go as string array.

@@ -197,6 +200,9 @@ export class ClientFeatureToggleDelta {
}
}

/**
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We needed a way to clear out delta between e2e test runs. We might find a better way in future.

@@ -217,6 +223,7 @@ export class ClientFeatureToggleDelta {
...new Set(
changeEvents
.filter((event) => event.featureName)
.filter((event) => event.type !== 'feature-archived')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change events should not have archived events. These belong to removed.

import { validateSchema } from '../validate';
import type { ClientFeaturesDeltaSchema } from './client-features-delta-schema';

test('clientFeaturesDeltaSchema all fields', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add schema test.

@@ -44,7 +42,7 @@ export class ClientFeatureToggleService {
async getClientDelta(
revisionId: number | undefined,
query: IFeatureToggleQuery,
): Promise<RevisionDeltaEntry | undefined> {
): Promise<ClientFeaturesDeltaSchema | undefined> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix the types. RevisionDeltaEntry has removed as complex objects, but we are returning string array.

Copy link
Contributor

@FredrikOseberg FredrikOseberg left a comment

Choose a reason for hiding this comment

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

LGTM

@sjaanus sjaanus merged commit 8bf1b78 into main Jan 6, 2025
12 checks passed
@sjaanus sjaanus deleted the removed-out branch January 6, 2025 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants