SSO between two React applications InteractionRequiredAuthError: login_required

Core Library
MSAL.js (@azure/msal-browser)
Core Library Version
3.4.0
Wrapper Library
MSAL React (@azure/msal-react)
Wrapper Library Version
2.0.6
Public or Confidential Client?
Public
Description
I am attempting to perform local testing of SSO capabilities with two React applications on different subdomains but I am getting InteractionRequiredAuthError: login_required.
The first application is responsible for handling the login process and enabling users to redirect to the second application without requiring them to re-enter credentials. To achieve this, I created two React applications, both using MSAL, running locally on ports 3001 and 3002. I configured Nginx to proxy pass requests, using a self-signed certificate, to servers at https://app1.local and https://app2.local, which in turn point to http://<IP_ADDRESS>:3001 and http://<IP_ADDRESS>:3002, respectively.
Both applications are using the same clientId under the same tenant.
To test the login process, I'm using an internal user I created under my organization. Their email domain is @{tenantname}.onmicrosoft.com. After successfully logging in on app1, I am passing the authenticated email as a query parameter while redirecting to app2. App2 retrieves the email from the query param and tries to perform an ssoSilent request while using the email as the loginHint, however, I am getting InteractionRequiredAuthError: login_required: AADSTS50058: A silent sign-in request was sent but none of the currently signed in user(s) match the requested login hint.
I tried catching the error and performing a loginPopup request with prompt "none", but I am getting the same error. I am also redirecting to a blank page (redirect.html) for both login attempts (ssoSilent and loginPopup). The redirect URIs in Entra are the following:
https://app2.local/redirect.html
https://app2.local/
Any insight as to what could be causing the error would be highly appreciated. The below code snippets and configurations are of App2.
MSAL Configuration
import { LogLevel } from "@azure/msal-browser";

export const msalConfig = {
    auth: {
        clientId: "{SameClientId as App1}",
        authority: "https://login.microsoftonline.com/{tenantId},
        redirectUri: "/redirect.html",
        postLogoutRedirectUri: "/",
        navigateToLoginRequestUrl: false
    },
    cache: {
        cacheLocation: "localStorage",
        storeAuthStateInCookie: false,
    },
    system: {
        loggerOptions: {
            loggerCallback: (level, message, containsPii) => {
                if (containsPii) {
                    return;
                }
                switch (level) {
                    case LogLevel.Error:
                        console.error(message);
                        return;
                    case LogLevel.Info:
                        console.info(message);
                        return;
                    case LogLevel.Verbose:
                        console.debug(message);
                        return;
                    case LogLevel.Warning:
                        console.warn(message);
                        return;
                }
            }
        }
    }
};

export const protectedResources = {
    apiTodoList: {
        scopes: {
            read: [ "api://{SameClientId as App1}/Todolist.Read" ],
            write: [ "api://{SameClientId as App1}/Todolist.ReadWrite" ]
        }
    }
}

export const loginRequest = {
    scopes: [...protectedResources.apiTodoList.scopes.read, ...protectedResources.apiTodoList.scopes.write]
};

Relevant Code Snippets
//App.jsx
import { useEffect } from 'react';
import { useMsal, AuthenticatedTemplate, MsalProvider, UnauthenticatedTemplate } from "@azure/msal-react";
import { InteractionRequiredAuthError } from "@azure/msal-browser";

const TestSSOComponent = () => {
    const {instance, inProgress } = useMsal();
    useEffect(() => {
        console.log('Component has mounted');

        const silentRequest = {
            loginHint<EMAIL_ADDRESS>            scopes: ["api://{SameClientId as App1}/TodoList.Read", "api://{SameClientId as App1}/TodoList.ReadWrite"],
            redirectUri: '/redirect.html',
            prompt: 'none'
        };

        const loginResponse = instance.ssoSilent(silentRequest).then(tokenResponse => {
            console.log(tokenResponse);
        }).catch(error => {
            if (error instanceof InteractionRequiredAuthError) {
                console.log("InteractionRequiredAuthError caught");
                console.log(error);
                const loginResponse = instance.loginPopup(silentRequest).then(tokenResponse => {
                    console.log("login popup response:");
                    console.log(tokenResponse);
                });
            } else {
                console.log("other error");
                console.log(error);
            }
        });

        return () => {
          console.log('Component will unmount');
        };
      }, []);
}

const App = ({ instance }) => {
    return (
        <MsalProvider instance={instance}>
          <AuthenticatedTemplate>
            User is authenticated!
          </AuthenticatedTemplate>
          <UnauthenticatedTemplate>
            <TestSSOComponent />
          </UnauthenticatedTemplate>
        </MsalProvider>
    );
};

export default App;

Identity Provider
Azure AD / MSA
Source
External (Customer)

username is an unreliable hint. Try using the login_hint optional idToken claim instead.

I tried passing the login_hint optional idToken claim in the ssoSilent request as the loginHint but I am getting the same InteractionRequiredAuthError: login_required.
const silentRequest = {
    loginHint: "O.CiR...gNg==",
    scopes: ["api://.../TodoList.Read", "api://.../TodoList.ReadWrite"],
    redirectUri: '/redirect',
    prompt: 'none'
};

const loginResponse = instance.ssoSilent(silentRequest).then(tokenResponse => {
    console.log(tokenResponse);
})

After changing the authority in both applications to https://login.microsoftonline.com/consumers/ I am able to login on app1 using a personal outlook email, and the ssoSilent request on app2 worked like a charm while passing the corresponding login_hint.
@tnorling Any idea why authentication using a user created in my organization using the Microsoft Entra Admin center is giving InteractionRequiredAuthError: login_required for the authority https://login.microsoftonline.com/{tenantId} while personal accounts using the consumers authority work? Supported account types are set to: Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts

There's nothing that comes to mind, we'd have to review the network logs and server traces to understand why that's happening. We (MSAL.js) aren't the best people to analyze that so if you'd like to dig into that further I'd suggest opening a support ticket and they should be able to assist you.


[Bug]: No way to tell what triggers a net::ERR_ABORTED response

Bug description
Under a number of different circumstances, such as calling page.goto, puppeteer will throw Error: net::ERR_ABORTED, as far as I can tell, this is an internally generated error message not based on the server response and as such there is no way to determine why chrome has decided to throw this error.
Is there any kind of tracing/logging/debugging that can determine why chrome/puppeteer has decided to generate this error?
Puppeteer version
13.5.2
Node.js version
17.8.0
npm version
8.5.5
What operating system are you seeing the problem on?
Linux
Relevant log output
Error: net::ERR_ABORTED at https://www.totaljobs.com/job/net-software-developer-programmer/reflex-computer-recruitment-job97238730

you are blocked by server , however puppeteer itself is easy to be detected , so you have to configure the puppeteer to undetected
also you can youse some plugin called puppeteer-extra and puppeteer-extra-plugin-stealth

I am having the same problem, has there been any solution for that ?

