-
Notifications
You must be signed in to change notification settings - Fork 0
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
The Great Rename #416
Merged
Merged
The Great Rename #416
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cruikshanks
added
the
housekeeping
Refactoring, tidying up or other work which supports the project
label
Sep 9, 2023
Cruikshanks
force-pushed
the
the-great-rename
branch
from
September 9, 2023 14:46
17c6bf6
to
6be2d25
Compare
const { address, name } = GenerateMockDataService.go() | ||
|
||
billingInvoice.accountAddress = address | ||
billingInvoice.contact = name | ||
bill.accountAddress = address |
Check failure
Code scanning / CodeQL
Insecure randomness
This uses a cryptographically insecure random number generated at [Math.random()](1) in a security context.
This uses a cryptographically insecure random number generated at [Math.random()](2) in a security context.
This uses a cryptographically insecure random number generated at [Math.random()](3) in a security context.
Cruikshanks
force-pushed
the
the-great-rename
branch
3 times, most recently
from
September 12, 2023 15:14
747c6ab
to
ff405cf
Compare
Enough is enough! Too many of our conversations when discussing this service follow the pattern of > "The _charge version_, known as the _charge information_ in the UI, links to multiple _charge references_, which are _charge elements_ in the code. Each of these has multiple _charge purposes_, which are _charge elements_ in the UI". This insanity is because things were either built before the content design had agreed on what they should be called, or they've changed over time but the code hasn't. We're not going to go back and fix all the legacy code. But we have this confusion in the [water-abstraction-system](https://github.com/DEFRA) because we named our models to match the tables, which is the norm. We could rename the tables and our models to match the UI but then we'd break _everything_. So, we are going to do what is within our control. We will rename our models and services to match how things are referred to in the UI (even though some of those names don't help!) Hopefully, this will reduce conversations like our example and help bring new team members on board. We'll still need to be aware of the name disconnect between the code and the DB. But at least our models will act as documentation for what is _actually_ what. Anyone trying to match something from the UI to something in the code will have a much easier time if we rename everything.
We have just come back from 3 days of all the delivery team and its users referring to these as Charge Versions. In fact, their example formed the basis for an idea of doing the same thing for 'return versions'. Clearly, that is how everyone refers to them, even if the UI page has the title 'Charge information'. So, we revert that name change.
Cruikshanks
force-pushed
the
the-great-rename
branch
from
September 17, 2023 16:10
39d4a95
to
88aab9a
Compare
Cruikshanks
added a commit
that referenced
this pull request
Jan 17, 2024
https://eaflood.atlassian.net/browse/WATER-4336 Whilst working on updating our acceptance tests due to changes in the view bill run and view bill screens we found even after accounting for the changes, the SROC reissue test still failed. After investigation we were able to identify changes made during the [The Great Rename](#416) had broken the reissue engine. Prior to the rename the reissue engine was depending on shared fields between records. For example, a `water.billing_invoice` and a `crm_v2.invoice_account` shared the same fields; `invoice_account_id` and `invoice_account_number`. So, you could pass an instance of both to a service like `GenerateBillService` and as far as it is concerned it is dealing with a 'billing account' instance because it has the `invoice_account_id` and `invoice_account_number` properties it expects. ```javascript const billingInvoice = { billingInvoiceId: 'e1b40699-3b57-422c-96c3-3732e86312fc' invoiceAccountId: '53c85d8c-d5fc-48db-9c59-aa36995c0e4b', invoiceAccountNumber: 'A00000002A' } const invoiceAccount = { invoiceAccountId: '53c85d8c-d5fc-48db-9c59-aa36995c0e4b', invoiceAccountNumber: 'A00000002A' } ``` Post the rename this is no longer the case. Now we have the following ```javascript const billingInvoice = { id: 'e1b40699-3b57-422c-96c3-3732e86312fc' invoiceAccountId: '53c85d8c-d5fc-48db-9c59-aa36995c0e4b', invoiceAccountNumber: 'A00000002A' } const invoiceAccount = { id: '53c85d8c-d5fc-48db-9c59-aa36995c0e4b', invoiceAccountNumber: 'A00000002A' } ``` > We use field names pre the great rename to help explain the issue. But this is not what they would actually be. It's `invoiceAccountId` on the billing invoice and just `id` on the invoice account. `GenerateBillService` can no longer be given both types of instance and expect to give the same result. So, this fixes the issue by generating objects that represent what `GenerateBillService` and `GenerateBillLicenceService` expect.
Cruikshanks
added a commit
that referenced
this pull request
Jan 17, 2024
https://eaflood.atlassian.net/browse/WATER-4336 Whilst working on updating our acceptance tests due to changes in the view bill run and view bill screens we found even after accounting for the changes, the SROC reissue test still failed. After investigation, we were able to identify changes made during the [The Great Rename](#416) had broken the reissue engine. Before the rename the reissue engine depended on shared fields between records. For example, a `water.billing_invoice` and a `crm_v2.invoice_account` shared the same fields; `invoice_account_id` and `invoice_account_number`. So, you could pass an instance of both to a service like `GenerateBillService` and as far as it is concerned it is dealing with a 'billing account' instance because it has the `invoice_account_id` and `invoice_account_number` properties it expects. ```javascript const billingInvoice = { billingInvoiceId: 'e1b40699-3b57-422c-96c3-3732e86312fc', invoiceAccountId: '53c85d8c-d5fc-48db-9c59-aa36995c0e4b', invoiceAccountNumber: 'A00000002A' } const invoiceAccount = { invoiceAccountId: '53c85d8c-d5fc-48db-9c59-aa36995c0e4b', invoiceAccountNumber: 'A00000002A' } ``` Post the rename this is no longer the case. Now we have the following ```javascript const billingInvoice = { id: 'e1b40699-3b57-422c-96c3-3732e86312fc', invoiceAccountId: '53c85d8c-d5fc-48db-9c59-aa36995c0e4b', invoiceAccountNumber: 'A00000002A' } const invoiceAccount = { id: '53c85d8c-d5fc-48db-9c59-aa36995c0e4b', invoiceAccountNumber: 'A00000002A' } ``` > We use field names before the great rename to help explain the issue. But this is not what they are in the code anymore. It's `invoiceAccountId` on the billing invoice and just `id` on the invoice account. `GenerateBillService` can no longer be given both types of instances and expect to get the same result. So, this fixes the issue by generating objects that represent what `GenerateBillService` and `GenerateBillLicenceService` expect.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
DEFRA/water-abstraction-team#97
Enough is enough!
Too many of our conversations when discussing this service follow the pattern of
This insanity is because things were either built before the content design had agreed on what they should be called, or they've changed over time but the code hasn't.
We're not going to go back and fix all the legacy code. But we have this confusion in the water-abstraction-system because we named our models to match the tables, which is the norm. We could rename the tables and our models to match the UI but then we'd break everything.
So, we are going to do what is within our control. We will rename our models and services to match how things are referred to in the UI (even though some of those names don't help!) Hopefully, this will reduce conversations like our example and help bring new team members on board. We'll still need to be aware of the name disconnect between the code and the DB. But at least our models will act as documentation for what is actually what.
Anyone trying to match something from the UI to something in the code will have a much easier time if we rename everything.
Renames
BillingBatch
toBillRun
BillingInvoice
toBill
BillingInvoiceLicence
toBillLicence
BillingTransaction
toTransaction
BillingChargeCategory
toChargeCategory
ChargeElement
toChargeReference
ChargePurpose
toChargeElement
ChargeVersionWorkflow
toWorkflow
PurposesUse
toPurpose