{"record":{"id":"132cf22e9432e3a7","repo":"toeverything/AFFiNE","slug":"unsupported-permission-evaluation-input-version","errorCode":null,"errorMessage":"unsupported permission evaluation input version: {}","messagePattern":"unsupported permission evaluation input version: (.+?)","errorType":"validation","errorClass":"napi::Error","httpStatus":null,"severity":"error","filePath":"packages/backend/native/src/permission/evaluator.rs","lineNumber":14,"sourceCode":"use super::{\n  actions::VERSION,\n  candidates::{\n    best_doc_role, decide, decide_doc, doc_candidates, parse_workspace_role, role_name, workspace_candidates,\n  },\n  types::{\n    PermissionDocEvaluationOutputV1, PermissionEvaluationInputV1, PermissionEvaluationOutputV1,\n    PermissionWorkspaceEvaluationOutputV1,\n  },\n};\n\npub fn evaluate_permission(input: PermissionEvaluationInputV1) -> anyhow::Result<PermissionEvaluationOutputV1> {\n  if input.version != VERSION {\n    anyhow::bail!(\"unsupported permission evaluation input version: {}\", input.version);\n  }\n\n  let workspace_candidates = workspace_candidates(&input)?;\n  let workspace_decisions = input\n    .workspace_actions\n    .iter()\n    .map(|action| decide(&input, action, &workspace_candidates))\n    .collect::<Vec<_>>();\n  let workspace_effective_role = workspace_candidates\n    .iter()\n    .filter_map(|candidate| parse_workspace_role(&candidate.role).ok())\n    .max()\n    .map(role_name);\n  let workspace_resource_owner_role = workspace_candidates\n    .iter()\n    .any(|candidate| candidate.owner)\n    .then(|| \"owner\".to_string());\n","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/backend/native/src/permission/evaluator.rs#L1-L32","documentation":"Version check at the entry of evaluate_permission: the PermissionEvaluationInputV1 version does not match the actions module VERSION the native evaluator was compiled for, so evaluation is refused rather than misinterpreting an incompatible input shape.","triggerScenarios":"Raised at the start of evaluate_permission when input.version does not match the VERSION constant supported by this evaluator build.","commonSituations":"The frontend and native module disagree on the permission input schema version. Upgrade the native package so both sides use the same version.","solutions":["Pass a supported permission evaluation input version.","Upgrade the evaluator or downgrade the input payload."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}