I was experiencing this issue and it was actually due to an error thrown by chrome.
Immediately before experiencing this issue I migrated my Ubuntu system to use jemalloc system-wide instead of glib malloc.
This change caused puppeteer to start throwing these net::ERR_ABORTED errors. I thought it was because the site was blocking my requests - that was not the case.
Using some diagnostic CLI command as shown below:
admin@m18574:~/orch$ google-chrome-stable --headless --dump-dom https://www.how2shout.com --no-sandbox
[1218/022947.825929:WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable.
[1218/022947.843086:WARNING:sandbox_linux.cc(380)] InitializeSandbox() called with multiple threads in process gpu-process.
[1218/022947.846753:ERROR:command_buffer_proxy_impl.cc(128)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.
[1218/022947.871366:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[1218/022947.871403:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
[1218/022947.877119:ERROR:network_service_instance_impl.cc(513)] Network service crashed, restarting service.

This command is actually supposed to spit out the html of the page https://www.how2shout.com.
There are a few errors here. Only one is the cause of net::ERR_ABORTED:
[1218/022947.877119:ERROR:network_service_instance_impl.cc(513)] Network service crashed, restarting service.

I was able to see that the internal chrome network service was crashing. This crash caused the chrome process to throw net::ERR_ABORTED which makes sense as the connection was literally aborted due to the network service crashing. This is in contrast to the assumption that the website was aborting the request.
If you are experiencing this issue please ensure that you have disabled jemalloc for the chrome process.
Note: You can use jemalloc for specific process by setting the environment variable specifically for that process. For example:
> LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so node index.js

@FabianoFMSilva Run this and check/share the output:
google-chrome-stable --headless --dump-dom https://www.how2shout.com --no-sandbox

Just one solution.
handle your promises mindfully. when they collidle by parallel function on same page this occurs problem occurs by the side of puppeteer.


[DDC-1505] joinColumn "nullable" should be handled true by default

a join column is nullable when the mapping is omitted (whereas standard columns are not nullable in such case). So this change is wrong

sorry, I read it too fast.


Fix the UAV type of shape combine texture array

_LD_TexArray_AnimatedWaves_Compute is now half4 instead of float4
to match the type of the underlying texture.

I realise that we tested if this fixed the UAV issues (it didn't), but it is probably a good thing to checkin regardless!

Thanks.
I don't know if it's worth lumping into this pr but there's a bit more fixup we should do with the you're of the slice index. It's using floats to index into arrays so there will be conversions from float to int happening a bunch. I think we should try changing to int starting from the sample functions and can probably avoid conversions in a bunch of places. Just mentioning it as if we're looking at types this would be a low hanging fruit that would be good to hit.

Thanks.
I don't know if it's worth lumping into this pr but there's a bit more fixup we should do with the you're of the slice index. It's using floats to index into arrays so there will be conversions from float to int happening a bunch. I think we should try changing to int starting from the sample functions and can probably avoid conversions in a bunch of places. Just mentioning it as if we're looking at types this would be a low hanging fruit that would be good to hit.

We could do, but it's worth pointing out the the desired type is uint, not int.

Done, is this good? :)

I tackled some remaining type issues separately. With those and this PR the types are in pretty good shape. There's still a few integer to float conversions but some go into SampleLevel as a float3 and didnt feel worth trying to eradicate.


Censored Common Passwords

I'm wanting to use the Common-Credentials password list for a Science Fair project for Password Cracking. I wanted to know if there was a way I could get a version that doesn't have vulgar words because I don't think it would be school appropriate. If you can't provide this or know where else I can find something like this let me know.
I don't where else to put something like this so correct me if I need to send something like this somewhere else.

Your best bet would be to parse the list through something that checks for a list of vulgar words (for example, the Ofcom Attitueds to potentially offensive language and gestures on TV and radio).
In my opinion, providing a censored list would devalue the core intent of the repository, as some common passwords do contain vulgar words.

Thanks for the suggestion.
Thats a good point and idea.
It would need someone to remove it and then make a pull request with it.
There should already be various lists of "naughty words" to remove!

I can do this. Could you tell me which exact file you intend to use?  I've already found a list of words to censor. If someone has time to do the new one before I do, I recommend doing some permutations for greater scope. Anyway, the repository in question has lists in several languages.

this looks interesting to implement

I know this is a bit old, but what I ended up doing was just making a python script that just parsed the list, and removed words that were profanity by just using a profanity checker library, and used that in my project.

check out pr #931 and see if there could be anything that can be added


PHYSLITE lecture update

Mainly adjust the text and a bit the student workbook

@ekourlit your PR currently has merge conflicts. Can you resolve these? In PR #16 your last commit was execute notebook in coffea-casa so can you do an interactive rebase from origin/main and then drop everything up to 0f269b6?


co: decrease max_number_of_runs_of_hsi_if_consumable_not_available

A parameter max_number_of_runs_of_hsi_if_consumable_not_available in ResourceFile_ContraceptionParams is set to 1000, so we are assuming that women will be coming back every day for 1000 consecutive days?
Tim H suggested to reduce this.
And interestingly, when I printed footprints for did_not_run event when switch to female sterilization when consumables available but equipment not available in test_contraception (test_record_of_appt_footprint_for_switching_to_methods) in #1098, it only printed 8 footprints, why not 1000? What am I missing?

It's not 1000 because they stop repeating the appointment when they have received all the consumables they require.


Error while running the make file

I am getting the following error while running the make file:
No rule to make target 'objs/RaspiCamCV.o' , needed by 'libraspicamcv.a' . Stop .
How should I solve this problem?

please check Makefile.
probably,

change to "CFLAGS_OPENCV"

CFLAGS_OPENCV = -I/usr/include/opencv

ex, -I/usr/local/include/opencv

change to "USERLAND_ROOT"

USERLAND_ROOT = $(HOME)/git/userland

ex. $(HOME)/git/raspberrypi/userland

try again!


Compatibility with php 7.2

Fresh install on MacOS, php 7.2, Laravel 5.5
after command

$ php artisan version:show
In Resolver.php line 33:
count(): Parameter must be an array or an object that implements Countable

Suppose one of dependency packages write this. May be "pragmarx/yaml"

Fixed.


Error when using pre-trained weights

Hi, there is an error that says "command not found" when using the --pretrained-model-name command to use pre-trained weights

Hi! How did you solve the problem?


Tool tip for less ambiguous name in schema editor

https://github.com/cardstack/boxel/assets/8165111/07d36d69-2b9d-4b84-a400-349a9d83c50d
I put the placement of tool tip at the bottom bcos it looks better
When codeRef is available

When codeRef is unavailable

There is a loader related issue. Let me write it down here to explain for clarity

The Base pill should have a codeRef but not just any codeRef -- a resolved one. One that resolves to {module, name}
This is not always guaranteed, particularly if BaseDef is not used in one of the modules within the drafts workspace.
If BaseDef is not imported somewhere to trigger an indexing of the modules identities, the codeRef would just be {ancestorOf}

Ok Ready for review now

add tests please

Added test here https://github.com/cardstack/boxel/pull/781/commits/6eb120d8a6a888f13c9822c302024a15367758f7


pycoin: expose cli via top-level entry

Motivation for this change
pycoin is a python crypto currency library, which was added to nixpkgs python modules in commit 2b11dcd789f60961473830b7202f9b44810a455c .  However, it also brings some command line tools, which may be accessed by building it as python application.
Things done

[x] Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
Built on platform(s)

[x] NixOS
[ ] macOS
[ ] other Linux distributions

[ ] Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
[ ] Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
[x] Tested execution of all binary files (usually in ./result/bin/)
[ ] Determined the impact on package closure size (by running nix path-info -S before and after)
[ ] Ensured that relevant documentation is up to date
[x] Fits CONTRIBUTING.md.

Besides the default version of Python 3 (currently 3.8 in nixpkgs master), I successfully built the package with Python 2.7, 3.6, 3.7 and 3.9 (3.10 fails as a dependency is broken).  I tested the following actions with each of those builds:

Invoke each executable in /bin/ with --help.
Use /bin/b58 to convert a base58 key to its hex representation.
Use /bin/ku to generate a new Bitcoin secret/public keypair, to compute the public key from a secret key, and to show information on a public key.
Use /bin/tx to list a Bitcoin public key's transactions, to download and dissect a transaction, and to show a transaction's unspent outputs.
Use /bin/tx to generate and sign a new transaction for Bitcoin network.

Since pycoin's transaction signing mechanism is deterministic, the new transaction is bitwise the same for all versions of Python used.  The new Bitcoin transaction got accepted by the network.
Notifying pycoin maintainer: @nyanloutre

Result of nixpkgs-review pr 117883 run on x86_64-linux 1

1 package built:

pycoin


Circle ci ssh key update

@conda-forge-admin, please update circle

Hi! This is the friendly automated conda-forge-webservice.
I just wanted to let you know that I updated the circle-ci deploy key and followed the project.


Many iterations of discriminator training causes strange noise

I compared the following two models:

(Red) The model which trains the discriminator from 200k iters
(Blue) The model which trains the discriminator from the first iter
Here is the training curve.

From the curve, the blue one is better than the red in terms of log STFT magnitude loss.

However, the blue model causes strange noise.
You can listen to the samples.
https://drive.google.com/open?id=1LL_A4ysUqKJ13YQBdQwzNBvGp8m8BhqY
I think this is caused by the discriminator (v1 is red and v2 is blue).
If you have any idea or suggestion to avoid this issue, please share with me.

I'm curious how much contribution training the discriminator helps with final audio quality. From the initial 75k step sample you showed, with only stft loss the generator seems to generate decent sounding audio already, and the loss curve seems to still go down. Perhaps it's worth investigating starting the adversarial training much later (300k etc) or not at all to see if the model can still generate good quality audio.

Hi @G-Wang. Thank you for your comments.
Yes, I'm also curious about it.
I will run with

discriminator_train_start_step=300000  # add discriminator more later
discriminator_train_start_step=400000  # not at all use discriminator

I finished training four models:

v1 (red): start to train discriminator from 100k iter
v2 (blue): start from 1 iter
v3 (light blue): start from 300k iter
v4 (pink): no discriminator

Here is the training curve.

Here is the sample.
https://drive.google.com/open?id=1LL_A4ysUqKJ13YQBdQwzNBvGp8m8BhqY
Conseqently, in terms of perceptual quality, v1 is the best.
The v1 loss value itself is higher than the v2 or v4 but the quality is the best.
v4 (no discriminator) is the lowest loss but it causes strang noise as similar as v2.
v3 also contains such kind of noise but less smaller than v1.

@kan-bayashi I wonder if training the model with mulaw audio will help with the noise. In Deepmind's Gan-TTS they say they get better audio than with mulaw.

Hi @G-Wang, this is interesting.
I will try.

@G-Wang I started training (#37)! Please look forward to seeing the results!

So far, I could not confirm any improvement.
I tried several settings:

v1.mulaw: v1 config + Apply mu-law as preprocessing
v2.mulaw: v2 config + Apply mu-law as preprocessing
v1.mulaw.v2: v1 config + Apply mu-law for the only discriminator inputs

The training curves are as follows:

where v1.single is the baseline with v1 config.
This is the example of v1.mulaw @ 100k steps
It seems that spectral convergence loss for the mu-law converted signal is not effective.

After introducing adversarial loss, the outline became better

But the sound quality is too bad.
If we start to train the discriminator from the first steps (v2.mulaw), it became slightly better. But compared to the baseline, the quality is too bad @ 160k steps.
I think one of these reasons is that the spectrogram of the mu-law converted signal is less meaningful.

So I tried to apply mu-law for only the inputs of discriminator (v1.mulaw.v2).
But the spectral loss becomes bigger as you can see in the training curve.
You can listen to the samples at
https://drive.google.com/open?id=1BrbB3Dh0c8HYxCQ5YGmXqNO-qXB0rJIB

@kan-bayashi Hi, thanks for great repo.
I have a question about the graphs on adversarial and fake losses.
If I understood correctly, they should be a reflection of each other, yes, instead of having similar values?
I mean, the adversarial loss is computed for generator, right.
Whereas, the fake loss is computed for discriminator.
That means, adv_loss = ||1-D(G(z))||, whereas fake_loss = ||D(G(z))||.
So, if fake_loss is around 0.25, adv_loss should be around 0.75, no?
Or, maybe I misunderstood about it.

Hi @patrickltobing.
Parallel WaveGAN uses least squeare GAN so we calculate L2norm, not L1norm.
So the discriminator outputs should be around 0.5 and then the both fake and real (adv) loss will be around 0.25.

Hello @kan-bayashi, great work!
About the strange noise caused by the discriminator, my guess is that the discriminator doesn't have enough receptive field to capture such artifacts and penalize them.
The receptive field of the discriminator with a linearly increasing dilation rate, with 8 dilated layers of kernel size 3, and two other layers of dilation 1 gives a receptive field of 77 samples or 3.2ms if the audio has 24kHz. If that noise ticks once each 10ms let's say, the discriminator cannot learn that pattern and penalize it. Thus a wider receptive field for the discriminator should help with it.
Switching the 8 dilated layers to have a power of 2 ascending dilations yields a receptive field of  515 or 21.4ms for an audio of 24kHz, which might be more suited.
Again, great work! Looking forward to see what can be done with this vocoder!

Hi @Rayhane-mamah. I have learned much things from your great repository :)
Thank you for your great suggestions!
I've never tried to expand the discriminator network size.
Maybe this idea is worthwhile to try in the case of the singing voice generation (#42).
I will try it.

Hi again @kan-bayashi. In theory, an adversary with the exact same receptive field as the generator should be able to detect all types of artifacts that the generator creates. Unfortunately, simply stacking 30 dilated conv layers in the discriminator will probably create a vanishing gradient problem.
Thankfully, there is a solution to that, which also provides a pretty cool extra: a discriminator that has the same architecture as the generator's:

fix vanishing gradient problem because of the skip connections
has the potential to discriminate real/generated audio at different receptive fields (first layers detect high frequency issues while deeper layers detect low frequency problems).

With this idea in mind, I trained a model very similar to your parallel WaveGan and found these results: https://drive.google.com/drive/folders/1FwivBIwKqCSd4Pz8dKl7Mwa6EtEUKYlt?usp=sharing
The model is trained for 200k steps. I also tried an earlier checkpoint of 130k steps but it had more low frequency problems. I am assuming a longer training will probably fix remaining issues of 200k checkpoint.
Finally, I can send a PR with this discriminator option if you want. Cheers!
PS: while using a deeper discriminator makes the sec/step speed slower during training, the learning however seems to be happening faster. i.e: the model might require less training steps (than 400k) to reach a good quality.

Hi @Rayhane-mamah. Thank you for your valuable report!
This is great. I'm looking forward to seeing the results with 400k steps.
PR is always welcome! Could you make a PR for your great extension? :)

Move on #61


[core] Supports StartingContext and Mini-Refactor StartingScanner

Purpose
Let StartingScanner return some information that will be used in Spark Streaming Source.

Linked issue: close #xxx

Tests

API and Format

Documentation

Test failed


feat(logger): accept arbitrary keyword=value for ephemeral metadata

Issue number: #1167

This supersedes PR #1505 as (1) Noah is busy with his day-to-day work priorities, and (2) the actual solution requires a full rewrite of the original PR

Summary
Changes

Please provide a summary of what's being changed

This change allows customers to pass arbitrary and ephemeral keyword=value arguments in log statements.
It addresses one of the oldest issues and makes it a better UX than extra argument. Both can coexist, but this is a feature that was backported from Python 3.8.
Why did it take us so long?
The reason that this took us so long was that we inject the location key in log, so customers know where a logging statement came from in their code.
{
    "level": "WARNING",
    "location": "<module>:7",
    "message": "Testing",
    "timestamp": "2022-10-26 15:54:34,945+0200",
    "service": "payment",
    "request_id": "c344d8ca-2697-42b1-ad67-2bed036c550d",
}

When using a class like Logger, we need to override all log statement methods. When doing so, it moves the stack frame location, where the location key now points to where the statement was called inside Logger, instead of the customer log statement location.
def warning(msg, *args, **kwargs):...
def info(msg, *args, **kwargs):
    return self._logger.info(msg, *args, **kwargs)  # <--- location would always show up here
....

Actual result without monkeypatching stack frame position
{
    "level": "WARNING",
    "location": "warning:465",
    "message": "Testing",
    "timestamp": "2022-10-26 16:22:27,543+0200",
    "service": "payment",
    "request_id": "0c7ff166-3be1-4795-8f0c-b48ca5ce5a95"
}

This PR backports the necessary code implemented in CPython 3.8, monkeypatch and adds additional guards to only use the backported code in older Python versions to not impact performance and future improvements.
User experience

Please share what the user experience looks like before and after this change

BEFORE
from aws_lambda_powertools import Logger

from uuid import uuid4

logger = Logger(service="payment")

logger.warning("Testing", extra={"request_id": f"{uuid4()}"})

AFTER
from aws_lambda_powertools import Logger

from uuid import uuid4

logger = Logger(service="payment")

logger.warning("Testing", request_id=f"{uuid4()}")

Checklist
If your change doesn't seem to apply, please leave them unchecked.

[x] Meet tenets criteria
[x] I have performed a self-review of this change
[x] Changes have been tested
[ ] Changes are documented
[x] PR title follows conventional commit semantics

Is this a breaking change?
RFC issue number:
Checklist:

[ ] Migration process documented
[ ] Implement warnings (if it can live side by side)

Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

Waiting for CI to complete to ensure it works in a fresh Python env, then will refresh Docs.

Need to add co-authorship for Noah before merging (@OGoodness). I'll work on docs now as we've finished peer review due to the complexity of this change.

Docs now in!


Having "next export" in npm script fails build, even if unused.

Error message ** Static HTML export next.js projects do not require this plugin ** was caused by "export": "next export" existing in my package.json file. I removed "npm run export" from my netlify.toml file when converting my site from SSG to adding some SSR pages, but had left that command in package.json (not documented in any posts that I would need to make sure to remove it).
Was very very confusing to figure out. I think the easiest fix is updating the error message to be more specific to what is detected. But maybe there is another thing to detect off of? I'm new to Next so not sure.
File with detection logic
Also off topic, but for a new NextJS dev the docs around next-on-netlify vs this plugin were confusing. Is next-on-netlify legacy? Is this one the only way to also have custom functions?

hey @racedale thanks so much for bringing this up!!! really value your insight/feedback :).

would love to hear what an ideal error message would've been for you to read/diagnose that build failure! if you don't have one, no worries! i can definitely make it more specific and point devs in the right direction.

yes, we need to clarify that :( it's been tough because internally our mission is to make next.js "just work" on netlify. that means in the not so distant future, this plugin will be automatically installed on all new next.js sites, without needing to add it yourself. for that reason, we've been unfortunately ambiguous about NoN vs plugin. NoN will likely always exist as its own repo, but using it as a manual install will become "legacy"/deprecated/the uncommon path.

yes this is the only way right now to use custom functions and publish dirs!

Noting that this just super confused me. I removed the export from the .toml file, but just that existing at all in package.json triggered the failed, even totally unused.

Hi,
At the bottom of the announcement blog post it says to deploy:
@cassidoo's https://github.com/cassidoo/next-netlify-starter
I get this error:
1:04:57 PM:   Plugin "@netlify/plugin-nextjs" failed
1:04:57 PM: ────────────────────────────────────────────────────────────────
1:04:57 PM:
1:04:57 PM:   Error message
1:04:57 PM:   Error: ** Static HTML export next.js projects do not require this plugin **
1:04:57 PM:
1:04:57 PM:   Plugin details
1:04:57 PM:   Package:        @netlify/plugin-nextjs
1:04:57 PM:   Version:        1.0.2
1:04:57 PM:   Repository:     git+https://github.com/netlify/netlify-plugin-nextjs.git
1:04:57 PM:   npm link:       https://www.npmjs.com/package/@netlify/plugin-nextjs
1:04:57 PM:   Report issues:  https://github.com/netlify/netlify-plugin-nextjs/issues

I tried:

Adding a next.config.js like this

It did not work

Removing the npm run export from the the netlify.toml build command

See the full deployment log and code:
https://app.netlify.com/sites/confettilabs/deploys/5fe08f23bbf52800077cfcb7
What GitHub repo should I start with?

https://github.com/netlify/next-on-netlify-demo or
https://github.com/cassidoo/next-netlify-starter

Thanks

@gianpaj for the specific repo you linked, remove line 9 from https://github.com/gianpaj/confettilabs/blob/master/package.json#L9
for any repo you start with, don't include any export script in your package.json's list of scripts. this has been fixed in main but not published to npm yet unfortunately

just published to npm, pending upgrade here -> https://github.com/netlify/plugins/pull/193

@lindsaylevine thanks a lot for the quick reply! removing that fixed the deployment!


added emnist dataset

awesome.
it's just for quickly testing within the main
we have some (object) attributes in factory, which is why not all methods can be static. but yeah I think some of them could be made static :+1:


Add read within uncertainty interval to 19.1 docs

Follow-up to #4402.
Finishes off #4401.

This change is

http://cockroach-docs-review.s3-website-us-east-1.amazonaws.com/40648a447c54c65d12c2cb55b27f296df24c4daa/

Jesse you are right!  It was in #4401
Apologies for making the crazy.  Will just merge this.

Are these placeholders for future work?

Yes, different retry error types I "overheard" mentioned on Slack.


how to call d3 function with svg?

can we create a dom element like below:
let chart = xxx.createElement('svg')
let svg = d3.select(chart)
let yLeftAxis = d3.axisLeft(yScale).ticks(0);
svg.append('g').call(yLefttAxis);
then call some function like chart.toReact() to generate JSX element.
if not, how to use react-native-svg to call d3.axis function?

Here is example source and a demo of using this library with D3.
In short, use React to build and handle events from the SVG node components in react-native-svg and use D3 for everything else.

@jmfirth Is it possible to do this with force layouts? For example in this code: https://bl.ocks.org/programng/c919e33d6b08829b77cf9aea1f22e674
How would this block be done with React Native?
        var node = svg.append("g")
            .attr("class", "nodes")
            .selectAll("circle")
            .data(data.nodes)
            .enter().append("circle")
            .attr("r", function(d){  return d.r })

        var ticked = function() {
            node
                .attr("cx", function(d) { return d.x; })
                .attr("cy", function(d) { return d.y; });
        }

@booboothefool I've created a demo of this here: https://github.com/jmfirth/rn-d3-force.  The important parts are here: https://github.com/jmfirth/rn-d3-force/blob/master/ForceDiagram.js.

@jmfirth That's amazing!! Great idea just relying on the simulation and applying forceUpdate. Can you elaborate though, on how'd you do something more complicated? For example, how would you get those nodes to move in random directions? Usually these implementations involve d3-selection and .attr, wouldn't they? Like this: https://bl.ocks.org/mbostock/1136236 Sorry, don't want you to waste your time, but pointing me in the right direction would be great.

Does anyone know if React Native has a way to do the .call(xAxis) function on a G element? That's the only part I can't get past right now.

@booboothefool I've created a demo of this here: https://github.com/jmfirth/rn-d3-force. The important parts are here: https://github.com/jmfirth/rn-d3-force/blob/master/ForceDiagram.js.

thanks for sharing this way. but it has performance issue, will cause high cpu load and overheating or UI stuck and crash. not sure it has better way. seems putting this into native will resolve performance issue (multithreading). react native is single thread for UI

@booboothefool I've created a demo of this here: https://github.com/jmfirth/rn-d3-force. The important parts are here: https://github.com/jmfirth/rn-d3-force/blob/master/ForceDiagram.js.

thanks for sharing this way. but it has performance issue, will cause high cpu load and overheating or UI stuck and crash. not sure it has better way. seems putting this into native will resolve performance issue (multithreading). react native is single thread for UI


Update TargetCard to use CardHeader guidelines

Refactor the TargetCard component a bit, using PF CardHeader for header content and checkbox. Show checkbox for both checked and unchecked.
Consider using selectableActions to handle changes - this may or may not make sense in our implementation.

@ibolton336 -- include in work for #1950 ?

This was fixed in https://github.com/konveyor/tackle2-ui/pull/1251/files

Changing the line in target-card.tsx
    <Card       onClick={handleCardClick}        isSelectable={!!cardSelected}
to
    <Card       onClick={handleCardClick}        isSelectable={true}
introduces a nasty PF bug where selecting a card results in triggering the onMove event via a stepChange event being fired.
Update: event.preventDefault fixed this in the card onClick handler.

Yep, PR #2025 will also resolve this issue.  The CardHeader.selectableActions have been aligned and the click handler moved to onChange instead of the Card.onClick.


Vizor2 teaser form submission tracking

The form submission has to be delayed to track it. Otherwise, the browser might cancel the requests to Mixpanel and/or Google Analytics APIs.
I used 300ms, because that's the value that Mixpanel JS API uses by default: https://mixpanel.com/help/reference/javascript-full-api-reference#mixpanel.track_forms
Tested in latest Chrome, Safari and Firefox on Mac.

@gmarinov I think it depends at what point the request gets cancelled, but I don't actually know. What I learned from 5 minutes of googling is that all analytics libraries do a similar thing when tracking form submissions; they delay the submission. I could look into that more deeply, but I don't think it's time well spent.
Mixpanel JS API supports waiting for the analytics event to go through, but our own E2.track doesn't support that. And I don't know about Google Analytics.
I'm actually not even sure if this tracking is needed, because we have all signups listed in MailChimp anyway. So before spending more time on this, I'll ask Kaarlo about that.

it would be nice to have the tracking in Mixpanel too so we can follow it over time. this is the way it's done unfortunately so I'm still a go on this, @gmarinov @joukosaastamoinen


Taxon constraint for GO:0001944

I came across some annotations in TAIR to vasculature development
http://amigo.geneontology.org/amigo/term/GO:0001944
As a result these genes are also mapped to cardiovascular development.
@tberardini  found that  the term is linked by logical def to the uberon term for vasculature, which effectively restricts it to animals
intersection_of: GO:0048856 ! anatomical structure development
intersection_of: results_in_development_of UBERON:0002049 ! vasculature
this suggests that there should be a taxon restriction placed on the term itself.
The proper term for these annotations is
GO:0010087 and I will fix those in TAIR but I want to be sure that other annotations of plants to these terms are caught.

These plant annotations didn't come up in any of the GO QC reports from jenkins.  I think they should have appeared as taxon violations.  Which makes me wonder how taxon constraints are applied to terms linked to external ontologies.  Can someone clarify? @ukemi?  @cmungall?

related to #13338?

@jimhu-tamu - I don't think it's related to #13338. This issue is more related to the lack of reported taxon violations rather than too many inappropriate ones.

looks like we're not importing the uberon taxon axioms. This all comes down to imports being hard to manage,

looks like we're not importing the uberon taxon axioms.

Which means we're not taking full advantage of the info in the external ontologies, no?  Do you think that this is something that will be addressed fairly soon or should we think about adding taxon restrictions manually into GO for situations like this?

Working on a fix...

@lreiser @tberardini @cmungall
Just checking on this ticket, since it was assigned to me.  It sounds like between the TAIR annotation updates and the fix to Uberon taxon imports, this issue will be addressed.
Please let me know if there's anything that still needs to be done manually in the ontology.

Seems to me like there's no need to do anything manually after the fix that Chris implemented.

Think its all good. I cleaned up our annotations. Checking AmiGO ours were the only annotations extant for the Viridiplantae...


Polymer 3 compatibility: run tests against converted version

The conversion for this particular repo is the noop change because of the fact that HTML imports are not in use. So the.js file is not getting converted to ES module, and is not supposed to be, unless we switch vaadin-development-mode-detector to use dynamic imports in the future.
So, the goal of this PR is to ensure that the tests still pass with Polymer 3.

This change is

Reviewed 5 of 5 files at r1.
Review status: all files reviewed at latest revision, all discussions resolved.

Comments from Reviewable

Reviewed 2 of 2 files at r2.
Review status: all files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.

.npmignore, line 2 at r2 (raw file):

bower_components
test

BTW not a problem here, but we cannot ignore tests in general other components, since some of them, e. g., <vaadin-overlay>, import and run tests from the dependant components.

Comments from Reviewable


"Disconnected!" when Changing Language Mode [VS Code]

When using ghost with VS Code if I try and change the Language Mode (syntax) after selecting the new language mode I get a message saying "Disconnected \n Report Issues | Leave Review". This pretty much renders the editor useless as the whole reason I want to use VS Code is to benefit from the different language modes.

The VS Code extension is from a third party, there's an issue open there: https://github.com/jtokoph/ghosttext-vscode/issues/1


Add install guide in README

Rationale for this change
I've add guide for running dashboard UI in ballista project.
Please review 🙏
What changes are included in this PR?
Add guide in README

Codecov Report

Merging #236 (b6d4ba6) into master (c945b03) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #236   +/-   ##
=======================================
  Coverage   76.46%   76.46%
=======================================
  Files         135      135
  Lines       23250    23250
=======================================
  Hits        17777    17777
  Misses       5473     5473

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c945b03...b6d4ba6. Read the comment docs.


Extend [compat] Distributions to include ^0.24

Needs https://github.com/JuliaStats/GLM.jl/pull/384 to avoid test package conflict.

GLM just released a new version which is compatible with Distributions 0.24 🙂


[Docs] jdbc external table related changes in main

What type of PR is this：

[ ] bug
[ ] feature
[ ] enhancement
[ ] refactor
[x] others

Which issues of this PR fixes ：

Fixes #
Problem Summary(Required) ：

run starrocks_admit_test

run starrocks_admit_test


Add a new cache mode 'follow'

Rather than specifying 'true' or 'false' for the 'cache' option,
specifying 'follow' will use a changes feed to track external
modification to cached documents.  Only documents that have been
cached during normal write-through operation will be updated.
This is useful if you have a system where multiple clients may write
directly to the database without going through a single cache.
Note: This could be made more optimal for cases where not all changes
in the feed are cached as it pulls the full document content in the
change feed.  Maybe a mode 'follow-lite' could enable a lightweight
change feed followed by additional fetch if it is found that a changed
document is cached.  If, for a particular app however, changes are
likely to occur externally to documents in the cache, the existing
'include_docs' mode is probably OK.

My personal opinion would be to get rid of the cache altogether. It shouldn't be the purview of a database access library to cache database operations, and usually these caches have more costs than benefits. Cache will be disabled by default in 1.0.0, but I'd even push for removing the cache feature completely from cradle. I don't know how others feel about this change, though.

I've had issues with the cache in the past +1 to remove it.


Can a well-generated SQL file be provided? In some user environments, the generation is too slow and prone to errors.

Can a well-generated SQL file be provided? In some user environments, the generation is too slow and prone to errors.

@rxyshww Could you please elaborate? what do you mean by a SQL file in this case?

Going to close for now, but feel free to re-open with more details


Footer: links should be removable

terms of use, imprint, privacy policy and glossary links should be removable.

I'd say adjustable ;)

I'd say adjustable ;)
@dmytro-infineon
What do you mean by "adjustable"?

Everything I wanted to say you already described in https://github.com/Infineon/infineon-design-system-stencil/issues/966 ;)


Implement standard collection collectors using Collections#seqCollector()

Actually, it turns out that we can expand even further the reuse of a standard collector factory.

Codecov Report

Merging #2541 into master will increase coverage by 0.03%.
The diff coverage is 100%.

@@             Coverage Diff              @@
##             master    #2541      +/-   ##
============================================
+ Coverage     93.04%   93.08%   +0.03%
+ Complexity     5294     5285       -9
============================================
  Files            89       89
  Lines         12762    12708      -54
  Branches       1603     1603
============================================
- Hits          11875    11829      -46
+ Misses          702      694       -8
  Partials        185      185

Impacted Files
Coverage Δ
Complexity Δ

...rc/main/java/io/vavr/collection/LinkedHashSet.java
96.61% <100%> (-0.09%)
145 <1> (-1)

src/main/java/io/vavr/collection/HashSet.java
95.76% <100%> (-0.11%)
140 <1> (-1)

src/main/java/io/vavr/collection/Tree.java
97.91% <100%> (-0.04%)
159 <1> (-1)

src/main/java/io/vavr/collection/TreeSet.java
100% <100%> (ø)
169 <1> (-1)
:arrow_down:

...rc/main/java/io/vavr/collection/PriorityQueue.java
98.67% <100%> (-0.04%)
109 <1> (-2)

...rc/main/java/io/vavr/collection/LinkedHashMap.java
98.64% <100%> (+0.84%)
143 <2> (ø)
:arrow_down:

src/main/java/io/vavr/collection/TreeMap.java
94.9% <100%> (+0.51%)
166 <3> (-3)
:arrow_down:

src/main/java/io/vavr/collection/HashMap.java
99.44% <100%> (+1.05%)
139 <2> (ø)
:arrow_down:

src/main/java/io/vavr/concurrent/FutureImpl.java
75.18% <0%> (+1.5%)
27% <0%> (ø)
:arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 556db11...5053f11. Read the comment docs.


Revert dropped native validation test

See https://github.com/CrowdStrike/ember-headless-form/pull/37#discussion_r1103080442

Late to this - but 🎉  thank you for putting this back in so quickly!


Add support for custom CSS and JavaScript in the Swagger UI

Allows users to add a URI to load a custom CSS stylesheet and a URI to load a custom JavaScript file into the Swagger index.html.
Resolves #1137

Isnt it a problem that by default it renders an empty src attribute?

Isnt it a problem that by default it renders an empty src attribute?

This doesn't present a problem apart from being technically invalid markup, I could add an update to remove the custom tags if unused?

I think it's fine as long as it still works without these urls, have you tested this?

I think it's fine as long as it still works without these urls, have you tested this?

Yes I have tested it with and without the urls, it works fine :)

Ok... thanks for the PR, will be in the next version in the next days..


Typo of processed

Thanks Phil. I didn't notice this pull request until after I'd already fixed that in the process of revamping those bits as a whole, so that's already fixed.


Config for disabling updater

This will allow us (admins) to test the new updater version.
BTW, once the updater v2 goes live (in a few weeks?), we'll remove all the updater code from this repo :)

@maxtaco @cjb


qrexample

Porting over Flutter Web Chrome Extension example from discontinued chromeapi package.

The options page is just the words Options on a red background.

Feel free to use as much or as little as you want. One option I was considering was allowing the user to select QR code generator defaults (like color) in the options page that would be saved using the Chrome storage API.

This example, in addition to using the # tags for options page. Also implements the sizing of pop-up in Dart, rather than hardcoding in index.html as described in https://github.com/xvrh/chrome_extension.dart/issues/21#issuecomment-2008155223

Thanks for the contribution! I'll merge it directly.


Phase 1

[x] static website > docusaurus < @rlisahuang
[x] migrate content to markdown @ayanamonr
[x] katex enabled for the math stuff @rlisahuang
[x] native computing every snippet at runtime @rlisahuang
[x] github publish action

[x]  make sure the typescript stuff is correctly

[x] codespace configured
[x] bjorner onboarding documentation @ayanamonr << last step! Subject B :)
[x] react component to render output

Phase 1 complete!


Training with GPU

Hello,
I have all the gpu packages and no cpu ones yet It wont train via gpu usign the default code:
from imageai.Classification.Custom import ClassificationModelTrainer model_trainer = ClassificationModelTrainer() model_trainer.setModelTypeAsResNet50() model_trainer.setDataDirectory("idenprof") model_trainer.trainModel(num_experiments=100, batch_size=32)

@ARatcliffe101

Did you install the GPU dependencies
If yes, can you try running the code below in a Python file to confirm GPU is detectable by your dependency installations

import torch
print(torch.cuda.is_available())

Hi, I'm not the original poster but I am also having a similar problem. I am trying to train an image recognition AI but it will not use the GPU. the code snippet you provided evaluated to false, so I think that is the problem. However, I have tried to install cuda before, and it failed on the "Nsight Visual Studio Edition". I tried again and only selected the cuda files in the nvidia cuda installer. That showed it successfully installed, but it still won't work. I don't think it is very clear, so how exactly do I install cuda?


About mix audio

Hello, pedro
Thank you so much for contributing to this repo, it's very nice.
I've been using this repo recently and found some issues in the meantime and I've spent a lot of time debugging it. I hope to share my experience, if it is useful to you, I hope you can optimize this warehouse better.
Here are some of my suggestions:

Regarding the PCMUtil.java mixPCM function, after my test, the body of the if statement is written in reverse.
This is what it looks like after the repair.

Regarding MicrophoneManager.java, maybe you should call getPcmBufferSize() again in the createMicrophone or createInternalMicrophone function body, because the new sampling rate and channel number parameters are passed in

I use the setCustomAudioEffect() function to try to mix the pcm buffer. pcm buffer 1 was recorded using MicrophoneManager. pcm buffer2 is from AudioDecoder. I encountered a lot of problems during this process, first I fixed the function mixPCM, as suggested in suggestion 1. The length of pcm buffer1 is always 5120, and the length of pcm buffer2 is always 4096. Due to the inconsistent length of the two pcm buffers, a broken sound will occur. So I try to make pcm buffer 1 the same length as pcm buffer 2. I have tried padding pcm buffer2 with 0, but it doesn't work well. I try to modify the buffer size of AudioDecoder, which will cause new problems. I gave up on this practice. Finally I try to modify the buffer size of MicrophoneManager Recoder. Because I can't modify MicrophoneManager, so I copied some source code and modified the buffer size.

In this way, the buffer size of the Recorder and AudioDecoder will be the same, both of which are 4096. After my test, the effect is not bad.

Due to my special business, I have my own EGL environment, and eventually generate opengl textures, I need to push these textures with rtmp. Based on the existing code, a better way to deal with it is to directly obtain the SurfaceTexture object of MediaCodec, and I can directly draw the texture into the SurfaceTexture of MediaCodec. This way the texture is encoded directly and sent to the server. For this, I customized SurfaceBase.java. If you agree with this practice, I hope this feature can be added in subsequent versions.

Thanks again for contributing this repo, it helped me a lot.

Hello @robinxdroid,
Thank you for your suggestions. All seems insterested so I will ask you fews questions:
1 - Thank you, I will fix it soon
3 - It is basically a code error. I will fix it.
4 - Do you means replace this method: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/app/src/main/java/com/pedro/rtpstreamer/defaultexample/ExampleRtmpActivity.java#L166
To suggested code, right? I don't remember now the device but I think that a device produce problems using a constant value instead of get value provided by AudioRecord.getMinBufferSize. I will check with all devices I have and check if the change is possible.
5 - It is interested but instead of expose VideoEncoder surface directly maybe use OffScreenGlThread is more interested because you can support filters. I will study it. it is maybe is the higher change because I need develop SurfaceBase

Hello @pedroSG94
About item 4, Yes, I agree with you. Setting a constant value is not a very good solution. I just want to ask if it is possible to open a function so that the developer can control the buffer size by himself. When the developer needs this modification, he can modify it without copying the source code.
I will try to use OffScreenGlThread. I didn't study the source code well enough before. It looks powerful.

Hello @robinxdroid,
Ok, I will add it in next commits

Points 1, 3 and 4 added here: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/commit/96dd4853f7d4042823cc8a538f2a9d1cd5521ac3
I only need add point 5 now.


Remove the distributedCp/Mv commands

What changes are proposed in this pull request?
Remove the distributedCp/Mv commands
Why are the changes needed?
Remove the distributedCp/Mv commands.
Does this PR introduce any user facing changes?
NA

Also need to remove the entry points in the Alluxio shell

Also need to remove the entry points in the Alluxio shell

It is loaded from
"fs")
CLASS="alluxio.cli.fs.FileSystemShell"
CLASSPATH=${ALLUXIO_CLIENT_CLASSPATH}
runJavaClass "$@"
Reflect mechanism:

public static Map<String, Command> loadCommands(String pkgName, Class[] classArgs,
Object[] objectArgs) {
Map<String, Command> commandsMap = new HashMap<>();
Reflections reflections = new Reflections(Command.class.getPackage().getName());
for (Class<? extends Command> cls : reflections.getSubTypesOf(Command.class)) {
// Add commands from .command.*
if (cls.getPackage().getName().equals(pkgName + ".command")
&& !Modifier.isAbstract(cls.getModifiers())) {
// Only instantiate a concrete class
Command cmd = CommonUtils.createNewClassInstance(cls, classArgs, objectArgs);
commandsMap.put(cmd.getCommandName(), cmd);
}
}
return commandsMap;
}

alluxio-bot, merge this please


Does this tool skip already downloaded images

Does this tool skip already downloaded images

ok i found out it does


Unable to edit prometheus.yml configuration via web interface.

Problem/Motivation
Trying to read metrics from home assistant I am unable. In particular seems no way to edit the configuration
prometheus.yml file.
Background I'm just trying to set up this addon and prometheus history component.
I'm not seeing any metrics in promethesus with a integration config of
namespace: 245b
component_config_glob:
  sensor.*temp*:
    override_metric: temperature_c
filter:
  include_entities:
    - sensor.ben_temperature_temperature

https://www.home-assistant.io/integrations/prometheus/
I wanted to add the scrape config which I think should be.
- job_name: "hass"
    scrape_interval: 60s
    metrics_path: /api/prometheus
    scheme: https
    static_configs:
      - targets: ['HOSTNAME:8123']

as the default config has a scrape of /core/api/prometheus only
Expected behavior
Should be able to edit prometheus.yml via supervisor web interface.
Actual behavior
There is no configuration to edit.
Configuration is there in the running docker image /etc/prometheus/prometheus.yml but cannot be edited.
Steps to reproduce
Install prometheus addon , go to configuration tab. See attached screen shot.

Prometheus addon - 1.0.0-beta.0
Core version - core-2021.2.3
supervisor-2021.02.9
Home Assistant OS 5.11
Proposed changes

Sorry just read this https://github.com/hassio-addons/addon-prometheus/blob/master/prometheus/DOCS.md#configuration

To add additional scrape targets you need to create a file per target in /share/prometheus/targets.

Sorry for the noise - my real problem was chossing a prefix of 245b results in.
  File "/usr/local/lib/python3.8/site-packages/prometheus_client/metrics.py", line 94, in __init__
    raise ValueError('Invalid metric name: ' + self._name)
ValueError: Invalid metric name: 245b_temperature_c

fine with non-numerics.


Problems making updates to the schema

I have a simple schema like this
const Query = queryType({
  definition(t) {
    t.field("user", {
      type: User,
      nullable: false,
      resolve() {
        return null;
      }
    });
  }
});

And this give the following error because of the nullable
$ ts-node-dev src/index.ts
Using ts-node version 8.0.2, typescript version 3.3.3
[ERROR] 12:02:47 ⨯ Unable to compile TypeScript:
src/index.ts(26,7): error TS2322: Type '() => null' is not assignable to type 'FieldResolver<"Query", "user">'.
  Type 'null' is not assignable to type 'MaybePromise<{ id: MaybePromise<string>; name: MaybePromise<string>; }>'.

The problem is that when I update to nullable: true I still get the same error.
It looks like it is getting the old generated types because it cannot run the server to generate the new types.

If you run with --transpileOnly option it will start the server even with type errors which will then allow it to generate the correct types.
Probably need to add this to the docs/faq since this has come up a few times.

The downside about --transpileOnly transpile only is that it won't detect any errors.
Maybe I could setup an initial step to generate the schema using --transpileOnly and then run the application with error detection enabled.

Generally my workflow when developing is to have two processes running via gulp or similar, one starting/reloading the server with transpile only, one checking for errors.
Then in CI I’ll only have the tsc run so it catches any errors.

Ok, that makes sense. Thanks!

Related https://github.com/prisma-labs/nexus/issues/77


Voice control Activity com.tri.airr.hero.VoiceControl has leaked ServiceConnection

After a bit of time on the activity the voice will go into the error callback constantly then throw error. Unknown cause

Seems to just be an error from leaving the activity, but as far as seen does not have an effect on app functionality


waveform discontinuities?

Sorry,  I feel I'm generating a lot of issues...  :(
But I was just looking at the waveforms outputted by PyRPL and noticed what seems to be some discontinuities:

To reproduce this,  I used the following setup code:
iq0 = r.iq0
iq0.setup(frequency=2e6, bandwidth=[10e3,20e3], gain=0.0,
         phase=0, acbandwidth=50000, amplitude=0,
         input='in1', output_direct='out1',
         output_signal='quadrature', quadrature_factor=10)

iq1 = r.iq1
iq1.setup(frequency=2e6, bandwidth=[10e3,20e3], gain=0.0,
         phase=np.pi/2, acbandwidth=50000, amplitude=0.5,
         input='in1', output_direct='out2',
         output_signal='quadrature', quadrature_factor=10)

triggered off ch1 (which means basically random triggering) and then say, every  so  often, the  discontinuity flashed by.
Maybe this has something to do with the  reset  of the phase accumulator in the DDS? I saw it before in the spring with the  PyRPL  ASGs too (and it was absent when we used the SCPI generators)
Cheers,
Gary

This data was acquired with the pyrpl scope? Which command was used for that? I'm just trying to make sure the data acquisition is not the problem here.

Yes, it was acquired using the pyrpl scope
You can  find the full code here, I've written a small "live display"  oscilloscope using Bokeh:
https://gitlab.tudelft.nl/gsteele/red-pitaya-control-notebooks
Feel free to clone it and give it a try :).  I had to hack it a bit with an try /  except  to deal with the  change of "duration_options"  to "durations" so that it works with the latest pip release and the development branch...
The basic acquisition code is here:
# The trace acquisition
def get_traces(decimation = 1024):
    s.decimation = decimation
    s._start_acquisition()
    time.sleep(s.duration)
    ch1,ch2 = s._get_curve()
    t = s.times
    return ch1,ch2,t

Cheers,
Gary

(btw, let me know if there is a better / proper way to use the scope object, I seem to be using some internal functions...)

I would also strongly suspect your data acquisition script rather than the data generation...
Several remarks:

I guess a strong motivation for you to rewrite a simple data acquisition function was the awful mess of the scope acquisition code in the master branch: apologize for having such a hard-to-read code. The main reason why the code is so obscure in there is that we want the whole GUI not to freeze when waiting for data from an instrument: since we are using an event-base system, calling "sleep" in a function is not an option. However, using timers and callbacks forces us to split all the acquisition logic in many different functions.
--> The solution that we have found to improve readability is to use the new async support introduced progressively in python 3. In the branch python3-only, the whole acquisition code has become much more readable. That branch will very soon become the new master branch (by the way, @lneuhaus , I am now fixing the last failing unittests, and I guess we can proceed very soon with a new release).

Reading the code in python3_only, acquisition_module.py, line 225., and comparing to your function  get_traces, I see that you are missing the call to self._data_ready_async(min_delay_ms) (or the equivalent in the other branch). This function is there to make sure the full buffer has been acquired in the FPGA before attempting to download it. I think you have to be careful with sleep, IMO, there is no strict guarantee that it will not return slightly before the requested time (you can make a small benchmark, and this is also probably system-dependent)... In this case, this has a catastrophic consequence, because the end of your buffer will be old data that have not yet been overwritten. Could be that the glitches you are seeing are due to this effect (at least I tried several times using the scope acquisition function of pyrpl and didn't see any of these glitches). One very quick-and-dirty test would be to replace in your code sleep(s.duration) by sleep(10*duration) and see if it improves things.

Also, I would advocate to switch right away towards the python3-only branch... Let me know if it helps...

By the way, the correct way of getting a scope curve in python3-only is to call scope.single()or scope.single_async()if you are using it within an async framework.

Thanks, I'll take a look, and make some simple test code to check it out

BTW, I am now on the develop 0.9.3 branch: does that already include the python3_only branch, or should I clone and pip install the python3_only one?

BTW, I am now on the develop 0.9.3 branch: does that already include the python3_only branch, or should I clone and pip install the python3_only one?

I think it does not yet. @SamuelDeleglise do you want to make a PR merging python3 into develop-0.9.3 (or vice versa if you prefer)? I feel Python2.7 support can finally be dropped now :)

And after that we'll merge all this into master. The automatic binary build is currently broken, but better have an up-do-date master branch I guess, right?

@SamuelDeleglise let's try to get #32 (python-3 branch) merged into master asap. And simultaneously we can merge #239 (0.9.3 branch) into master as well. I guess Python3 is based on 0.9.3, so better first merge 0.9.3 and then python3?

Sounds all good to me at least :)  thanks as well for this great project, am very excited about it
For now, I'll checkout the python3 branch and play with that

I think I pulled anyways most of the important stuff from develop0.9.3 into python3-only regularly anyways (for instance the demodulation at 2f, and the synchronize IQs are already there).
I agree with you that it might make sense to make a last clean release still supporting python 2.7 (pulling develop0.9.3 into master) and then to pull python3-only into master.
I am not sure what you mean with the automatic binary builds (I haven't followed that), but if this is possible to make at least one clean .exe file with the latest clean version, I would strongly advocate for that since many people I have met have been discouraged by bad bugs remaining in the current .exe file (for instance, I think the GUI instruments freeze ...), which is very bad because it is the first thing they try...

Okay, all makes sense:

I will try to merge develop-0.9.3 asap
you (@SamuelDeleglise) focus on getting the python3 branch pass on python 3.7 and 3.8
we then focus on making a working .exe file

I am proud to announce that all tests are passing on python 3.7 and 3.8 with branch python3-only. There's already a pull request, but it's very old, I don't know if you want to make a new one ?

Thanks! I pulled python3-only and changed the code to use scope.single(), and I now no longer see any sign of discontinuities
Cheers,
Gary


[gopls] run editor.action.organizeImports  on save.

I'm struggling to figure out how to make an autocmd to call the editor.action.organizeImports command that gopls offers. For coc.nvim they provide the following config https://github.com/golang/tools/blob/master/gopls/doc/vim.md#cocnvim
Not sure if this is the write project to add this type of support or if it is just a lua function that calls the built in vim.lsp functions. Any help would be appreciated though.

Just winging it here, but something like this could be a starting point:
autocmd BufWritePost * lua vim.lsp.buf.formatting()

It's pretty naive. So using the on_attach callback is probably a better approach:
local nvim_lsp = require("nvim_lsp")

local on_attach = function(_, bufnr)
  vim.api.nvim_command("au BufWritePost <buffer> lua vim.lsp.buf.formatting()")
end

nvim_lsp.gopls.setup({ on_attach = on_attach })

It works, kind of, but leaves the file a 'modified' state which isn't desirable. So there's at least one missing piece.

So that autocmd works alright, however gopls separates out updating imports as a separate action than formatting. I guess my question is how to call a custom lsp action (not sure the lsp terms here).

So that autocmd works alright, however gopls separates out updating imports as a separate action than formatting. I guess my question is how to call a custom lsp action (not sure the lsp terms here).

What you want to run is a code action. "Organize imports" is one of the gopls code actions.

It works, kind of, but leaves the file a 'modified' state which isn't desirable. So there's at least one missing piece.

The formatting params in https://github.com/neovim/neovim/blob/9678fe4cfba9f7a9dacbd6d5a56c58241e98aa60/runtime/lua/vim/lsp/buf.lua#L73-L85 could be extracted into a helper function, and there could be an additional formatting_sync function. Something along the following lines:
local function formatting_params(options)
  validate { options = {options, 't', true} }
  local sts = vim.bo.softtabstop;
  options = vim.tbl_extend('keep', options or {}, {
    tabSize = (sts > 0 and sts) or (sts < 0 and vim.bo.shiftwidth) or vim.bo.tabstop;
    insertSpaces = vim.bo.expandtab;
  })
  return {
    textDocument = { uri = vim.uri_from_bufnr(0) };
    options = options;
  }
end

function M.formatting(options)
  return request('textDocument/formatting', params)
end

function M.formatting_sync(options, timeout)
  local params = formatting_params(options)
  local result = vim.lsp.buf_request_sync(0, "textDocument/formatting", params, timeout)
  if not result then return end
  result = result[1].result
  vim.lsp.util.apply_text_edits(result)
end

This would allow formatting to be run synchronously on BufWritePre (possibly increasing the default 100ms timeout to e.g. 1000ms), so that the file isn't left in a modified state:
vim.api.nvim_command("au BufWritePost <buffer> lua vim.lsp.buf.formatting_sync(nil, 1000)")

I know OP actually wants something slightly different, but since I got here looking for the above and got halfway there thanks to @lithammer's snippet, I figured I'd post the rest since it might help other people too :)

