[APP-1072] Add labeler declaration lexicons (#3521)

* updates to com.atproto.moderation.* for report routing

* updates to labeler service declaration; and new reason types

* Apply suggestions from code review

Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>

* remove dupe reasonAppeal

* iterate on labeler declaration lexicons

* Makefile: fast helper for formatting just lex json

* external, not link

* change default when subjectCollections is not defined

* remove 'example reason' disclaimers

* simplify lex report proposal: just labeler declartions

* missed knownValues list

* Codegen, changeset

---------

Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>
Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
bnewbold 2025-02-25 07:46:12 -08:00 committed by GitHub
parent e40758c36a
commit 99e2809ca2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 204 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
"@atproto/api": patch
---
Add `reasonTypes`, `subjectTypes`, and `subjectCollections` properties to labeler service records.

View File

@ -38,6 +38,10 @@ lint: ## Run style checks and verify syntax
fmt: ## Run syntax re-formatting
pnpm format
.PHONY: fmt-lexicons
fmt-lexicons: ## Run syntax re-formatting, just on .json files
pnpm exec eslint ./lexicons/ --ext .json --fix
.PHONY: deps
deps: ## Installs dependent libs using 'pnpm install'
pnpm install --frozen-lockfile

View File

@ -18,7 +18,28 @@
"type": "union",
"refs": ["com.atproto.label.defs#selfLabels"]
},
"createdAt": { "type": "string", "format": "datetime" }
"createdAt": { "type": "string", "format": "datetime" },
"reasonTypes": {
"description": "The set of report reason 'codes' which are in-scope for this service to review and action. These usually align to policy categories. If not defined (distinct from empty array), all reason types are allowed.",
"type": "array",
"items": {
"type": "ref",
"ref": "com.atproto.moderation.defs#reasonType"
}
},
"subjectTypes": {
"description": "The set of subject types (account, record, etc) this service accepts reports on.",
"type": "array",
"items": {
"type": "ref",
"ref": "com.atproto.moderation.defs#subjectType"
}
},
"subjectCollections": {
"type": "array",
"description": "Set of record types (collection NSIDs) which can be reported to this service. If not defined (distinct from empty array), default is any record type.",
"items": { "type": "string", "format": "nsid" }
}
}
}
}

View File

@ -41,6 +41,11 @@
"reasonAppeal": {
"type": "token",
"description": "Appeal: appeal a previously taken moderation action"
},
"subjectType": {
"type": "string",
"description": "Tag describing a type of subject that might be reported.",
"knownValues": ["account", "record", "chat"]
}
}
}

View File

@ -1278,6 +1278,11 @@ export const schemaDict = {
type: 'token',
description: 'Appeal: appeal a previously taken moderation action',
},
subjectType: {
type: 'string',
description: 'Tag describing a type of subject that might be reported.',
knownValues: ['account', 'record', 'chat'],
},
},
},
ComAtprotoRepoApplyWrites: {
@ -9162,6 +9167,33 @@ export const schemaDict = {
type: 'string',
format: 'datetime',
},
reasonTypes: {
description:
"The set of report reason 'codes' which are in-scope for this service to review and action. These usually align to policy categories. If not defined (distinct from empty array), all reason types are allowed.",
type: 'array',
items: {
type: 'ref',
ref: 'lex:com.atproto.moderation.defs#reasonType',
},
},
subjectTypes: {
description:
'The set of subject types (account, record, etc) this service accepts reports on.',
type: 'array',
items: {
type: 'ref',
ref: 'lex:com.atproto.moderation.defs#subjectType',
},
},
subjectCollections: {
type: 'array',
description:
'Set of record types (collection NSIDs) which can be reported to this service. If not defined (distinct from empty array), default is any record type.',
items: {
type: 'string',
format: 'nsid',
},
},
},
},
},

View File

@ -7,6 +7,7 @@ import { validate as _validate } from '../../../../lexicons'
import { $Typed, is$typed as _is$typed, OmitKey } from '../../../../util'
import type * as AppBskyLabelerDefs from './defs.js'
import type * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs.js'
import type * as ComAtprotoModerationDefs from '../../../com/atproto/moderation/defs.js'
const is$typed = _is$typed,
validate = _validate
@ -17,6 +18,12 @@ export interface Record {
policies: AppBskyLabelerDefs.LabelerPolicies
labels?: $Typed<ComAtprotoLabelDefs.SelfLabels> | { $type: string }
createdAt: string
/** The set of report reason 'codes' which are in-scope for this service to review and action. These usually align to policy categories. If not defined (distinct from empty array), all reason types are allowed. */
reasonTypes?: ComAtprotoModerationDefs.ReasonType[]
/** The set of subject types (account, record, etc) this service accepts reports on. */
subjectTypes?: ComAtprotoModerationDefs.SubjectType[]
/** Set of record types (collection NSIDs) which can be reported to this service. If not defined (distinct from empty array), default is any record type. */
subjectCollections?: string[]
[k: string]: unknown
}

