feat(sla_enforcement): config-driven SLA rules as authoritative source for slaBreachesAt#6
Merged
shannonwho merged 3 commits intomainfrom Apr 15, 2026
Merged
Conversation
0404931 to
bf03de3
Compare
…el permissions Introduces a hierarchical allowlist model with field-level permission grants. - AllowlistGroup / AllowlistLeaf types with unlimited nesting depth - linearTeamId: all members of a Linear team auto-match the group; membership fetched at startup via getTeamMembers and refreshed every 4 hours - Four permissions: labels, sla, priority, slaBaseline (clock anchor — most restricted) - Union resolution: user matching multiple entries receives the most permissive union - Partial authorization: only unauthorized fields are reverted per webhook event - Backward compatible: flat leaf entries with no permissions default to all four - 36-case authorization test suite covering inheritance, union, partial auth, and linearTeamId resolution Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
89bbce3 to
3daa1f4
Compare
blkinney
approved these changes
Apr 15, 2026
Collaborator
blkinney
left a comment
There was a problem hiding this comment.
one issue i see there, but otherwise seems good! great job!
| cachedCreatedAt, | ||
| liveIssue.priority ?? 0, | ||
| liveIssue.labels ?? [], | ||
| (liveIssue as any).teamId |
Collaborator
There was a problem hiding this comment.
it looks like teamId isn't on the issue data coming from linear-client, you'll want to update the graphql to pull in team {id}.
Collaborator
Author
There was a problem hiding this comment.
thanks for catching that! fixed with the UUID add-on
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
getTeamMembers now detects whether the configured value is a UUID or a
short team key (e.g. "ADM", "ENG"). Keys use the teams(filter:{key:{eq:}})
query; UUIDs use the existing team(id:) query.
Previously, passing a team key to team(id:) caused "Entity not found" errors
at startup, leaving the team member cache empty and blocking all team-based
authorization until the next restart.
Docs updated in README and IMPLEMENTATION_GUIDE to recommend the team key
format and explain where to find it in the Linear UI.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
shannonwho
pushed a commit
that referenced
this pull request
Apr 20, 2026
All conflicts resolved by keeping feature branch — our version is the superset of main's squashed PR #6 (hierarchical auth + slaRules) plus the new slaConfigurations API work. No functionality changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Fixes SOL-237
Summary
resolveBreachFromRules— new method that computesslaBreachesAt = createdAt + rule.hours(priority)fromslaRulesin config.json. Replaces reliance on Linear's internally-computed SLA values, which are vulnerable to async race conditions (wrong priority's workflow firing during rapid priority changes).setTimeout(2500ms)after authorized priority change — waits for Linear's internal workflow to settle, then reads liveIssue and applies the rule-based correction in one update. Includes idempotency check to skip if values are already correct.slaRulesare the sole source, exactly one update fires per priority change (no double-write). Documented in README and IMPLEMENTATION_GUIDE.linearTeamId-backed groups, union resolution,slaBaselinesplit fromsla.Changes
src/enforcement-engine.tsresolveBreachFromRulesmethod;setTimeoutcorrection handler; three-tier source logic in all revert pathssrc/types.tsSLARuleSet,SLAPriorityWindow,Permissiontypes;AllowlistGroup/AllowlistLeafhierarchysrc/linear-client.tsgetTeamMembersforlinearTeamIdresolution at startupconfig/config.json.exampleslaRulesexamples.env.exampleREADME.mdslaCreatedAtBaselinecalculation, added single-update architecture noteIMPLEMENTATION_GUIDE.mdTest plan
slaBreachesAtcorrected tocreatedAt + rule.hours(newPriority)in one update (no Linear UI SLA rules active)slaBreachesAtrestored using rule lookupslaStartedAtdrift (silent reset by Linear workflow) → corrected unconditionally regardless of actorlinearTeamId-backed group → permissions resolved correctly at startup and after 4h refreshslaRule→ falls back to cached duration when drift detected, bails when no drift🤖 Generated with Claude Code