isWatching/background task as preLaunchTask in launch.json

It would be nice to have a watcher task as preLaunchTask in launch.json. At the moment this is not possible because the launch task will not start before the preLaunchTask ends.
A long running preLaunchTask should have a regex similar to problemMatcher to wait for a specific text in the output window before executing the launch task.
In my scenario I'm running webpack dev server as a watcher task. I want this task to run if F5 is hit and the preLaunchTask is not running. To delay the debugger launch it would be useful to test for a specific string in the output window webpack: bundle is now VALID.

@skolmer it is possible to have a watcher task as a preLaunchTask in launch.json. Just checkout the VScode typescript extension template - it has a watching preLaunchTask.
What is your watch task, can you create a small reproducable sample for which we can try to reproduce this.
@dbaeumer I guess it might happen that I am not getting an 'inactive' event from the tasks framework for @skolmer use case

@isidorn This is the project boilerplate I'm working on. It has a watching task that runs webpack-dev-server. If you set development task as a prelauchTask in launch.json and hit F5 you can reproduce the described behavior.

@dbaeumer I double checked and I am not getting the Inactive event from the tasks framework in this case. Forwarding to you

@skolmer I see your point. AS a workaround couldn't you define a problemMatcher with a regexp not matching anything. In the problem matcher you then set the watching property to define regular expression that signals when the watching tasks begins and when it ends. An example of such a property for the tsc watching compilation mode is:
        "watching": {
            "activeOnStart": true,
            "beginsPattern": "^\\s*(?:message TS6032:|\\d{1,2}:\\d{1,2}:\\d{1,2} (?:AM|PM) -) File change detected\\. Starting incremental compilation\\.\\.\\.",
            "endsPattern": "^\\s*(?:message TS6042:|\\d{1,2}:\\d{1,2}:\\d{1,2} (?:AM|PM) -) Compilation complete\\. Watching for file changes\\."
        }

We should support defining watch begin / end pattern without a problem pattern as well.

@dbaeumer Thanks! I wasn't aware of the watching config. This did exactly what I wanted to achieve.
{
	"owner": "custom",
	"pattern": [],
	"watching": {
		"activeOnStart": true,
		"beginsPattern": "webpack: bundle is now INVALID",
		"endsPattern": "webpack: bundle is now VALID"
	}
}

It is showing The problem pattern is invalid. It must have at least a file, message and line or location match group. in the output but is working as expected.

@skolmer Great to see you got it working. I will keep this issue open to address the comment https://github.com/Microsoft/vscode/issues/6209#issuecomment-218154446

@dbaeumer I couldn't find any documentation about the watching config. Would be nice to have this feature in the docs https://code.visualstudio.com/Docs/editor/tasks#_defining-a-problem-matcher

@dbaeumer My workaround (https://github.com/Microsoft/vscode/issues/6209#issuecomment-218175415) stopped working in one of the latest insider builds. The prelaunch task is now failing. Do you have a suggestion how to fix this?

@skolmer how does the task fail?

@dbaeumer This is the error message:
Error: Invalid problemMatcher description. A matcher must at least define a pattern, owner and a file location. The problematic matcher is:
{
    "owner": "custom",
    "watching": {
        "activeOnStart": true,
        "beginsPattern": "^webpack: Compiling\\.\\.\\.$",
        "endsPattern": "^webpack: Compiled successfully\\.$"
    }
}

@skolmer Thanks.

@skolmer I looked into the real fix for this and it basically requires some major restructuring I only want to do for the new terminal runner. Basically we need to allow to defined watching patterns on the task level as well.
I found a way how you can make this work right now with a different work around. Define the problem matcher as follows:
			"problemMatcher": {
				"owner": "custom",
				"pattern": { "regexp": "__________" },
				"watching": {
					"activeOnStart": true,
					"beginsPattern": "^webpack: Compiling\\.\\.\\.$",
					"endsPattern": "^webpack: Compiled successfully\\.$"
				}
			}

As the regexp use a regular expression that doesn't match anything in the output.

As mention the real fix is to allow something like
{
    "taskName": "abc",
    "background": {
         "activeOnStart": true,
         "beginsPattern": "^webpack: Compiling\\.\\.\\.$",
         "endsPattern": "^webpack: Compiled successfully\\.$"
    }
}

Thanks for the workaround!

Moving to Mai due to shifted priorities.

Another important part of this enhancement is to terminate the preLaunch watch task when the debugging session is ended.

@AshleyGrant nice idea. Can you please open a separate issue since this should be done via the debugger. @isidorn FYI.

@dbaeumer done. Another thought I've had regarding this issue is that a check should be done to see if the watching task is already running. In that situation, a duplicate task probably should not be launched.

Any recent updates on this? I'm also hitting this using a webpack hot-reload server to debug an electron app. :D

Any updates on this?

You can now run tasks as background tasks: https://code.visualstudio.com/docs/editor/tasks#_background-watching-tasks

This still doesn't really fully cover what the feature request is. Currently, I have to launch the background task and then launch a debugging session.

I was able to configure VS Code to launch both with the following config:
tasks.json
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "gulp",
            "label": "build",
            "task": "webpack-watch-dev", // gulp webpack-watch-dev is the gulp task I want to run in the background
            "isBackground": true,
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

launch.json
{
    // Use IntelliSense to learn about possible Node.js debug attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "${workspaceRoot}/server/index.js",
            "env": {
                "NODE_ENV": "development"
            },
            "preLaunchTask": "build",
            "console": "integratedTerminal"
        }
     ]
}

Well, I stand corrected.. Maybe someone from the VS Code team can look at removing that prompt, or giving a configuration to make it go away.

Yeah, I've been meaning to confirm it's an actual bug (and not just something caused by code, as my build task does take a bit to fully start), and file an issue if so.

I cannot get this to work. Am I misunderstanding the intent of the current design?
I am trying to run debugging with chrome from launch.json, running webpack-dev-server, with chrome only launching after the server is running.
Instead, the launch task (Chrome) always executes immediately (before the server is initialized) if the task has isBackground set to true.
I thought I should be able to accomplish this by adding the dummy regex to the problem matcher on webpack-dev-server, and adding the begin/end regex to the background property on the problem matcher. However, the regexes in the problem matcher do not appear to affect anything (aside from that the task cannot be terminated if the main regex is omitted).
Chrome is run from a compound configuration in launch.json:
{
   "version": "0.2.0",
   "configurations": [
        {
            // ...
        },
        {
            "name": "Launch_Chrome",
            "type": "chrome",
            "request": "launch",
            "url": "http://localhost:8080",
            "preLaunchTask": "webpack_dev_server_task",
        }
    ],
    "compounds": [
        {
            "name": "Compound",
            "configurations": [
                // ...
                "Launch_Chrome"
            ]
        }
    ]
}

and webpack-dev-server is run from tasks.json:
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "webpack_dev_server_task",
            "command": "webpack-dev-server",
            "dependsOn": [
                "build_webpack_task"
            ],
            "type": "shell",
            "isBackground": true,
            "problemMatcher": {
                "owner": "custom",
                "pattern": {
                    "regexp": "_____"
                },
                "background": {
                    "activeOnStart": false,
                    "beginsPattern": "^.*Project is running at.*$",
                    "endsPattern": "^.*webpack: Compiled successfully..*$"
                },
            }
        }
    ]
}

@dbaeumer none of solutions mentioned above work for me (I am using 1.23.1). I have tried
"isBackground": true , "problemMatcher" regexp  ...
Still, I can see after my preLaunchTask (to start the webpack server) finished, launch.json did not launch chrome. Only after I killed preLaunchTask did it launch chrome.

Does the webpack output contain the lines Project is running at and webpack: Compiled successfully

@dbaeumer Hello Dirk, has there been any progress on this matter? I'm having a hard time setting up a rather basic configuration with a launch configuration which runs and debugs a .netcore app, as prelaunch I need to call two tasks: one npm task to do build stuff and a second watching task for webpack devserver.
For the watching task I want to use the tsc-watch problem solver to get hints to my code when it does not compile. Is this supposed to get easier at some point in the future?

No progress yet. For the watching task: does it only compile or do you want to wait until the wepkack server is running?

Did something change in the latest update? In a previous project, I was able to get my angular front end task to run and then debug the back end using the following tasks.json code:
            "command": "ng serve",
            "isBackground": true,
            "problemMatcher": [
                "$tsc-watch",
                {
                    "owner": "typescript",
                    "pattern": {
                        "regexp": "^([^\\s].*)\\((\\d+|\\,\\d+|\\d+,\\d+,\\d+,\\d+)\\):\\s+(error|warning|info)\\s+(TS\\d+)\\s*:\\s*(.*)$",
                        "file": 1,
                        "location": 2,
                        "severity": 3,
                        "code": 4,
                        "message": 5
                    },
                    "background": {
                        "activeOnStart": true,
                        "beginsPattern": "^\\s*\\d{1,2}:\\d{1,2}:\\d{1,2}(?: AM| PM)? - File change detected\\. Starting incremental compilation\\.\\.\\.",
                        "endsPattern": "^webpack: Compiled successfully."
                    }
                }
            ]

I haven't used that in a month or so because I'm on a new project. I tried to do the same thing as before, but it doesn't work.
My new code is:
        {
            "label": "ModelAgentFrontEnd",
            "identifier": "ModelAgentFrontEnd",
            "type": "shell",
            "command": "ng serve",
            "options": {
                "cwd": "../ModelAgentFrontEnd"
            },
            "presentation": {
                "reveal": "always",
                "panel": "new"
            },
            "isBackground": true,
            "problemMatcher": [
                "$tsc-watch",
                {
                    "owner": "typescript",
                    "pattern": {
                        "regexp": "^([^\\s].*)\\((\\d+|\\,\\d+|\\d+,\\d+,\\d+,\\d+)\\):\\s+(error|warning|info)\\s+(TS\\d+)\\s*:\\s*(.*)$",
                        "file": 1,
                        "location": 2,
                        "severity": 3,
                        "code": 4,
                        "message": 5
                    },
                    "background": {
                        "activeOnStart": true,
                        "beginsPattern": "^Your global Angular CLI version.*",
                        "endsPattern": "^webpack: Compiled successfully.*"
                    }
                }
            ]
        }

Any ideas as to why this doesn't work anymore? Did this stop working for anyone else?

Actually no. How does the output of the task look like?

It is a typical ng serve output. I didn't get fancy with regex at all, to make sure it works. The output is below:
Your global Angular CLI version (1.6.5) is greater than your local
version (1.6.0). The local Angular CLI version is used.

To disable this warning use "ng set --global warnings.versionMismatch=false".

<EMAIL_ADDRESS>requires<EMAIL_ADDRESS><2.5.0' but 2.6.2 was found instead.
Using this version can result in undefined behaviour and difficult to debug problems.

Please run the following command to install a compatible version of TypeScript.

    npm install<EMAIL_ADDRESS><2.5.0'

To disable this warning run "ng set warnings.typescriptMismatch=false".

** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2018-06-14T18:31:45.847Z
Hash: 1b793a4a1ae8dc08feec
Time: 11918ms
chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 657 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 607 kB [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 363 kB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 11.7 MB [initial] [rendered]

webpack: Compiled successfully.

For this output activeOnStart needs to be false this the begin pattern is present even on the first run.

I have the same problem with a Node.js app running inside a container locally. I have a bash script setting up the container and I can't attach the debugger using preLaunchTask.
I am using:
,
      "problemMatcher": {
        "pattern": [{
          "regexp": "!!!DO NOT MATCH ME!!!",
          "file": 1,
          "location": 2,
          "message": 3
        }],
        "background": {
          "activeOnStart": true,
          "beginsPattern": "^.+Debugger listening.+",
          "endsPattern": "-----"
        }
      }

And my output is
[nodemon] 1.18.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node --expose-gc --inspect=<IP_ADDRESS> server.js || exit 1`
Debugger listening on ws://<IP_ADDRESS>:9229/ad551785-a8ff-47af-8e98-3e5890889205
For help, see: https://nodejs.org/en/docs/inspector
{
  "level": "info",
  "message": "server up @ http://localhost:5000"
}

When I change beginsPattern to something that doesn't match anything I get the Dialog with "Debug Anyway" when I do match something it just hangs.
If I run the task and then attach manually it works.

@kilianc your ends pattern needs to match as well. This tells the debugger that the task actually has finished.

@dbaeumer in my case is a server running, so end of the process is the end of the task. I don't log anything on exit but I only ^+C.
I am confused on how the end of the task is going to affect the debugger attaching itself. Does the debugger wait for the task to be complete?

@dbaeumer !!!!
"beginsPattern": "^Debugger listening.+$",
"endsPattern": "^For help.+$"

IT WORKS!

@dbaeumer seems like this hasn't moved in a while.
Is this feature still desired (I see it in the backlog) or should it be ditched entirely?
If this is something we'd like to have, is there a way we could break down the necessary steps to get it done?

@synthkaf this is still on the list. That is why it is On Deck. The reason why it didn't get more tracking so far is that there is a reasonable workaround (a stupid problem pattern).
But we just discussed this last week to decide what it means to make the pattern optional. Internally not a big issue but it has impact on the API as well.

I'm able to use the workaround @skolmer outlines, but with a slight modification. You do not need to provide a pattern if you set base, as the following does:
      {
        "label": "Start for Debugger",
        "type": "npm",
        "script": "start",
        "problemMatcher": [
          {
            "base": "$tsc-watch", // <-- extends the TypeScript watcher
            "background": {
              "activeOnStart": true,
              "beginsPattern": "Angular Live Development Server is listening",
              "endsPattern": "｢wdm｣: Compiled successfully"
            }
          }
        ],
        "isBackground": true,
        "group": "build"
      }

You still have to manually stop ng serve after disconnecting the debugger unless you add a postDebugTask to run a shell command to stop ng serve.

This just broke for me. I haven't changed anything, but now the task is never signaled as complete:
launch.json
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Chrome Docs Debug",
      "type": "chrome",
      "request": "launch",
      "preLaunchTask": "npm: start:docs",
      "url": "http://localhost:8080/",
      "webRoot": "${workspaceFolder}/test",
      "sourceMapPathOverrides": {
        "webpack:///./*":"${workspaceRoot}/*",
      }
  },
  ]
}

tasks.json
{
  "version": "2.0.0",
  "tasks": [
    {
      "type": "npm",
      "script": "start:docs",
      "isBackground": true,
      "problemMatcher": [{
        "owner": "webpack",
        "source": "webpack",
        "fileLocation": "absolute",
        "severity": "error",
        "pattern": [{
          "regexp": "^ERROR in (.*)$",
        }, {
          "regexp": "^.*$"
        }, {
          "regexp": "^([^:]*): ([^:]*): ([^\\(]*) \\((\\d+):(\\d+)\\)$",
          "file": 2,
          "message": 3,
          "line": 4,
          "column": 5
        }],
        "background": {
          "activeOnStart": true,
          "beginsPattern": "^.*: Hash: *$",
          "endsPattern": "^.*(Compiled successfully)|(Failed to compile).*$"
        }
      }]
    }
  ]
}

Chrome Debugger doesn't trigger anymore because it thinks the task isn't complete. When I kill the task (with the trash icon), then I get the usual popup to continue debugging.

Just realized, it's quite possibly from https://github.com/Microsoft/vscode/issues/65472

Status on this? I want to set up a launch task to start azurite first and then start the azure functions host before launching the powershell debug, and I can't because of this issue if I make the functions host task dependson azurite.
I'm going to look into the biu program to "consolidate" it to one task maybe as a workaround.

It looks like the workarounds expressed here no longer work (seeing the same behavior as https://github.com/microsoft/vscode/issues/6209#issuecomment-449052178)

@alexr00 can you please have a look. If you need explanation please step by.

@dbaeumer I think I understand the issue. I'll check whether the problem matcher work around still works.

Running into this, the answer from Mike Wyatt worked for me:
https://stackoverflow.com/questions/44242048/how-to-make-vscode-not-wait-for-finishing-a-prelaunchtask

I tested with this as a prelaunch task:
		{
			"type": "npm",
			"script": "watch",
			"problemMatcher": "$tsc-watch",
			"isBackground": true,
			"presentation": {
				"reveal": "never"
			},
			"group": {
				"kind": "build",
				"isDefault": true
			}
		}

The work around to use a watching problem matcher is still good.

I have the same problem, trying to run nodemon as a prelaunch task. Workaround for now is to use the answer from this SO: https://stackoverflow.com/questions/44242048/how-to-make-vscode-not-wait-for-finishing-a-prelaunchtask
However, I just rely on the debugger attachment timeout to be long enough. Is there anyway to signal debugger to wait until nodemon actually starts node (there are build and lint tasks execution before nodemon, so timeout sometimes is not enough)?

Today all of the previously good workarounds have stopped working for me. No matter what I do I cannot get the debugging to start after a watching prelaunchTask.

Came here just to remind that none of the workarounds works as today

Came here just to remind that none of the workarounds works as today

@eathtespagheti Actually I've managed to set up a chain of two dependent background tasks with VS Code 1.64. The trick is to carefully write the endsPattern for the first task in the chain so it indeed matches the line indicating that the background service has started

Came here just to remind that none of the workarounds works as today

@eathtespagheti Actually I've managed to set up a chain of two dependent background tasks with VS Code 1.64. The trick is to carefully write the endsPattern for the first task in the chain so it indeed matches the line indicating that the background service has started

Can you post an example?

Can you post an example?

@eathtespagheti Sure:
tasks.json
{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "npm",
			"script": "testbed",
			"label": "npm: testbed",
			"detail": "node client-test-bed/serve.js",
			"isBackground": true,
			"dependsOn": [
				"npm: watch"
			],
			"problemMatcher": {
				"pattern": [
					{
						"regexp": ".",
						"file": 1,
						"location": 2,
						"message": 3
					}
				],
				"background": {
					"activeOnStart": true,
					"beginsPattern": ".",
					"endsPattern": "."
				}
			}
		},
		{
			"type": "npm",
			"script": "build",
			"group": "build",
			"problemMatcher": [],
			"label": "npm: build",
			"detail": "rollup -c"
		},
		{
			"type": "npm",
			"script": "watch",
			"group": "build",
			"problemMatcher": {
				"pattern": [
					{
						"regexp": ".",
						"file": 1,
						"location": 2,
						"message": 3
					}
				],
				"background": {
					"activeOnStart": true,
					"beginsPattern": "^\\[nodemon\\]\\s(starting|restarting)",
					"endsPattern": "^\\[nodemon\\]\\sclean\\sexit\\s\\-\\swaiting\\sfor\\schanges"
				}
			},
			"isBackground": true,
			"label": "npm: watch",
			"detail": "npm-watch"
		}
	]
}

launch.json
{
  "configurations": [
    {
      "name": "Launch Test Bed in Chrome",
      "request": "launch",
      "type": "pwa-chrome",
      "url": "http://localhost:3000",
      "pathMapping": {
        "/": "${workspaceFolder}/client-test-bed",
        "/scripts": "${workspaceFolder}/dist/esm"
      },
      "preLaunchTask": "npm: testbed"
    }]
}

Today all of the previously good workarounds have stopped working for me. No matter what I do I cannot get the debugging to start after a watching prelaunchTask.

If nothing else works you can use just "isBackground": true without a problem matcher which will prompt to debug anyway after a timeout. Or use a shell task with some magic like I explained in #151101.

These problem matchers do not work for me. I'm trying to have a preLaunchTask start up a docker-compose. I prefer this to using the built in docker compose task because using a task produces the logs and all the output in the terminal window and the docker stuff can be shutdown by hitting CTRL+C in that terminal window. It's better. BUT, I cant use it this way because I cannot get the problem matcher to work. The problem matchers are insufficiently documented. The documentation doesnt even use the term 'regular expression'. It is unclear if there any constraints on the 'endsPattern'. It is unclear if there is any connection to the 'pattern.regexp', or 'pattern.file' etc.
It seems like a very simple feature for VSCode and something it should have. I'm dissapointed that it is so low priority.
My use case is this:

docker-compose up debug-server
attach remote debugger in vscode to the debug server

This seems like a very standard workflow.
All the related github issues around this topic show a consistent pattern of confused and dissapointed users. Saying things like "I got it to work" then "It doesnt work anymore".
Here's my attempt to write a 'endsPattern'. Honestly it's gross.
			"label": "Docker Compose Up Debug",
			"type": "shell",
			"isBackground": true,
			"command": "./scripts/dlv_start.sh",
			"problemMatcher": {
				"owner": "custom",
				"pattern": {
					"regexp": "__________________"
				},
				"background": {
					"activeOnStart": true,
					"beginsPattern": ".*",
					"endsPattern": ".*API server listening.*"
				}
			}
		},


CLIPVIT error: Model ViT-B/16 not found; available models=['RN50', 'ViT-B/32']

Do I have to modify the clip code?

Using official clip repo by following lines solved my issue.
$ conda install --yes -c pytorch pytorch=1.7.1 torchvision cudatoolkit=11.0
$ pip install ftfy regex tqdm
$ pip install git+https://github.com/openai/CLIP.git

Installing clip-by-openai would lead to my problem


Polymorphic extends using enum for the type when using @@delegate

Description and expected behavior
A clear and concise description of what the bug is and what's the expected behavior.
Does the polymorphism support using enum's for the @@delegate? I am looking at git clone https://github.com/zenstackhq/docs-tutorial-nextjs.git specifically the polymorphic branch.
You have the following but use String for content type. If I wanted to use an enumerated type property how would that work? How does the two extended models know which property they are associated with?
enum ContentType {
  POST
  IMAGE
}

model Content {
  id String @id @default(cuid())
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  published Boolean @default(false)
  author User @relation(fields: [authorId], references: [id])
  authorId String
  contentType ContentType
  likes Like[]

  @@delegate(contentType)
  // author has full access
  @@allow('all', auth() == author)
  // logged-in users can view published posts
  @@allow('read', auth() != null && published)
}

model Post extends Content {
  title String
}

model Image extends Content {
  url String
}

Error:
prisma:query SELECT 1
prisma:query BEGIN
prisma:error
Invalid `db[model].create()` invocation in
/Users/sigex/workdir/docs-tutorial-nextjs/node_modules/@zenstackhq/runtime/enhancements/delegate.js:340:44

  337 if (this.options.logPrismaQuery) {
  338     this.logger.info(`[delegate] \`create\` ${this.getModelName(model)}: ${(0, utils_1.formatObject)(args)}`);
  339 }
→ 340 const result = yield db[model].create({
        data: {
          title: "sadsad",
          delegate_aux_content: {
            create: {
              contentType: "Post",
                           ~~~~~~
              authorId: "clutm64xr0004nfjmm7l9l5hi"
            }
          }
        },
        select: {
          id: true
        }
      })

Invalid value for argument `contentType`. Expected ContentType.

create table
  public.content (
    id text not null,
    "createdAt" timestamp without time zone not null default current_timestamp,
    "updatedAt" timestamp without time zone not null,
    published boolean not null default false,
    "authorId" text not null,
    "contentType" public.ContentType not null,
    constraint content_pkey primary key (id),
    constraint content_authorId_fkey foreign key ("authorId") references "User" (id) on update cascade on delete restrict
  ) tablespace pg_default;

  create table
  public.image (
    id text not null,
    url text not null,
    constraint image_pkey primary key (id),
    constraint image_id_fkey foreign key (id) references content (id) on update cascade on delete cascade
  ) tablespace pg_default;

  create table
  public.post (
    id text not null,
    title text not null,
    constraint post_pkey primary key (id),
    constraint post_id_fkey foreign key (id) references content (id) on update cascade on delete cascade
  ) tablespace pg_default;

Screenshots
If applicable, add screenshots to help explain your problem.
Before changing contentType to an enum the types for the contentType in index.tsx are;

Generated types;
    export type ContentSelect<ExtArgs extends $Extensions.Args = $Extensions.DefaultArgs> = $Extensions.GetSelect<{
        id?: boolean
        createdAt?: boolean
        updatedAt?: boolean
        published?: boolean
        authorId?: boolean
        contentType?: boolean
        author?: boolean | UserDefaultArgs<ExtArgs>
        likes?: boolean | Content$likesArgs<ExtArgs>
        _count?: boolean | ContentCountOutputTypeDefaultArgs<ExtArgs>
    }, ExtArgs["result"]["content"]>;
    export type ContentSelectScalar = {
        id?: boolean
        createdAt?: boolean
        updatedAt?: boolean
        published?: boolean
        authorId?: boolean
        contentType?: boolean
    };
    export type ContentInclude<ExtArgs extends $Extensions.Args = $Extensions.DefaultArgs> = {
        author?: boolean | UserDefaultArgs<ExtArgs>
        likes?: boolean | Content$likesArgs<ExtArgs>
        _count?: boolean | ContentCountOutputTypeDefaultArgs<ExtArgs>
    };
    export type $ContentPayload<ExtArgs extends $Extensions.Args = $Extensions.DefaultArgs> = ($PostPayload<ExtArgs> & { scalars: { contentType: 'Post' } }) | ($ImagePayload<ExtArgs> & { scalars: { contentType: 'Image' } });
    type ContentGetPayload<S extends boolean | null | undefined | ContentDefaultArgs> = $Result.GetResult<Prisma.$ContentPayload, S>;
    type ContentCountArgs<ExtArgs extends $Extensions.Args = $Extensions.DefaultArgs> = Omit<ContentFindManyArgs, 'select' | 'include'> & {
        select?: ContentCountAggregateInputType | true
    };
    ```

After

<img width="1527" alt="image" src="https://github.com/zenstackhq/zenstack/assets/4559650/49b5c482-f592-45ce-8337-483171f5c430">

<img width="1459" alt="image" src="https://github.com/zenstackhq/zenstack/assets/4559650/9a807198-6c9e-459a-9e0e-80afe04738a1">

`content` is of type `never`.

```ts
    export type ContentSelect<ExtArgs extends $Extensions.Args = $Extensions.DefaultArgs> = $Extensions.GetSelect<{
        id?: boolean
        createdAt?: boolean
        updatedAt?: boolean
        published?: boolean
        authorId?: boolean
        contentType?: boolean
        author?: boolean | UserDefaultArgs<ExtArgs>
        likes?: boolean | Content$likesArgs<ExtArgs>
        _count?: boolean | ContentCountOutputTypeDefaultArgs<ExtArgs>
    }, ExtArgs["result"]["content"]>;
    export type ContentSelectScalar = {
        id?: boolean
        createdAt?: boolean
        updatedAt?: boolean
        published?: boolean
        authorId?: boolean
        contentType?: boolean
    };
    export type ContentInclude<ExtArgs extends $Extensions.Args = $Extensions.DefaultArgs> = {
        author?: boolean | UserDefaultArgs<ExtArgs>
        likes?: boolean | Content$likesArgs<ExtArgs>
        _count?: boolean | ContentCountOutputTypeDefaultArgs<ExtArgs>
    };
    export type $ContentPayload<ExtArgs extends $Extensions.Args = $Extensions.DefaultArgs> = ($PostPayload<ExtArgs> & { scalars: { contentType: 'Post' } }) | ($ImagePayload<ExtArgs> & { scalars: { contentType: 'Image' } });
    type ContentGetPayload<S extends boolean | null | undefined | ContentDefaultArgs> = $Result.GetResult<Prisma.$ContentPayload, S>;
    type ContentCountArgs<ExtArgs extends $Extensions.Args = $Extensions.DefaultArgs> = Omit<ContentFindManyArgs, 'select' | 'include'> & {
        select?: ContentCountAggregateInputType | true
    };

And as you can see the types generated are not using the enum type. Nor is there a way to specify which type each of the extending models are using.
Environment (please complete the following information):

ZenStack version: 2.0.0-beta.8
Prisma version: 5.2.0
Database type: Postgresql

Additional context
Add any other context about the problem here.

Might not be a bug but it is unclear how the two extends models know which type they are when using enum.

Right! since you can use Pascal case enum keys you can actually name the types with the same pattern as the original and it will work!
enum ContentType {
  Post
  Image

  @@schema("public")
}

model Content {
  id String @id @default(cuid())
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  published Boolean @default(false)
  author User @relation(fields: [authorId], references: [id])
  authorId String
  contentType ContentType
  likes Like[]

  @@delegate(contentType)
  // author has full access
  @@allow('all', auth() == author)
  // logged-in users can view published posts
  @@allow('read', auth() != null && published)

  // Try using enum
  // Had another model that has delegates related to content
  // @@map

  // @@map("content")
  @@schema("public")
}

model Post extends Content {
  title String

  // @@map("post")
}

model Image extends Content {
  url String

  // @@map("image")
}

You can also put @@map back but ensure the enum values remain Pascal case otherwise it will blow up in your face.
enum ContentType {
  Post
  Image

  @@schema("public")
}

model Content {
  id String @id @default(cuid())
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  published Boolean @default(false)
  author User @relation(fields: [authorId], references: [id])
  authorId String
  contentType ContentType
  likes Like[]

  @@delegate(contentType)
  // author has full access
  @@allow('all', auth() == author)
  // logged-in users can view published posts
  @@allow('read', auth() != null && published)

  // Try using enum
  // Had another model that has delegates related to content
  // @@map

  @@map("content")
  @@schema("public")
}

model Post extends Content {
  title String

  @@map("post")
}

model Image extends Content {
  url String

  @@map("image")
}

Hi @gruckion , thanks for bringing this up. Yes, as you've discovered, currently the discriminator field is totally name-based. If you use an enum, the enum field names much match the model names. I understand it's not ideal.
I'll try to add some documentation and probably also let zmodel validation report errors when the names don't match for now.

Hi @gruckion , thanks for bringing this up. Yes, as you've discovered, currently the discriminator field is totally name-based. If you use an enum, the enum field names must match the model names. I understand it's not ideal.
I'll try to add some documentation and probably also let zmodel validation report errors when the names don't match for now.

Sounds good, documentation should be sufficient in the short term.
We decided to remove this from the project, me and another senior dev looked at adding it into our project as we didn't want to have verbose code. But unfortunately the build flow seems to be troubled at the moment.
We ran into issues with the types not refreshing and the executed queries being wrong until we rebooted VSCode and secondly rebooted the NextJS dev server.
Here's the schema we was trying to model.
  id String @id @default(uuid())
  locations Location[]
}

model Location {
  id String @id @default(uuid())
  entity Entity @relation(fields: [entityId], references: [id])
  entityId String
}

model Meter {
  id String @id @default(uuid())
  meterType MeterType
  usage Usage[]
  supplier Supplier[]
}

model TypeAMeter extends Meter {
  id String @id @default(uuid())
  meter Meter @relation(fields: [meterId], references: [id])
  meterId String
}

model TypeBMeter extends Meter {
  id String @id @default(uuid())
  meter Meter @relation(fields: [meterId], references: [id])
  meterId String
}

model ItemList {
  id String @id @default(uuid())
  items Item[]
}

model Item {
  id String @id @default(uuid())
  itemList ItemList @relation(fields: [itemListId], references: [id])
  itemListId String
}

model TypeAItem extends Item {
  id String @id @default(uuid())
  item Item @relation(fields: [itemId], references: [id])
  itemId String
}

model TypeBItem extends Item {
  id String @id @default(uuid())
  item Item @relation(fields: [itemId], references: [id])
  itemId String
}

model Usage {
  id String @id @default(uuid())
}

model TypeAUsage extends Usage {
  id String @id @default(uuid())
  usage Usage @relation(fields: [usageId], references: [id])
  usageId String
}

model TypeBUsage extends Usage {
  id String @id @default(uuid())
  usage Usage @relation(fields: [usageId], references: [id])
  usageId String
}

model Supplier {
  id String @id @default(uuid())
}

model TypeASupplier extends Supplier {
  id String @id @default(uuid())
  supplier Supplier @relation(fields: [supplierId], references: [id])
  supplierId String
}

model TypeBSupplier extends Supplier {
  id String @id @default(uuid())
  supplier Supplier @relation(fields: [supplierId], references: [id])
  supplierId String
}

We want to generate an ItemList for a specific meter at a specific Location for a specific Entity. That ItemList is specific to the user's current Supplier and Usage. We want to avoid littering the application code with a lot of is this meterType TypeA or TypeB?.
Our tech stack:

NextJS
Pnpm monorepo
Turbo repo
tRPC
Supabase

Addressed in documentation here: https://zenstack.dev/docs/guides/polymorphism.
I'm closing this issue for now.


dpm command unable to set device owner

After installing the cosu comple app, once i run the command
adb shell dpm set-device-owner com.google.codelabs.cosu/.DeviceAdminReceiver
I get the following error
Trying to set device owner but device is already provisioned.
Other details about this is :

Just remove the all account from google and the try