View File

@ -34,3 +34,6 @@ export const REASONRUDE = `${id}#reasonRude`
export const REASONOTHER = `${id}#reasonOther`
/** Appeal: appeal a previously taken moderation action */
export const REASONAPPEAL = `${id}#reasonAppeal`
/** Tag describing a type of subject that might be reported. */
export type SubjectType = 'account' | 'record' | 'chat' | (string & {})

View File

@ -1278,6 +1278,11 @@ export const schemaDict = {
type: 'token',
description: 'Appeal: appeal a previously taken moderation action',
},
subjectType: {
type: 'string',
description: 'Tag describing a type of subject that might be reported.',
knownValues: ['account', 'record', 'chat'],
},
},
},
ComAtprotoRepoApplyWrites: {
@ -9162,6 +9167,33 @@ export const schemaDict = {
type: 'string',
format: 'datetime',
},
reasonTypes: {
description:
"The set of report reason 'codes' which are in-scope for this service to review and action. These usually align to policy categories. If not defined (distinct from empty array), all reason types are allowed.",
type: 'array',
items: {
type: 'ref',
ref: 'lex:com.atproto.moderation.defs#reasonType',
},
},
subjectTypes: {
description:
'The set of subject types (account, record, etc) this service accepts reports on.',
type: 'array',
items: {
type: 'ref',
ref: 'lex:com.atproto.moderation.defs#subjectType',
},
},
subjectCollections: {
type: 'array',
description:
'Set of record types (collection NSIDs) which can be reported to this service. If not defined (distinct from empty array), default is any record type.',
items: {
type: 'string',
format: 'nsid',
},
},
},
},
},

View File

@ -7,6 +7,7 @@ import { validate as _validate } from '../../../../lexicons'
import { $Typed, is$typed as _is$typed, OmitKey } from '../../../../util'
import type * as AppBskyLabelerDefs from './defs.js'
import type * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs.js'
import type * as ComAtprotoModerationDefs from '../../../com/atproto/moderation/defs.js'
const is$typed = _is$typed,
validate = _validate
@ -17,6 +18,12 @@ export interface Record {
policies: AppBskyLabelerDefs.LabelerPolicies
labels?: $Typed<ComAtprotoLabelDefs.SelfLabels> | { $type: string }
createdAt: string
/** The set of report reason 'codes' which are in-scope for this service to review and action. These usually align to policy categories. If not defined (distinct from empty array), all reason types are allowed. */
reasonTypes?: ComAtprotoModerationDefs.ReasonType[]
/** The set of subject types (account, record, etc) this service accepts reports on. */
subjectTypes?: ComAtprotoModerationDefs.SubjectType[]
/** Set of record types (collection NSIDs) which can be reported to this service. If not defined (distinct from empty array), default is any record type. */
subjectCollections?: string[]
[k: string]: unknown
}

View File

@ -34,3 +34,6 @@ export const REASONRUDE = `${id}#reasonRude`
export const REASONOTHER = `${id}#reasonOther`
/** Appeal: appeal a previously taken moderation action */
export const REASONAPPEAL = `${id}#reasonAppeal`
/** Tag describing a type of subject that might be reported. */
export type SubjectType = 'account' | 'record' | 'chat' | (string & {})

View File

@ -1278,6 +1278,11 @@ export const schemaDict = {
type: 'token',
description: 'Appeal: appeal a previously taken moderation action',
},
subjectType: {
type: 'string',
description: 'Tag describing a type of subject that might be reported.',
knownValues: ['account', 'record', 'chat'],
},
},
},
ComAtprotoRepoApplyWrites: {
@ -9162,6 +9167,33 @@ export const schemaDict = {
type: 'string',
format: 'datetime',
},
reasonTypes: {
description:
"The set of report reason 'codes' which are in-scope for this service to review and action. These usually align to policy categories. If not defined (distinct from empty array), all reason types are allowed.",
type: 'array',
items: {
type: 'ref',
ref: 'lex:com.atproto.moderation.defs#reasonType',
},
},
subjectTypes: {
description:
'The set of subject types (account, record, etc) this service accepts reports on.',
type: 'array',
items: {
type: 'ref',
ref: 'lex:com.atproto.moderation.defs#subjectType',
},
},
subjectCollections: {
type: 'array',
description:
'Set of record types (collection NSIDs) which can be reported to this service. If not defined (distinct from empty array), default is any record type.',
items: {
type: 'string',
format: 'nsid',
},
},
},
},
},

