A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.
JavaScript claude-code-pluginclaude-code-skillscode-appsgithub-copilot-pluginpower-appspower-pagespower-platform
fix(mobile-apps): accept standard Dataverse GUID metadata (#857)
Shubham Agarwalea1c302887e9
diff --git a/plugins/mobile-apps/.claude-plugin/plugin.json b/plugins/mobile-apps/.claude-plugin/plugin.jsonindex 0dd0621b5..fc9d8e73c 100644--- a/plugins/mobile-apps/.claude-plugin/plugin.json+++ b/plugins/mobile-apps/.claude-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "mobile-app",- "version": "0.6.0",+ "version": "0.6.1","description": "Build and deploy Power Apps code apps for mobile using Expo (React Native), with native device functionality and Power Platform connectors","author": {"name": "Microsoft",diff --git a/plugins/mobile-apps/.plugin/plugin.json b/plugins/mobile-apps/.plugin/plugin.jsonindex 0dd0621b5..fc9d8e73c 100644--- a/plugins/mobile-apps/.plugin/plugin.json+++ b/plugins/mobile-apps/.plugin/plugin.json@@ -1,6 +1,6 @@{"name": "mobile-app",- "version": "0.6.0",+ "version": "0.6.1","description": "Build and deploy Power Apps code apps for mobile using Expo (React Native), with native device functionality and Power Platform connectors","author": {"name": "Microsoft",diff --git a/plugins/mobile-apps/scripts/build-dataverse-operation-manifest.js b/plugins/mobile-apps/scripts/build-dataverse-operation-manifest.jsindex d14a4f17b..5eb30aab6 100644--- a/plugins/mobile-apps/scripts/build-dataverse-operation-manifest.js+++ b/plugins/mobile-apps/scripts/build-dataverse-operation-manifest.js@@ -56,6 +56,9 @@ const NULL_SOURCE_TYPE_IS_ORDINARY_TYPES = new Set(['lookup','memo','multiline',+ // GUID columns cannot be specialized, so their explicit null is valid evidence.+ // https://learn.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.metadata.attributemetadata.sourcetype+ 'uniqueidentifier',]);function parseArgs(argv) {@@ -202,6 +205,7 @@ function dataverseType(column) {lookup: 'Lookup',image: 'Image',file: 'File',+ uniqueidentifier: 'Uniqueidentifier',computed: String(column.attributeType || ''),calculated: String(column.attributeType || ''),rollup: String(column.attributeType || ''),diff --git a/plugins/mobile-apps/scripts/create-dataverse-snapshot.js b/plugins/mobile-apps/scripts/create-dataverse-snapshot.jsindex 1e21cd9cd..d1cf9184f 100644--- a/plugins/mobile-apps/scripts/create-dataverse-snapshot.js+++ b/plugins/mobile-apps/scripts/create-dataverse-snapshot.js@@ -1479,7 +1479,12 @@ async function loadDetailedEntity(request, entity, {validForCreate: Boolean(attribute.IsValidForCreate),validForRead: Boolean(attribute.IsValidForRead),validForUpdate: Boolean(attribute.IsValidForUpdate),- sourceType: normalizeIntegerMetadata(attribute.SourceType),+ // { SourceType: null } is valid for non-specializable columns. Missing+ // or malformed evidence must not become null and authorize reuse.+ ...(hasOwn(attribute, 'SourceType')+ && (attribute.SourceType === null || Number.isInteger(attribute.SourceType))+ ? { sourceType: attribute.SourceType }+ : {}),sourceTypeMask: normalizeIntegerMetadata(attribute.SourceTypeMask),attributeOf: attribute.AttributeOf || null,logical: Boolean(attribute.IsLogical),diff --git a/plugins/mobile-apps/scripts/tests/dataverse-operation-manifest.test.js b/plugins/mobile-apps/scripts/tests/dataverse-operation-manifest.test.jsindex d04f68b04..2cdfd57f3 100644--- a/plugins/mobile-apps/scripts/tests/dataverse-operation-manifest.test.js+++ b/plugins/mobile-apps/scripts/tests/dataverse-operation-manifest.test.js@@ -19,6 +19,7 @@ const {validateManifest,} = require('../build-dataverse-operation-manifest');const { operationFingerprint } = require('../dataverse-request');+const { loadDetailedEntity } = require('../create-dataverse-snapshot');const NOW = '2026-08-19T00:00:00.000Z';const SNAPSHOT_AT = '2026-08-18T23:55:00.000Z';@@ -497,6 +498,51 @@ function fullyAppliedSnapshot() {});}+async function systemUserDetail(sourceEvidence = { SourceType: null }, attributeOverrides = {}) {+ const attributes = ['systemuserid', 'azureactivedirectoryobjectid'].map((logicalName) => ({+ LogicalName: logicalName,+ SchemaName: logicalName,+ AttributeType: 'Uniqueidentifier',+ AttributeTypeName: { Value: 'UniqueidentifierType' },+ RequiredLevel: { Value: logicalName === 'systemuserid' ? 'SystemRequired' : 'None' },+ IsPrimaryId: logicalName === 'systemuserid',+ ...sourceEvidence,+ ...attributeOverrides,+ }));+ return loadDetailedEntity(async (method, apiPath) => {+ assert.equal(method, 'GET');+ return {+ status: 200,+ data: { value: apiPath.includes('/Attributes?$select=') ? attributes : [] },+ };+ }, {+ LogicalName: 'systemuser',+ SchemaName: 'SystemUser',+ EntitySetName: 'systemusers',+ PrimaryIdAttribute: 'systemuserid',+ PrimaryNameAttribute: 'fullname',+ OwnershipType: 'BusinessOwned',+ IsCustomEntity: false,+ IsCustomizable: { Value: true },+ CanCreateAttributes: { Value: true },+ CanBePrimaryEntityInRelationship: { Value: true },+ CanBeRelatedEntityInRelationship: { Value: true },+ });+}++function systemUserContract(type = 'uniqueidentifier') {+ return {+ schemaVersion: 1,+ publisherPrefix: 'cr1',+ tables: [+ contractTable('systemuser', 'reuse', 0, [+ contractColumn('systemuserid', type, 'reuse', { requiredLevel: 'SystemRequired' }),+ contractColumn('azureactivedirectoryobjectid', type, 'reuse'),+ ], { ownershipType: 'BusinessOwned' }),+ ],+ };+}+test('manifest output is deterministic with complete coverage and dependency order', () => {const contract = createContract();const inputs = buildInputs(contract, basePlanningSnapshot());@@ -1370,6 +1416,122 @@ test('ordinary-column reuse requires complete compatible behavior evidence', ()}});+test('standard GUID columns verify reuse without blocking 14 dependent relationships', async () => {+ const contract = systemUserContract();+ const relationships = Array.from({ length: 14 }, (_, index) => ({+ kind: 'many-to-one',+ schemaName: `cr1_item_user${index}`,+ plannedDecision: 'reuse',+ parentTable: 'systemuser',+ childTable: 'cr1_item',+ lookup: {+ logicalName: `cr1_user${index}id`,+ schemaName: `cr1_user${index}id`,+ displayName: `User ${index}`,+ requiredLevel: 'None',+ },+ }));+ contract.tables.push(contractTable('cr1_item', 'reuse', 1, [+ contractColumn('cr1_name', 'string', 'reuse', { primaryName: true }),+ ...relationships.map((relationship) => contractColumn(+ relationship.lookup.logicalName,+ 'lookup',+ 'reuse',+ { lookupTarget: 'systemuser' },+ )),+ ], { relationships }));+ const item = table('cr1_item', [+ column('cr1_name', 'String', { primaryName: true }),+ ...relationships.map((relationship) => column(relationship.lookup.logicalName, 'Lookup', {+ lookupTargets: ['systemuser'],+ })),+ ], {+ manyToOneRelationships: relationships.map((relationship) => ({+ schemaName: relationship.schemaName,+ lookupColumn: relationship.lookup.logicalName,+ targetTable: 'systemuser',+ targetColumn: 'systemuserid',+ cascadeConfiguration: {+ Assign: 'NoCascade',+ Delete: 'RemoveLink',+ Merge: 'NoCascade',+ Reparent: 'NoCascade',+ Share: 'NoCascade',+ Unshare: 'NoCascade',+ RollupView: 'NoCascade',+ },+ })),+ });+ const inputs = buildInputs(contract, snapshot({+ tables: [await systemUserDetail(), item],+ }));+ const manifest = buildManifest(inputs);++ assert.equal(manifest.executable, true, JSON.stringify(manifest.summary));+ assert.equal(manifest.decisions.filter((decision) => decision.itemType === 'relationship').length, 14);+ assert.ok(manifest.decisions.every((decision) => (+ decision.decision === 'reuse'+ && decision.verificationStatus === 'verified'+ && decision.operation === 'none'+ )));+ assert.equal(manifest.summary.metadataOperationCount, 0);+ const validation = validateManifest(manifest, { ...inputs, requireExecutable: true });+ assert.equal(validation.valid, true, validation.errors.join('; '));+});++test('GUID plan spellings accept explicit null or zero SourceType from raw metadata', async () => {+ for (const sourceType of [null, 0]) {+ const user = await systemUserDetail({ SourceType: sourceType });+ for (const type of ['uniqueidentifier', 'Uniqueidentifier', 'UNIQUEIDENTIFIER', 'Unique identifier']) {+ const manifest = buildManifest(buildInputs(systemUserContract(type), snapshot({ tables: [user] })));+ assert.equal(manifest.executable, true, `${type}, SourceType=${sourceType}`);+ assert.equal(manifest.summary.metadataOperationCount, 0);+ }+ }+});++test('GUID reuse blocks missing or malformed raw SourceType instead of treating it as null', async () => {+ const sourceEvidence = [+ {},+ ...[undefined, '', '0', 'invalid', false, true, {}, [], 0.5]+ .map((SourceType) => ({ SourceType })),+ ];+ for (const evidence of sourceEvidence) {+ const manifest = buildManifest(buildInputs(systemUserContract(), snapshot({+ tables: [await systemUserDetail(evidence)],+ })));+ assert.equal(manifest.executable, false, JSON.stringify(evidence));+ for (const decision of manifest.decisions.filter((item) => item.itemType === 'column')) {+ assert.equal(decision.verificationStatus, 'unverified');+ assert.match(decision.reason, /SourceType evidence is missing/);+ }+ assert.equal(manifest.summary.metadataOperationCount, 0);+ }+});++test('GUID reuse still rejects specialized source types and incompatible column metadata', async () => {+ const cases = [+ ...[1, 2, 3, 4].map((SourceType) => ({+ sourceEvidence: { SourceType },+ reason: /ordinary column has SourceType/,+ })),+ { attributeOverrides: { AttributeType: 'String' }, reason: /type mismatch/ },+ { attributeOverrides: { AttributeTypeName: { Value: 'StringType' } }, reason: /type-name mismatch/ },+ { attributeOverrides: { AttributeTypeName: undefined }, reason: /type-name evidence is missing/ },+ { attributeOverrides: { RequiredLevel: undefined }, reason: /RequiredLevel evidence is missing/ },+ ];+ for (const { sourceEvidence, attributeOverrides, reason } of cases) {+ const manifest = buildManifest(buildInputs(systemUserContract(), snapshot({+ tables: [await systemUserDetail(sourceEvidence, attributeOverrides)],+ })));+ assert.equal(manifest.executable, false);+ assert.ok(manifest.decisions+ .filter((decision) => decision.itemType === 'column')+ .every((decision) => decision.verificationStatus !== 'verified' && reason.test(decision.reason)));+ assert.equal(manifest.summary.metadataOperationCount, 0);+ }+});+test('ordinary Memo and Lookup columns accept nullable Dataverse SourceType', () => {const lookupReconciliation = fullyAppliedSnapshot();lookupReconciliation.tablesdiff --git a/plugins/mobile-apps/scripts/tests/dataverse-planning-snapshot.test.js b/plugins/mobile-apps/scripts/tests/dataverse-planning-snapshot.test.jsindex 6ec90bb1a..cca2ae8d6 100644--- a/plugins/mobile-apps/scripts/tests/dataverse-planning-snapshot.test.js+++ b/plugins/mobile-apps/scripts/tests/dataverse-planning-snapshot.test.js@@ -1203,6 +1203,38 @@ test('exact-name expansion propagates terminal authentication failures', async ();});+test('snapshot preserves explicit null or integer SourceType without inventing absent evidence', async () => {+ const cases = [+ ...[null, 0, 1, 2, 3, 4].map((value) => ({ evidence: { SourceType: value }, expected: value })),+ { evidence: {} },+ ...[undefined, '', '0', 'invalid', false, true, {}, [], 0.5]+ .map((value) => ({ evidence: { SourceType: value } })),+ ];+ const table = await loadDetailedEntity(async (_method, apiPath) => ({+ status: 200,+ data: {+ value: apiPath.includes('/Attributes?$select=')+ ? cases.map(({ evidence }, index) => ({+ LogicalName: `new_guid${index}`,+ SchemaName: `new_Guid${index}`,+ AttributeType: 'Uniqueidentifier',+ AttributeTypeName: { Value: 'UniqueidentifierType' },+ ...evidence,+ }))+ : [],+ },+ }), entity('new_item', 'Item'));++ assert.equal(table.columns.length, cases.length);+ for (const [index, { expected }] of cases.entries()) {+ const column = table.columns[index];+ assert.equal(Object.hasOwn(column, 'sourceType'), expected !== undefined, `case ${index}`);+ assert.equal(column.sourceType, expected, `case ${index}`);+ assert.equal(column.type, 'Uniqueidentifier');+ assert.equal(column.typeName, 'UniqueidentifierType');+ }+});+test('computed metadata is explicitly unavailable when SourceTypeMask cannot be proven', async () => {const table = await loadDetailedEntity(async (_method, apiPath) => {if (apiPath.includes('/Attributes?$select=')) {diff --git a/plugins/mobile-apps/shared/references/dataverse-change-planning.md b/plugins/mobile-apps/shared/references/dataverse-change-planning.mdindex 2cd4c0d1f..4ebdc81e6 100644--- a/plugins/mobile-apps/shared/references/dataverse-change-planning.md+++ b/plugins/mobile-apps/shared/references/dataverse-change-planning.md@@ -81,6 +81,15 @@ snapshot with `render-dataverse-architect-evidence.js --validate-only` as therecipe requires. Never dispatch on failed/stale output. Agents read only thecompact sidecar; the full snapshot is an opaque validator input.+For existing GUID columns, use `uniqueidentifier` in the approved contract.+The verifier maps it to Dataverse's `Uniqueidentifier` / `UniqueidentifierType`;+standard `systemuser` GUID columns can remain `reuse`, without aliases or schema+writes. An explicitly present `SourceType: null` is valid for these columns+because they cannot be specialized ([SourceType metadata](https://learn.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.metadata.attributemetadata.sourcetype)).+Missing or malformed `SourceType` is not that evidence and must remain unverified.+After updating a verifier, regenerate the bounded execution-reconciliation+snapshot; do not repair cached metadata by inserting nulls or changing types.+## 3. Produce a proposal on every pathUse this handoff for the architect, including retries: