* chore: refactor user subject logic to be in 1 place
* test: implement test to assert deleted custom roles are omitted
* add unit test for deleted role
Refactor autobuild/notify and tests to use the clock testing library.
I also rewrote some of the comments because I didn't understand them when I was looking at the package.
re: #13327
Adds local interfaces to `coder netcheck` and checks their MTUs for potential problems.
This is mostly relevant for end-user systems where VPNs are common. We _could_ also add it to coderd healthcheck, but until I see coderd connecting to workspaces over a VPN in the wild, I don't think its worth the UX effort.
Netcheck results get the following:
```
"interfaces": {
"error": null,
"severity": "ok",
"warnings": null,
"dismissed": false,
"interfaces": [
{
"name": "lo0",
"mtu": 16384,
"addresses": [
"127.0.0.1/8",
"::1/128",
"fe80::1/64"
]
},
{
"name": "en8",
"mtu": 1500,
"addresses": [
"192.168.50.217/24",
"fe80::c13:1a92:3fa5:dd7e/64"
]
}
]
}
```
_Technically_ not back compatible if anyone is parsing `coder netcheck` output as JSON, since the original output is now under `"derp"` in the output.
Fixes flake seen here: https://github.com/coder/coder/actions/runs/9461246505/job/26061605278#13486 subtly changes the test so that `post` uses the new v2 Agent API, and when canceling context, there is a race condition where the yamux session underpinning the API can get torn down before the RPC processes the canceled context, yielding a different error response than the test was previously expecting.
I've refactored the test to just stop posting when the test finishes, rather than depend on a context cancel to end the posting goroutine.
* chore: create type for unique role names
Using `string` was confusing when something should be combined with
org context, and when not to. Naming this new name, "RoleIdentifier"
* Updates OIDC and GitHub OAuth login to fetch set name from relevant claim fields
* Adds CODER_OIDC_NAME_FIELD as configurable source of user name claim
* Adds httpapi function to normalize a username such that it will pass validation
* Adds firstName / lastName fields to dev OIDC setup
Organization member's table is already scoped to an organization.
Rolename should avoid having the org_id appended.
Wipes all existing organization role assignments, which should not be used anyway.
Fixes the flake seen here: https://github.com/coder/coder/runs/25832852690
Linux is not a real time operating system, and so there is no guarantee that subsequent `time.Now()` `time.Since()` calls will return a non-zero time. This assert is mainly there to ensure we don't return `-1`.