View File

@ -7,6 +7,7 @@ import { validate as _validate } from '../../../../lexicons'
import { $Typed, is$typed as _is$typed, OmitKey } from '../../../../util'
import type * as AppBskyLabelerDefs from './defs.js'
import type * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs.js'
import type * as ComAtprotoModerationDefs from '../../../com/atproto/moderation/defs.js'
const is$typed = _is$typed,
validate = _validate
@ -17,6 +18,12 @@ export interface Record {
policies: AppBskyLabelerDefs.LabelerPolicies
labels?: $Typed<ComAtprotoLabelDefs.SelfLabels> | { $type: string }
createdAt: string
/** The set of report reason 'codes' which are in-scope for this service to review and action. These usually align to policy categories. If not defined (distinct from empty array), all reason types are allowed. */
reasonTypes?: ComAtprotoModerationDefs.ReasonType[]
/** The set of subject types (account, record, etc) this service accepts reports on. */
subjectTypes?: ComAtprotoModerationDefs.SubjectType[]
/** Set of record types (collection NSIDs) which can be reported to this service. If not defined (distinct from empty array), default is any record type. */
subjectCollections?: string[]
[k: string]: unknown
}

View File

@ -34,3 +34,6 @@ export const REASONRUDE = `${id}#reasonRude`
export const REASONOTHER = `${id}#reasonOther`
/** Appeal: appeal a previously taken moderation action */
export const REASONAPPEAL = `${id}#reasonAppeal`
/** Tag describing a type of subject that might be reported. */
export type SubjectType = 'account' | 'record' | 'chat' | (string & {})

View File

@ -1278,6 +1278,11 @@ export const schemaDict = {
type: 'token',
description: 'Appeal: appeal a previously taken moderation action',
},
subjectType: {
type: 'string',
description: 'Tag describing a type of subject that might be reported.',
knownValues: ['account', 'record', 'chat'],
},
},
},
ComAtprotoRepoApplyWrites: {
@ -9162,6 +9167,33 @@ export const schemaDict = {
type: 'string',
format: 'datetime',
},
reasonTypes: {
description:
"The set of report reason 'codes' which are in-scope for this service to review and action. These usually align to policy categories. If not defined (distinct from empty array), all reason types are allowed.",
type: 'array',
items: {
type: 'ref',
ref: 'lex:com.atproto.moderation.defs#reasonType',
},
},
subjectTypes: {
description:
'The set of subject types (account, record, etc) this service accepts reports on.',
type: 'array',
items: {
type: 'ref',
ref: 'lex:com.atproto.moderation.defs#subjectType',
},
},
subjectCollections: {
type: 'array',
description:
'Set of record types (collection NSIDs) which can be reported to this service. If not defined (distinct from empty array), default is any record type.',
items: {
type: 'string',
format: 'nsid',
},
},
},
},
},

View File

@ -7,6 +7,7 @@ import { validate as _validate } from '../../../../lexicons'
import { $Typed, is$typed as _is$typed, OmitKey } from '../../../../util'
import type * as AppBskyLabelerDefs from './defs.js'
import type * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs.js'
import type * as ComAtprotoModerationDefs from '../../../com/atproto/moderation/defs.js'
const is$typed = _is$typed,
validate = _validate
@ -17,6 +18,12 @@ export interface Record {
policies: AppBskyLabelerDefs.LabelerPolicies
labels?: $Typed<ComAtprotoLabelDefs.SelfLabels> | { $type: string }
createdAt: string
/** The set of report reason 'codes' which are in-scope for this service to review and action. These usually align to policy categories. If not defined (distinct from empty array), all reason types are allowed. */
reasonTypes?: ComAtprotoModerationDefs.ReasonType[]
/** The set of subject types (account, record, etc) this service accepts reports on. */
subjectTypes?: ComAtprotoModerationDefs.SubjectType[]
/** Set of record types (collection NSIDs) which can be reported to this service. If not defined (distinct from empty array), default is any record type. */
subjectCollections?: string[]
[k: string]: unknown
}

View File

@ -34,3 +34,6 @@ export const REASONRUDE = `${id}#reasonRude`
export const REASONOTHER = `${id}#reasonOther`
/** Appeal: appeal a previously taken moderation action */
export const REASONAPPEAL = `${id}#reasonAppeal`
/** Tag describing a type of subject that might be reported. */
export type SubjectType = 'account' | 'record' | 'chat' | (string & {})