[TS migration] Migrate 'CloseAccount.js' lib to TypeScript

Details
Migration of CloseAccount.js to Typescript.
Fixed Issues
$ https://github.com/Expensify/App/issues/24843
PROPOSAL: N/A
Tests

[x] Verify that no errors appear in the JS console

Offline tests
N/A
QA Steps
N/A
PR Author Checklist

[x] I linked the correct issue in the ### Fixed Issues section above
[x] I wrote clear testing steps that cover the changes made in this PR

[x] I added steps for local testing in the Tests section
[x] I added steps for the expected offline behavior in the Offline steps section
[x] I added steps for Staging and/or Production testing in the QA steps section
[x] I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
[x] I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
[x] I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).

[x] I included screenshots or videos for tests on all platforms
[x] I ran the tests on all platforms & verified they passed on:

[x] Android / native
[x] Android / Chrome
[x] iOS / native
[x] iOS / Safari
[x] MacOS / Chrome / Safari
[x] MacOS / Desktop

[x] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
[x] I followed proper code patterns (see Reviewing the code)

[x] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
[x] I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
[x] I verified that comments were added to code that is not self explanatory
[x] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
[x] I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method

[x] If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:

[x] I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
[x] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
[x] I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
[x] I verified the JSDocs style guidelines (in STYLE.md) were followed

[x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
[x] I followed the guidelines as stated in the Review Guidelines
[x] I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
[x] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
[x] I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
[x] I verified that if a function's arguments changed that all usages have also been updated correctly
[x] If a new component is created I verified that:

[x] A similar component doesn't exist in the codebase
[x] All props are defined accurately and each prop has a /** comment above it */
[x] The file is named correctly
[x] The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
[x] The only data being stored in the state is data necessary for rendering and nothing else
[x] If we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
[x] For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
[x] Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
[x] All JSX used for rendering exists in the render method
[x] The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions

[x] If any new file was added I verified that:

[x] The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory

[x] If a new CSS style is added I verified that:

[x] A similar style doesn't already exist
[x] The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))

[x] If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
[x] If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
[x] If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
[x] If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
[x] If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
[x] If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
[x] I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
https://github.com/Expensify/App/assets/46095609/9fe2312a-3c65-49f8-936b-a1511b8db6df

Mobile Web - Chrome
https://github.com/Expensify/App/assets/46095609/0d8e7593-bb80-42b7-9c47-23b956bcaee5

Mobile Web - Safari
https://github.com/Expensify/App/assets/46095609/4d55ead7-e2f5-44e4-a4d7-c072c597d2b0

Desktop
https://github.com/Expensify/App/assets/46095609/f3e52b90-8af7-462d-8385-e8f7a5af4148

iOS
https://github.com/Expensify/App/assets/46095609/19f96a6d-686a-4c8c-a1e3-e697df7cacf2

Android
https://github.com/Expensify/App/assets/46095609/b2067a55-3120-4e8f-b90d-25a114ea507d

On hold until https://github.com/Expensify/App/pull/27230 is merged (tests are failing due to onyx package bump)

Reviewer Checklist

[x] I have verified the author checklist is complete (all boxes are checked off).
[x] I verified the correct issue is linked in the ### Fixed Issues section above
[x] I verified testing steps are clear and they cover the changes made in this PR

[x] I verified the steps for local testing are in the Tests section
[x] I verified the steps for Staging and/or Production testing are in the QA steps section
[x] I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
[x] I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)

[x] I checked that screenshots or videos are included for tests on all platforms
[x] I included screenshots or videos for tests on all platforms
[x] I verified tests pass on all platforms & I tested again on:

[x] Android / native
[x] Android / Chrome
[x] iOS / native
[x] iOS / Safari
[x] MacOS / Chrome / Safari
[x] MacOS / Desktop

[x] If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
[x] I verified proper code patterns were followed (see Reviewing the code)

[x] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
[x] I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
[x] I verified that comments were added to code that is not self explanatory
[x] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
[x] I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
[x] I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
[x] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
[x] I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
[x] I verified the JSDocs style guidelines (in STYLE.md) were followed

[x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
[x] I verified that this PR follows the guidelines as stated in the Review Guidelines
[x] I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
[x] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
[x] I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
[x] If a new component is created I verified that:

[x] A similar component doesn't exist in the codebase
[x] All props are defined accurately and each prop has a /** comment above it */
[x] The file is named correctly
[x] The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
[x] The only data being stored in the state is data necessary for rendering and nothing else
[x] For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
[x] Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
[x] All JSX used for rendering exists in the render method
[x] The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions

[x] If any new file was added I verified that:

[x] The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory

[x] If a new CSS style is added I verified that:

[x] A similar style doesn't already exist
[x] The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)

[x] If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
[x] If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
[x] If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
[x] If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
[x] If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
[x] If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
[x] I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
https://github.com/Expensify/App/assets/20051562/a52ea073-a605-4345-935f-8ccc59343bd8
https://github.com/Expensify/App/assets/20051562/4ade2286-4bf1-4fb7-ac48-1bdf83e93aa4

Desktop
https://github.com/Expensify/App/assets/20051562/8967aee1-bd8e-4943-864a-9264e99af230

Mobile Web - Chrome
https://github.com/Expensify/App/assets/20051562/2b05909b-a29d-47c3-8f51-2ade37a2a016

Android
https://github.com/Expensify/App/assets/20051562/8397e54e-1e71-4537-a11b-8523ac03810f

Mobile Web - Safari
https://github.com/Expensify/App/assets/20051562/452e2ad1-ed60-45ee-ab0a-dd4235dd4b40

iOS
https://github.com/Expensify/App/assets/20051562/1211ef5a-a859-44cb-8a16-4552325217c4

🚀 Deployed to staging by https://github.com/neil-marcellini in version: 1.3.75-0 🚀

platform
result

🤖 android 🤖
success ✅

🖥 desktop 🖥
success ✅

🍎 iOS 🍎
success ✅

🕸 web 🕸
success ✅

🚀 Deployed to production by https://github.com/mountiny in version: 1.3.75-12 🚀

platform
result

🤖 android 🤖
success ✅

🖥 desktop 🖥
success ✅

🍎 iOS 🍎
failure ❌

🕸 web 🕸
success ✅

🚀 Deployed to staging by https://github.com/neil-marcellini in version: 1.3.76-0 🚀

platform
result

🤖 android 🤖
success ✅

🖥 desktop 🖥
success ✅

🍎 iOS 🍎
success ✅

🕸 web 🕸
success ✅

🚀 Deployed to production by https://github.com/mountiny in version: 1.3.76-6 🚀

platform
result

🤖 android 🤖
success ✅

🖥 desktop 🖥
success ✅

🍎 iOS 🍎
failure ❌

🕸 web 🕸
success ✅


Duplicate operationId

I want to generate a golang client but the swagger validation is failing as many of the definitions have duplicate operationId entries. For example in release.json
- "List" is defined 4 times
- "Create" is defined 2 times
- "Get" is defined 2 times
- "Update" is defined 4 times

These swagger files are used to generate our REST documentation, and that is there main purpose.  The operationId is used for the title of the method in the docs for example:  Releases - Create  comes from <tag> - <operatiodId>  The non-unique Create value is intentional to make the docs simpler and more consistent.
I will follow up with the team that owns the doc generation tooling to see if we can get the same behavior while still keeping the operationId unique.
In the meantime you could write a quick script to replace the operationId value with the value of its sibling x-ms-vss-method property, as this will always be unique.

FYI : , operationId is required to be unique in swagger/openapi

These swagger files are used to generate our REST documentation, and that is there main purpose. The operationId is used for the title of the method in the docs for example: Releases - Create comes from <tag> - <operatiodId> The non-unique Create value is intentional to make the docs simpler and more consistent.
I will follow up with the team that owns the doc generation tooling to see if we can get the same behavior while still keeping the operationId unique.
In the meantime you could write a quick script to replace the operationId value with the value of its sibling x-ms-vss-method property, as this will always be unique.

Fair enough, but the name of the repo implies that these are the API specifications - if they're not it seems like this should be a private repo, otherwise people will keep assuming it contains valid specs.

I will follow up with the team that owns the doc generation tooling to see if we can get the same behavior while still keeping the operationId unique.

@tedchamb any update you can share on this?
If it is not possible to use the swagger specs from this repo, is there a way to get “clean” specs from the AzureDevOps team somewhere?

