Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: col, line numbers on mdapi deploy errors #771

Merged
merged 2 commits into from
Oct 9, 2023

Conversation

mshanemc
Copy link
Contributor

@mshanemc mshanemc commented Oct 5, 2023

requires forcedotcom/source-deploy-retrieve#1130

What does this PR do?

  • show col/line numbers on component fails
  • sort the failures table better
  • remove duplicate failure reporting

What issues does this PR fix or reference?

forcedotcom/cli#356
@W-14247072@

@cristiand391
Copy link
Member

QA notes:

setup:
sf: @salesforce/cli/2.12.9 darwin-x64 node-v18.17.0
using dreamhouse, full deploy then modify GeocodingService apex class and try to deploy with invalid syntax in mdapi format:
sf project convert source --metadata ApexClass:GeocodingService --output-dir col-line-err

current scenario:
no col, line info in human output (but it is included in json), duplicate errors:
Screenshot 2023-10-09 at 11 32 13

Line:Column column in deploy failures, no duplicate errors:

➜  dreamhouse-lwc git:(main) ✗ sf project deploy start --metadata-dir col-line-err
Deploying <version specified in manifest> metadata to [email protected] using the v58.0 SOAP API.
Deploy ID: 0Af8N00000tvZrkSAE
Status: Failed | ████████████████████████████████████████ | 2/2 Components (Errors:2) | 0/0 Tests (Errors:0)

Component Failures [2]
===============================================================
| Type  Name             Problem                    Line:Column
| ───── ──────────────── ────────────────────────── ───────────
| Error GeocodingService Unexpected token 'static'. 2:12
| Error GeocodingService Unexpected token 'static'. 2:12

✅ json output

{
  "status": 1,
  "result": {
    "checkOnly": false,
    "completedDate": "2023-10-09T14:36:37.000Z",
    "createdBy": "0058N000004sBPj",
    "createdByName": "User User",
    "createdDate": "2023-10-09T14:36:35.000Z",
    "details": {
      "componentFailures": [
        {
          "changed": false,
          "columnNumber": 12,
          "componentType": "ApexClass",
          "created": false,
          "createdDate": "2023-10-09T14:36:36.000Z",
          "deleted": false,
          "fileName": "zip/classes/GeocodingService.cls",
          "fullName": "GeocodingService",
          "lineNumber": 2,
          "problem": "Unexpected token 'static'.",
          "problemType": "Error",
          "success": false
        },
        {
          "changed": false,
          "columnNumber": 12,
          "componentType": "ApexClass",
          "created": false,
          "createdDate": "2023-10-09T14:36:36.000Z",
          "deleted": false,
          "fileName": "zip/classes/GeocodingService.cls",
          "fullName": "GeocodingService",
          "lineNumber": 2,
          "problem": "Unexpected token 'static'.",
          "problemType": "Error",
          "success": false
        }
      ],
      "componentSuccesses": [
        {
          "changed": true,
          "componentType": "",
          "created": false,
          "createdDate": "2023-10-09T14:36:37.000Z",
          "deleted": false,
          "fileName": "zip/package.xml",
          "fullName": "package.xml",
          "success": true
        }
      ],
      "runTestResult": {
        "numFailures": 0,
        "numTestsRun": 0,
        "totalTime": 0,
        "codeCoverage": [],
        "codeCoverageWarnings": [],
        "failures": [],
        "flowCoverage": [],
        "flowCoverageWarnings": [],
        "successes": []
      }
    },
    "done": true,
    "id": "0Af8N00000tvYRWSA2",
    "ignoreWarnings": false,
    "lastModifiedDate": "2023-10-09T14:36:37.000Z",
    "numberComponentErrors": 2,
    "numberComponentsDeployed": 0,
    "numberComponentsTotal": 2,
    "numberTestErrors": 0,
    "numberTestsCompleted": 0,
    "numberTestsTotal": 0,
    "rollbackOnError": true,
    "runTestsEnabled": false,
    "startDate": "2023-10-09T14:36:36.000Z",
    "status": "Failed",
    "success": false,
    "files": [
      {
        "error": "Unexpected token 'static'.",
        "problemType": "Error",
        "columnNumber": 12,
        "lineNumber": 2,
        "fullName": "GeocodingService",
        "type": "ApexClass",
        "state": "Failed",
        "filePath": "classes/GeocodingService.cls"
      },
      {
        "error": "Unexpected token 'static'.",
        "problemType": "Error",
        "columnNumber": 12,
        "lineNumber": 2,
        "fullName": "GeocodingService",
        "type": "ApexClass",
        "state": "Failed",
        "filePath": "classes/GeocodingService.cls"
      }
    ]
  },
  "warnings": []
}

❓ why do we see 2 component failures for 1 apex class? is this something we can fix in SDR or is just the MD API response?

@mshanemc
Copy link
Contributor Author

mshanemc commented Oct 9, 2023

❓ why do we see 2 component failures for 1 apex class? is this something we can fix in SDR or is just the MD API response?

I think they came back like that. But we could definitely de-dupe them

@cristiand391
Copy link
Member

I think they came back like that. But we could definitely de-dupe them

Logged W-14262002 to track this 👍🏼

@cristiand391 cristiand391 merged commit dd27b0d into main Oct 9, 2023
36 checks passed
@cristiand391 cristiand391 deleted the sm/line-col-deploy-errors branch October 9, 2023 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants