@salesforce/afv-skills 1.67.0 → 1.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +55 -5
  2. package/package.json +1 -1
  3. package/skills/agentforce-offline-experimentation-run/SKILL.md +14 -22
  4. package/skills/agentforce-offline-experimentation-run/scripts/bt_compare.py +81 -0
  5. package/skills/agentforce-offline-experimentation-run/scripts/bt_fetch.py +358 -0
  6. package/skills/agentforce-offline-experimentation-run/scripts/bt_patch_agent.py +110 -0
  7. package/skills/agentforce-offline-experimentation-run/scripts/btlib/__init__.py +34 -0
  8. package/skills/agentforce-offline-experimentation-run/scripts/btlib/agentpatch.py +483 -0
  9. package/skills/agentforce-offline-experimentation-run/scripts/btlib/agentsrc.py +565 -0
  10. package/skills/agentforce-offline-experimentation-run/scripts/btlib/cache.py +95 -0
  11. package/skills/agentforce-offline-experimentation-run/scripts/btlib/compare.py +617 -0
  12. package/skills/agentforce-offline-experimentation-run/scripts/btlib/fetch.py +1012 -0
  13. package/skills/agentforce-offline-experimentation-run/scripts/btlib/judge.py +148 -0
  14. package/skills/agentforce-offline-experimentation-run/scripts/btlib/messages.py +92 -0
  15. package/skills/agentforce-offline-experimentation-run/scripts/btlib/patch.py +327 -0
  16. package/skills/agentforce-offline-experimentation-run/scripts/btlib/redact.py +40 -0
  17. package/skills/agentforce-offline-experimentation-run/scripts/btlib/results.py +288 -0
  18. package/skills/agentforce-offline-experimentation-run/scripts/btlib/scoring.py +340 -0
  19. package/skills/agentforce-offline-experimentation-run/scripts/btlib/sfap.py +238 -0
  20. package/skills/agentforce-offline-experimentation-run/scripts/btlib/splits.py +136 -0
  21. package/skills/agentforce-offline-experimentation-run/scripts/btlib/stdm.py +98 -0
  22. package/skills/agentforce-offline-experimentation-run/scripts/btlib/tokens.py +173 -0
  23. package/skills/agentforce-offline-experimentation-run/scripts/btlib/units.py +199 -0
  24. package/skills/agentforce-offline-experimentation-run/scripts/btlib/versions.py +194 -0
  25. package/skills/agentforce-offline-experimentation-run/scripts/build_report.py +366 -378
  26. package/skills/agentforce-offline-experimentation-run/scripts/resolve-token.sh +14 -4
  27. package/skills/agentforce-offline-experimentation-run/scripts/sfap_replay.py +472 -796
  28. package/skills/dx-lifecycle-center/SKILL.md +5 -2
  29. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/connect-connected.json +65 -0
  30. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/schema.json +32 -0
  31. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/connect-sign-in.json +57 -0
  32. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/schema.json +21 -0
  33. package/skills/dx-lifecycle-center/examples/workflows.md +20 -6
  34. package/skills/dx-lifecycle-center/references/connect-org.md +21 -2
  35. package/skills/dx-lifecycle-center/references/deploy.md +2 -2
  36. package/skills/dx-lifecycle-center/references/list-orgs.md +1 -1
  37. package/skills/dx-lifecycle-center/scripts/card-policy.jq +71 -0
  38. package/skills/dx-lifecycle-center/scripts/fill-widget.jq +29 -0
  39. package/skills/dx-lifecycle-center/scripts/widget.sh +28 -0
  40. package/skills/dx-org-devhub-configure/SKILL.md +85 -84
  41. package/skills/dx-org-devhub-configure/examples/status-output.md +25 -2
  42. package/skills/dx-org-devhub-configure/scripts/devhub.sh +265 -140
  43. package/skills/dx-org-devhub-configure/scripts/test-devhub.sh +100 -15
  44. package/skills/dx-packaging-move-to-2gp-migrate/SKILL.md +89 -0
  45. package/skills/dx-packaging-move-to-2gp-migrate/references/api-operations.md +164 -0
  46. package/skills/dx-scratch-def-configure/SKILL.md +163 -0
  47. package/skills/dx-scratch-def-configure/examples/confirm-card.md +53 -0
  48. package/skills/dx-scratch-def-configure/examples/report-recipes.md +100 -0
  49. package/skills/dx-scratch-def-configure/references/features.json +3270 -0
  50. package/skills/dx-scratch-def-configure/references/project-scratch-def.schema.json +1841 -0
  51. package/skills/dx-scratch-def-configure/references/settings-map.json +682 -0
  52. package/skills/dx-scratch-def-configure/scripts/lib_scratch_def.py +1306 -0
  53. package/skills/dx-scratch-def-configure/scripts/requirements.txt +3 -0
  54. package/skills/dx-scratch-def-configure/scripts/scrape_config_values.py +848 -0
  55. package/skills/education-cloud-domain-configure/SKILL.md +1 -1
  56. package/skills/education-cloud-multi-campus-configure/SKILL.md +1 -1
  57. package/skills/education-cloud-student-recruitment-agent-configure/SKILL.md +1 -1
  58. package/skills/experience-design-validate/SKILL.md +1 -1
  59. package/skills/experience-search-coordinate/SKILL.md +18 -12
  60. package/skills/experience-search-coordinate/references/content-route.md +79 -1
  61. package/skills/field-service-data-capture-migrate/SKILL.md +1 -1
  62. package/skills/platform-apex-generate/SKILL.md +14 -11
  63. package/skills/platform-apex-test-generate/SKILL.md +2 -1
  64. package/skills/platform-datamask-run/SKILL.md +52 -71
  65. package/skills/platform-datamask-run/references/api-surface.md +10 -4
  66. package/skills/platform-datamask-run/references/policy-authoring.md +56 -7
  67. package/skills/platform-datamask-run/references/run-and-abort.md +17 -10
  68. package/skills/platform-datamask-run/scripts/poll-job.sh +15 -25
  69. package/skills/platform-dataspace-access-configure/SKILL.md +19 -1
  70. package/skills/platform-metadata-discovery-get/SKILL.md +185 -0
  71. package/skills/platform-metadata-discovery-get/references/api-map.md +25 -0
  72. package/skills/platform-metadata-discovery-get/references/h360-routes.md +30 -0
  73. package/skills/platform-metadata-discovery-get/references/scoped-soql.md +52 -0
  74. package/skills/platform-metadata-grounding-get/SKILL.md +170 -0
  75. package/skills/platform-policy-rule-generate/SKILL.md +84 -232
  76. package/skills/platform-policy-rule-generate/references/condition-model.md +47 -0
  77. package/skills/platform-policy-rule-generate/references/condition-templates.md +89 -0
  78. package/skills/platform-policy-rule-generate/references/conjunction-compiler.md +25 -0
  79. package/skills/platform-policy-rule-generate/references/conjunction-expression.md +22 -0
  80. package/skills/platform-policy-rule-generate/references/consumer-all.md +9 -0
  81. package/skills/platform-policy-rule-generate/references/consumer-datacloud-ui.md +91 -0
  82. package/skills/platform-policy-rule-generate/references/deploy-errors.md +24 -36
  83. package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/package.xml +12 -0
  84. package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitionSets/ExistsJoinRLS.policyRuleDefinitionSet +6 -0
  85. package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitions/ExistsJoinRLS_Rule_1.policyRuleDefinition +91 -0
  86. package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/package.xml +12 -0
  87. package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitionSets/FieldReadDeny.policyRuleDefinitionSet +6 -0
  88. package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitions/FieldReadDeny_Rule_1.policyRuleDefinition +72 -0
  89. package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/package.xml +12 -0
  90. package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitionSets/LastCharactersFieldMasking.policyRuleDefinitionSet +6 -0
  91. package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitions/LastCharactersFieldMasking_Rule_1.policyRuleDefinition +77 -0
  92. package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/package.xml +12 -0
  93. package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitionSets/PrincipalFieldMatchRLS.policyRuleDefinitionSet +6 -0
  94. package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitions/PrincipalFieldMatchRLS_Rule_1.policyRuleDefinition +77 -0
  95. package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/package.xml +12 -0
  96. package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitionSets/TaggedObjectAccess.policyRuleDefinitionSet +4 -0
  97. package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitions/TaggedObjectAccess_Rule_1.policyRuleDefinition +65 -0
  98. package/skills/platform-policy-rule-generate/references/headless-transport.md +87 -0
  99. package/skills/platform-policy-rule-generate/references/policy-schema-full.md +17 -10
  100. package/skills/platform-policy-rule-generate/references/policy-shapes.md +74 -0
  101. package/skills/platform-policy-rule-generate/references/principal-expression.md +31 -0
  102. package/skills/platform-policy-rule-generate/references/reference-resolution.md +51 -0
  103. package/skills/platform-policy-rule-generate/references/resource-expression.md +48 -0
  104. package/skills/platform-policy-rule-generate/references/runtime-context.md +9 -0
  105. package/skills/platform-policy-rule-generate/references/templates-access.md +11 -9
  106. package/skills/platform-policy-rule-generate/references/templates-advanced.md +4 -2
  107. package/skills/platform-policy-rule-generate/references/templates-record.md +37 -22
  108. package/skills/platform-policy-rule-generate/references/templates-transform.md +10 -8
  109. package/skills/platform-policy-rule-generate/references/templates.md +2 -2
  110. package/skills/platform-policy-rule-generate/references/ui-compatibility.md +35 -17
  111. package/skills/platform-report-generate/SKILL.md +9 -4
  112. package/skills/platform-report-generate/references/chart-types.md +26 -2
  113. package/skills/platform-report-generate/references/column-names.md +43 -0
  114. package/skills/platform-report-generate/references/errors-and-troubleshooting.md +1 -1
  115. package/skills/platform-report-generate/references/verification-checklist.md +10 -2
  116. package/skills/service-digital-engagement-channel-configure/SKILL.md +7 -5
  117. package/skills/service-digital-engagement-channel-configure/assets/messaging_channel_template.xml +33 -0
  118. package/skills/service-digital-engagement-channel-configure/references/channel_settings.md +110 -14
@@ -0,0 +1,89 @@
1
+ # Condition Templates
2
+
3
+ Use these templates only after resolving the reference values in the target org.
4
+
5
+ ## Entity Type
6
+
7
+ ```xml
8
+ <conditions>
9
+ <clause>WHEN</clause>
10
+ <operator>IS</operator>
11
+ <policyRuleValueSet>
12
+ <valueText>OBJECT</valueText>
13
+ </policyRuleValueSet>
14
+ <resourcePath>ENTITYTYPE</resourcePath>
15
+ </conditions>
16
+ ```
17
+
18
+ For a UI-renderable object-level (OLS/GOVERNANCE `TupleRead`) policy, both `OBJECT` and `FIELD` entity-type conditions are required and must be OR'd together — see the OLS section in `policy-shapes.md` and the entity-type discriminator rule in `ui-compatibility.md`. Omitting the pair still deploys and works at runtime, but crashes the Policy Builder on open (UI-only failure, not a persistence failure). FLS/masking policies use `FIELD` only — do not add an `OBJECT` condition for those.
19
+
20
+ ## Standard Tag
21
+
22
+ ```xml
23
+ <conditions>
24
+ <clause>WHEN</clause>
25
+ <operator>CONTAINS_ANY</operator>
26
+ <policyRuleValueSet>
27
+ <valueReference>EXACT.STANDARD.TAG.NAME</valueReference>
28
+ <valueReferenceType>STANDARD_TAG</valueReferenceType>
29
+ </policyRuleValueSet>
30
+ <resourcePath>TAG</resourcePath>
31
+ </conditions>
32
+ ```
33
+
34
+ ## Standard Classification
35
+
36
+ ```xml
37
+ <conditions>
38
+ <clause>WHEN</clause>
39
+ <operator>CONTAINS_ANY</operator>
40
+ <policyRuleValueSet>
41
+ <valueReference>EXACT.STANDARD.CLASSIFICATION.NAME</valueReference>
42
+ <valueReferenceType>STANDARD_CLASSIFICATION</valueReferenceType>
43
+ </policyRuleValueSet>
44
+ <resourcePath>CLASSIFICATION</resourcePath>
45
+ </conditions>
46
+ ```
47
+
48
+ ## Custom Permission
49
+
50
+ ```xml
51
+ <conditions>
52
+ <clause>WHEN</clause>
53
+ <operator>CONTAINS_ANY</operator>
54
+ <policyRuleValueSet>
55
+ <valueReference>EXACT_CUSTOM_PERMISSION_DEVELOPER_NAME</valueReference>
56
+ <valueReferenceType>CUSTOM_PERMISSION</valueReferenceType>
57
+ </policyRuleValueSet>
58
+ <principalPath>ASSIGNED_PERMISSIONS_PATH</principalPath>
59
+ </conditions>
60
+ ```
61
+
62
+ ## Principal Scalar Attribute
63
+
64
+ Use the complete `principalExpression` template in `principal-expression.md`. Its right-side comparison is normally `<valueText>...</valueText>`.
65
+
66
+ For FLS or masking, instantiate the Entity Type template once with `FIELD`. For OLS, instantiate it twice, first with `OBJECT` and then with `FIELD`.
67
+
68
+ ## RLS Record Field Equals Principal Attribute
69
+
70
+ Use this template in normal author mode whenever the request compares a resource field to the requesting principal's own attribute (for example, "records where `OwnerDepartment` matches the user's `Department`"). `SCALAR_ATTRIBUTE` is a confirmed, deployable, Policy Builder-compatible principal path for this comparison, per DG UI source (this is how the builder itself authors the condition, not established by a per-shape round-trip).
71
+
72
+ ```xml
73
+ <conditions>
74
+ <clause>WHEN</clause>
75
+ <operator>EQUALS</operator>
76
+ <principalExpression>
77
+ <soqlTarget>
78
+ <select>EXACT_USER_FIELD</select>
79
+ </soqlTarget>
80
+ <type>SOQLTARGETLISTEXPR</type>
81
+ <version>1</version>
82
+ </principalExpression>
83
+ <resourcePath>RECORDFIELD</resourcePath>
84
+ <valueDomain>EXACT_DMO:EXACT_FIELD</valueDomain>
85
+ <valuePrincipalPath>SCALAR_ATTRIBUTE</valuePrincipalPath>
86
+ </conditions>
87
+ ```
88
+
89
+ This shape has a resource path, a principal expression, a value domain, and a value principal path. Resolve all three API names in the target org before generating XML.
@@ -0,0 +1,25 @@
1
+ # Conjunction Compiler
2
+
3
+ Construct conjunctions from a typed intermediate plan, not by hand-editing an expression string.
4
+
5
+ 1. Build and validate all conditions.
6
+ 2. Classify each condition into `DATA_SPACE`, `TAG_CLASSIFICATION`, `PERMISSION`, `ENTITY_TYPE`, or `RECORD_FIELD`; never mix classifications, permissions, entity types, and RLS criteria in one local group.
7
+ 3. Reject conditions that cannot belong to a selected consumer/profile.
8
+ 4. Assign stable condition IDs after final ordering.
9
+ 5. Build each non-empty local group with its requested operator.
10
+ 6. In normal author mode for `DATACLOUD`, build a typed custom-conjunction plan for UI validation, then serialize it to the ordinary MDAPI `conjunctionExpression`. There is no literal `CUSTOM` XML element. For example, two alternative classifications plus one required permission become `(AND (OR 1 2) (AND 3))`.
11
+ 7. For `ALL`, use the general conjunction contract.
12
+ 8. Validate that every condition is referenced exactly once, no unknown ID is referenced, no group is empty, and nested RLS join conditions use independent numbering.
13
+
14
+ In explicit evidence-recreation mode, do not compile or normalize the named API 69.0 example's conjunction. Its exact condition order and conjunction take precedence; validate their internal index consistency and reproduce them verbatim.
15
+
16
+ For `DATACLOUD`, a typical OLS tree is:
17
+
18
+ ```text
19
+ CUSTOM(AND,
20
+ ENTITY_TYPE(OR, 1, 2),
21
+ TAG_CLASSIFICATION(OR, 3, 4),
22
+ PERMISSION(AND, 5))
23
+ ```
24
+
25
+ The XML has no literal section elements; section identity is represented by the custom-conjunction tree consumed by the UI.
@@ -0,0 +1,22 @@
1
+ # Conjunction Expressions
2
+
3
+ Conditions are numbered in document order, starting at `1`. The `<conjunctionExpression>` uses those numbers in prefix notation.
4
+
5
+ For six conditions grouped as two entity-type checks, two principal checks, and two tag checks:
6
+
7
+ ```xml
8
+ <conjunctionExpression>(AND (OR 1 2) (AND 3 4) (AND 5 6))</conjunctionExpression>
9
+ ```
10
+
11
+ **Top-level operator must always be `AND`.** Never emit a bare top-level `(OR 1 2)` — the UI treats it as `// ERROR: Unsupported rule!` and silently drops the rule — and never emit a bare top-level condition index (e.g. `3` instead of `(AND 3)`), which crashes the builder. `OR` is allowed only inside a single section's local group, never as (or at) the top level. Wrap every local group under a top-level `AND`: `(AND (OR 1 2))`, `(AND 3)`. See `ui-compatibility.md` for the full non-round-trip checklist.
12
+
13
+ Construction:
14
+
15
+ 1. Number every `<conditions>` element from top to bottom.
16
+ 2. Build each local group using those numbers.
17
+ 3. Combine the groups with the top-level `AND` operator — never a bare top-level `OR` or a bare index.
18
+ 4. Check that every referenced number exists exactly once in the intended expression.
19
+
20
+ Do not renumber conditions after changing their order without updating the expression.
21
+
22
+ An `EXISTS` resource expression can contain nested `policyRuleDefinitionCondition` elements. Its `whereClauseConjunction` has a separate one-indexed namespace. For one nested condition, use `<whereClauseConjunction>1</whereClauseConjunction>` exactly as preserved by the semantic `ExistsJoinRLS` example.
@@ -0,0 +1,9 @@
1
+ # ALL Consumer: General Policy
2
+
3
+ `consumer=ALL` selects the shared H360 policy contract. It does not apply Data Governance Policy Builder restrictions.
4
+
5
+ Keep the shared OLS, FLS, direct RLS, join RLS, Transform, condition, expression, and conjunction models reusable here. Apply base metadata, semantic, target-org reference, MDAPI, and runtime validation.
6
+
7
+ `ALL` does not mean unvalidated. Resolve resource domains, fields, joins, tags, classifications, permissions, and principal expressions before deployment. Reject `PLACEHOLDER` because it is internal-only. Do not reject `PLURAL_ATTRIBUTE` solely because the Data Governance UI cannot render it; require separate MDAPI/runtime evidence for any such policy.
8
+
9
+ RLS plus tag/classification conditions remain experimental until their combined metadata and runtime semantics are proven. Do not claim support from enum presence alone.
@@ -0,0 +1,91 @@
1
+ # DATACLOUD Consumer: Data Governance UI
2
+
3
+ In normal author mode, `consumer=DATACLOUD` selects the Data Governance UI-renderability candidate contract. The policy must be representable by the Data Governance Policy Builder and must not rely on the UI silently dropping or rewriting unsupported content. The consumer value alone is not proof of UI validation.
4
+
5
+ Explicit evidence-recreation mode is the narrow exception. When the request names one of this skill's retrieved API 69.0 examples and asks for exact recreation, preserve that example's exact conjunction and persisted scalar-expression shape even when it is not accepted by the normal author-mode compiler. Do not describe the recreated policy as UI validated; MDAPI retrieval, dry run, deploy, or persistence cannot establish that claim.
6
+
7
+ ## UI Conjunction and Section Grouping
8
+
9
+ The UI reconstructs policy sections through a custom-conjunction API/UI projection. `whenClauseConjunction=Custom` and `whenClauseCustomConjunction` are API/UI concepts, not XML elements or MDAPI enum values. The generated package still emits ordinary MDAPI XML: serialize the typed plan into a nested `<conjunctionExpression>` using `AND`/`OR` groups. Do not invent a `CUSTOM` XML wrapper or put condition indexes directly in the top-level expression.
10
+
11
+ - `DATA_SPACE`: `DATASPACE` or `SESSION_DATASPACE`.
12
+ - `TAG_CLASSIFICATION`: `TAG` or `CLASSIFICATION`.
13
+ - `PERMISSION`: `ASSIGNED_PERMISSIONS_PATH` for permission membership, and `SCALAR_ATTRIBUTE` (with a `SOQLTARGETLISTEXPR` `principalExpression`) for a supported principal-attribute comparison. Both are confirmed deployable; `SCALAR_ATTRIBUTE` is UI-renderable per DG UI source (this is how the builder itself authors the condition), not by a per-shape round-trip. Group them together in the `PERMISSION` section.
14
+ - `ENTITY_TYPE`: `ENTITYTYPE`.
15
+ - `RECORD_FIELD`: `RECORDFIELD` or `EXPRESSION`.
16
+
17
+ Build conditions first, classify them, build each local group with its requested `AND`/`OR`, then build the top-level custom `AND`. Serialize that plan to the MDAPI `conjunctionExpression`. Every condition identifier must appear exactly once, no group may be empty, and no bare condition may be used where the UI expects a group. RLS join `whereClauseConjunction` uses a separate nested index namespace. Validate the API/UI projection separately; MDAPI persistence alone does not prove UI behavior.
18
+
19
+ The grouping contract is:
20
+
21
+ | Section group | Conditions kept together | Local grouping |
22
+ |---|---|---|
23
+ | `DATA_SPACE` | Dataspace and session-dataspace conditions | `AND` or `OR` as required by the policy |
24
+ | `TAG_CLASSIFICATION` | Tag and classification conditions | `OR` for alternatives, `AND` for cumulative requirements |
25
+ | `PERMISSION` | Assigned-permission and supported principal-attribute conditions | `AND` or `OR` as required by the policy |
26
+ | `ENTITY_TYPE` | Object/field entity-type discriminator conditions | `OR` for object-versus-field alternatives |
27
+ | `RECORD_FIELD` | Direct record-field and RLS join-expression conditions | `AND` for cumulative RLS criteria |
28
+
29
+ Examples:
30
+
31
+ ```text
32
+ Two alternative classifications + one required permission:
33
+ Custom conjunction API/UI object:
34
+ CUSTOM(AND,
35
+ TAG_CLASSIFICATION(OR, 1, 2),
36
+ PERMISSION(AND, 3))
37
+
38
+ The corresponding MDAPI XML expression is:
39
+ (AND (OR 1 2) (AND 3))
40
+ ```
41
+
42
+ For an object-level TupleRead policy with two entity-type alternatives, two alternative classifications, and one permission gate:
43
+
44
+ ```text
45
+ (AND (OR 1 2) (OR 3 4) (AND 5))
46
+ ```
47
+
48
+ Here `(OR 1 2)` is the `ENTITY_TYPE` group, `(OR 3 4)` is the `TAG_CLASSIFICATION` group, and `(AND 5)` is the `PERMISSION` group. If the policy is RLS, its direct field or `EXPRESSION` conditions form the `RECORD_FIELD` group instead of being mixed into the tag or permission group. The numbers are assigned only after final condition ordering.
49
+
50
+ ## Shape Restrictions
51
+
52
+ - One rule per set.
53
+ - One action only; use only UI-supported `Read` or `TupleRead` combinations.
54
+ - At most one resource domain; the UI consumes only the first domain.
55
+ - Use only UI-supported categories, effects, scopes, and transforms.
56
+ - Do not emit `UNLESS` conditions or an `UNLESS` conjunction.
57
+ - Do not emit a plain `AND`/`OR` conjunction in place of the custom conjunction.
58
+ - Never author `PLACEHOLDER`; its recognition by the UI reader does not make it an authoring construct.
59
+
60
+ ## Principal Attributes
61
+
62
+ Reject `PLURAL_ATTRIBUTE`; it remains unconfirmed. `SCALAR_ATTRIBUTE`/`SOQLTARGETLISTEXPR` is confirmed deployable and UI-compatible per DG UI source (this is how the builder itself authors the condition, not established by a per-shape round-trip) — generate it directly for any attribute the directional table below marks `yes`:
63
+
64
+ | Attribute | Principal path | Resource/RLS path |
65
+ |---|---:|---:|
66
+ | `CompanyName` | yes | yes |
67
+ | `Department` | yes | yes |
68
+ | `Division` | yes | yes |
69
+ | `Username` | no | yes |
70
+ | `Email` | no | yes |
71
+ | `Title` | yes | yes |
72
+ | `CallCenterId` | yes | yes |
73
+ | `ContactId` | no | yes |
74
+ | `ProfileId` | yes | yes |
75
+ | `UserRoleId` | no | no |
76
+
77
+ This table is intentionally extensible and reflects the current UI source, not a universal H360 enum.
78
+
79
+ ## RLS
80
+
81
+ - Resolve the single resource domain and every referenced field in the target org.
82
+ - Resolve every join schema, alias, predicate field, and principal expression field.
83
+ - Reject unresolved value domains; never emit a null or guessed field reference.
84
+ - The UI currently exposes RLS target field types `Text`, `Number`, `Boolean`, `Date`, and `Percent`; currency is normalized as `Number`.
85
+ - Reject `Email`, `Phone`, `Url`, and array-valued target fields for UI-renderable RLS.
86
+ - Validate resource-domain containment when dataspace scope is present.
87
+ - Treat RLS plus tag/classification predicates as unsupported until a UI round-trip and runtime test proves their semantics.
88
+
89
+ ## Evidence Boundary
90
+
91
+ The UI source confirms its reconstruction and serialization contract. MDAPI deploy/retrieve alone does not prove that a policy opens, saves, and preserves semantics in the UI. Claim UI compatibility only after open/save/retrieve validation.
@@ -1,54 +1,42 @@
1
1
  # Deploy Error Reference
2
2
 
3
- When `sf project deploy start` fails, it prints a per-component status table. Below are the most common error families for `PolicyRuleDefinition` / `PolicyRuleDefinitionSet` metadata.
4
-
5
- For verbose output when scripting:
6
- ```bash
7
- sf project deploy start --target-org <alias> --source-dir … --json --verbose \
8
- | jq '.result.details.componentFailures'
9
- ```
3
+ Create/update run over headless-360 `dispatch`/`/headless/metadata`; delete runs over the Data 360 MCP `d360_data_governance_access_policy_delete` tool (Core has no real metadata delete). There is no CLI fallback on either path. This file documents the server-side error taxonomy; the create/update/read errors below surface directly on the `dispatch` path.
10
4
 
11
5
  ---
12
6
 
13
- ## Error Table
7
+ ## Headless Dispatch Errors
14
8
 
15
9
  | Error fragment | Likely cause | Fix |
16
10
  |---|---|---|
17
- | `Not available for deploy for this organization` | Org has `EnforceOMatic` perm (entities visible) but lacks `PolicyRuleMDAPI` org perm | Internal license/feature provisioning — surface to the operator. Both `EnforceOMatic` AND `PolicyRuleMDAPI` are required (see §11.1 of policy.md). |
18
- | `Cannot find … PolicyRuleDefinition` (older orgs) | Org missing `EnforceOMatic` entirely, or API version too low | Confirm both `EnforceOMatic` and `PolicyRuleMDAPI` perms; ensure `<version>` ≥ 64.0 in package.xml |
19
- | `INVALIDFORCATEGORY` / `Resource scope … not valid for category …` | Scope × category mismatch (e.g., ACCESS/GOVERNANCE + RECORD scope, or TRANSFORM + ANY scope) | Match scope to category per the §4 matrix in SKILL.md. For OLS/FLS on tagged objects: use `ANY`/`FIELD` scope + tag/classification condition — **not** `<resourceDomain>`. |
20
- | `Identified record category should use record field …` | Attempted to author an `IDENTIFIED_RECORD` policy with a non-`RECORDFIELD` resource path | Do not author `IDENTIFIED_RECORD` via MDAPI — use a runtime `RuleProvider` instead. |
21
- | `Invalid resource domain - <name>` | `<resourceDomain>` references an entity that doesn't exist in the target org | Pre-deploy the DMO/entity, or remove the rule until the target is available. Namespaced DMOs (e.g. `ssot__Account__dlm`) need the namespace prefix in the XML. |
22
- | `An unexpected error occurred. Please include this ErrorId… (-116061062)` (opaque gack on RLS deploy) | RLS rule references a `<valueDomain>` DMO field that exists in metadata but is **not mapped** in the target org's data streams. Server-side NPE instead of a clean validation error. | Verify each `<valueDomain>` field is mapped in Setup → Data Cloud → Data Explorer. Build the rule in the UI first — the UI surfaces field-mapping issues with usable errors where MDAPI doesn't. |
23
- | `Metadata API received improper input. … Load of metadata from db failed for metadata of type:PolicyRuleDefinition and file name:<name>` (on **retrieve**) | UI-saved RLS rules can fail to round-trip back through MDAPI retrieve in some org states | No clean fix. Use the UI as source of truth for that rule, or hand-author from a known-deployable RLS template. |
24
- | `Use the principal … with external record category.` | `EXTERNAL_RECORD` rule used a non-`IS_AUTHENTICATED`/`IS_INTERNAL` `principalPath` | Switch principal path or change category |
25
- | `Unsupported … contextPath` | Used a context path outside `RuleContextPathType.SESSION_DATASPACE` | Not authorable via MDAPI XML — use a runtime `RuleProvider` |
11
+ | `400 FIELD_INTEGRITY_EXCEPTION "Not available for deploy for this organization"` | Type/op is on the MD-CRUD allowlist, but the org lacks the feature/perm provisioning to deploy this metadata type | Org setup gap — surface it to the operator; do not fall back to CLI on this error alone, since the CLI path hits the same org gate. |
12
+ | `400 UNSUPPORTED_OPERATION` | The type/op is genuinely not on the MD-CRUD allowlist | Onboarding gap — surface it to the operator; there is no CLI fallback. |
13
+ | `'body' must be a JSON object, got an unexpected type` | A client/transport let a raw unescaped newline reach the JSON body, or a transient tool-arg serialization glitch (NOT the server rejecting multi-line XML — a properly-escaped multi-line `xmlRep` persists fine) | Flatten `xmlRep` to one line as a defensive default; if it still fails, retry once before concluding the shape is unsupported. |
14
+ | `404` (on GET) | Type/op is allowlisted; the named member does not exist | Expected for a not-yet-created component, not an error. |
15
+ | `405` / no-op `200` (on a `/headless/metadata` DELETE) | Core has no real metadata delete — the verb 405s, and the interim delete is a no-op 200 that removes nothing | Do not delete via `/headless/metadata`. Delete the whole policy over the Data 360 MCP `d360_data_governance_access_policy_delete` tool (removes the Access Policy and its embedded rules by developer name). |
16
+ | DC-connectivity error (on the Data 360 Access Policy delete) | The off-core Data Cloud delete path failed on DC connectivity | Provisioning gap — surface it to the operator; there is no `sf` CLI fallback. Confirm removal via `d360_data_governance_access_policy_get` by name (not-found = success). |
17
+
18
+ See `references/headless-transport.md` for the full request/response contract.
26
19
 
27
20
  ---
28
21
 
29
- ## OrgPerm Gating
22
+ ## Server-Side Validation Errors
30
23
 
31
- Two org permissions are **both** required for MDAPI authoring:
24
+ These deploy-time validation errors are raised by the same metadata deploy engine behind `/headless/metadata`, so they surface directly in the `dispatch` response for `PolicyRuleDefinition` / `PolicyRuleDefinitionSet`. They are shape or org-provisioning problems, not transport problems — fix the authored XML or surface the org gap to the operator; there is no CLI to fall back to.
32
25
 
33
- | Permission | Gate | Effect if missing |
26
+ | Error fragment | Likely cause | Fix |
34
27
  |---|---|---|
35
- | `EnforceOMatic` | `@WsdlGuard` master switch | Entities not visible in UI/Tooling API at all |
36
- | `PolicyRuleMDAPI` | `orgCanUsePolicyRuleMDAPI` WSDL layer | Deploy fails with `Not available for deploy for this organization` |
37
-
38
- `EnforcOMaticMDAPI` is a separate **packaging** gate (`isMdAPIAllowedInternal`) — only required for packaging/change sets, not for DX CLI deploys. After PR #98647 (merged 2026-06-08) the predicate is `DBContext.get().isDoingPackageInstall()`, so DX CLI deploys work with just the two perms above.
28
+ | `Not available for deploy for this organization` | Policy-rule metadata deployment is not enabled for the org | Surface the missing org capability to the operator; do not attempt to bypass the server gate. |
29
+ | `Cannot find … PolicyRuleDefinition` (older orgs) | Policy-rule metadata is unavailable, or the API version is too low | Confirm the org supports policy-rule metadata and ensure the resolved org API version meets the skill's `minApiVersion`. |
30
+ | `INVALIDFORCATEGORY` / `Resource scope … not valid for category …` | Scope × category mismatch (e.g., GOVERNANCE + RECORD scope, or TRANSFORM + ANY scope) | Match a persistence-validated combination in `policy-shapes.md`; do not infer a new category/scope pairing. |
31
+ | `Identified record category should use record field …` | Attempted to author an `IDENTIFIED_RECORD` policy with a non-`RECORDFIELD` resource path | Do not author `IDENTIFIED_RECORD` via MDAPI — use a runtime `RuleProvider` instead. |
32
+ | `Invalid resource domain - <name>` | `<resourceDomain>` references an entity that doesn't exist in the target org | Pre-deploy the DMO/entity, or remove the rule until the target is available. Namespaced DMOs (e.g. `ssot__Account__dlm`) need the namespace prefix in the XML. |
33
+ | Unexpected server error on RLS deploy | RLS rule may reference a `<valueDomain>` DMO field that exists in metadata but is not mapped in the target org's data streams | Verify each `<valueDomain>` field is mapped using a read-only Data 360 MCP / `dispatch_readonly` inspection, then re-issue the create. |
34
+ | `Metadata API received improper input. … Load of metadata from db failed for metadata of type:PolicyRuleDefinition and file name:<name>` (on **GET read-back**) | UI-saved RLS rules can fail to round-trip back through the MD-CRUD read in some org states | No clean fix. Use the UI as source of truth for that rule, or hand-author from a known-deployable RLS template. |
35
+ | `Use the principal … with external record category.` | `EXTERNAL_RECORD` rule used a non-`IS_AUTHENTICATED`/`IS_INTERNAL` `principalPath` | Switch principal path or change category |
36
+ | `Unsupported … contextPath` | Used a context path outside `RuleContextPathType.SESSION_DATASPACE` | Not authorable via MDAPI XML — use a runtime `RuleProvider` |
39
37
 