@japj - There is an ongoing discussion with the Azure doc teams to see how we can rectify this issue, while still having our docs render correctly.  I don't have a solution yet or an eta.
In the meantime you could write a quick script to replace the operationId value with the value of its sibling x-ms-vss-method property, as this will always be unique.

I'm also investigating using these swagger docs to replace our internal-handcrafted golang API against AzDO.  I wrote a script to do as you said and replaced the operationId with x-ms-vss-method.  This allows me to generate an example API.
However I found that List operations don't seem to work.  As an example for listing builds:
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/Build"
              }
            }
          }

This expects the return payload to be a []Build.  But the actual return object is { count: int, value: []Build }.  This also exposes itself as incorrect here in the docs: https://docs.microsoft.com/en-us/rest/api/azure/devops/build/builds/list?view=azure-devops-rest-5.0#response

@SirAlvarex, yes, any REST endpoint that says it returns a list, will actually return a wrapped list, of the type you noted above.

Ok, I just realized that this list thing is also documented differently from other Azure Rest Api docs.
E.g. see https://docs.microsoft.com/en-us/rest/api/advisor/operations/list?view=azdevserver-2019#response
There the response to a List operation is typically called a List or ListResult (in that case OperationEntityListResult) which then specifies the properties (e.g. value is of type OperationEntity[])
From this whole discussion, I think it is clear enough that the current purpose is to only document the apis. The swagger files in their current form are not intended to generate code with (and it seems we run into multiple issues while trying this). But there seem to be at least some people interested in the code generation aspect.
@tedchamb is there a way that we can help move this forward in a generic way or do we run into issues with the doc generation tools?
I don’t like forking this repo just to “prepare” the swagger files to be code generation ‘ready’.

I opened #201 as a possible way forward

Looking at https://github.com/Microsoft/azure-devops-python-api it looks like it is possible to generate the python client code with autorest?

Let me try to summarize our current state.  We have internal tooling that generates all of our REST clients.  It uses code reflection, route registration, language specific settings, and templates as input.  One of the 'languages' we output is Swagger 2.0, which is used for documentation purposes.  We also use this tool to generate c#, python, node, the typescript extension sdk, internal typescript, and previously java.
This is different than how the Azure organization works.  In my understanding they handcraft their swagger and then code there server side endpoints to match.
We already had thousands of endpoints before we ever looked into generating swagger.  What we quickly found is that the swagger 2.0 spec is limited and can not fully describe our api.  In order to work around this, we use a lot of custom properties in the swagger that the documentation tooling recognizes.  There are not custom properties for everything, and existing properties also have limitations on what they support.  Therefore there is information loss when converting the input data to our generation tooling into the swagger, which means that any client built from that swagger would not have all the information necessary to build the best client we can.   The custom properties would also mean that we would need to build autorest extensions to handle those.
One thing we would like to do is to build a better Open API spec document for our endpoints that is meant for code generation.  It will not build clients as good as what we can do with our internal generation for the reasons mentioned above, but would be good enough to generate useful clients, and allow consumers to use other Open Api spec tooling.    The only thing holding us back from doing this is priorities.  We only have so much engineering bandwidth, and we have a large number of high priority tasks with a steady stream of more incoming.  The priority of these tasks is always measured in the beneficial impact to our customers.  I am not sure when this particular task would make it to the top of that list.
For those of you on this thread that are Microsoft employees, you can contact me directly, and I can show you how to hook into our internal generator, so that you can generate additional languages.  We would then ask you to open source and maintain that client, so that all customers can take advantage of it.
I understand your frustration with our swagger 2.0 specs, and do hope we can provide better specs in the future.

@tedchamb - do you know if there any any plans to generate a golang sdk along with the c#, python and node ones?

@hbuckle There are no concrete plans, but we have been discussing it.


PIP failing to install

Issue Type

Bug Report / Support Request

Your Environment

Vagrant 2.2.14
VirtualBox 6.0.15r135660
-bash: ansible: command not found

DrupalVM version: 6.0.2
Using latest drupalvm base box 2.0.10

Your OS

macOS (version)

Full console output
This is the provisioning output.
==> dev: Running provisioner: drupalvm (ansible_local)...
    dev: Installing Ansible...
    dev: Installing pip... (for Ansible installation)
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

curl https://bootstrap.pypa.io/get-pip.py | sudo python

Stdout from the command:

Stderr from the command:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1883k  100 1883k    0     0  3607k      0 --:--:-- --:--:-- --:--:-- 3600k
Traceback (most recent call last):
  File "<stdin>", line 24226, in <module>
  File "<stdin>", line 199, in main
  File "<stdin>", line 82, in bootstrap
  File "/tmp/tmpnrUI4i/pip.zip/pip/_internal/cli/main.py", line 60
    sys.stderr.write(f"ERROR: {exc}")
                                   ^
SyntaxError: invalid syntax

Summary

I'm not sure if this is a vagrant problem or something that needs to change on the base box. This error has only just started happening. According to something i read, it looks like a problem relating to using Python2 instead of Python3 to execute that script. Apparently Python2 has reached End Of Life.
If you run it this manually you still get errors relating to missing dependencies
curl https://bootstrap.pypa.io/get-pip.py | sudo python3

I managed to create a workaround by adding this to my Vagrantfile.local to change the method of pip installation:
config.vm.provision 'drupalvm', type: provisioner do |ansible|
    ansible.compatibility_mode = '2.0'
    ansible.playbook = playbook
    ansible.extra_vars = {
      config_dir: config_dir,
      drupalvm_env: drupalvm_env
    }
    ansible.raw_arguments = Shellwords.shellsplit(ENV['DRUPALVM_ANSIBLE_ARGS']) if ENV['DRUPALVM_ANSIBLE_ARGS']
    ansible.tags = ENV['DRUPALVM_ANSIBLE_TAGS']

    ansible.pip_install_cmd = "sudo apt-get -y install python-pip"

    # Use pip to get the latest Ansible version when using ansible_local.
    provisioner == :ansible_local && ansible.install_mode = 'pip'
end

This seems a pretty hacky but it does work in the short term.
To make this work out of the box, does something need to happen to the base box so that the default pip installation command works with python3?
If everything is working as planned is there a better way to override the ansible.pip_install_cmd? Would be nice to have that option as drupalvm config. Or should I just rework it as a SHELL provisioner in Vagrantfile.local?

For further information I joined a chat on the vagrant issue queue about this (https://github.com/hashicorp/vagrant/issues/12155) and someone pointed me to the following news which confirms that something happened with PIP in the last few days. They have dropped support for Python2 and Python 3.5:  https://pip.pypa.io/en/stable/news/#id1

For further information I joined a chat on the vagrant issue queue about this (https://github.com/hashicorp/vagrant/issues/12155) and someone pointed me to the following news which confirms that something happened with PIP in the last few days. They have dropped support for Python2 and Python 3.5:  https://pip.pypa.io/en/stable/news/#id1

If everything is working as planned is there a better way to override the ansible.pip_install_cmd?

Another solution with an open PR is here: #2137
IMHO it's a bit more elegant, mainly because it's a two line change.

If everything is working as planned is there a better way to override the ansible.pip_install_cmd?

Another solution with an open PR is here: #2137
IMHO it's a bit more elegant, mainly because it's a two line change.

Oh cool. I'll try that out. Didn't even realise pip3 was an option.

Oh cool. I'll try that out. Didn't even realise pip3 was an option.

Issue has also been reported to stack exchange:
https://stackoverflow.com/questions/65896334/python-pip-broken-wiith-sys-stderr-writeferror-exc

Issue has also been reported to stack exchange:
https://stackoverflow.com/questions/65896334/python-pip-broken-wiith-sys-stderr-writeferror-exc

I think this will need the addition of pip3 to the base box or prefixing the install_cmd with sudo apt-get install -y python3-pip && instead.

If you use the changes in #2137 , you provisioning installs pip3 for you. It doesn't need to be on the base box in advance.

I think this will need the addition of pip3 to the base box or prefixing the install_cmd with sudo apt-get install -y python3-pip && instead.

If you use the changes in #2137 , you provisioning installs pip3 for you. It doesn't need to be on the base box in advance.

if using composer this works as well if you don't want to use the master branch:
            "geerlingguy/drupal-vm": {
                "Add pip3 to fix failing provision": "https://patch-diff.githubusercontent.com/raw/geerlingguy/drupal-vm/pull/2137.patch"
            }

would be good to have a new release though, as this is breaking current vm the moment they get rebuilt

If you use the changes in #2137 , the provisioning installs pip3 for you. It doesn't need to be on the base box in advance.

Looks like i need to do less talking and more thorough testing. ;-) Awesome. Thanks for teaching me something. :-)

