feat(assessment): record capture hints and keep one window per attempt
This commit is contained in:
1 parent
c975a0d506
commit
bb917bf62e
108 files changed
+6649
-139
No files matched your search
@@ -56,6 +56,21 @@ type AssessmentSignalPolicy struct {
|
||||
ClientFocusLossAttentionMS int32
|
||||
ClientClipboardEventsAttention int32
|
||||
ClientFullscreenExitsAttention int32
|
||||
|
||||
// The signals below were added after the policy section was first
|
||||
// published, so a stored version does not carry them. A zero threshold
|
||||
// leaves the signal out of the band, and a version never acquires a
|
||||
// default: the facts are stored and counted for the operator either way.
|
||||
//
|
||||
// ClientScreenshotKeysAttention and ClientDevtoolsAttention are client
|
||||
// thresholds, so they raise a normal band to attention only.
|
||||
ClientScreenshotKeysAttention int32
|
||||
ClientDevtoolsAttention int32
|
||||
// ExtraAgents counts the distinct User-Agent digests of the attempt beyond
|
||||
// the first. It joins the weak group of parallel sessions and extra
|
||||
// networks, so alone it reaches attention at most.
|
||||
ExtraAgentsAttention int32
|
||||
ExtraAgentsReview int32
|
||||
}
|
||||
|
||||
// Sanity bounds of the signal section. They reject a value in the wrong unit;
|
||||
@@ -99,6 +114,20 @@ func DemoAssessmentSignalPolicy() AssessmentSignalPolicy {
|
||||
}
|
||||
}
|
||||
|
||||
// DemoAssessmentSignalPolicyWithCaptureHints is the demonstration policy with
|
||||
// the optional signals switched on: three screenshot keys, one detection of
|
||||
// open developer tools, and two extra User-Agents reach attention. Like the
|
||||
// other demo values they are agreed starting points that no study supports.
|
||||
// DemoAssessmentSignalPolicy itself stays as it was published, because a stored
|
||||
// version never changes.
|
||||
func DemoAssessmentSignalPolicyWithCaptureHints() AssessmentSignalPolicy {
|
||||
policy := DemoAssessmentSignalPolicy()
|
||||
policy.ClientScreenshotKeysAttention = 3
|
||||
policy.ClientDevtoolsAttention = 1
|
||||
policy.ExtraAgentsAttention, policy.ExtraAgentsReview = 2, 4
|
||||
return policy
|
||||
}
|
||||
|
||||
// Validate rejects a zero, out-of-range, or inconsistent section.
|
||||
func (policy AssessmentSignalPolicy) Validate() error {
|
||||
const location = "AssessmentSignalPolicy.Validate"
|
||||
@@ -115,6 +144,21 @@ func (policy AssessmentSignalPolicy) Validate() error {
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := firstError(
|
||||
checkOptionalRange(location, "assessment.signals.client_screenshot_keys_attention", policy.ClientScreenshotKeysAttention, maxSignalCount),
|
||||
checkOptionalRange(location, "assessment.signals.client_devtools_attention", policy.ClientDevtoolsAttention, maxSignalCount),
|
||||
checkOptionalRange(location, "assessment.signals.extra_agents_attention", policy.ExtraAgentsAttention, maxSignalCount),
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
if policy.ExtraAgentsAttention == 0 && policy.ExtraAgentsReview != 0 {
|
||||
return invalidPolicy(location, "assessment.signals.extra_agents_review needs extra_agents_attention")
|
||||
}
|
||||
if policy.ExtraAgentsAttention != 0 {
|
||||
if err := checkRange(location, "assessment.signals.extra_agents_review", policy.ExtraAgentsReview, policy.ExtraAgentsAttention, maxSignalCount); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
for _, pair := range []struct {
|
||||
field string
|
||||
attention, review int32
|
||||
@@ -135,3 +179,12 @@ func (policy AssessmentSignalPolicy) Validate() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// checkOptionalRange accepts zero, which leaves an optional signal out, or a
|
||||
// value from 1 to maximum.
|
||||
func checkOptionalRange(location, field string, value, maximum int32) error {
|
||||
if value == 0 {
|
||||
return nil
|
||||
}
|
||||
return checkRange(location, field, value, 1, maximum)
|
||||
}
|
||||
Reference in new issue
Block a user