feat(policy): add immutable versioned product policy store

This commit is contained in:
shira committed 2026-10-06 01:52:39 +03:00
1 parent 0e2a3b02ab
commit 7a5105acc7
30 files changed
+3893 -37

No files matched your search

+62
View File
@@ -0,0 +1,62 @@
package domain
// DemoProductPolicyV1 returns the initial product policy that is published as
// version 1 of ProductPolicyKey with PolicyKindDemo. Its values are the agreed
// starting rules for verifying the product flow, not results of a study: the
// assessment section is marked AssessmentCalibrationUncalibratedInitial, and
// its thresholds and stop rule make no psychometric or quality claim until a
// pilot calibrates them and a calibrated version is published.
//
// The policy holds rules only. Assessment content, such as the task bank,
// blueprints, and variants, is separate work and is not part of it.
//
// Tests must not use this policy as a fixture for other values; they build
// their own policies under their own keys.
func DemoProductPolicyV1() ProductPolicy {
return ProductPolicy{
Invitations: InvitationPolicy{
ResponseDeadlineOptions: []CalendarDays{3, 7, 14},
DefaultResponseDeadline: 7,
MaxPendingPerNeed: 20,
RepeatAfterDecline: 30,
InterviewProposalDeadline: 5,
NoDealPause: 30,
},
OrganizationQuotas: OrganizationQuotaPolicy{
InvitationWindow: 7,
CardViewWindow: 24,
TierE0: OrganizationTierQuota{Active: true, InvitationsPerWindow: 10, DistinctCardViewsPerWindow: 50},
TierE1: OrganizationTierQuota{Active: true, InvitationsPerWindow: 40, DistinctCardViewsPerWindow: 150},
// E2 stays inactive until the organization verification that
// grants it exists.
TierE2: OrganizationTierQuota{Active: false, InvitationsPerWindow: 100, DistinctCardViewsPerWindow: 400},
},
Assessment: AssessmentPolicy{
Calibration: AssessmentCalibrationUncalibratedInitial,
SameGradeRetryAfter: 30,
MaxAttemptsPerWindow: 3,
AttemptWindow: 180,
PromotionMinInterval: 90,
ConfirmationThreshold: 8000,
HighStrengthThreshold: 9000,
PracticeRequired: true,
StopRule: AssessmentStopRule{
MinScoredItems: 8,
MaxScoredItems: 23,
SeedItems: 2,
UpperProbability: 9000,
LowerProbability: 1000,
MaxStandardError: 2500,
},
},
Identity: IdentityPolicy{
VerificationTokenLifetime: 24,
UnverifiedAccountLifetime: 7,
SessionIdleTimeout: 24,
SessionAbsoluteLifetime: 7,
},
SearchStatus: SearchStatusPolicy{
SearchingConfirmationInterval: 30,
},
}
}