feat(audit-roles-tasks): add read-only resources (Audit Events, Roles, Tasks, OKRs, Webhook Events)#107
Open
sgerrand wants to merge 4 commits into
Open
feat(audit-roles-tasks): add read-only resources (Audit Events, Roles, Tasks, OKRs, Webhook Events)#107sgerrand wants to merge 4 commits into
sgerrand wants to merge 4 commits into
Conversation
Adds Humaans.AuditEvents covering /api/audit-events. The API only exposes GET /:id (no list), so the resource declares actions [:retrieve] explicitly and a guard test asserts the other CRUD functions are not exported.
Adds Humaans.Roles, Humaans.RoleMembers, Humaans.RolePermissions covering /api/roles, /api/role-members, /api/role-permissions. All three are read-only via the API; the resources declare actions [:list, :retrieve] explicitly and guard tests assert the write actions are not exported.
…list/retrieve Adds Humaans.Tasks, Humaans.OKRs, Humaans.WebhookEvents covering /api/tasks, /api/okrs, /api/webhook-events. All three are read-only via the API.
Coverage Report for CI Build 25329531329Coverage decreased (-3.1%) to 96.903%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
There was a problem hiding this comment.
Pull request overview
Adds new read-only client modules and resource structs for audit/admin/reporting endpoints in the Humaans API, plus accompanying tests and documentation updates.
Changes:
- Introduces 7 new read-only resource modules (
AuditEvents,Roles,RoleMembers,RolePermissions,Tasks,OKRs,WebhookEvents) usingHumaans.Resourcewith restrictedactions. - Adds new resource struct modules under
Humaans.Resources.*with basicnew/1constructors and timestamp/date parsing where applicable. - Updates
Humaansmodule access helpers and README to surface the new resources; adds ExUnit tests covering list/retrieve and guarding unsupported actions.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents newly supported read-only resources. |
| lib/humaans.ex | Adds convenience accessors for the new resource modules. |
| lib/humaans/audit_events.ex | Adds retrieve-only Audit Events resource module. |
| lib/humaans/roles.ex | Adds read-only Roles resource module (list + retrieve). |
| lib/humaans/role_members.ex | Adds read-only Role Members resource module (list + retrieve). |
| lib/humaans/role_permissions.ex | Adds read-only Role Permissions resource module (list + retrieve). |
| lib/humaans/tasks.ex | Adds read-only Tasks resource module (list + retrieve). |
| lib/humaans/okrs.ex | Adds read-only OKRs resource module (list + retrieve). |
| lib/humaans/webhook_events.ex | Adds read-only Webhook Events resource module (list + retrieve). |
| lib/humaans/resources/audit_event.ex | Defines Humaans.Resources.AuditEvent struct + timestamp parsing. |
| lib/humaans/resources/role.ex | Defines Humaans.Resources.Role struct. |
| lib/humaans/resources/role_member.ex | Defines Humaans.Resources.RoleMember struct. |
| lib/humaans/resources/role_permission.ex | Defines Humaans.Resources.RolePermission struct. |
| lib/humaans/resources/task.ex | Defines Humaans.Resources.Task struct + date/datetime parsing. |
| lib/humaans/resources/okr.ex | Defines Humaans.Resources.OKR struct + datetime parsing. |
| lib/humaans/resources/webhook_event.ex | Defines Humaans.Resources.WebhookEvent struct + datetime parsing. |
| test/humaans/audit_events_test.exs | Adds retrieve tests + guard that non-supported actions aren’t exported. |
| test/humaans/roles_test.exs | Adds list/retrieve tests + guard that write actions aren’t exported. |
| test/humaans/role_members_test.exs | Adds list/retrieve tests + guard that write actions aren’t exported. |
| test/humaans/role_permissions_test.exs | Adds list/retrieve tests + guard that write actions aren’t exported. |
| test/humaans/tasks_test.exs | Adds list/retrieve tests + guard that write actions aren’t exported. |
| test/humaans/okrs_test.exs | Adds list/retrieve tests + guard that write actions aren’t exported. |
| test/humaans/webhook_events_test.exs | Adds list/retrieve tests + guard that write actions aren’t exported. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+17
to
+19
| expect(Humaans.MockHTTPClient, :request, fn _, opts -> | ||
| assert Keyword.fetch!(opts, :url) == "https://app.humaans.io/api/webhook-events" | ||
|
|
Comment on lines
+17
to
+19
| expect(Humaans.MockHTTPClient, :request, fn _, opts -> | ||
| assert Keyword.fetch!(opts, :url) == "https://app.humaans.io/api/tasks" | ||
|
|
Comment on lines
+17
to
+19
| expect(Humaans.MockHTTPClient, :request, fn _, opts -> | ||
| assert Keyword.fetch!(opts, :url) == "https://app.humaans.io/api/okrs" | ||
|
|
Comment on lines
+17
to
+19
| expect(Humaans.MockHTTPClient, :request, fn _, opts -> | ||
| assert Keyword.fetch!(opts, :url) == "https://app.humaans.io/api/role-permissions" | ||
|
|
Comment on lines
+17
to
+20
| expect(Humaans.MockHTTPClient, :request, fn _, opts -> | ||
| assert Keyword.fetch!(opts, :method) == :get | ||
| assert Keyword.fetch!(opts, :url) == "https://app.humaans.io/api/role-members" | ||
|
|
Comment on lines
+17
to
+21
| expect(Humaans.MockHTTPClient, :request, fn client_param, opts -> | ||
| assert client_param == client | ||
| assert Keyword.fetch!(opts, :method) == :get | ||
| assert Keyword.fetch!(opts, :url) == "https://app.humaans.io/api/roles" | ||
|
|
| expect(Humaans.MockHTTPClient, :request, fn client_param, opts -> | ||
| assert client_param == client | ||
| assert Keyword.fetch!(opts, :method) == :get | ||
| assert Keyword.fetch!(opts, :url) == "https://app.humaans.io/api/audit-events/ae_abc" |
This file contains hidden or 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
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.
💁 Adds 7 read-only resources — useful for reporting dashboards and admin/audit tooling.
Summary
Retrieve only (no list endpoint):
List + retrieve (read-only):
Each resource declares the supported `actions: [...]` list explicitly and includes a guard test asserting that the unsupported actions stay unexported. Module access helpers and README updated.
Test plan