Would you be willing to accept a PR adding a formatting_sync function to vim.lsp.buf? Or do you feel that a more general solution is needed, since there are other actions which might need to be run in a synchronous fashion (e.g. on save), like that "organize imports" code action of gopls?

Would you be willing to accept a PR adding a formatting_sync function to vim.lsp.buf? Or do you feel that a more general solution is needed, since there are other actions which might need to be run in a synchronous fashion (e.g. on save), like that "organize imports" code action of gopls?

I think there's a reason why a formatting_sync equivalent exists in most LSP clients: many people use it. I'm not a Neovim maintainer, but IMO, it would be a nice addition to the official API. Otherwise people will either have to implement the function themselves or use a third-party plugin.

@dlukes I think that would make a good PR where we can talk about where that should live and how we can add improvements like this. If you make the PR and place it somewhere sensible to start, we can chat about it in that PR (which would be a better place).
(As a note, the PR would be on neovim, not nvim-lsp. Just to be clear)

autocmd BufWritePre *.go lua vim.lsp.buf.code_action({ source = { organizeImports = true } })
this seems to kinda work, except it always prompts you what to do

So i'm still testing right now but this is what I'm trying out. I dont think its working quite right though but it at least doesn't prompt me.
-- organize imports sync
function go_org_imports(options, timeout_ms)
  local context = { source = { organizeImports = true } }
  vim.validate { context = { context, 't', true } }
  local params = vim.lsp.util.make_range_params()
  params.context = context

  local results = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, timeout_ms)
  print(vim.inspect(result))
  if not result then return end
  vim.lsp.util.apply_text_edits(result[1].result)

  -- local params = vim.lsp.util.make_formatting_params(options)
  -- local result = vim.lsp.buf_request_sync(0, "textDocument/formatting", params, timeout_ms)
  -- if not result then return end
  -- result = result[1].result
  -- vim.lsp.util.apply_text_edits(result)
end

vim.api.nvim_command("au BufWritePre *.go lua go_org_imports({}, 1000)")

ah cool thanks for sharing @tkinz27

@tkinz27 your example doesn't work because the return type of textDocument/codeAction is different from textDocument/formatting. Only after figuring this out by trial and error did I realize I should've looked at nvim-lsp's own textDocument/codeAction implementation.
The modified (verified working as of right now) version is:
-- Synchronously organise (Go) imports.
function go_organize_imports_sync(timeout_ms)
  local context = { source = { organizeImports = true } }
  vim.validate { context = { context, 't', true } }
  local params = vim.lsp.util.make_range_params()
  params.context = context

  local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, timeout_ms)
  if not result then return end
  result = result[1].result
  if not result then return end
  edit = result[1].edit
  vim.lsp.util.apply_workspace_edit(edit)
end

Though it's not perfect, because we should be emulating the codeAction handler to be resistant to changes in gopls implementation.

@aktau thanks for the update, yeah I hadn't really verified that mine was working. Been stuck workign on terraform stuff and haven't worked in go for a little while. Thanks for sharing.

Thanks for your report. The configs here are best-effort:

It is hoped that these configurations serve as a "source of truth", but they are strictly best effort. If something doesn't work, these configs are useful as a starting point, which you can adjust to fit your environment.

If you have an improvement or fix, please send a PR!
If you have a specific question we'll try to answer it (keeping in mind the configs in this repo are best-effort and unsupported).
If you found a bug in the core lsp module, the best way to get it fixed is to describe steps to reproduce it without the particular LSP server and other factors particular to your environment. Or better, by adding a failing test case to lsp_spec.lua, which has code to setup a fake LSP server to simulate various scenarios.

