apsislabs / apsislabs/phi_attrs

Update Internal Stack Behavior

Open
#33 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Ruby
Stars
31
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Instead of using a raw stack with simple push and pops we should assign each entry a GUID so that we can have more controlled revoke behavior for easier mixing of `block` and `!` syntax's.

* `allow_phi!` should return a GUID
* `disallow_phi!` should accept an optional GUID to remove
* `allow_phi` and `disallow_phi` blocks should track the GUID they create and then revoke that particular access.

This will better support weird mixes like the following, with at least consistent behavior (even if we still don't recommend it):
```
patient_john = PatientInfo.new

guid = patient_john.allow_phi!('allow1', 'reason) # Stack: 'allow1'

patient_john.disallow_phi do # Stack: 'allow1', 'disallow1'
patient_john.disallow_phi(guid) # Stack: 'disallow1'
guid = patient_john.allow_phi('allow2') # Stack: 'disallow1', 'allow2'
end

patient_john.name # Stack: 'allow2'
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the implementations of allow_phi!, disallow_phi!, allow_phi, and disallow_phi and read how the current raw stack is maintained. Trace the block behavior and verify that GUIDs are returned, optionally accepted for removal, and tied to the matching block access so the mixed example leaves the expected access active.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.