feat(assessment): record capture hints and keep one window per attempt

This commit is contained in:
shira committed 2026-10-11 13:16:52 +03:00
1 parent c975a0d506
commit bb917bf62e
108 files changed
+6649 -139

No files matched your search

@@ -2666,6 +2666,138 @@ func decodeHideOrganizationParams(args [1]string, argsEscaped bool, r *http.Requ
return params, nil
}
// HoldMyAssessmentWorkSessionParams is parameters of HoldMyAssessmentWorkSession operation.
type HoldMyAssessmentWorkSessionParams struct {
// Identifier of an assessment attempt of the current candidate. An attempt of another candidate and an
// unknown identifier both answer 404 not_found, so identifiers cannot be enumerated.
AttemptID uuid.UUID
// The page identifier described at AttemptClient. It is required here because the operation exists to
// hold or release the work session of one page.
XAttemptClient string
}
func unpackHoldMyAssessmentWorkSessionParams(packed middleware.Parameters) (params HoldMyAssessmentWorkSessionParams) {
{
key := middleware.ParameterKey{
Name: "attempt_id",
In: "path",
}
params.AttemptID = packed[key].(uuid.UUID)
}
{
key := middleware.ParameterKey{
Name: "X-Attempt-Client",
In: "header",
}
params.XAttemptClient = packed[key].(string)
}
return params
}
func decodeHoldMyAssessmentWorkSessionParams(args [1]string, argsEscaped bool, r *http.Request) (params HoldMyAssessmentWorkSessionParams, _ error) {
h := uri.NewHeaderDecoder(r.Header)
// Decode path: attempt_id.
if err := func() error {
param := args[0]
if argsEscaped {
unescaped, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
param = unescaped
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "attempt_id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToUUID(val)
if err != nil {
return err
}
params.AttemptID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "attempt_id",
In: "path",
Err: err,
}
}
// Decode header: X-Attempt-Client.
if err := func() error {
cfg := uri.HeaderParameterDecodingConfig{
Name: "X-Attempt-Client",
Explode: false,
}
if err := h.HasParam(cfg); err == nil {
if err := h.DecodeParam(cfg, func(d uri.Decoder) error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToString(val)
if err != nil {
return err
}
params.XAttemptClient = c
return nil
}); err != nil {
return err
}
if err := func() error {
if err := (validate.String{
MinLength: 16,
MinLengthSet: true,
MaxLength: 64,
MaxLengthSet: true,
Email: false,
Hostname: false,
Regex: regexMap["^[A-Za-z0-9_-]+$"],
MinNumeric: 0,
MinNumericSet: false,
MaxNumeric: 0,
MaxNumericSet: false,
}).Validate(string(params.XAttemptClient)); err != nil {
return errors.Wrap(err, "string")
}
return nil
}(); err != nil {
return err
}
} else {
return err
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "X-Attempt-Client",
In: "header",
Err: err,
}
}
return params, nil
}
// ListMyAssessmentResultsParams is parameters of ListMyAssessmentResults operation.
type ListMyAssessmentResultsParams struct {
// Maximum number of results per page.
@@ -5833,6 +5965,138 @@ func decodeRegisterAccountParams(args [0]string, argsEscaped bool, r *http.Reque
return params, nil
}
// ReleaseMyAssessmentWorkSessionParams is parameters of ReleaseMyAssessmentWorkSession operation.
type ReleaseMyAssessmentWorkSessionParams struct {
// Identifier of an assessment attempt of the current candidate. An attempt of another candidate and an
// unknown identifier both answer 404 not_found, so identifiers cannot be enumerated.
AttemptID uuid.UUID
// The page identifier described at AttemptClient. It is required here because the operation exists to
// hold or release the work session of one page.
XAttemptClient string
}
func unpackReleaseMyAssessmentWorkSessionParams(packed middleware.Parameters) (params ReleaseMyAssessmentWorkSessionParams) {
{
key := middleware.ParameterKey{
Name: "attempt_id",
In: "path",
}
params.AttemptID = packed[key].(uuid.UUID)
}
{
key := middleware.ParameterKey{
Name: "X-Attempt-Client",
In: "header",
}
params.XAttemptClient = packed[key].(string)
}
return params
}
func decodeReleaseMyAssessmentWorkSessionParams(args [1]string, argsEscaped bool, r *http.Request) (params ReleaseMyAssessmentWorkSessionParams, _ error) {
h := uri.NewHeaderDecoder(r.Header)
// Decode path: attempt_id.
if err := func() error {
param := args[0]
if argsEscaped {
unescaped, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
param = unescaped
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "attempt_id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToUUID(val)
if err != nil {
return err
}
params.AttemptID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "attempt_id",
In: "path",
Err: err,
}
}
// Decode header: X-Attempt-Client.
if err := func() error {
cfg := uri.HeaderParameterDecodingConfig{
Name: "X-Attempt-Client",
Explode: false,
}
if err := h.HasParam(cfg); err == nil {
if err := h.DecodeParam(cfg, func(d uri.Decoder) error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToString(val)
if err != nil {
return err
}
params.XAttemptClient = c
return nil
}); err != nil {
return err
}
if err := func() error {
if err := (validate.String{
MinLength: 16,
MinLengthSet: true,
MaxLength: 64,
MaxLengthSet: true,
Email: false,
Hostname: false,
Regex: regexMap["^[A-Za-z0-9_-]+$"],
MinNumeric: 0,
MinNumericSet: false,
MaxNumeric: 0,
MaxNumericSet: false,
}).Validate(string(params.XAttemptClient)); err != nil {
return errors.Wrap(err, "string")
}
return nil
}(); err != nil {
return err
}
} else {
return err
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "X-Attempt-Client",
In: "header",
Err: err,
}
}
return params, nil
}
// RevokeMyConsentParams is parameters of RevokeMyConsent operation.
type RevokeMyConsentParams struct {
// Consent being revoked. C1 has a deletion-request operation and C4 requires an organization scope.
@@ -6274,6 +6538,15 @@ type StartMyAssessmentAttemptSessionParams struct {
// does the server check If-Match, so a retry of a completed change replays its outcome instead of
// failing on the version it has just changed. After 24 hours the key may be accepted as new.
IdempotencyKey string
// Random identifier that one open page of the assessment attempt generates when it loads and keeps
// until it closes, 16 to 64 characters of `A-Za-z0-9_-`. It names the page that holds the single
// active work session of the attempt (see HoldMyAssessmentWorkSession). The server keeps only a
// one-way keyed digest bound to the attempt, never the value.
//
// A request that omits the header counts as one anonymous client. It is refused with 409
// `state_conflict` while another page holds the work session, and it is accepted while nobody does, so
// a client that predates the header keeps working until a page holds the session.
XAttemptClient OptString `json:",omitempty,omitzero"`
}
func unpackStartMyAssessmentAttemptSessionParams(packed middleware.Parameters) (params StartMyAssessmentAttemptSessionParams) {
@@ -6291,6 +6564,15 @@ func unpackStartMyAssessmentAttemptSessionParams(packed middleware.Parameters) (
}
params.IdempotencyKey = packed[key].(string)
}
{
key := middleware.ParameterKey{
Name: "X-Attempt-Client",
In: "header",
}
if v, ok := packed[key]; ok {
params.XAttemptClient = v.(OptString)
}
}
return params
}
@@ -6395,6 +6677,72 @@ func decodeStartMyAssessmentAttemptSessionParams(args [1]string, argsEscaped boo
Err: err,
}
}
// Decode header: X-Attempt-Client.
if err := func() error {
cfg := uri.HeaderParameterDecodingConfig{
Name: "X-Attempt-Client",
Explode: false,
}
if err := h.HasParam(cfg); err == nil {
if err := h.DecodeParam(cfg, func(d uri.Decoder) error {
var paramsDotXAttemptClientVal string
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToString(val)
if err != nil {
return err
}
paramsDotXAttemptClientVal = c
return nil
}(); err != nil {
return err
}
params.XAttemptClient.SetTo(paramsDotXAttemptClientVal)
return nil
}); err != nil {
return err
}
if err := func() error {
if value, ok := params.XAttemptClient.Get(); ok {
if err := func() error {
if err := (validate.String{
MinLength: 16,
MinLengthSet: true,
MaxLength: 64,
MaxLengthSet: true,
Email: false,
Hostname: false,
Regex: regexMap["^[A-Za-z0-9_-]+$"],
MinNumeric: 0,
MinNumericSet: false,
MaxNumeric: 0,
MaxNumericSet: false,
}).Validate(string(value)); err != nil {
return errors.Wrap(err, "string")
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "X-Attempt-Client",
In: "header",
Err: err,
}
}
return params, nil
}
@@ -6423,6 +6771,15 @@ type SubmitMyAssessmentAnswerParams struct {
// does the server check If-Match, so a retry of a completed change replays its outcome instead of
// failing on the version it has just changed. After 24 hours the key may be accepted as new.
IdempotencyKey string
// Random identifier that one open page of the assessment attempt generates when it loads and keeps
// until it closes, 16 to 64 characters of `A-Za-z0-9_-`. It names the page that holds the single
// active work session of the attempt (see HoldMyAssessmentWorkSession). The server keeps only a
// one-way keyed digest bound to the attempt, never the value.
//
// A request that omits the header counts as one anonymous client. It is refused with 409
// `state_conflict` while another page holds the work session, and it is accepted while nobody does, so
// a client that predates the header keeps working until a page holds the session.
XAttemptClient OptString `json:",omitempty,omitzero"`
}
func unpackSubmitMyAssessmentAnswerParams(packed middleware.Parameters) (params SubmitMyAssessmentAnswerParams) {
@@ -6440,6 +6797,15 @@ func unpackSubmitMyAssessmentAnswerParams(packed middleware.Parameters) (params
}
params.IdempotencyKey = packed[key].(string)
}
{
key := middleware.ParameterKey{
Name: "X-Attempt-Client",
In: "header",
}
if v, ok := packed[key]; ok {
params.XAttemptClient = v.(OptString)
}
}
return params
}
@@ -6544,6 +6910,72 @@ func decodeSubmitMyAssessmentAnswerParams(args [1]string, argsEscaped bool, r *h
Err: err,
}
}
// Decode header: X-Attempt-Client.
if err := func() error {
cfg := uri.HeaderParameterDecodingConfig{
Name: "X-Attempt-Client",
Explode: false,
}
if err := h.HasParam(cfg); err == nil {
if err := h.DecodeParam(cfg, func(d uri.Decoder) error {
var paramsDotXAttemptClientVal string
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToString(val)
if err != nil {
return err
}
paramsDotXAttemptClientVal = c
return nil
}(); err != nil {
return err
}
params.XAttemptClient.SetTo(paramsDotXAttemptClientVal)
return nil
}); err != nil {
return err
}
if err := func() error {
if value, ok := params.XAttemptClient.Get(); ok {
if err := func() error {
if err := (validate.String{
MinLength: 16,
MinLengthSet: true,
MaxLength: 64,
MaxLengthSet: true,
Email: false,
Hostname: false,
Regex: regexMap["^[A-Za-z0-9_-]+$"],
MinNumeric: 0,
MinNumericSet: false,
MaxNumeric: 0,
MaxNumericSet: false,
}).Validate(string(value)); err != nil {
return errors.Wrap(err, "string")
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "X-Attempt-Client",
In: "header",
Err: err,
}
}
return params, nil
}