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

feat: Feature lifecycle sql store #6790

Merged
merged 4 commits into from
Apr 8, 2024
Merged

Conversation

kwasniew
Copy link
Contributor

@kwasniew kwasniew commented Apr 5, 2024

About the changes

  • db migration for lifecycle stages
  • sql store based on the new migration and tested through the e2e test (if there's error in any query the tests catches it)
  • making feature lifecycle service an event emitter itself so that we can wait to stage change events in tests instead of await ms(randomTime)

Important files

Discussion points

Copy link

vercel bot commented Apr 5, 2024

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

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Apr 5, 2024 1:49pm
unleash-monorepo-frontend ⬜️ Ignored (Inspect) Visit Preview Apr 5, 2024 1:49pm

@kwasniew kwasniew changed the title Feature lifecycle sql store feat: Feature lifecycle sql store Apr 5, 2024
Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 1 findings(s) 🚩

  • Affected Hotspots: 1 files(s) 🔥

View detailed results in CodeScene

src/lib/services/index.ts Show resolved Hide resolved
Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 1 findings(s) 🚩

  • Affected Hotspots: 1 files(s) 🔥

View detailed results in CodeScene


return results.map(({ stage, created_at }: DBType) => ({
stage,
enteredStageAt: created_at,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

will probably rename enteredStageAt to createdAt in the service and openapi

@@ -8,9 +8,12 @@ export class FakeFeatureLifecycleStore implements IFeatureLifecycleStore {
private lifecycles: Record<string, FeatureLifecycleView> = {};

async insert(featureLifecycleStage: FeatureLifecycleStage): Promise<void> {
const existing = await this.get(featureLifecycleStage.feature);
if (await this.stageExists(featureLifecycleStage)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

prevent double inserts in fake impl

db.runSql(
`
CREATE TABLE IF NOT EXISTS feature_lifecycles (
feature VARCHAR(255) NOT NULL REFERENCES features(name) ON DELETE CASCADE,
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 want to delete feature lifecycle when feature is removed

CREATE TABLE IF NOT EXISTS feature_lifecycles (
feature VARCHAR(255) NOT NULL REFERENCES features(name) ON DELETE CASCADE,
stage VARCHAR(255) NULL,
created_at TIMESTAMP WITH TIME ZONE default now(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

sticking to generic name instead of specific stage_entered_at

Copy link
Contributor Author

Choose a reason for hiding this comment

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

using timestamp with timezone to have the same type as features table

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 1 findings(s) 🚩

  • Affected Hotspots: 1 files(s) 🔥

View detailed results in CodeScene

Copy link
Contributor

@andreas-unleash andreas-unleash left a comment

Choose a reason for hiding this comment

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

LGTM

@kwasniew kwasniew merged commit 9dc9fb3 into main Apr 8, 2024
7 of 8 checks passed
@kwasniew kwasniew deleted the feature-lifecycle-sql-store branch April 8, 2024 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants