Executables not accessing the same state #23
Labels
No Label
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: grassrootseconomics/sarafu-vise#23
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When running executables using the same session-id and connection string, it is expected that one would get the same state
Running the menu using cmd/main.go for session-id +254712345678 should result in the same menu gotten from cmd/africastalking/main.go
This is crucial as other executables rely on this principle, such as devtools/admin/main.go
Case examples
These two executables will default to the defined DB_CONN and DB_CONN_RESOURCE strings in the .env
However, completing registration in the
sarafu-at
with thephoneNumber
as+254712345678
will not allow you to proceed with the menu from thesarafu-cmd
. Instead, one has to restart the registration*After registration, both executables retain their own unique states, even after restart
What the
sarafu-at
andsarafu-async
create (correct state)What
sarafu-cmd
createsThe
sarafu-cmd
saves under<sessionId>.<sessionId>
whilesarafu-at
andsarafu-async
save under<sessionId>
The
devtools/admin/main.go
reads from the<sessionId>.<sessionId>
resulting in an error when accessing account data created bysarafu-at
ea6bfa050e/db/db.go (L171)
For
sarafu-at
orsarafu-async
, the sessionId is not set in the context (ctx). once the SetSession is called, the baseDb.sid is set to an empty byte, leading to a final sessionKey of just<sessionId>
When the same
SetSession
is called onsarafu-cmd
or theadmin devtool
, the sessionId exists in the context.This sets the baseDb.sid to
<sessionId>.
, leading to a final sessionKey of<sessionId>.<sessionId>
Removing the sessionId from the ctx in the
devtool/admin/main.go
andcmd/main.go
resolves the issue