updates
This commit is contained in:
parent
9bf93596e7
commit
802fa6b542
2 changed files with 285 additions and 0 deletions
84
aweber/20210928155832-translating_the_search_dsl.org
Normal file
84
aweber/20210928155832-translating_the_search_dsl.org
Normal file
|
@ -0,0 +1,84 @@
|
|||
:PROPERTIES:
|
||||
:ID: 7b0f97f3-9037-4d05-9170-a478e97c8d1f
|
||||
:END:
|
||||
#+title: Translating the search DSL
|
||||
|
||||
Defining and translating the Search DSL for the [[id:11edd6c9-b976-403b-a419-b5542ddedaae][Subscriber Search Service]].
|
||||
|
||||
* Searches
|
||||
** A search is a collection of groupings
|
||||
#+begin_src python :noweb-ref search
|
||||
@dataclasses.dataclass
|
||||
class Search:
|
||||
conditions: typing.List[Group]
|
||||
#+end_src
|
||||
|
||||
** A grouping is a collection of conditions
|
||||
#+begin_src python :noweb-ref group
|
||||
class GroupType(enum.Enum):
|
||||
AND = 1
|
||||
# TODO: OR = 2
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class Group:
|
||||
group_type: GroupType
|
||||
conditions: typing.List[Condition]
|
||||
#+end_src
|
||||
|
||||
** A condition is a boolean expression applied to a field
|
||||
#+begin_src python :noweb-ref condition
|
||||
@dataclasses.dataclass
|
||||
class Condition:
|
||||
field: Field
|
||||
operator: str
|
||||
value: typing.Optional[str]
|
||||
#+end_src
|
||||
|
||||
** A field refers to a specific database field somewhere in our system
|
||||
#+begin_src python :noweb-ref field
|
||||
class Database(enum.Enum):
|
||||
AppDB = 1
|
||||
Analytics = 2
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class FieldType:
|
||||
name: str
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class Field:
|
||||
name: str
|
||||
column: str
|
||||
table: str
|
||||
database: Database
|
||||
#+end_src
|
||||
|
||||
** Allowable conditions
|
||||
|
||||
* Decisions
|
||||
|
||||
** Should the input type presented to the end-user be tied to the database field or the conditional operator?
|
||||
Seems it should be the operator, as an "equals" operator would match a single
|
||||
value, whereas an "in" operator would match against multiple. That said, it
|
||||
could be /parameterized/ by the field's type (e.g. a tag has type =str=, its
|
||||
"equals" operator has type =str=, its "in" operator has type =List[str]=).
|
||||
|
||||
* Code
|
||||
#+begin_src python :noweb yes :noweb-ref final :exports code :results silent
|
||||
import dataclasses
|
||||
import enum
|
||||
import typing
|
||||
|
||||
<<field>>
|
||||
|
||||
|
||||
<<condition>>
|
||||
|
||||
|
||||
<<group>>
|
||||
|
||||
|
||||
<<search>>
|
||||
#+end_src
|
201
daily/2021-09-28.org
Normal file
201
daily/2021-09-28.org
Normal file
|
@ -0,0 +1,201 @@
|
|||
:PROPERTIES:
|
||||
:ID: 8d604092-6764-4fe4-b152-c7040c2a25db
|
||||
:header-args: :exports both :eval no-export
|
||||
:END:
|
||||
#+title: 2021-09-28
|
||||
|
||||
* User Management Issue
|
||||
An issue was found with a user logging into and using their account. Rob and
|
||||
Steve had determined that the user was missing an association with their account
|
||||
ID and added it (=621d5ff1-cec6-4ac6-b0fc-bf41819ee9bb=).
|
||||
|
||||
#+begin_src http :pretty
|
||||
GET http://user-management.service.production.consul/users/tee@pipsovermoney.com?expand=account
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_example
|
||||
{
|
||||
"id": "ed8a68a9-3fc7-496c-850e-d25292152d40",
|
||||
"given_name": "Tee",
|
||||
"surname": "POM",
|
||||
"display_name": "Tee POM",
|
||||
"login": "tee@pipsovermoney.com",
|
||||
"security_questions": [],
|
||||
"accounts": [
|
||||
{
|
||||
"account": {
|
||||
"account": "2843971d-f44b-433f-b161-1c756f8b6b5a",
|
||||
"name": "Pips Over Money",
|
||||
"active": false
|
||||
},
|
||||
"role": "owner",
|
||||
"is_account_owner": true,
|
||||
"created_at": "2019-07-24T01:25:38Z",
|
||||
"updated_at": "2019-07-24T01:25:38Z"
|
||||
},
|
||||
{
|
||||
"account": {
|
||||
"account": "7c73d2c0-fe0e-4a14-a4fd-637489864f00",
|
||||
"name": "Tee POM's Company",
|
||||
"active": true
|
||||
},
|
||||
"role": "owner",
|
||||
"is_account_owner": true,
|
||||
"created_at": "2019-09-01T00:31:22Z",
|
||||
"updated_at": "2019-09-01T00:31:22Z"
|
||||
},
|
||||
{
|
||||
"account": {
|
||||
"account": "621d5ff1-cec6-4ac6-b0fc-bf41819ee9bb",
|
||||
"name": "Tee POM's Company",
|
||||
"active": true
|
||||
},
|
||||
"role": "owner",
|
||||
"is_account_owner": true,
|
||||
"created_at": "2021-09-28T18:30:39Z",
|
||||
"updated_at": "2021-09-28T18:30:39Z"
|
||||
}
|
||||
],
|
||||
"created_at": "2019-07-24T01:25:38Z",
|
||||
"updated_at": "2021-06-27T06:53:49Z",
|
||||
"last_logged_in_at": "2021-08-29T16:35:17Z",
|
||||
"reset_password": false
|
||||
}
|
||||
#+end_example
|
||||
|
||||
I investigated the mappings for the account UUIDS to check on the related
|
||||
account information, and determined that they both referenced the same numeric
|
||||
AID (=1423829=).
|
||||
|
||||
#+begin_src http
|
||||
GET https://mapping.aweberprod.com/7c73d2c0-fe0e-4a14-a4fd-637489864f00
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_example
|
||||
HTTP/2 200
|
||||
date: Tue, 28 Sep 2021 18:43:05 GMT
|
||||
content-type: application/json; charset="utf-8"
|
||||
content-length: 83
|
||||
server: mapping/2.2.5
|
||||
correlation-id: 4fa82382-7796-449b-b1a0-4344150d8168
|
||||
cache-control: public, max-age=2592000
|
||||
vary: Accept,Accept, Accept-Encoding
|
||||
last-modified: Thu, 02 Apr 2020 22:09:23 +0000
|
||||
|
||||
{"id": "7c73d2c0-fe0e-4a14-a4fd-637489864f00", "type": "account", "value": 1423829}
|
||||
#+end_example
|
||||
|
||||
#+begin_src http
|
||||
GET https://mapping.aweberprod.com/621d5ff1-cec6-4ac6-b0fc-bf41819ee9bb
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_example
|
||||
HTTP/2 200
|
||||
date: Tue, 28 Sep 2021 18:42:20 GMT
|
||||
content-type: application/json; charset="utf-8"
|
||||
content-length: 83
|
||||
server: mapping/2.2.5
|
||||
correlation-id: c2997b37-424a-4737-8c7e-3ef0b354de94
|
||||
warning: Returning mapped value for invalid ID
|
||||
cache-control: public, max-age=2592000
|
||||
vary: Accept,Accept, Accept-Encoding
|
||||
last-modified: Thu, 02 Apr 2020 22:09:23 +0000
|
||||
|
||||
{"id": "7c73d2c0-fe0e-4a14-a4fd-637489864f00", "type": "account", "value": 1423829}
|
||||
#+end_example
|
||||
|
||||
#+begin_src http :pretty
|
||||
GET http://account.service.production.consul/v1/accounts/1423829
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_example
|
||||
{
|
||||
"status": "Paid",
|
||||
"account_id": 1423829,
|
||||
"url": "",
|
||||
"company": "Tee POM's Company",
|
||||
"phonenum": "3103630374",
|
||||
"lname": "POM",
|
||||
"package_id": 67,
|
||||
"is_analytics": true,
|
||||
"fname": "Tee",
|
||||
"date_opened": "2019-08-31T20:31:19.945092-04:00",
|
||||
"login": null,
|
||||
"is_closed": false,
|
||||
"addresses": [
|
||||
{
|
||||
"city": "Brentwood",
|
||||
"address_id": null,
|
||||
"address1": "8816 Manchester",
|
||||
"address2": "",
|
||||
"country_id": 2,
|
||||
"zipcode": "63114",
|
||||
"state": "MO",
|
||||
"country_name": "USA",
|
||||
"is_billing": true
|
||||
},
|
||||
{
|
||||
"city": "Scottsdale",
|
||||
"address_id": 982879,
|
||||
"state": "Arizona",
|
||||
"address1": "14455 N. Hayden Road",
|
||||
"address2": "",
|
||||
"country_id": 2,
|
||||
"zipcode": "85260",
|
||||
"address_verified_at": "2020-06-30T20:03:28.575601-04:00",
|
||||
"country_name": "USA",
|
||||
"is_billing": false
|
||||
},
|
||||
{
|
||||
"city": "Jefferson",
|
||||
"address_id": 982852,
|
||||
"state": "Missouri",
|
||||
"address1": "PO BOX 537",
|
||||
"address2": "",
|
||||
"country_id": 2,
|
||||
"zipcode": "63020",
|
||||
"address_verified_at": "2020-06-30T18:31:29.446071-04:00",
|
||||
"country_name": "USA",
|
||||
"is_billing": false
|
||||
},
|
||||
{
|
||||
"city": "St. Louis",
|
||||
"address_id": 940602,
|
||||
"state": "MO",
|
||||
"address1": "3124 Olive St #4",
|
||||
"address2": null,
|
||||
"country_id": 2,
|
||||
"zipcode": "63103",
|
||||
"address_verified_at": "2020-03-13T17:57:24.591486-04:00",
|
||||
"country_name": "USA",
|
||||
"is_billing": false
|
||||
}
|
||||
]
|
||||
}
|
||||
#+end_example
|
||||
|
||||
I was able to refer to old notes from a mapping correction performed on this
|
||||
account on [2020-04-02 Thu]:
|
||||
https://correlr.gitlab.aweber.io/org/worklog.html#2020-04-02-thursday-account-mapping-issue.
|
||||
I determined that =7c73d2c0-fe0e-4a14-a4fd-637489864f00= is the "correct" UUID
|
||||
for this account, per the fix performed at that time, and the results returned
|
||||
by mapping.
|
||||
|
||||
Looking at appdb, since making the accounts table the source of truth for
|
||||
account UUIDs in the time between that mapping fix and now, the account was set
|
||||
to use the erroneous UUID:
|
||||
|
||||
#+begin_example
|
||||
app-txn=> select a_id, account from accounts where a_id = 1423829;
|
||||
a_id | account
|
||||
---------+--------------------------------------
|
||||
1423829 | 621d5ff1-cec6-4ac6-b0fc-bf41819ee9bb
|
||||
(1 row)
|
||||
#+end_example
|
||||
|
||||
Steve updated the account UUID in AppDB and removed the additional association
|
||||
in user management. This appears to have resolved the issue.
|
Loading…
Reference in a new issue