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

!!! FEATURE: Stabilize WorkspaceName value object #5193

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

bwaidelich
Copy link
Member

@bwaidelich bwaidelich commented Aug 2, 2024

Extracted from #5146 this just improves stability of the WorkspaceName value object by

  • Restricting the allowed value range to 30 lower case characters and properly enforce it
  • Adding a tryFromString() constructor
  • Exposing the MAX_LENGTH and use that for the corresponding database schemas
  • Reuse instance for same values (flightweight)
  • 100% test coverage

upgrade instructions

Possibly needs a migration (see #5202) which rewrites all events containing a workspaceName, which doesn't match the new workspaceName constraints and rewrites them with (shortend) a md5 hash of themself.

Run the migration with:

./flow migrateevents:migratepayloadtovalidworkspacenames

If the migration found some workspaceNames or baseWorkspaceNames to migrate, please run a projection replay of the workspace projection.

./flow cr:projectionreplay --projection workspace

Fixes: #5125
Related: #4726

Extracted from #5146 this just improves stability of the `WorkspaceName` value object by
- Restricting the allowed value range to 30 lower case characters and properly enforce it
- Adding a `tryFromString()` constructor
- Exposing the `MAX_LENGTH` and use that for the corresponding database schemas
- 100% test coverage

Related: #4726
Copy link
Member

@mhsdesign mhsdesign left a comment

Choose a reason for hiding this comment

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

❤️

@mhsdesign
Copy link
Member

I guess this does not fully solve your issue #5125, should it though or is that separate?

@bwaidelich
Copy link
Member Author

I guess this does not fully solve your issue #5125, should it though or is that separate?

Yes, I think it does. Added a fixes tag

Copy link
Member

@Sebobo Sebobo left a comment

Choose a reason for hiding this comment

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

LGBR

@bwaidelich bwaidelich merged commit 05c0ee4 into 9.0 Aug 5, 2024
12 checks passed
@bwaidelich bwaidelich deleted the feature/4726-stabilize-workspacename-valueobject branch August 5, 2024 15:53
@bwaidelich
Copy link
Member Author

LGBR

I'm not sure what that means, but thanks for the +1 :)

@mhsdesign
Copy link
Member

looks-good-by-reading i guess ^^

@dlubitz
Copy link
Contributor

dlubitz commented Aug 15, 2024

You might need to migrate your events with this migration:
#5202

@mhsdesign mhsdesign changed the title FEATURE: Stabilize WorkspaceName value object !!! FEATURE: Stabilize WorkspaceName value object Aug 15, 2024
@mhsdesign
Copy link
Member

Btw while were hotfixing, we dont say what the attempted value was on error could be:

            throw new \InvalidArgumentException(sprintf('Invalid workspace name "%s" given.', $value), 1505826610);

@bwaidelich
Copy link
Member Author

bwaidelich commented Aug 15, 2024

Btw while were hotfixing, we dont say what the attempted value was on error could be:

You made it again: I have a knot in my brain :D what do you mean?

Gotcha, you suggest to include the attempted workspace name in the exception message?!

@bwaidelich
Copy link
Member Author

BTW: It's almost as easy to create a PR on Github as it is to put code in a comment: #5204 ;)

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.

WorkspaceName is far too permissive
4 participants