40
38
  ---
41
39
 
42
- ## Dry-Run First
43
-
44
- Always validate before deploying to a long-lived org:
45
-
46
- ```bash
47
- sf project deploy start \
48
- --target-org <alias> \
49
- --source-dir force-app/main/default \
50
- --dry-run \
51
- --wait 10
52
- ```
40
+ ## Validate Before You Persist
53
41
 
54
- A `--dry-run` failure runs the full server-side validation (including the `IDENTIFIED_RECORD` constraint) without persisting. This catches all of the errors in the table above before they affect a real org.
42
+ There is no dry-run on the MD-CRUD path — a `POST create` persists. Front-load correctness instead: resolve every reference in the target org (Data 360 MCP, or a read-only `dispatch_readonly` sObject describe for a custom `__dlm` DMO), match a persistence-validated scope × category combination from `policy-shapes.md`, and GET the component back after the write to confirm it persisted as authored. The same deploy-time server validation (including the `IDENTIFIED_RECORD` constraint) runs inline on the create and returns in the `dispatch` response.
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Package xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <types>
4
+ <members>ExistsJoinRLS_Rule_1</members>
5
+ <name>PolicyRuleDefinition</name>
6
+ </types>
7
+ <types>
8
+ <members>ExistsJoinRLS</members>
9
+ <name>PolicyRuleDefinitionSet</name>
10
+ </types>
11
+ <version>{API_VERSION}</version>
12
+ </Package>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <PolicyRuleDefinitionSet xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <builderCompatible>false</builderCompatible>
4
+ <builderValidated>false</builderValidated>
5
+ <label>ExistsJoinRLS</label>
6
+ </PolicyRuleDefinitionSet>
@@ -0,0 +1,91 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <PolicyRuleDefinition xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <action>Read</action>
4
+ <category>RECORD_POLICY_RULE_DEFINITION</category>
5
+ <effect>Permit</effect>
6
+ <label>Rule 1</label>
7
+ <policyRuleDefinitionSetName>ExistsJoinRLS</policyRuleDefinitionSetName>
8
+ <policyRuleResourceDomains>
9
+ <resourceDomain>yourcontacts__dlm</resourceDomain>
10
+ </policyRuleResourceDomains>
11
+ <principalAuthenticationLevel>INTERNAL</principalAuthenticationLevel>
12
+ <principalScopeType>ANY</principalScopeType>
13
+ <resourceScopeType>RECORD</resourceScopeType>
14
+ <ruleConsumer>DATACLOUD</ruleConsumer>
15
+ <transformPrecedence>0</transformPrecedence>
16
+ <whenPolicyRuleDefinitionClauseConjunction>
17
+ <conditions>
18
+ <clause>WHEN</clause>
19
+ <operator>CONTAINS_ANY</operator>
20
+ <policyRuleValueSet>
21
+ <valueReference>cust_perm1</valueReference>
22
+ <valueReferenceType>CUSTOM_PERMISSION</valueReferenceType>
23
+ </policyRuleValueSet>
24
+ <principalPath>ASSIGNED_PERMISSIONS_PATH</principalPath>
25
+ </conditions>
26
+ <conditions>
27
+ <clause>WHEN</clause>
28
+ <operator>EQUALS</operator>
29
+ <policyRuleValueSet>
30
+ <valueText>sdfgd</valueText>
31
+ </policyRuleValueSet>
32
+ <principalExpression>
33
+ <soqlTarget>
34
+ <select>Department</select>
35
+ </soqlTarget>
36
+ <type>SOQLTARGETLISTEXPR</type>
37
+ <version>1</version>
38
+ </principalExpression>
39
+ <principalPath>SCALAR_ATTRIBUTE</principalPath>
40
+ </conditions>
41
+ <conditions>
42
+ <clause>WHEN</clause>
43
+ <operator>EQUALS</operator>
44
+ <principalExpression>
45
+ <soqlTarget>
46
+ <select>Email</select>
47
+ </soqlTarget>
48
+ <type>SOQLTARGETLISTEXPR</type>
49
+ <version>1</version>
50
+ </principalExpression>
51
+ <resourcePath>RECORDFIELD</resourcePath>
52
+ <valueDomain>yourcontacts__dlm:EMAIL__c</valueDomain>
53
+ <valuePrincipalPath>SCALAR_ATTRIBUTE</valuePrincipalPath>
54
+ </conditions>
55
+ <conditions>
56
+ <clause>WHEN</clause>
57
+ <operator>EXISTS</operator>
58
+ <policyRuleDefinitionCondition>
59
+ <clause>WHEN</clause>
60
+ <operator>EQUALS</operator>
61
+ <policyRuleValueSet>
62
+ <valueText>${User.Email}</valueText>
63
+ </policyRuleValueSet>
64
+ <resourcePath>RECORDFIELD</resourcePath>
65
+ <valueDomain>yourcontacts__dlm:EMAIL__c</valueDomain>
66
+ </policyRuleDefinitionCondition>
67
+ <resourceExpression>
68
+ <projection>
69
+ <join>
70
+ <alias>ci</alias>
71
+ <predicate>
72
+ <attribute>contacts_to_importcsv__dlm:EMAIL__c</attribute>
73
+ <comparator>EQUALS</comparator>
74
+ <on>
75
+ <field>EMAIL__c</field>
76
+ <resourceAlias>resource</resourceAlias>
77
+ <schema>yourcontacts__dlm</schema>
78
+ </on>
79
+ </predicate>
80
+ <schema>contacts_to_importcsv__dlm</schema>
81
+ </join>
82
+ </projection>
83
+ <type>PROJECTION</type>
84
+ <version>1</version>
85
+ </resourceExpression>
86
+ <resourcePath>EXPRESSION</resourcePath>
87
+ <whereClauseConjunction>1</whereClauseConjunction>
88
+ </conditions>
89
+ <conjunctionExpression>(AND (AND 1 2) (OR 3 4))</conjunctionExpression>
90
+ </whenPolicyRuleDefinitionClauseConjunction>
91
+ </PolicyRuleDefinition>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Package xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <types>
4
+ <members>FieldReadDeny_Rule_1</members>
5
+ <name>PolicyRuleDefinition</name>
6
+ </types>
7
+ <types>
8
+ <members>FieldReadDeny</members>
9
+ <name>PolicyRuleDefinitionSet</name>
10
+ </types>
11
+ <version>{API_VERSION}</version>
12
+ </Package>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <PolicyRuleDefinitionSet xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <builderCompatible>false</builderCompatible>
4
+ <builderValidated>false</builderValidated>
5
+ <label>FieldReadDeny</label>
6
+ </PolicyRuleDefinitionSet>
@@ -0,0 +1,72 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <PolicyRuleDefinition xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <action>Read</action>
4
+ <category>GOVERNANCE_POLICY_RULE_DEFINITION</category>
5
+ <effect>Forbid</effect>
6
+ <label>Rule 1</label>
7
+ <policyRuleDefinitionSetName>FieldReadDeny</policyRuleDefinitionSetName>
8
+ <principalAuthenticationLevel>INTERNAL</principalAuthenticationLevel>
9
+ <principalScopeType>ANY</principalScopeType>
10
+ <resourceScopeType>ANY</resourceScopeType>
11
+ <ruleConsumer>DATACLOUD</ruleConsumer>
12
+ <transformPrecedence>0</transformPrecedence>
13
+ <whenPolicyRuleDefinitionClauseConjunction>
14
+ <conditions>
15
+ <clause>WHEN</clause>
16
+ <operator>IS</operator>
17
+ <policyRuleValueSet>
18
+ <valueText>FIELD</valueText>
19
+ </policyRuleValueSet>
20
+ <resourcePath>ENTITYTYPE</resourcePath>
21
+ </conditions>
22
+ <conditions>
23
+ <clause>WHEN</clause>
24
+ <operator>EQUALS</operator>
25
+ <policyRuleValueSet>
26
+ <valueText>RESOLVE_TARGET_PROFILE_ID</valueText>
27
+ </policyRuleValueSet>
28
+ <principalExpression>
29
+ <soqlTarget>
30
+ <select>ProfileId</select>
31
+ </soqlTarget>
32
+ <type>SOQLTARGETLISTEXPR</type>
33
+ <version>1</version>
34
+ </principalExpression>
35
+ <principalPath>SCALAR_ATTRIBUTE</principalPath>
36
+ </conditions>
37
+ <conditions>
38
+ <clause>WHEN</clause>
39
+ <operator>EQUALS</operator>
40
+ <policyRuleValueSet>
41
+ <valueText>gj</valueText>
42
+ </policyRuleValueSet>
43
+ <principalExpression>
44
+ <soqlTarget>
45
+ <select>Title</select>
46
+ </soqlTarget>
47
+ <type>SOQLTARGETLISTEXPR</type>
48
+ <version>1</version>
49
+ </principalExpression>
50
+ <principalPath>SCALAR_ATTRIBUTE</principalPath>
51
+ </conditions>
52
+ <conditions>
53
+ <clause>WHEN</clause>
54
+ <operator>CONTAINS_ANY</operator>
55
+ <policyRuleValueSet>
56
+ <valueReference>DataGovernanceClassifications.DataCategorization.DataQuality.Consistent</valueReference>
57
+ <valueReferenceType>STANDARD_CLASSIFICATION</valueReferenceType>
58
+ </policyRuleValueSet>
59
+ <resourcePath>CLASSIFICATION</resourcePath>
60
+ </conditions>
61
+ <conditions>
62
+ <clause>WHEN</clause>
63
+ <operator>CONTAINS_ANY</operator>
64
+ <policyRuleValueSet>
65
+ <valueReference>DataGovernanceTags.EthicalAiStandards.EthicalAI.Caste</valueReference>
66
+ <valueReferenceType>STANDARD_TAG</valueReferenceType>
67
+ </policyRuleValueSet>
68
+ <resourcePath>TAG</resourcePath>
69
+ </conditions>
70
+ <conjunctionExpression>(AND 1 (AND 2 3) (OR 4 5))</conjunctionExpression>
71
+ </whenPolicyRuleDefinitionClauseConjunction>
72
+ </PolicyRuleDefinition>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Package xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <types>
4
+ <members>LastCharactersFieldMasking_Rule_1</members>
5
+ <name>PolicyRuleDefinition</name>
6
+ </types>
7
+ <types>
8
+ <members>LastCharactersFieldMasking</members>
9
+ <name>PolicyRuleDefinitionSet</name>
10
+ </types>
11
+ <version>{API_VERSION}</version>
12
+ </Package>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <PolicyRuleDefinitionSet xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <builderCompatible>false</builderCompatible>
4
+ <builderValidated>false</builderValidated>
5
+ <label>LastCharactersFieldMasking</label>
6
+ </PolicyRuleDefinitionSet>