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

Refactor (DRY) workspace TTL/Schedule validation logic #2119

Closed
johnstcn opened this issue Jun 7, 2022 · 5 comments
Closed

Refactor (DRY) workspace TTL/Schedule validation logic #2119

johnstcn opened this issue Jun 7, 2022 · 5 comments
Labels
api Area: HTTP API chore Non-customer facing refactors, cleanup, or technical debt.

Comments

@johnstcn
Copy link
Member

johnstcn commented Jun 7, 2022

What

We currently duplicate some validations of workspace TTL / autostart schedule. We should refactor these and put them all in one place.

Interesting to do it in the cli. Can we somehow put the validation on a datastructure and reuse it for the backend + frontend? Like reuse the same code?

Originally posted by @Emyrk in #2018 (comment)

Why

Don't make me Repeat mYself.

@johnstcn johnstcn added regression prevention api Area: HTTP API chore Non-customer facing refactors, cleanup, or technical debt. labels Jun 7, 2022
@ketang
Copy link
Contributor

ketang commented Jun 7, 2022

Validation is complicated. I like to do it as close to the user as possible. To avoid repeating yourself typically means your validation is against rules sent from the server to the client, which works for many though not all cases (e.g. valid IDs or very complex data). I mention this because I'd like to make it possible to avoid at least some of the server round trips during data entry.

@Emyrk
Copy link
Member

Emyrk commented Jun 7, 2022

The current validation was just the TTL duration to be within some constants iirc.

@johnstcn
Copy link
Member Author

johnstcn commented Jun 7, 2022

Right, and with the current "all-in-one" approach we can just have the validation be a shared library. However, this means it's more important for folks to have a matching CLI <-> server version.

@ketang
Copy link
Contributor

ketang commented Jun 7, 2022

Yeah I've done the shared library thing and would prefer to skip it altogether. It's a dead end.

@kylecarbs kylecarbs changed the title chore: coderd: refactor (DRY) workspace TTL/Schedule validation logic Refactor (DRY) workspace TTL/Schedule validation logic Aug 24, 2022
@bpmct
Copy link
Member

bpmct commented Sep 20, 2022

Gonna close this for now

@bpmct bpmct closed this as not planned Won't fix, can't repro, duplicate, stale Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Area: HTTP API chore Non-customer facing refactors, cleanup, or technical debt.
Projects
None yet
Development

No branches or pull requests

5 participants