Sadly using latest neovim HEAD with gopls 0.6.1 and latest version of nvim-lspconfig it seems that while this code works, it doesn't really work when you are trying to import non standard library modules like dependencies in go.mod and vendored.
Executing a print(vim.inspect(result))  of the call returns { {} } if I remove a module, say "go.uber.org/zap", while it returns a nicer full table if I remove "time".

I had a problem when using 'gd' goto definitions my go imports gave an index error. Turns out that the above script uses index[1] but that is only when a file is open directly. If a function opens the file it gets index 2. So my modified versions looks like this:
function go_organize_imports_sync(timeoutms)
local context = {source = {organizeImports = true}}
vim.validate {context = {context, 't', true}}
local params = vim.lsp.util.make_range_params()
params.context = context

local method = 'textDocument/codeAction'
local resp = vim.lsp.buf_request_sync(0, method, params, timeoutms)

if not resp then return end

-- imports can be indexed 1 or 2
-- 1 is a file opened directly
-- 2 is a file opened via functions like goto definition
for _, v in next, resp, nil do
  local result = v.result
  if result and result[1] then
    local edit = result[1].edit
    vim.lsp.util.apply_workspace_edit(edit)
  end
end
-- Always do formating
vim.lsp.buf.formatting()

end

Hey all,
Got to here from: https://github.com/golang/tools/blob/master/gopls/doc/vim.md#neovim-imports
I'm not sure if you are all away, but when you're utilizing this function on safe, it appears any code action that's available to you on the given line will be called.
This is an issue when you're saving to add an import, but your cursor is in an incomplete struct, the code action to fill in all the struct fields are ran unconditionally, while your intent was only to import a missing package.

When using the above function I actually get the same index error in
local actions = result[1].result

Hey all,
Got to here from: https://github.com/golang/tools/blob/master/gopls/doc/vim.md#neovim-imports
I'm not sure if you are all aware, but when you're utilizing this function on save, it appears any code action that's available to you on the given line will be called.
This is an issue when you're saving to add an import, but your cursor is in an incomplete struct, the code action to fill in all the struct fields are ran unconditionally, while your intent was only to import a missing package.

Haven't had that problem but I guess it should be pretty easy to modify the function to test which action it is and only take action if its the wanted code action

This is correct, I can reproduce it. If you look at it, at the beginning it sets the context (that will be passed with the code action request) to local context = {source = {organizeImports = true}} - I modified that to some bogus value (for completeness, to organizeImportsz) and the imports were STILL organized. Which means the context was not used at all.
I then went back to the spec, and apparently, the context should look like this instead: https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#codeActionContext  That's quite different from what is in the solution given in here. So I used that and it seems to actually work as expected.  So in theory, it should filter out unwanted actions. This is the full method that I use, FWIW:
    function util.OrgImports(wait_ms)
      local params = vim.lsp.util.make_range_params()
      params.context = {only = {"source.organizeImports"}}
      local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, wait_ms)
      for _, res in pairs(result or {}) do
        for _, r in pairs(res.result or {}) do
          if r.edit then
            vim.lsp.util.apply_workspace_edit(r.edit)
          else
            vim.lsp.buf.execute_command(r.command)
          end
        end
      end
    end

Oh, I tested this on Go files (so gopls).
Hope it helps!

the above code also works great for me as long as I add vim.lsp.buf.formatting()

The code above seems to work although now it seems the imports are re-organized but code is formatted again after the save has happened so it needs a new command to again save the buffer.

Hi!
Can someone, please, summarise a full working example? Thanks in advance!

You can find a working example in gopls repo: https://github.com/golang/tools/blob/master/gopls/doc/vim.md#neovim-imports

Just a little heads up for everyone using this workaround from @zapling with a recent neovim version. With the current master (f4300985d3212887ef27d703ba8cb4230813e095), this does not work anymore and imports are not automatically added.

That is due to https://github.com/neovim/neovim/issues/14090#issuecomment-1012005684 , the offset_encoding is now a required parameter for vim.lsp.util.apply_workspace_edit() & friends.
Changing vim.lsp.util.apply_workspace_edit(r.edit) to vim.lsp.util.apply_workspace_edit(r.edit, "utf-16") should do for most LSPs (including gopls) or you can follow the instructions in the issue above mentioned for a more correct solution (i.e. detect the offset encoding and use that).

Just a little heads up for everyone using this workaround from @zapling with a recent neovim version. With the current master (f4300985d3212887ef27d703ba8cb4230813e095), this does not work anymore and imports are not automatically added.

Thanks for the heads up. The fix should is probably be like this, as @alexaandru mentioned.
          if r.edit then
-            vim.lsp.util.apply_workspace_edit(r.edit)
+            vim.lsp.util.apply_workspace_edit(r.edit, "utf-16")
          else

@alexaandru Can you add some explanations to the code? because when I hit :w, nothing happened and the result is nil

Sorry, I can't get this to work, result is always nil

you can just dump this anywhere in your Neovim lua config:
organize imports aka goimports:
vim.api.nvim_create_autocmd("BufWritePre", {
	pattern = { "*.go" },
	callback = function()
		local params = vim.lsp.util.make_range_params(nil, "utf-16")
		params.context = { only = { "source.organizeImports" } }
		local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 3000)
		for _, res in pairs(result or {}) do
			for _, r in pairs(res.result or {}) do
				if r.edit then
					vim.lsp.util.apply_workspace_edit(r.edit, "utf-16")
				else
					vim.lsp.buf.execute_command(r.command)
				end
			end
		end
	end,
})

code formatting:
vim.api.nvim_create_autocmd("BufWritePre", {
	pattern = { "*.go" },
	callback = vim.lsp.buf.formatting,
})

(mostly taken from https://github.com/neovim/nvim-lspconfig/issues/115#issuecomment-902680058

code formatting aka gofmt:
vim.api.nvim_create_autocmd("BufWritePre", {
	pattern = { "*.go" },
	callback = vim.lsp.buf.formatting,
})

For some reason this formats the code on write but its not written .. so I have to save twice

For some reason this formats the code on write but its not written .. so I have to save twice

try to increment the timeout (from 3000 to something like 5000 or more)

For some reason this formats the code on write but its not written .. so I have to save twice

try to increment the timeout (from 3000 to something like 5000 or more)

I just find it soo nasty. Its like having sleep in my code and I'm not a fan .. wish it would fail and give an error if it got a timeout

It's true that vim.lsp.buf.formatting_sync was deprecated (more information on the deprecation in https://github.com/neovim/neovim/issues/18371). However, unless you're building from the default branch you won't have access to vim.lsp.buf.format yet. I'm running Neovim v0.7.0 with the following configuration for Go:
vim.api.nvim_create_autocmd("BufWritePre", {
  pattern = { "*.go" },
  callback = function()
	  vim.lsp.buf.formatting_sync(nil, 3000)
  end,
})

vim.api.nvim_create_autocmd("BufWritePre", {
	pattern = { "*.go" },
	callback = function()
		local params = vim.lsp.util.make_range_params(nil, vim.lsp.util._get_offset_encoding())
		params.context = {only = {"source.organizeImports"}}

		local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 3000)
		for _, res in pairs(result or {}) do
			for _, r in pairs(res.result or {}) do
				if r.edit then
					vim.lsp.util.apply_workspace_edit(r.edit, vim.lsp.util._get_offset_encoding())
				else
					vim.lsp.buf.execute_command(r.command)
				end
			end
		end
	end,
})

I'm using vim.lsp.util._get_offset_encoding() to get the offset encoding currently. I'm not sure if there's a better way. If anyone has any suggestions, please let me know.

Anyone aware of a way to specify the equivalent to  goimports -local?

Anyone aware of a way to specify the equivalent to goimports -local?

when in your gopls settings there is a "local" setting
https://github.com/golang/tools/blob/master/gopls/doc/settings.md#local-string
i think something like
lspconfig.gopls.setup({
	settings = {
		gopls = {
			local = "example.com"
		}
	}
})

Ah yes. Though I hadn't realized it was a prefix, that's not very useful as-is. I'll have to figure out a way to automagically get that value 😭

Ah yes, I needed to look more carefully. Though I hadn't realized it was a prefix, that's not very useful as-is. I'll have to figure out a way to automagically get that value sob

i wonder if you could do something funny like have lua execute the equivalent of go mod edit -json | jq .Module.Path and use that as local :grin:

Ah yes, I needed to look more carefully. Though I hadn't realized it was a prefix, that's not very useful as-is. I'll have to figure out a way to automagically get that value sob

i wonder if you could do something funny like have lua execute the equivalent of go mod edit -json | jq .Module.Path and use that as local 😁

I wrote a simple helper function in Lua:
function GetGoModuleName()
  local module_name = nil
  for line in io.lines("go.mod") do
    if vim.startswith(line, "module") then
      local items = vim.split(line, " ")
      module_name = vim.trim(items[2])
    end
  end
  return module_name
end

local goModule = GetGoModuleName()
...

local servers = {
  goals = {
    ["local"] = goModule,
  }
}

That said, it seems like organizing imports doesn't always behave as I would expect when the local setting is configured, but I'm not sure why.

autocmd BufWritePre *.go :silent! lua vim.lsp.buf.code_action({ context = { only = { "source.organizeImports" } }, apply = true })

The latest advice from https://github.com/golang/tools/blob/master/gopls/doc/vim.md#imports  still required me to save the file twice, even if i set the timeout at 5000.
Using goimports as a null-ls formatter works better for me but I'd rather use gopls.  Saving twice is unacceptable, so I'll have to for now though.

Does any one encounter slow response time when the buffer is first time send textDocument/codeAction to gopls?

Does any one encounter slow response time when the buffer is first time send textDocument/codeAction to gopls?

I wrote some hacks to prevent blocking when save buffer on first time opened (send a preflight request to gopls when lsp attached):
local golang_organize_imports = function(bufnr, isPreflight)
  local params = vim.lsp.util.make_range_params(nil, vim.lsp.util._get_offset_encoding(bufnr))
  params.context = { only = { "source.organizeImports" } }

  if isPreflight then
    vim.lsp.buf_request(bufnr, "textDocument/codeAction", params, function() end)
    return
  end

  local result = vim.lsp.buf_request_sync(bufnr, "textDocument/codeAction", params, 3000)
  for _, res in pairs(result or {}) do
    for _, r in pairs(res.result or {}) do
      if r.edit then
        vim.lsp.util.apply_workspace_edit(r.edit, vim.lsp.util._get_offset_encoding(bufnr))
      else
        vim.lsp.buf.execute_command(r.command)
      end
    end
  end
end

vim.api.nvim_create_autocmd("LspAttach", {
  group = vim.api.nvim_create_augroup("LspFormatting", {}),
  callback = function(args)
    local bufnr = args.buf
    local client = vim.lsp.get_client_by_id(args.data.client_id)

    if client.name == "gopls" then
      -- hack: Preflight async request to gopls, which can prevent blocking when save buffer on first time opened
      golang_organize_imports(bufnr, true)

      vim.api.nvim_create_autocmd("BufWritePre", {
        pattern = "*.go",
        group = vim.api.nvim_create_augroup("LspGolangOrganizeImports." .. bufnr, {}),
        callback = function()
          golang_organize_imports(bufnr)
        end,
      })
    end
  end,
})

I'm simply doing like this.
vim.api.nvim_create_autocmd("BufWritePre", {   callback = function(args)     vim.lsp.buf.format()     vim.lsp.buf.code_action { context = { only = { 'source.organizeImports' } }, apply = true }     vim.lsp.buf.code_action { context = { only = { 'source.fixAll' } }, apply = true }   end, })

Hi!
I have read through this thread wanting to do the same thing for my setup. I ended up realizing that:

Some actions have an .edit or a .command: those can be run immediately synchronously
Other actions don't have either, so for those I was trying to fall back to vim.lsp.buf.code_action
However, vim.lsp.buf.code_action is asynchronous, so it does not always resolve before Neovim has written to the file
I found that for those actions, there is a codeAction/resolve command, which we can call synchronously using buf_request_sync

I've put this all together into a snippet here: https://github.com/fnune/codeactions-on-save.nvim/blob/06ee93541ae32d335e5614ea389b2703a31cb658/lua/codeactions-on-save/main.lua#L15-L70
You can use it as a plugin if you'd like: https://github.com/fnune/codeactions-on-save.nvim
Thanks for this thread 🙇

Hi @fnune. Wouldn't it be a good idea to request upstream (neovim/neovim) for a synchronous option for vim.lsp.buf.code_action?

Good idea, gotchu https://github.com/neovim/neovim/issues/31176


Remove Config

Coverage remained the same at 96.667% when pulling 69d746aaaa1a6eb8b1f485eb11ac984d60a12498 on switch_to_ets into cdee6957dcc6f093ba4c8ceb04ea65f22f00f44d on master.

Coverage remained the same at 96.667% when pulling 69d746aaaa1a6eb8b1f485eb11ac984d60a12498 on switch_to_ets into cdee6957dcc6f093ba4c8ceb04ea65f22f00f44d on master.


prepare: Fill in fields based on parties roles

For example, if buyer and procuringEntity are not set, but parties/roles contains 'buyer' or 'procuringEntity', we can fill in these fields, before calculating indicators. Similarly:

If there is only one active award, we can set awards/suppliers with role 'supplier'
if there is only one active award and no lots, we can set tender/tenderers with role 'tenderer'

Not needed for MVP. Ecuador sets: buyer 100%; procuringEntity 99.5%; suppliers in 99.999% awards; tenderers in all auction bids, auction winningBids, all bids details and 16% tender. DGCP sets: buyer never; procuringEntity 100%; suppliers in all awards; tenderers in all bids details and 95% tender.


[Feature Request] CONTRIBUTING.md

Since we had various long discussions on small details of the project (#5, #6, #9, #10), how about adding their results to a CONTRIBUTING.md?

Yeah, I would be open to it. 😄

Okay, I would like to suggest that when #9 is merged, you should add a basic set of advice on how to contribute to this project, including a priority.  Especially the latter (together with the selection of the most important ones for the initial set) is something only you can decide.

What do you mean by priority?

In some cases, there are trade-offs between different conventions.  Then, it should be clear which one is more important.


Projects image are not shown

Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:

Go to /Projects.html

Expected behavior
A clear and concise description of what you expected to happen.
Logs
If applicable, add logs to help explain your problem (e.g. the error message and/or exception traceback).
Environment (please complete the following information):

OS:
Browser:

Additional context
Add any other context about the problem here.

Thanks for raising this issue, @divyang0712 . The bug has been resolved, and the changes have been successfully merged into the repository.Thank you for bringing this to our attention!
If you encounter any other bugs or issues, please feel free to open new discussions. Happy coding!


无法在flutter手机设备上运行吗

我想在手机上运行效果，请问怎么做呢

Hello, peter100u.
Since this package uses ffi, it is difficult to upload a dynamic library in order to operate it with flutter.
If you are thinking of using flutter, flame is recommended.
https://pub.dev/packages/flame

非常感谢


Future::await hangs indefinitely if the CheckedSupplier throws an InterruptedException

Future::await will hang indefinitely if the CheckedSupplier throws an InterruptedException

possibly related to #1382
using version 2.0.6

This test hangs indefinitely
 @Test
    public void testFutureInterruptedException()
    {

        Future<String> future = Future.of(() ->
        {
            if (true)
                throw new InterruptedException("interrupted");
            return "hello";
        });

        // this never returns, the test hangs here
        future.await();

        assertThat(future.isFailure(), is(true));
    }

Working example with another exception type, works as expected
    @Test
    public void testFutureOtherException()
    {

        Future<String> future = Future.of(() ->
        {
            if (true)
                throw new IOException("interrupted");
            return "hello";
        });

        // this does return, works as expected
        future.await();

        assertThat(future.isFailure(), is(true));
    }

A CheckedSupplier that uses Thread.sleep can throw an InterruptedException causing the awaiting thread to hang. Also it will obviously occur if something else throws that exception.

Scala act's similar, i.e. not completing the Future in the case of a Fatal exception:
scala> import scala.concurrent._
import scala.concurrent._

scala> import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.ExecutionContext.Implicits.global

scala> Future(throw new InterruptedException())
java.lang.InterruptedException
	at $line7.$read$$iw$$iw$$iw$$iw$.$anonfun$res2$1(<console>:16)
	at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:653)
	at scala.util.Success.$anonfun$map$1(Try.scala:251)
	at scala.util.Success.map(Try.scala:209)
	at scala.concurrent.Future.$anonfun$map$1(Future.scala:287)
	at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29)
	at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29)
	at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
	at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:140)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
res2: scala.concurrent.Future[Nothing] = Future(<not completed>)

Scala's solution:

Fork join execution context loses fatal exceptions
SI-7029 - Makes sure that uncaught exceptions are propagated to the UEH ...

References:

Dealing with InterruptedException
Being Aware Scala 2.10.0 Futures Conceal Fatal Exceptions
How to Handle Died Threads due to Uncaught Exceptions in Java

@Ramblurr this is no bug, it is correct behavior. Scala acts the same (see links above).
This is the critical code section:
    @Override
    public Future<T> await() {
        final Object monitor = new Object();
        onComplete(ignored -> {
            synchronized (monitor) {
                monitor.notify();
            }
        });
        synchronized (monitor) {
            if (!isCompleted()) {
                Try.run(monitor::wait);
            }
        }
        return this;
    }

On when the Future completes, the blocking monitor is notified and the Thread awakes.
The result of a Future computation is a Try - namely a Success or a Failure. The Failure does only encapsulate causes that are so-called non-fatal. An InterruptedException is Fatal and re-thrown by the Try.
The fatal exception takes place silently in the ExecutorService Thread. Such a Thread can register an UncaughtExceptionHandler in order to react to uncaught exceptions. However, we currently do not support uncaught exception handlers.
Nevertheless, a handler would not solve the problem of the blocking await() call. The real problem is, that await() waits infinitely long for the Future to complete. Under the presence of a fatal exception the Future will never complete. As a result, await() will never terminate.
Scala act's the same:
// = Future(<not completed>)
Future(Await.ready(Future { throw new InterruptedException() }, Duration.Inf))

I.e. the Await.ready() will never complete when we throw an InterruptedException in Scala (which is also fatal there). If we throw an Exception instead, we get a Failure, as expected.
Please note that we can't just abort await() in the case of a fatal exception. The state of the Future would be not completed. But the semantics of await() is to wait until the Future is completed.
Also Failure can't wrap a fatal exception. The meaning of fatal is, that it can't be handled, so it is re-thrown.

I see two follow-up tasks regarding this issue:

We should provide a mechanism to handle uncaught exceptions. This will give insight into the execution of our program and the ability to handle these exception and perform cleanup operations.
We should add a Future.await(timeout) (related to #1871)

The test will look like this:
@Test
public void shouldHandleInterruptedExceptionCorrectlyInAwait() {
    final Future<String> future = Future.of(() -> { throw new InterruptedException(); });
    future.await(Duration.ofMillis(100));
    assertThat(future)isEqualTo(Future.failed(new java.util.TimeoutException("Future timed out after 100 milliseconds")));
}

A mandatory timeout on await() sounds good to me. Thanks for looking into this.. looking forward to the fix.


python bindings (libselinux-python) aren't installed : Even though libselinux is installed and selinux is disabled

Bug Report
What happened: We are trying to onboard one of the linux server into ansible 2.6.3. This server has selinux disabled in /etc/selinux/config , libselinux is already installed and we are asking ansible to use python26 path (ansible_python_interpreter=/usr/bin/python2.6). But still while connecting to ansible server this remote machine throws error as Aborting, target uses selinux but python bindings (libselinux-python) aren't installed!. Please provide a fix to this
Remote server is using Python 2.6.8 and libselinux package install version is libselinux-python-1.33.4-5.7.el5
What you expected to happen:ideally if selinux is disabled ansible should not check libselinx and even if it is checking and if its already installed on remote machine it should detect it.
How to reproduce it (minimal and precise):

Share your group_vars files, inventory
[ttylinux]
xx.xx.xx.xx.xxx
[ttylinux:vars]
ansible_python_interpreter=/usr/bin/python2.6
Environment:

OS (e.g. from /etc/os-release): ansible server - 7.3 , remote server - 5.7
Kernel (e.g. uname -a): remote server - 2.6.18-274.el5 , ansible server - 3.10.0-514.el7.x86_64
Docker version if applicable (e.g. docker version): Not used
Ansible version (e.g. ansible-playbook --version):2.6.3
ceph-ansible version (e.g. git head or tag or stable branch):not used
Ceph version (e.g. ceph -v):not used

@Darknight123 this issue needs to be open on ansible project because it's not related at all with ceph-ansible project.
Also I saw something similar when using ansible via a python virtualenv because selinux python bindings can't be install in the venv, only via rpm package.
https://github.com/ansible/ansible/blob/stable-2.6/lib/ansible/module_utils/basic.py#L1056-L1067
https://dmsimard.com/2016/01/08/selinux-python-virtualenv-chroot-and-ansible-dont-play-nice/