This is fixed... will be in the 6.0.3 release to be out soon: https://github.com/geerlingguy/drupal-vm/issues/2147


How can I suppress unnecessary variables outside of my program?

In zsh, when I press TAB I see all defined variables. Is it possible to suppress all those unnecessary variables?
$ program    <TAB >    # works
about          --  metadata
console        -- Load the console

When I have a sub-argument I face with following output, example view :
$ program run    <TAB>   # shows many variables along with the defined arguments
ALTERNATE_EDITOR             BAT_PAGER
_ARGCOMPLETE                 COMP_POINT
_ARGCOMPLETE_SUPPRESS_SPACE  _ARGCOMPLETE_SHELL
BROWNIE_LIB                  CLICOLOR
COLORTERM                    _P9K_TTY
COMP_LINE                    IFS
DBUS_SESSION_BUS_ADDRESS     DISPLAY
DEFAULT_USER                 ZSH
EDITOR                       EBB
FZF_DEFAULT_COMMAND          DIRHISTORY_SIZE
FZF_DEFAULT_OPTS             FZF_CTRL_R_OPTS
GO111MODULE                  GOPATH
GPG_TTY                      GOROOT
GROFF_NO_SGR                 HISTCONTROL
HOST                         HOME
IGNOREEOF                    LANG
LANGUAGE                     LC_ALL
LC_COLLATE                   LC_CTYPE
LC_TERMINAL                  LC_MESSAGES
LC_TERMINAL_VERSION          LESS
LESS_TERMCAP_md              LESS_TERMCAP_mb
LESS_TERMCAP_se              LESS_TERMCAP_me
LESS_TERMCAP_ue              LESS_TERMCAP_so
LESS_TERMCAP_us              LOGNAME
LS_COLORS                    LSCOLORS
LSP_USE_PLISTS               MANPAGER
MOTD_SHOWN                   OLDPWD
NVM_CD_FLAGS                 NVM_DIR
NVM_INC                      NVM_BIN
P9K_SSH                      PS1
P9K_TTY                      _
PAGER                        PATH
PROMPT_COMMAND               PWD
PYTHONPYCACHEPREFIX          PYTHONBREAKPOINT
SHLVL                        SHELL
SSH_AUTH_SOCK                SQUEUE_FORMAT
SSH_CONNECTION               SSH_CLIENT
SSH_TTY                      TERM
TERM_PROGRAM_VERSION         TERM_PROGRAM
TMUX_PANE                    TMUX
TMUX_PLUGIN_MANAGER_PATH     USER
VIRTUAL_ENV                  COLUMNS
WORKON_HOME                  XAUTHORITY
XDG_SESSION_CLASS            XDG_RUNTIME_DIR
XDG_SESSION_TYPE             XDG_SESSION_ID      -- Authenticate orcid

This was potentially fixed in #463 or is related to #445. Can you give more information about how you have installed completion (either register-python-argcomplete or activate-global-python-argcomplete)? Can you also test against #466 please?


How does "precommit" script work in package.json?

Excuse me.
I'm confused about the "precommit" script in package.json:
"precommit": "npm run lint",

How can I trigger this script?
Like executing npm run precommit? Or add a hook in .git manually?
What is the best practice to do?
And what is your way to trigger this script?
Thanks first ฅ' ω 'ฅ

for my experience
I had use hook at pre-commit package
like this http://elijahmanor.com/npm-precommit-scripts/
but ,
I think I don't have a good coding style . so ,
sometimes when I commit my code with a little long message ,
but it lint error and reject my commit ... so , I need fixed my code first , and ....
I forgot my what is my commit message ...
so , Now I will lint first , make sure it ok then commit .
thanks god we had nuxt live eslint , Now, we just only need fix nuxt.config.js  XD
maybe I can lint precommit use hook again...  :D

hello ฅ' ω 'ฅ
If I'm going to make a larger commit, I usually write the commit message with an editor.
 It reject my commit .
but I have something important than fix my code . when I fixed my code
maybe 2 or 3 hours later :D ( or 1 day 2 day later ? @@ )
maybe I remember want is major function , but will lose some information than before.
( no live lint project )
by the way
maybe @alexchopin just add pre-commit for a hint .

I understand XD
maybe you can use multiple panes or windows in your case ฅ' ω 'ฅ
I usually use three window, totally five panes as the same time.
The first one of the windows is use as my main editor,
the second one is splitted into three panes and each one has different usage,
tnd the last one is for a large commit, like squash commits of dev-branch.


add angular-cli

I tried to get Angular CLI working with import Raven = require('raven-js') and import Raven from 'raven-js' but neither worked because of typescript errors. The only thing that worked was import * as Raven from 'raven-js'.
Also I still can't build the sentry-docs...but thought I would make a PR anyway.
@benvinegar

@MeredithAnya is this ready to merge?


Add Unit Tests

Enough unit tests were added to get 100% coverage. Although more unit tests should still be added to really test all the features, the current test suite is sufficient to close this issue.


[FLINK-32349][table] Support atomic for CREATE TABLE AS SELECT(CTAS) statement

What is the purpose of the change
Support atomic for CREATE TABLE AS SELECT(CTAS) statement
Brief change log
Introduce StagedTable interface that support atomic operations.
Verifying this change
StagedTableITCase#testStagedTableWithAtomicCtas
Does this pull request potentially affect one of the following parts:

Dependencies (does it add or upgrade a dependency): (no)
The public API, i.e., is any changed class annotated with @Public(Evolving): (yes)
The serializers: (no)
The runtime per-record code paths (performance sensitive): (no)
Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
The S3 file system connector: (no)

Documentation

Does this pull request introduce a new feature? (yes)
If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@luoyuxia  hello, I have fix your comment, PTAL

@luoyuxia  hello, I have fix your comments, PTAL

Btw, please also remember to rebase master when you fix my comments.

@luoyuxia  hi, the test is pass, PTAL

Please don't forget to create a jira to add a doc for the atomic CTAS statement and put the jira and FLINK-32349 under a umbrella jira.

Please don't forget to create a jira to add a doc for the atomic CTAS statement and put the jira and FLINK-32349 under a umbrella jira.

@luoyuxia  thanks for your remind


Update sbt-scalajs, scalajs-compiler, ... to 1.14.0

About this PR
📦 Updates

org.scala-js:sbt-scalajs
org.scala-js:scalajs-compiler
org.scala-js:scalajs-library
org.scala-js:scalajs-library_2.13
org.scala-js:scalajs-test-bridge
org.scala-js:scalajs-test-bridge_2.13

from 1.7.1 to 1.14.0
📜 GitHub Release Notes - Version Diff
Usage
✅ Please merge!
I'll automatically update this PR to resolve conflicts as long as you don't change it yourself.
If you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below.
Configure Scala Steward for your repository with a .scala-steward.conf file.
Have a fantastic day writing Scala!

⚙ Adjust future updates
Add this to your .scala-steward.conf file to ignore future updates of this dependency:
updates.ignore = [ { groupId = "org.scala-js" } ]

Or, add this to slow down future updates of this dependency:
dependencyOverrides = [{
  pullRequests = { frequency = "30 days" },
  dependency = { groupId = "org.scala-js" }
}]

labels: library-update, early-semver-minor, semver-spec-minor, commit-count:1

Codecov Report
All modified lines are covered by tests :white_check_mark:

Comparison is base (2a51408) 90.23% compared to head (c679a07) 90.23%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #678   +/-   ##
=======================================
  Coverage   90.23%   90.23%
=======================================
  Files          15       15
  Lines         758      758
  Branches       40       43    +3
=======================================
  Hits          684      684
  Misses         74       74

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Superseded by #681.


style(articles): Improve article height

Describe the bug
Height of elements should be dynamic to the content
To Reproduce
Steps to reproduce the behavior:

Look at how much space is created for the images and boxes in the articles

Expected behavior
Continuity of content
Screenshots

Additional context
Too much white space above elements of articles

article (
...
margin-top: 9vh;
}


Ensure flexget installs version 2.x.x

Fixes #39
Upgrade of setuptools is required to ensure successful install of flexget

Thank you @bverc!


Update Yiqing profile

Update Yiqing's profile

Sorry, I reverted this after spotting an error.

Hi @benjamindkilleen, thanks! Could you specify the error such that I can fix it

Thank you so much @benjamindkilleen
My bad, I should have checked the image formatting before PR.

No worries. I should have checked the deploy before merging


Multi sensor fusion details

Hi,
Is there any source of information(paper preferably) that describes how the camera-lidar fusion is performed? i.e. from the perception pipeline, I can see that apollo runs two separate detection networks on the camera and lidar inputs, but I couldn't find any technical information about how the fusion on the two detection networks is performed. I'll appreciate any details you can provide. Thanks.

@AdirRahamim There are currently no papers covering sensor fusion, we will add some documentation in the future. Thank you for your attention!


Gostcerts2012 1 1 1

Restoring GOST TLS support in upstream/master.
Provided GOST SignatureAlgorithms for TLS 1.2
Restored selection of certificate for GOST ciphersuites allowing more than one auth type.

I think about it. I have no ideas how to deal with it when there is no GOST implementation in openssl.
As the Chinese algorithms are included in the main tree, may be it makes sense to discuss re-enabling the GOST algorithms too.

I think about it. I have no ideas how to deal with it when there is no GOST implementation in openssl.

Check if the underlying ciphers are available, e.g. see
https://github.com/openssl/openssl/blob/master/ssl/ssl_ciph.c#L332
If present then run the tests. If not, skip them.

As the Chinese algorithms are included in the main tree, may be it makes sense to discuss re-enabling the GOST algorithms too.

It's at least worthy of discussion.

I've been thinking for a while that the GOST suite should be in the main tree.  It meets the inclusion criteria.

Yes, they do - now, when there is an inclusion criteria :+1 :)
When they were introduced, they were implemented via engine to show how the new algorithms can be provided via engines.
When they were removed, the idea was to allow implementation of new GOST algorithms.

@bernd-edlinger @mattcaswell this seems ready to be committed

Pushed thanks. I squashed the various fixup commits.

So I still have not seen a substantive response on the question of the codepoints used by the GOST code in OpenSSL.  I strongly feel that we SHOULD NOT include support for ciphers or signature algorithms with unregistered or private use codepoints. How should this be resolved?

I also think that the GOST sigalgs currently supported should be explicitly disabled in TLS 1.3, where they have not been previously deployed or specified.

I am not familiar enough with TLS 1.3 code. Will it be sufficient to check whether we have TLS1.3 in tls_construct_ctos_sig_algs and, if yes, filter out the GOST algorithms (and DSA, if I understand correctly) from the tls12_sigalgs? If yes, I'll provide the pull request.

So I still have not seen a substantive response on the question of the codepoints used by the GOST code in OpenSSL. I strongly feel that we SHOULD NOT include support for ciphers or signature algorithms with unregistered or private use codepoints. How should this be resolved?

The long and correct variant is mentioned before. As we complete the draft, we get a set of allocated codepoints and after that the usage of codepoints from the private area can be eliminated. Unfortunately, we need a national standard to provide a draft, we need a draft to obtain code points and we need code points to finalize a national standard.
In practice for now it's enough to compile openssl with disabled GOST algorithms to remove usage of these codepoints. May be a special #ifdef ENABLE_PRIVATE_AREA or smth like will be also useful.

I am not familiar enough with TLS 1.3 code. Will it be sufficient to check whether we have TLS1.3 in tls_construct_ctos_sig_algs and, if yes, filter out the GOST algorithms (and DSA, if I understand correctly) from the tls12_sigalgs? If yes, I'll provide the pull request.

The problem is that at the point of constructing the ClientHello (when tls_construct_ctos_sig_algs is called) we have not yet negotiated TLSv1.3. We do know whether we will potentially support a version less that TLSv1.3. So we could filter out those sig algs on the basis that if the lowest supported protocol is TLSv1.3 then they shouldn't be offered.
We could do something stronger on the server side to ensure they never get selected if TLSv1.3 has been negotiated.

So I still have not seen a substantive response on the question of the codepoints used by the GOST code in OpenSSL. I strongly feel that we SHOULD NOT include support for ciphers or signature algorithms with unregistered or private use codepoints. How should this be resolved?

Normally I would agree with this, but I'm not sure that removing this functionality (for TLS <= 1.2) in a point release is consistent with the release policy.

I also think that the GOST sigalgs currently supported should be explicitly disabled in TLS 1.3, where they have not been previously deployed or specified.

This seems like something that we could do, though.

I also think that the GOST sigalgs currently supported should be explicitly disabled in TLS 1.3, where they have not been previously deployed or specified.

This seems like something that we could do, though.

Shouldn't we start a separate topic for that?

Shouldn't we start a separate issue for that?

Yes, there probably should be a new issue, rather than having the discussion in this old PR.

#6513


"as" prop being passed to rendered component?

Hey, I could be mistaken, but doesn't this line (https://github.com/TheMightyPenguin/dessert-box/blob/746e9ba797a58dd645a6945579de04341f16dad2/packages/react/src/index.ts#L104) mean the "as" prop will be spread to the rendered component? Prior to this it was destructured out (https://github.com/TheMightyPenguin/dessert-box/blob/e39aa98c535f6ef086f7d32c0a03bfbf1be75b86/packages/react/src/index.ts#L69) and not passed.
React seems happy to take the prop and renders it, so <Box as="span">Span Content</Box> renders Span Content.

Which then triggers this kind of error in html validator: "Attribute as not allowed on element button at this point"
https://validator.w3.org/

@fshowalter @prncss-xyz just published 0.7.3 with this fix!


hotfix(conf) load custom plugins property

Ensure custom_plugins are passed from the config file to the prefix
config file, and hence down to the runtime OpenResty Kong.

This needs to manually be merged in both master and next, ideally in fast-forward mode for master.


[Issue-2791] Extension - Do not show balance in case standing on History list to search token

Related issue: #2791

Please, let's check this issue on the NFTs, History, and Crowdloans tabs.

🚀 Deployed on https://pr-2815--sw-web-runner.netlify.app


Updated remaining projects to netcoreapp3.1

:x: Build ExtendedXmlSerializer <IP_ADDRESS>-qoucyocf failed (commit https://github.com/ExtendedXmlSerializer/home/commit/3e50396000 by @Mike-E-angelo)

:x: Build ExtendedXmlSerializer <IP_ADDRESS>-npnykfey failed (commit https://github.com/ExtendedXmlSerializer/home/commit/3c3a5d4c41 by @Mike-E-angelo)

:x: Build ExtendedXmlSerializer <IP_ADDRESS>-nhcabgwo failed (commit https://github.com/ExtendedXmlSerializer/home/commit/ebf9451cbc by @Mike-E-angelo)

:x: Build ExtendedXmlSerializer <IP_ADDRESS>-vkqjjhtr failed (commit https://github.com/ExtendedXmlSerializer/home/commit/e6b3a3d06b by @Mike-E-angelo)

:x: Build ExtendedXmlSerializer <IP_ADDRESS>-verqrnqy failed (commit https://github.com/ExtendedXmlSerializer/home/commit/e6b3a3d06b by @Mike-E-angelo)

:x: Build ExtendedXmlSerializer <IP_ADDRESS>-epcuabso failed (commit https://github.com/ExtendedXmlSerializer/home/commit/ef146f73e8 by @Mike-E-angelo)

:white_check_mark: Build ExtendedXmlSerializer <IP_ADDRESS>-tjtkgxcr completed (commit https://github.com/ExtendedXmlSerializer/home/commit/43d3d70295 by @Mike-E-angelo)
Install it by running the following command in Package Manager Console:
Install-Package ExtendedXmlSerializer -Version <IP_ADDRESS>-tjtkgxcr -Source https://ci.appveyor.com/nuget/extendedxmlserializer-preview

Problems with the above command?  You may be running into this known issue here:
https://github.com/NuGet/Home/issues/7189


Color-Game

I want to add a color game where the user have to predict the color based on the given color code, it can be played in two(easy and hard) modes.
I want to work on this issue under hactoberfest-2022.

please assign this to me.