It's impossible to import a remote module with a dynamic URL

Bug report
What is the current behavior?
If importing a module of the form:
`http://my.module/test?queryParam=${something}`

causes Webpack to throw a Module not found: Error: Can't resolve http://my.module regardless of externals configuration.
If the current behavior is a bug, please provide the steps to reproduce.
Create a function included in the build that looks something like this:
function importMyModuleDynamically(queryParam) {
  import(`http://my.module/test?query=${queryParam}`)
}

What is the expected behavior?
The expected behavior is for there to exist a configuration in which it's possible to load this module. Things I've tried:

Adding "externals" to the webpack configuration:

externals: [
  function(context, callback) {
    // This is invoked for all imports except for the http://my.module import
  }
]

Using experiments: { outputModule: true }. Setting this in the webpack config properly imports the module if the URL is a constant string, but it does not work when the URL is dynamic.

Adding a custom loader with the test:

{
  test: /^http:\/\/my.module/,
  use: 'my-loader'
}

my-loader is never invoked even though the test matches the URL.

Ignore the import:

import(/* webpackIgnore: true */ `http://my.module/test?query=${queryParam}`)

This still throws the Module not found error.
Other relevant information:
webpack version:  5.74.0
Node.js version: 18.8.0
Operating System: MacOS 11.6.8
Additional tools:

This was actually due to TypeScript converting the import statement into a require statement because the module type was set to commonjs.


CUDA -> CPU issue

def drop_connect(inputs, p, training):
    """ Drop connect. """
    if not training: return inputs
    batch_size = inputs.shape[0]
    keep_prob = 1 - p
    random_tensor = keep_prob
    random_tensor += torch.rand([batch_size, 1, 1, 1], dtype=inputs.dtype)  # uniform [0,1)
    binary_tensor = torch.floor(random_tensor)
    output = inputs / keep_prob * binary_tensor # error happens here
    return output

Faced error: RuntimeError: expected backend CUDA and dtype Float but got backend CPU and dtype Float
when I try to run on GPU, this error happens, the error direct me to this line, I think we should convert binary_tensor to inputs.device:
binary_tensor = torch.floor(random_tensor).to(inputs.device)

Hi kamwoh, do you use the efficientnet to train your own model or use pretrained models? If you use the pretrained models, the newly released version demands to add model.eval() after the model load.

Hi @dami23 , using pretrained models to finetune, yes I did model.eval()

Yup, this is now fixed in master. See https://github.com/lukemelas/EfficientNet-PyTorch/issues/29
I'll push out another release to pip soon.


Closed in favor of https://github.com/duburcqa/jiminy/pull/650


Initial plugin design

The goal of this plugin is to provide an interface for admin users of a Datasette instance to set secrets such as API keys, which can then be used by other plugins.
Plugins that already need this:

datasette-extract for OpenAI
datasette-enrichments-opencage for OpenCage Geocoder
datasette-query-assistant for Anthropic Claude 3

Datasette Cloud needs this, and I imagine it will quickly become useful for Datasette Desktop and https://github.com/datasette/studio as well.
Tasks:

[x] datasette secrets generate-encryption-key command
[x] Implement database schema
[x] Implement UI for editing secrets - should differ slightly for add v.s. update in terms of copy and placeholder text
[x] Implement encryption-at-rest
[x] Implement manage-secrets permission for managing secrets
[x] Implement register_secrets() hook - secrets should have an optional description which gets shown on the edit secret page
[x] Implement API for plugins to retrieve secrets that they need
[x] https://github.com/datasette/datasette-secrets/issues/2
[x] https://github.com/datasette/datasette-secrets/issues/3
[x] Documentation (including for plugin authors)

I built a tiny demo plugin: https://gist.github.com/simonw/d6c3500ea0c77499034df6b4e409e3e3
from datasette_secrets import Secret
from datasette import hookimpl

@hookimpl
def register_secrets():
    return [
        Secret(
            "DEMO_SECRET_ONE",
            "First demo secret",
        ),
        Secret(
            "DEMO_SECRET_TWO",
            "Second demo secret",
        ),
    ]

Install like this:
datasette install https://gist.github.com/simonw/d6c3500ea0c77499034df6b4e409e3e3/archive/2ae951bfbf2f945396c31cadadc437422a5df6f8.zip


Update hivesmodals.html

lbry.science just directs to an unrelated, broken/incomplete website. Not sure if LBRY Science is even a thing or not, so didn't remove it completely.
LBRY Records website no longer exists.

Go ahead and remove it. It's a sandbox for the time being.

Just resolve the conflicts and I'll get this merged

@Coolguy3289 Ready to merge I guess

No, because of the upstream merge. The !role command documentation has been added again, as well as the website that Jon approved removing.

Ah,  I probably reverted messed up something.
Checking...

Updated it manually


Coco and Flickr30 datasets download

HI,
I am a little confused about the number of images and the structure of the COCO and Flickr30 datasets. Could you provide the jsons and urls to which we can find the images, their names and captions in the same train, val and test subdivision that you used?
Thanks in advance

Hi, you can download mscoco here: https://cocodataset.org/#download, and flickr30k here: https://www.kaggle.com/hsankesara/flickr-image-dataset


Contract "import failed" on BSC/BSC Testnet fork

Abstract
I was trying to use blacksmith to test contracts on BSC/BSC Testnet fork. But when I tried to import contracts on blacksmith's local website it shows "import failed", tested several times, both BSC/BSC Testnet won't work.
What I did

Following the instruction, I cloned blacksmith and run it with yarn dev
Then I forked the BSC mainnet via anvil, using anvil --fork-url https://bsc-dataseed1.binance.org/. The network was forked successfully and wallets are generated. I also saw the "Chain 56" instruction at the blacksmith web (http://localhost:3000/)
I found a random contract on bscscan.com, let's say PancakeSwap MasterChef (0x73feaa1ee314f8c655e354234017be2193c9e24e), when I tried to import it in the via "Contact Management" in blacksmith, it shows "Import Failed".
I tried with ETH network and it works fine. So I guess there's some configuration wrong with networks outside of ETH?

Screenshots
Initial State:

After I tried to import a contract via blacksmith:

System (please complete the following information):

Browser: Chrome
Blacksmith Short SHA: f23b2dd
Anvil Version: anvil 0.1.0 (2ff9902 2023-01-11T00:22:04.738793Z)
Forge Version: forge 0.2.0 (2ff9902 2023-01-11T00:22:04.500579Z)

Additional context
Please let me know if there is any way to fix it. I am happy to learn and help. Thanks.

Thanks for filing this issue @a4dyn!
Unfortunately, the contract import functionality doesn't adapt to retrieve contracts from the appropriate block explorer/verifier based on the active chain (yet). Right now it is hardcoded to only import from Ethereum mainnet via Etherscan. I've actually been working to add support for other chains, but what I have right now isn't quite production ready.
As a quick fix I'll make this clearer in the instructions of the contract management section and I'll work on getting full support for importing contracts from other chains like BSC as soon as possible!

Added some additional language to the Contract Management section in #105.

Thanks for filing this issue @a4dyn!
Unfortunately, the contract import functionality doesn't adapt to retrieve contracts from the appropriate block explorer/verifier based on the active chain (yet). Right now it is hardcoded to only import from Ethereum mainnet via Etherscan. I've actually been working to add support for other chains, but what I have right now isn't quite production ready.
As a quick fix I'll make this clearer in the instructions of the contract management section and I'll work on getting full support for importing contracts from other chains like BSC as soon as possible!

Thanks for the reply! I would love to help you developer such features if needed. Should I go ahead and close this issue or leave it open until such feature is added? Thanks :)

Let's leave the issue open until the feature is added. I'll just change the label from bug to enhancement.


Change URL caching inside ThemeLoader.

This is another way of patching the issue we're facing with Figma application's plugin sandbox.

I definitely propose this as fix for the issue with Figma.
To me this is the wrong spot to evaluate anything URI related. Especially this being after the response got back and we just cache the URL.
Can we enlighten this discussion again please?

@mviranyi , agreed.
I see this line was written by @zbigg , do you remember why we have the call to resolveReferenceUri, is it some left over code from some refactoring? As mentioned by @mviranyi , we already do the fetch, so this shouldn't be needed?

@nzjony Unfortunately i don't remember all details about this patch. Brief look confirms that indeed, this is wrong place to "resolve" relative url to absolute.
I also got gut feeling that we needed to resolve theme.url to absolute but i don't remember if that's still the case.


fix(kotlin): deserialization

🧭 What and Why
🎟 JIRA Ticket: CR-6916
Changes included:

update recommend spec to add oneOf discriminators
update template to generate all possible oneOf cases
update template to fix array deserialization

🧪 Test

awesome btw, gg!!


Remove installation of pip and junit_xml library

These two dependencies have been pushed into the base AMI and it is no
longer necessary to install them at test run time.
Signed-off-by: Steve Kuznetsov<EMAIL_ADDRESS>

I thought you loved those tools

Only so much love.


Murchie2023

Pull Request
This PR is for a

[x] New Publication(s)
[ ] Correction

For the following list(s):

[x] ancientmetagenome-environmental (README)
[ ] ancientmetagenome-hostassociated (README)
[ ] ancientsinglegenome-hostassociated (README)

This is to close #1129
PR Workflow

Open this PR with sample metadata on the samples metadata sheet (:tada: you're already here!)
Wait for checks for sample metdata to pass
(If checks fail) make corrections, and push changes to this branch (no need to open a new PR!)
(Once passed) comment on this PR @spaam-bot please autofill <table_name> <project_id> to get a half-filled template! (may take a minute or so to get the comment with the file)
Fill in the template, and verify autofilled data correct!
Once filled in, append(!) the new rows from the TEMPLATE file to the end of the corresponding library metadata file, and update this PR
Wait for checks for library metadata to pass
Request review!

Pre-review checklist (new publications)

[x] Publication is published

Preprints currently not accepted?

[x] Checked the publication is not already in the database?
[x] Checked samples in this publication are not previously published data?

Newly re-sequenced metagenomes are OK!

[x] Samples are shotgun metagenomes and not amplicon data

Note: hostassociated-singlegenome may also contain whole-genome enriched data

[x] Checked the list follows conventions as described in the corresponding sample type's README file (e.g. using ERS/SRS accession codes for ENA/SRA)?
[ ] Once sample table validation completed Library metadata has been added

Use @spaam-bot please autofill <table_name> <project_id> to get a half-filled template! May take a minute or so to get the comment with the file
Fill in template, and verify autofill data correct!
Once filled in, append(!) the new rows to the end of the corresponding library metadata file

[x] Changelog is updated to include the publication under 'Added'?

Thanks @ktozdogan for the PR. I have reviewed it and added one sample, SET-279-SG, to both the sample and library table. In their Supplementary table Table S1, Murchie2023 defined it as a shotgun sample, which is indicated both in the sample name and in a separated column. However, on ENA, its library strategy was set to "targeted capture".
I think the latter information on ENA is wrong. After discussing with @jfy133, we will add the sample and library for the moment and I will email the authors about it. In case this is indeed a capture-enriched sample, we will remove it in a later release.


Updated Documentation -grunt to gulp

Pull Request
Hi,

A description of the changes proposed in the pull request:
Updated Local development steps from grunt to gulp

Thanks for pointing this out and taking the effort to fix it. It is appreciated. However, I am going to copy over our standard language instead. Cheers


Java: support multiple versions per release

Java publishes packages together and different artifacts are versioned independently. We already have precedent in google-cloud-java to manage all versions in a versions.txt file at the root directory and to be able to annotate places to replace throughout the README.md and pom.xml files.
This PR replaces the current utilites/bump_versions.py and utilities/replace_versions.py scripts in google-cloud-java so they can be used with other repositories like gax-java.
The workflow is now:

What type of release? (MINOR|patch|snapshot)
Bump versions.txt? (Y/n)
Update versions in pom.xml files? (Y/n)
Edit release notes
Create release branch? (Y/n)
Create PR? (Y/n)

See https://github.com/googleapis/google-cloud-java/issues/3777
This should make releasetool work for all of google-cloud-java, gax-java, google-auth-library-java, google-api-java-client, google-http-java-client, google-oauth-java-client.

@theacodes @busunkim96 As I'm not a pythonista yet, should I break the internal classes in here into separate files?

What would the usage look like in gax-java?

I haven't looked into the gradle release process yet.

I don't think it needs to be built into the gradle release process yet; the question was more about how the direct commands would look.

@garrettjonesgoogle I meant looking into how gradle handles release and snapshot versioning. The releasetool workflow should be identical.

@chingor13 Ok. So what commands would I run manually to invoke the bump & replace-versions logic?

This is ready to go whenever.


Bug: Text table chart, User Permission,  internal Hive, Create Dashboard(relationship, join)

Metatron version: final
datasource: csv

Text table chart: color setting is not properly work
custom color is not applied

Permission
If userA have watcher permission on Workspace1, I think userA only can watch on Workspace1.
As I guess, userA cannot make any workbook and Workbench.
But userA can move items from userA's workbook to Workspace1.
Is this bug? or function?

internal Hive
When I use snapshot and Staging DB, I think it use internal Hive which reference from Metatron Menual.
But It makes error message "Hive not configured"
Do I have to do something to use snapshot function (such as install Hive myself or else)?
I try to use Metatron with not configured Hive which means not installed any installed Hive at same position, and with Hive at same position. But both condition is not work.

Create Dashboard
When I try to make a Dashboard and select dataset, I can make a connection between dataset. I feels like configuration a foreign key.

After this action, I only can use single table to make a visualization result.
After this, I wish to make a Join, But I saw the error message.

Addtional bug(question)

If userA has a permission on Dataset1 but Workspace1 do not have permission to Dataset1.
I can reasonably understand move my visualization result to Workspace1(like publishing), but currently Workspace1 can see the original table of the Dataset1 by moved workbook without dataset permission.

@wm9947 There are a lot of issues. Could you tell us more in detail on our slack channel?
invitation link

@wm9947 I can't reproduce Number 2 because watcher cannot select move button like this :

@wm9947 I think custom color setting works well. Of course, we need to look more at the matching of values and colors.

@kyungtaak Would explain staging db concept? @wm9947 As I know, you should configure staging db.

@wm9947 It seems that there is a bug in the join function of the data source. I also tested and found the following bug. @kyungtaak It seems like a bug.
There were problems
Please check the following messages:
QueryTimeExcetpion: [{"error":"Can not deserialize instance of java.lang.String out of START_OBJECT token\n at [Source: HttpInputOverHTTP@7b515579; line: 1, column: 99] (through reference chain: java.util.ArrayList[0])"}]

@i1befree
For example,
userA has a manager permission on Workspace1.
userA has a watcher permission on Workspace2.
In this time userA cannot move his workbook, which is on the workspace1, to workspace2.
And the table color,
Once I set the color of the data, I cannot change color.
And seems like your result of the table which is colored background is different with mine.
As you can see below image, it changed text data instead of background.

@kyungtaak
Unfortunately, I cannot reach slack channel during my working time. I will try on weekend.
Many thanks,

@wm9947 You're right. If two measure values are present, the range is determined by the first measure value and the maximum and minimum values can not be modified. I think this issue is a bug, and we need to discuss this issue.

@i1befree ok! :) First from stagedb.. @wm9947 stagedb is a predefined hive database for internal use within metatron.
It is used as a snapshot repository in the data preparation function and provides additional ingestion options not available in the normal DB, such as supporting partition in the hive when ingesting datasources.
So, to use this, you need to configure the application as below.
polaris:
  storage:
    stagedb:
      hostname: your_host
      port: 10000
      username: hive
      password: hive
      metastoreUri: thrift://your_host:9083

If you have any problems with the configuration for stagedb, please let me know. :)

@kyungtaak
I add a configuration which you provided. like...

But it is not work.
Is there anything I have to configure more?

@kyungtaak
I try to make database, which is 'dataprep', in my Hive.
After this action the error message is changed to 'Query failed'
Here is my current conf.

Many thanks,

Hi @wm9947
For using staging DB, it only needs the previous configuration.
(As @kyungtaak described,
  storage:
    stagedb:
      hostname: your_host
      port: 10000
      username: hive
      password: hive
      metastoreUri: thrift://your_host:9083

, prefixed dataprep values are things to consider later.)
But it seems to be your settings have not been applied properly.
The first thing that you need to set is activating the template file within the conf directory.
mv application-config.template.yaml application-config.yaml
If you are not on the status I mentioned, please feel free to attach your logs detail :)

@alchan-lee
I set the application-config file as you mentioned.
(change file name, not use prefixed dataprep value)
But still not work.
{"code":"GB0005","message":"unauthorized","details":"Full authentication is required to access this resource"}
This is my error message. I think something in my hive set wrong way.

Many thanks,

@wm9947 I'm sorry for the late reply. Can I see which screen occurs the error message?

@kyungtaak
When I want to make a snapshot from the data flow.
and When I want to see the detail of a snapshot data which is saved in local.
(sorry the screenshot is not currently work in my computer)
Additionally, the manual of the geo server installation has been disappeared from git hub main page.
If I want to use the geo server, do I have to configure in the application-config?
(reason why I asked about this, error message has been appear when I do use geoserver configuration at the yaml file.)
I changed the password xxxx to geoserver. is this right?
Many thanks,

Additionally, the manual of the geo server installation has been disappeared from git hub main page.
If I want to use the geo server, do I have to configure in the application-config?
(reason why I asked about this, error message has been appear when I do use geoserver configuration at the yaml file.)
I changed the password xxxx to geoserver. is this right?

@wm9947 I'm sorry to the late reply
Geoserver is no longer used.  The process that geoserver is doing is handled by discovery and druid.

@wm9947 I think Number 2 is a bug.

fixed this issue. :)


[8.x] Add Model::transitionedTo() & Model::transitioningTo()

This PR adds a new model methods transitionedTo($attribute, $to, $from) and transitioningTo($attribute, $to, $from).
It's useful to detect changes that happened to the model from one state to another:
// Given the current user role as `super-admin`.

$user->role = 'admin';

$user->save();

$user->transitionedTo('role', 'admin'); // true

$user->transitionedTo('role', 'reviewer'); // false

$user->transitionedTo('role', 'admin', 'super-admin'); // true

$user->transitionedTo('role', 'admin', 'contributor'); // false

And for un-presisted changes, there's a transitioningTo method.
// Given the current user role as `super-admin`.

$user->role = 'admin';

$user->transitioningTo('role', 'admin'); // true

$user->transitioningTo('role', 'reviewer'); // false

$user->transitioningTo('role', 'admin', 'super-admin'); // true

$user->transitioningTo('role', 'admin', 'contributor'); // false

Why not implement transitionedFrom and transitioningFrom methods too, if we only want to check the old attribute whatever the new one is ?

I had similar thoughts when I saw the first iteration of the PR, wasChanged would be awesome to have (and not having to specify explicit attributes, similar to getDirty).
But I see the challenge of the shape to return (old or new or both values -> 💥 )

Great initiative @themsaid 👍 👋
What if the role depends on many attributes ?
Overall, using a state machine package with Eloquent models would make more sense
cf. https://symfony.com/doc/current/workflow/workflow-and-state-machine.html

@lucasmichot a real state machine is going to be useful in these complex cases. Just wanted to tackle the simple case when you just want to check a transition happened or is about to happen.

This PR adds a new model method wasChangedTo($attribute, $to, $from).

@themsaid Did you mean transitionedTo() in the description?

It would be nice it also supports operators something like:
$post->transitionedTo('votes', '>', 100);

I think changedTo() and changingTo() is a more consistent method name because of wasChanged() and getChanges(). Just my opinion tho.

I think changedTo() and changingTo() is a more consistent method name because of wasChanged() and getChanges(). Just my opinion tho.

Agree!

Awesome feature @themsaid! We have been working around this for quite a while in our own projects!
One question, in case we persist models on multiple occurrences in a single request it rewrites the previous persist difference.
Is there a reason why the new changes aren't merged with the previous ones?

That's how the $changes array works. It always gives you the latest attributes that has changed.

@themsaid  Is it intended that this will not work with things like array casts or Collection casts or other custom casts, etc?

That's how the $changes array works. It always gives you the latest attributes that has changed.

The $changes array just stores the changed current values, right? Where the $old array contains the values from before the changes. Might be great to keep the way both $changes and $old work in sync so that both reflect states in a similar way where $changes reflect the newest state and $old contains the previously known state. That way also multiple saves on the same model are supported. Just my two cents, great addition to the framework. :)

@taylorotwell yes transitioning is only detectable when comparing strings or null

Great work @themsaid!

That's how the $changes array works. It always gives you the latest attributes that has changed.

That's right, although I agreed with @ajcastro, but $changes is in a plural form, meaning you can handle it by providing new properties like $changed and $changing I guess.
Also, with PHP8 named arguments, it would be easier if removing To from method names:
// Given the current user role as `super-admin`.

$user->role = 'admin';

$user->transitioned(attribute: 'role', to: 'admin'); // true

$user->transitioned(attribute: 'role', to: 'reviewer'); // false

// Or using isTransitioned

$user->isTransitioned(attribute: 'role', to: 'admin', from: 'super-admin'); // true

$user->isTransitioned(attribute: 'role', to: 'admin', from: 'contributor'); // false

I feel like this should also take arrays of values. Even in the example you give, it would be very useful to check if a user has become any type of admin. Something like:
$user->transitionedTo('role', ['admin', 'super-admin'], ['chump', 'reviewer', 'contributor']); // false

That way this can be used to do something like send an email if a user has been given admin privileges.

I do agree not supporting arrays will be a source of continual user complaints / requests.

Arrays support was added as described in @bjhijmans's comment

@taylorotwell This isn't the same thing you are thinking of. This adds in_array checks, so you can check if something transitioned from either a or b, to either c or d. I think that's an important use case, but it still doesn't support casts.

@taylorotwell array support means you can provide an array of possible results form before and after and the method will return true if the before state and after state are included in both arrays.
$user->transitionedTo('role', ['admin', 'super-admin'], ['reviewer', 'contributor']);

Returns true of the role changed to admin or super-admin from reviewer or contributor.

I was looking at this and had an idea… if we have the previous attributes, could it be useful to be able to instantiate a model instance with the previous attributes? … you could make more complex checks agains the previous model’s state, including mutator support… for example… $model->updated_at compared against $model->wormhole()->updated_at… where some wormhole style method creates a new model instance with the old attribute array...
I am not suggesting wormhole should be the final method name...

@taylorotwell :
Rather than $model->wormhole(), I propose $model->original() (like the original vs. attributes arrays inside a Model)

Here's a question. If you do the following:
If field was changed from a to b
$this->changedTo('field', ['a', 'b']);

Should it return true or false?
Part of me says true, because it was changed to either a or b. But another part of me says false, because it already was one of those values. And I can see use cases for both.
Maybe additional methods are needed?

Nice work! Though wormhole() sounds a bit cryptic. Why not just call it previousState()?

I agree @windu2b I think $model->original() is pretty clear.
Another option in keeping with change may be:
$model->beforeChanges()->updated_at

Agree that wormhole is a bit cryptic, if super cool. I would propose withoutChanges(). I was going to suggest beforeChanges() but that sounds like it should be a callback or something.
Great feature!

It would be nice to have an equivalent changedFrom and changingFrom for those scenarios where we only care about the state a value was leaving.
I.e we might only care about triggering an action when a user's subscription leaves the 'active' state. I might not care where it ends up, just that it left being active.

I like beforeChanges more than wormhole.

It would be nice to have an equivalent changedFrom and changingFrom for those scenarios where we only care about the state a value was leaving.
I.e we might only care about triggering an action when a user's subscription leaves the 'active' state. I might not care where it ends up, just that it left being active.

Can't you just use the isDirty() method for that?
Anyway I agree on original(), hopefully it won't create confusion with getOriginal() or getRawOriginal()

I think that original() is misleading. To my mind "original" means the very first state of the model when it was originally created.

I am with @devinfd. The word original() should for the very first created state.
How about the name asBefore()? It refers to get the details of model as it was before changes.
$user->asBefore()->attribute

I feel like especially the changingTo method is solving an issue nobody asked for. I see no need to introduce a shortcut method which can already be bypassed by using the existing getChanges and isDirty methods. Furthermore the $to and $from arguments - including the proposed use of comparison operators - just introduces more unneeded clutter.
But maybe I am not getting the point in just using existing methods. I feel like this is a feature which could be implemented on a project-by-project level but does not serve a purpose for the majority of Laravel developers.

I think that there is a bug with the in_array checks:
E.g. in_array(0, [null]) and in_array(null, [0]) return true which could be wrong if we want to know if nullable/numeric attributes were changed.

I agree with @aarondfrancis. Wormhole is too cryptic and something like:
$user->previous();

would be better, but that specific option sounds a bit like "previous user (id-1) in the database", so something like previousState() or withoutChanges() is probably ideal.
That said, withoutChanges invites some complexity too, because:
$user = User::find($id);

$user === $user->withoutChanges(); // true

$user->foo = 'bar'; // not yet saved

$user === $user->withoutChanges(); // false

$user->save();

$user === $user->withoutChanges(); // true

$user->wormhole(); // same attributes as $user on the first line of this snippet

Referring to these things as changes is a bit tricky because there are changes before saving (dirty attributes) and then there's the previous state. So the model would need to keep track of three things:

original (wormhole) attributes. These are set once — after being fetched from the DB.
original (non-dirty) attributes. These are set to $attributes after each successful save()
current attributes

$user = User::find($id);
$user->attributes === $user->originalAttributes;
$user->originalAttributes === $user->wormholeAttributes;

$user->foo = 'bar';
$user->attributes !== $user->originalAttributes;
$user->originalAttributes === $user->wormholeAttributes;

$user->isDirty('foo'); // true

$user->save();

// no attributes are dirty anymore
// but the wormhole refers to $user form line 1

$user->attributes === $user->originalAttributes;
$user->originalAttributes !== $user->wormholeAttributes;

$user->foo = 'baz';
$user->attributes !== $user->originalAttributes;
$user->originalAttributes !== $user->wormholeAttributes;

$user->save();

// no attributes are dirty
// wormhole refers to $user with foo='bar'

Also, I agree that beforeChanges sounds like "something to execute before a change is made to the model's attributes" rather than "the state before any changes", so the word without is better.
This is a bit length comment, so in short my point is that using the word "change" is tricky because there are pre-save changes (dirty attributes) and post-save changes, and the original attributes & wormhole attributes update at different times.
I think if the changed methods are added, there should also be changing for dirty attribute comparisons. That would be consistent with the saving and saved Eloquent events:
class Report extends Model
{
    public static function booted()
    {
        static::saving(function (self $model) {
            if ($model->changing('assignee_id')) {
                Mail::to($model->assignee->email)->send(new ReportAssigned($model));
            }
        });

        static::saved(function (self ($model) {
            if ($model->changed('assignee_id')) {
                Mail::to($model->assignee->email)->send(new ReportAssigned($model));
            }
        });
    }
}

I'll note that for the use case in the example above, this PR adds the option to use the saved event which currently isn't possible at all since we can't access the previous state and can only detect changes as dirty attributes in the —ing events. Which is not ideal, because it can lead to the side effects (e.g. emails) being sent even if the update call is canceled further in the listener/exception handling logic.
I said that previous as a method is a bit confusing, but it'd make more sense than the word "change" for the attributes.
$user->original;
$user->attributes;

$user->foo;
$user->getOriginal('foo');
$user->isDirty('foo'); // compares $attributes and $original

// If we added $user->previous
$user->previous;
$user->getPrevious('foo');
$user->wasChanged('foo'); // compares $original and $previous

// If we added changed/changing methods
$user->changed('foo'); // alias for wasChanged() above
$user->changedTo('foo', 'bar');
$user->changing('foo'); // alias for isDirty()
$user->changing('foo', 'bar');

But I just noticed that wasChanged is already being used for comparing changes between $attributes and $original.
Which kind of makes it weird to use $user->changedTo('foo', 'bar') when $user->wasChanged('foo') is already being used for comparing different points of state 🤔
Anyway, sorry if this is a bit long, just my thoughts on the naming. I think there are some conflicts with the terminology that's already being used and other terms are just too unclear on their own. It'd be a good idea to write down what original, previous, changed, changing etc should mean in the context of the Model class.

Nice add on! 👍🏽
It will support relations right? I mean,
$user->locations->address = "Address";
Not sure if it stands to ground for but, can this apply to dynamic properties that depend upon multiple attributes like appends? Just thinking!
Also, Instead of 'wormhole' the 'original' sound much easier to understand.

original is already being used for the original (post-fetch pre-save) attributes of the model. And assuming that wormhole() will just take the previous attributes and instantiate a new model with them, yes, BelongsTo will be supported. HasMany relations use data in a different table, so those won't work.

$model->preceding() is the best I can come up with. Also considered $model->old().

original is already being used for the original (post-fetch pre-save) attributes of the model. And assuming that wormhole() will just take the previous attributes and instantiate a new model with them, yes, BelongsTo will be supported. HasMany relations use data in a different table, so those won't work.

Ah my bad! So many things already implemented! Another one I thought initially was restorePrevious but then it adds confusion with restore😅
Now I understand, why @themsaid have chosen 'wormhole' 😶
What about $user->reinstate()

What about ->past() ?
It would read nicely with attributes (as in 'past value') and indicates that the function returns a state of the model.
$user->past()->address

Agree that wormhole is a bit cryptic, if super cool. I would propose withoutChanges(). I was going to suggest beforeChanges() but that sounds like it should be a callback or something.
Great feature!

I agree, withoutChanges() feels like the most obvious name for this function. In my opinion, it fits nicely with the natural language that devs appreciate from the framework.

I propose ->virgin()  instead of ->wormhole()  🤔 😬

Could earlier() or former() be an option? Maybe with the ability to pass an attribute name if we only need to get the earlier/former value of that attribute:
$earlierInstance = $model->earlier();
$earlierAttribute = $model->earlier('attribute');

$formerInstance = $model->former();
$formerAttribute = $model->former('attribute');

It's a -1 from me.
When you are mutating attributes on a model - wouldn't you know what attributes are changing and what to? Seems this is far too high level to be in core imo, and would encourage a side-effect driven architecture.

When you are mutating attributes on a model - wouldn't you know what attributes are changing and what to?

You can do that already. isDirty(), originals etc.

It would also encourage a side-effect driven architecture

That's a good thing.
See the example code with the Report model I wrote above.
When some logic is bound to entities like reports (e.g. send an email after the assignee is changed, prune some cache after the price is changed), it's infinitely better to put it in models than controllers.
What if you want to use the model in Livewire? What if you want to have console commands, scheduled jobs, or any other things? Will you copy paste the logic for sending the notification to all of those places? Will you create a special action class for updating the assignee & sending a notification? And then when you want to make more of those changes, will you create a class that injects those two actions and runs them both?
I honestly don't see why using model events isn't a more common practice. I do this in literally all of my apps.
It's brilliant to test too:
test('a notification is sent when the assignee is changed', function () {
    $report = Report::factory()->create();
    $assignee = Assignee::factory()->create();

    Mail::fake();

    $report->update(['assignee_id' => $assignee->id]);

    Mail::assertSent(ReportAssigned::class, function ($mail) use ($assignee) {
        return $mail->hasTo($assignee->email);
    });
});

And now I can edit my reports from tinker, Invoker, Nova, Livewire components, controllers, console commands — and the logic will always be the same. I won't have to think about it.
Models aren't just fancy wrappers around DB::table('reports')->where('id', $id)->first(). They represent your business entities. When a report's assignee is changed, the new assignee should get an email notification. You declare that in the model and you never have to think about it again. It's guaranteed to happen.
You don't have to (and shouldn't) think "okay to update this report I need to do this, that, and then run this action". That's all behavior of the model, and it should be properly encapsulated.
I have a report, and I want to update it. "Report, please update your information with this data. Thanks." And it's done.
Writing code like this is beautiful and declarative. Procedural code that's hidden in controller methods isn't. Also, this is used on all layers of the app. SQL on update cascade is like this. "When a report is deleted, delete all of its status changes". You don't clean up the report_statuses table manually after deleting a report. The DB does it for you.
That's exactly like the model event listener, except it's in the simple DB layer that deals with low level data. Your application code is what deals with email notifications, and it's perfectly fine (and desirable) for it to follow the exact same pattern as your database of letting the developer declare what should happen when some data changes.

Maybe since its like the ghost of the model:
$model->phantom()->updated_at

@stancl
Your report example is what I call side-effect driven design, which is generally considered a code smell.
I would encapsulate the logic of assigning reports and sending email under a specific function. I would not put it in a model booing event, saving-event, updating-attribute event. As the size of the app grows, you will find it becoming increasingly complex to follow the rabbit trail of when things happen and why.

You declare that in the model and you never have to think about it again. It's guaranteed to happen. You don't have to (and shouldn't) think "okay to update this report I need to do this, that, and then run this action". That's all behaviour of the model, and it should be properly encapsulated.

That's also a problem. With your report example you could unknowingly send emails out after assigning reports. For example, if you had a cron script that simply wanted to update who they are assigned to:
$report->assigned_to = 15;
$report->save();

Is it obvious this sends an email? Not to me. And probably not to anyone other developer potentially working on your app. It's a source of strange behaviour if you design apps in this way.

That's like saying that it's not obvious to anyone that records in report_statuses will be deleted when report is deleted. Any developer working on the codebase can easily see all these things within a few minutes of going through the code.
"unknowingly send emails" — you know that notifications are sent when assignees are changed. That's what you've been expecting every single time when updating reports. If you want to avoid this behavior, you simply save the model without firing events.
Also, any other design pattern makes it extremely difficult to have a usable admin panel when using tools like Nova.
Models represent entities in your business logic, they're not stdObjects with data from a DB::table() call. If you want to do everything low level, procedurally, and very explicitly — that's fine, write code as you want. But it doesn't make sense to "-1" a PR that expands existing functionality that has valid use cases in many apps.

As the size of the app grows, you will find it becoming increasingly complex to follow the rabbit trail

Cool, I do this in many of apps, and I never had any issues at all. Only benefits.
I'm pretty sure that lots of people use Laravel for apps like mine where this works perfectly, so judging a feature by how useful it will be to a niche subset of supercomplex apps with a large developer team doesn't make any sense.
Should Laravel remove closure routes because they become problematic for apps with 10,000 routes? No. It's a versatile framework for apps of many sizes, and different features make sense for different apps.

This is starting to feel like a podcast. Enough with the paragraphs lol

Let's get back to the PR code examples:
// Given the current user role as `super-admin`.

$user->role = 'admin';

$user->save();

$user->changedTo('role', 'admin'); // true
$user->changedTo('role', 'reviewer'); // false
$user->changedTo('role', 'admin', 'super-admin'); // true

This could be written like so now:
$changed = $user->getChanges();

if ($changed['role'] ?? null == 'admin')
if ($changed['role'] ?? null == 'reviewer')
if (in_array($changed['role'] ?? null, ['admin', 'super-admin']))

You could even support different operators!
if ($changed['price'] ?? null >= 5000)
if ($changed['price'] ?? null < 5000)

And switch statements!
switch ($changed['role'] ?? null) {
   case 'admin':
     // ...
   break;

   case 'reviewer':
     //
   break;
}

If you fancy some match in PHP 8:
match($changed['role'] ?? null) {
   'admin', 'super-admin' => $this->sendEmail(),
   'reviewer' => $this->doSomethingElse()
};

For changingTo you just swap getChanges() with getDirty().
Benefit of this is:

You support many operators
Your not restricted in syntax
It's less code to maintain in core

Mild downside:

Slight clunky null coalescing operator

...but you can get around that by setting default values in $changed if you wanted.
Overall, I think this PR sounds good on the face of it, but it's too high level. It brings minor code improvement but adds more complexity and adds potential future problems (operators, relations support, etc). Interacting with a basic array of changing and changed values yourself gives you more flexibility.

What about supporting a user-provided anonymous function to allow custom logic like @foremtehan mentioned (e.g. > 100)?
$post->transitionedTo('votes', '>', 100);
$post->votes; // 99

$post->increment('votes');

$post->changedTo('votes', function ($value) {
    return $value > 100;
}); // true

@PHLAK that looks kinda clunky to me. Then again I've never been much of a fan of closures in general.
$post->changedTo('votes', fn ($votes) => $votes > 100); // true

Can currently be written as:
if ($post->getChanged()['votes'] ?? null > 100) // true

These kind of helpers should just sit in userland imo.

The entire point of the PR is to add:

syntactic sugar
access to the previous state

If you disagree with it, just downvote it. But there's no point in saying that some helpers should stay in userland when the PR is about adding these helpers. Just disagree and move on.
I agree @PHLAK, the closure approach is very versatile and clean. Very consistent with other Laravel APIs. Doing ->getChanges()['votes'] ?? null is almost never done in Laravel. Only in the bits that interact with the underlying Symfony logic. Checking if the result of a getChanges() methods has some key, using ?? fallbacks, and stuff like that is just ugly.
With @PHLAK's example in specific, I think this provides a really nice API for some things I mentioned above, where you want to run side effects, but want to use the —ed hooks instead of —ing so that your side effects only run after the changes have definitely been made.
static::saved(function (self $post) {
    if ($post->changed('votes')) {
        static::refreshRankings();
    }

    if ($post->changed('votes', fn ($votes) => $votes > 100)) {
        $post->flags()->create(['flag' => 'hot']);
    }
});

I personally think that changed works for these checks too, and maybe it's less clunky than changedTo in some cases.
If only one argument is passed, return whether a change to the attribute has been made. If the second argument is passed as well, return whether the change equals to that argument. If it's a closure, return whether the attribute has been changed && the result of the closure.
$post->changing('votes'); // isDirty('votes')
$post->changing('votes', 100); // isDirty('votes') && $this->votes === 100
$post->changing('votes', fn ($votes) => $votes > 100); // isDirty('votes') && $callback($this->votes)

$post->changed('votes'); // getPrevious('votes') !== getOriginal('votes')
$post->changed('votes', 100); // changed('votes') && getPrevious('votes') === 100
$post->changed('votes', fn ($votes) => $votes > 100);  // changed('votes') && $callback(getPrevious('notes'))

With getPrevious() being like getOriginal(), except it reads from previous rather than original.
When arguments like these are used, array support will not be an issue. Also, for comparing the original state too, you can add a third argument. Depending on how focused the team is on PHP 8 support, you can either do variadic arguments, or named arguments.
The difference would be whether you want changed('votes', 99, 100) or changed('votes', from: 99, to: 100).
public function changed($property, $to, $from = null) {}
changed('votes', from: fn ($votes) => $votes < 100, to: fn ($votes) => $votes > 100);

public function changed($property, $from, $to = null)
{
    if ($to === null) {
        $to = $from;
        $from = null;
    }

    // ...
}
changed('votes', fn ($votes) => $votes < 100, fn ($votes) => $votes > 100);

Personally, I'd go for the first variant (specifying from using a named attribute when needed), because it provides better IDE support — you can actually see what parameters are available. But if you'd want to be consistent with the rest of Laravel, running count() on func_get_args() or doing the if ($to === null) would be better.
The second approach in the code above provides support for named arguments as well, but it only works when passing both from and to. Otherwise it won't let you only pass to, and only passing from will actually set to. Also it's weird to see your IDE saying that you're setting $from when writing changed('votes', 100).
I'd also like to point out that the closures provide a great way to run complex comparisons on both the previous and the current value. A great example of a real world use case is exactly the above with votes. You want to add the "hot" flag to a post the moment its votes swing from < 100 to > 100, but at no other times. This lets you do that, using quite clean code.
And even though I said previous() is kinda ambiguous, if we go with previous in the above context (I think it's really the cleanest approach), using previous() as the wormhole, and adding original() for the same behavior except using the original (post-save, non-dirty) attributes would be very nice.
$post->previous(); // new static($this->previous);
$post->original(); // new static($this->originals);

And of course, $this->previous would have the non-dirty (original) attributes of the previous version of the model.
But to reiterate, there's already wasChanged() which looks into the dirty attributes. In my opinion it'd be best to deprecate it and replace it with changing. And add changed and previous.
I just realized that if the team is fine with it, you could implement the above in 8.x if you simply add a deprecation notice to wasChanged and tell people to use changing instead. And then fully remove the method in 9.x. There will be slight confusion about wasChanged and changed doing different things between now and 9.x, but it seems like a the best trade-off in my opinion.
It's worth mentioning that there's also getChanges() already (@garygreen's suggestion wouldn't work also for this reason), and if it were kept in 9.x, it could be kind of confusing because then changes would refer to both the dirty state and the previous state. But I think that possible solution is to have changed and changes as separate things.
$post->getChanges(); // difference between $attributes and $originals
$post->getChanged(); // difference between $originals and $previous

Changes sounds like current changes, or pending changes. And changed sounds like what was already changed in the past. So maybe it'd be best to refactor the code for consistency — to make all logic related to dirty attributes use changes (or changing), and all logic related to changes between DB states to use changed.
Apologies for the length of the comment, but since I use a lot of related logic already in my apps, I'm trying to do my best to provide valuable feedback and perspective for this feature. It's difficult to discuss these features without real code examples, and there's also feedback of others that needs to be addressed. I don't think it's productive to discuss whether Laravel should encourage this design pattern, as it encourages it in —ing events already and —ed support only makes the existing functionality safer (the listeners run after the changes have actually been made). It's also not productive to discuss that syntactic sugar should be in userland, since Laravel has a massive amount of them, and especially so in the context of model attribute helpers.
So this discussion got quite long, but I'd like to ask other commenters to bring up their use cases, potential syntax improvements, and edge cases where they'd personally have issues with the current/proposed implementation. If you disagree with the feature as a whole, simply downvote the PR. Laravel has similar features already, and those cannot be undone so comments criticizing those won't have any impact at all.
I'd also appreciate if someone from the team, perhaps Mohamed or ideally @driesvints could share their thoughts on the backwards compatibility issues and how conflicting terminology (changes both for current-original state and original-previous state) should be addressed or how deprecations should be done. Also it'd be good to decide how to implement the changed method with those three arguments (property, from, to) to support the best syntax and also be consistent with existing Laravel standards.

@stancl I think you should consider writing ebooks :)

Already have a few planned, Brian :)

changingTo('name', 'john', 'peter')
// can be like
$user->getDirty('name') === 'john'  && $user->getOriginal('name')

$user->changingTo('name', 'john', 'peter');
// can be like
$user->isDirty('name') && $user->getDirty('name') === 'john' && $user->getOriginal('name') === 'peter';

// isDirty() method should accept key parameter just like in getOriginal()

$user->changedTo('name', 'john', 'peter');
// can be like
$user->wasChanged('name') && $user->getChanges('name') === 'john' && $user->getAttribute('name') === 'peter';`
// getChanges() should add $key parameter

Hello guys, so I created a PR targeting @themsaid 's fork, https://github.com/themsaid/framework/pull/1/files
I improve the implementation of changingTo and changedTo.
I also added new methods changingToAny and changedToAny to handle array of values.

Passing callback as a second parameter $to can be easily added later in the suggested PR.
It would also easy to implement new methods like changingFrom and changedFrom as suggested in the first comment above.

this PR is a vital feature to the core. this is very helpful in cases like status updates.
if ($subscription->changedTo('status', 'expired')) {
  $user->notify(new ExpiredSubscription($subscription);
}

if ($subscription->changedTo('status', 'new', 'expired')) {
  $user->notify(new RenewedSubscription($subscription);
}

I am seeing a flaw in the method signature. null are valid $from values. So I am thinking to change to signature to something like this:

public function changingTo(...$params)
{
        $attribute = $params[0];
        $to = $attribute[1];
        // null is a valid $from value so we can use $params[2] to represent $from,
        // or maybe create new class like Undefined
       $from = isset($params[2]) ? $params[2] : new Undefined;
      // this way, we can compare if the given value is actually a null or there is no given value for $from
}

I also have plans to support accessor/mutator checks for changingTo and changedTo.

I suggest we include to the core atleast the wormhole() method. Then the other syntactic sugar like changedTo, changingTo can just be released as a package or stay in the userland.

@taylorotwell @themsaid  I believe the getPrevious() is a good addition to the core. It is complementary to the methods getChanges(), getOriginal(), getDirty(). Then imagine we have getPrevious().

Can we disable this feature?
Model::disablePreviousAttribute()

For example, this could be troublesome on models that hold huge walls of text in memory, considering there are already two (original/sync).

I like this but it seems like we could add to the existing APIs:
$user = new User(['role' => 'guest']);

$user->role = 'admin';

// Same as before
$user->isDirty();
$user->isDirty('role');

// New second param accepts a value or a callback
$user->isDirty('role', 'admin');

// Equality check gets both new and old value for complex logic, which
// lets us leave complexity in userland (no need to handle arrays,
// comparison operators, etc)
$user->isDirty('role', fn($new) => in_array($new, ['admin', 'superadmin']));
$user->isDirty('likes', fn($new, $old) => $new >= 100 && $old < 100);

$user->save();

// Same as before
$user->wasChanged();
$user->wasChanged('role');

// Same API as isDirty
$user->wasChanged('role', 'admin');
$user->wasChanged('role', fn($new, $old) => 'admin' === $new && 'staff' !== $old);

We already have isDirty() and wasChanged() — and adding a second optional param would be backwards compatible. The only thing that would need to happen is to track the previous state of any attribute that was changing.
We could also mitigate the memory impact by only tracking previous attributes that were changed, kind-of like how we track $changes right now (something like Arr::only($this->getOriginal(), array_keys($this->changes)) in syncChanges).

We already have isDirty() and wasChanged() — and adding a second optional param would be backwards compatible. The only thing that would need to happen is to track the previous state of any attribute that was changing.

Gah, I just realized that isDirty() and wasChanged() fall back on func_get_args() if an array is not provided, which means that they can't be reused in a backwards-compatible way unless we only allowed for the callback API (which may actually be fine).

The more I see this PR, the more I feel that setFooAttribute is a better approach to handle the incoming value, but also modifying or storing the old value for comparison ID necessary.
I don't think this would be used a lot to justify duplicating values on memory more than it is already done by Eloquent ORM.

If this is merged I hope this will be off by default. I think an opt-in approach would be sensible for those that see usefulness in the feature with the knowledge that it will increase memory usage + potential slowdown in Eloquent ORM (particularly if you're operating on lots of models in cron jobs, etc).

I see this as an ‘DetectChanges’ trait.
Italo Baeza C.

El 06-09-2021, a la(s) 22:51, Gary Green @.***> escribió:

If this is merged I hope this will be off by default. I think an opt-in approach would be sensible for those that see usefulness in the feature with the knowledge that it will increase memory usage + potential slowdown in Eloquent ORM (particularly if you're operating on lots of models in cron jobs, etc).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.

This should be really released as a separate package. I also created my own trait in a project which does the same thing.

I think I'm going to hold off on this for now.


Sync Modifier support object properties

What problem does this feature solve?
Sync Modifier support object properties.
For example, I have a myObj object, it has a foo and a bar property.
myObj: {
  foo: 'foo',
  bar: 'bar'
}

This feature could use update:myObj.foo and update:myObj.bar to update the value.
this.$emit('update:myObj.foo', 'new-foo');
this.$emit('update:myObj.bar', 'new-bar');

What does the proposed API look like?
Currently, I need to use below format
<MyComponent :foo.sync="myObj.foo" :bar.sync="myObj.bar"></MyComponent>

props: ['foo', 'bar']
...
this.$emit('update:foo', 'new-foo');
this.$emit('update:bar', 'new-bar');

But with this new feature:
<MyComponent :myObj.sync="myObj"></MyComponent>

props: ['myObj']
...
this.$emit('update:myObj.foo', 'new-foo');
this.$emit('update:myObj.bar', 'new-bar');

It becomes more simple and clear, especially when the object has many properties.

You can use v-bind without directive arguments:
<MyComponent v-bind="myObj"></MyComponent>
...
props: ['foo', 'bar']
...

@javoski it seems more clear than before. So I can use like below code, right?
this.$emit('update:foo', 'new-foo');
this.$emit('update:bar', 'new-bar');

but why not just myObj.foo? Especially the object has many properties.

Although I can see the point of this proposal, I don't feel that it's particularly needed. In some way it encourages passing multiple values in an object to avoid having to specify multiple props. It is very easy to abuse object props by tucking more and more properties into it, making it some sort of "super prop". However, I think having an explicit list of props makes your component's interface easier to understand.

You can use v-bind without directive arguments:
<MyComponent v-bind="myObj"></MyComponent>
...
props: ['foo', 'bar']
...

using sync with an object  work well.
<child :my-obj.sync = "myObj"/>

myObj take more than two key.
inner child
this.$emit("update:myObj",newObj)

who is more harder to understand? who is better? why?

You can use v-bind without directive arguments:
<MyComponent v-bind="myObj"></MyComponent>
...
props: ['foo', 'bar']
...

using sync with an object work well.
<child :my-obj.sync = "myObj"/>

myObj take more than two key.
inner child
this.$emit("update:myObj",newObj)

who is more harder to understand? who is better? why?

THis is great! works like a charm!


Update project from the template

Closes #21

@sprout42 This should be ready for review/merge. Let me know if you have any question about what something does?

It all looks pretty reasonable.

We lost the try except that I added in #24, @aaron do you want to just put that back in manually?

whoops, yeah I'll add that back in

Sorry about that! I couldn't see any place where .valid() could raise an exception and removing didn't seem to affect any test results.
You'll want to add an exception type as well: http://stackoverflow.com/questions/14797375/should-i-always-specify-an-exception-type-in-except-statements

well, it shouldn't raise an exception normally, but it guards against if someone adds a custom type and doesn't properly handle all possible type conditions.
Unfortunately it also means that we don't have a limited set of exceptions to look for, but the valid() function is limited enough it should be ok to just have a bare except.

let me see if I can break some to figure out what exceptions to look for.

done, and I removed the try/except guard from elementenum.py and moved it to element.py where it should be.


Linting

This addresses errors and warnings given by jslint and eslint.
Specifically

Using $= instead of $ in one instance
Using single quotes instead of double quotes in script sections
Using recommended spacing
Remove e from signOutHandler as it was not being used
Remove additional commas
Also attached are the remaining warnings given by jslint which are not addressed in this issue.
These warnings are not shown when using eslint.

Regards,
John
ErrorLogFirebaseElementExtended000.txt

LGTM thx one more time! :)


Move over to new Azure SDK

Move over this sample to new Azure SDK:

Move the original file to storage-blob-upload-from-webapp-node-v10 folder
Add folder storage-blob-upload-from-webapp-node-v12 for the sample referenced to the new SDK
Add two sections to the readme:

Prerequisites which tell user what info we need
SDK Versions

What old sample do

What can be updated to v12:

 Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.:x: zzhxiaofeng sign nowYou have signed the CLA already but the status is still pending? Let us recheck it.


Modify the pull policy so that the pull policy of busybox is consistent

Description

In values.yaml file, the pull policy of all Pods such as Manager for busybox image is IfNotPresent, except that the pull policy of busybox is not specified in Dfdaemon. Due to the Latest version tag, the pull policy for busybox in Dfdaemon will be resolved to Always by default, which results in  pulling from hub every time I initialize even if I have a local busybox image
Related Issue

Motivation and Context

@wyoung1 Please fix lint.


Support for Gamma sampler in JAX

Gamma sampler is one of the most popular samplers. Many popular distributions can be derived from Gamma sampler (e.g. Beta, Dirichlet, StudentT). This thread is created to discuss about details for an implementation in JAX.
Implement Gamma sampler
I made an initial attempt in https://github.com/google/jax/pull/551. Currently, the implementation is a bit slow but I believe that with some help from JAX devs, it will be fast.
TODO:

[ ] Explore warp-based parallelism as suggested by @slinderman

Implement JVP rule for shape parameter a (or alpha).
There are two recent papers which addresses this:

Ref 1. Implicit Reparameterization Gradients, which is implemented in tensorflow.
Ref 2. Pathwise Derivatives Beyond the Reparameterization Trick, which is implemented in pytorch.

Two references come up with the same formula for gradient of z ~ Gamma(a) w.r.t. a:
dz/da = - dCDF(z; a)/da / pdf(z; a)

Further derivation leads to:
# dz = - dCDF(z; a) / pdf(z; a)
# pdf = z^(a-1) * e^(-z) / Gamma(a)
# CDF(z; a) = IncompleteGamma(a, z) / Gamma(a)
# dCDF(z; a) = (dIncompleteGamma - IncompleteGamma * Digamma(a)) / Gamma(a)
# dz = (IncompleteGamma(a, z) * Digamma(a) - dIncompleteGamma) * e^z / z^(a-1)

So to compute unnormalized_dCDF, a derivative for IncompleteGamma function is required. [1] and [2] provide different ways to compute this derivative.
Two questions come to my mind:

If we have implemented reparameterized version of Gamma, do we need to compute pathwise derivative for all distributions Beta, Dirichlet, StudentT too? In [2], the authors computed pathwise derivative for Gamma and Beta/Dirichlet separately, and did not deal with StudentT. In [1], the authors only provide methods to compute pathwise derivative for Gamma.
Is it true (as reported in [1]) that the algorithm in [1] is faster than the algorithm in [2]? Or the performance difference comes from using different frameworks? It seems to me that the authors in [2] only uses first 5 terms in the IncompleteGamma series (and correct the accuracy on extreme cases using polynomials) while the authors of [1] use up to 200 terms. So I feel that the method in [2] would be faster than in [1], but might be less accuracy.

cc @neerajprad

cc @mfigurnov

hi
is there any support or workaround for the reparametrization trick in the case of truncated distributions? I am particularly interested in gamma, inverse Gaussian and Normal-inverse Gaussian distribution. thanks!

TFP has a jax variant you could use for these, from tensorflow_probability.substrates import jax as tfp, then go with
tfp.distributions.* You could use a custom distribution like on
tensorflow/probability#1135 (write tf = tfp.tf2jax)
Brian Patton | Software Engineer |<EMAIL_ADDRESS>On Thu, Feb 18, 2021 at 10:43 AM Dan Leonte<EMAIL_ADDRESS>wrote:

hi
is there any support or workaround for the reparametrization trick in the
case of truncated distributions? I am particularly interested in gamma,
inverse Gaussian and Normal-inverse Gaussian distribution. thanks!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/google/jax/issues/552#issuecomment-781435210, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AFJFSIZXEVR73DGXLLFBYD3S7UYTHANCNFSM4HCQD4WA
.

Hi, FWIW InverseGaussian has recently be reparameterized in TFP. NormalInverseGaussian will also make it there soon (which uses the InverseGaussian sampler and hence will be reparameterized).

@srvasude  @brianwa84  thank you very much for your answers.
please correct me if i got it wrong: your suggestion is to essentially sample from the non-truncated distributions and then only use the samples that are within the truncation bounds?

Sorry, my comment here was just availability of the non-truncated distributions.
Brian's suggestion contains a way to do generic truncation, but it does the naive thing of sampling and checking if it is in the truncation bounds (which can be sample inefficient).

@srvasude  thanks again for clarifying.
I understand that the Gamma, InverseGaussian and NormalInverseGaussian are reparametrised by passing uniform samples on [0,1] through the quantile function F^-1.  Assume that we truncate to [low,high]  and let F be the cdf pf the given  (non-truncated) distribution.  instead of sampling and rejecting, wouldn't it be more effective to sample u uniformly on [0,1] and return  F^-1 (y * (F(b)-F(a) + F(a))  ?

Currently these distributions are sampled via rejection reparameterized via the reparameterization trick: https://arxiv.org/abs/1805.08498 (which in essence means overriding the gradient of the samples with gradients of the quantile).
In principle one can use inverse CDF sampling for these truncated distributions and this will work well in some parameter regimes. The issue tends to be that the CDFs / Quantiles for these distributions tend to become ill-behaved in some parameter regimes. For instance, in the TruncatedNormal case if the bounds are really far away from the mean, you'll can get bad samples due to the 'non-invertibility' of these functions far enough out.
Generally, I think one would need to come up with hand tailored rejection samplers (or other methods) for the distributions in question in order to get performance for sampling (in terms of speed and sample quality).

Actually the issue discussion I pointed out contains a Truncated
distribution which is a quantile transformed Uniform, not a rejection
sampler. In many cases a rejection sampler would yield better samples
(numerically).
On Fri, Feb 19, 2021, 11:26 AM Srinivas Vasudevan<EMAIL_ADDRESS>wrote:

Sorry, my comment here was just availability of the non-truncated
distributions.
Brian's suggestion contains a way to do generic truncation, but it does
the naive thing of sampling and checking if it is in the truncation bounds
(which can be sample inefficient).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/google/jax/issues/552#issuecomment-782183298, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AFJFSIYE4PY3YNUCC4RRPC3S72GMDANCNFSM4HCQD4WA
.

Hi, FWIW InverseGaussian has recently be reparameterized in TFP. NormalInverseGaussian will also make it there soon (which uses the InverseGaussian sampler and hence will be reparameterized).

is there an expected time for this (weeks, months)? thanks a lot for your help!

The distribution is in TFP: https://www.tensorflow.org/probability/api_docs/python/tfp/distributions/NormalInverseGaussian

@srvasude Do you know if there is a gamma sampler on XLA, so we can do something similar to the PR that you made for gamma grad? In https://github.com/pyro-ppl/numpyro/issues/955, I saw that TFP gamma sampler is a few times faster than the jax version here.


[BEAM-3306] Hash keys when lifting

Hash key values when combiner lifting using the registered coder for the type.
Specialized for numeric primitive types to avoid unnecessary work.
This turns out to be faster than the general "interface{}" hashing we had previously for numeric type, and is comparable, but marginally slower than native maps with the primitive numeric type as keys.
Strings are currently much slower as keys than the native go runtime approach for interfaces{}, as the runtime uses a better hash function.
General struct performance (for values Go supported as keys) will be much slower than the go runtime.
Pointer elements (with coders) used as keys will be slower, but they'll also be correct, which wasn't the case previously.
Care needs to be taken using Maps in Key values, as the Go SDK does not presently sort maps in any fashion prior to encoding. Combined with go map's random iteration order, means combines with such keys will not be valid.
A separate in PR will add vetting for this case, to discourage the use of map fields in key types.

Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

[ ] Choose reviewer(s) and mention them in a comment (R: @username).
[ ] Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
[ ] If this contribution is large, please file an Apache Individual Contributor License Agreement.

Post-Commit Tests Status (on master branch)

Lang
SDK
Apex
Dataflow
Flink
Gearpump
Samza
Spark

Go

---
---
---
---
---
---

Java

Python

---

---
---
---

R: @aaltay Review please! Thanks.


Update README.md

Guide to run downloaded binary.

Thanks for your PR :)
I've been meaning to add instructions for downloading and verifying the integrity of binaries uploaded to a Github release, since it applies to a bunch of repos of mine. I finally finished it and uploaded the instructions here. I've also added a reference to them to omm's README.
Given this, I think this change is no longer needed. If you still have other ideas/suggestions, feel free to push them here, or to https://github.com/dhth/binhelpers.
Cheers.

Closing this as I added a section for downloading and verifying the authenticity of release assets here.
Thanks again.


Bound the channels on the SDK to apply back-pressure on slow ingest

Mitigates https://github.com/rerun-io/rerun/issues/2216
There will always be situations where the user logs things faster than we can convert them to arrow and send them on the wire. In these cases we should offer the user a choice of buffering and back-pressure, but until we have that choice for the user we should always go with back-pressure
Checklist

[x] I have read and agree to Contributor Guide and the Code of Conduct

PR Build Summary: https://build.rerun.io/pr/2218

We chose to optimize it instead: https://github.com/rerun-io/rerun/pull/2219


Pull an Image from a Private Registry

/question
Hi guys.
I had a terrible time thanks to the fact that the documentation describes the use of the email and auth trying to Create a Secret by providing credentials on the command line.
I'm using pass in my docker config.json so encoding the config.json file just doesn't work  in this case.
Everything works fine just encoding the registry, name and password with docker hub because it doesn't use email to login:
{"auths": {"https://index.docker.io/v1/": {"username":"my-name","password":"my-password"}}}
I didn't find too many questions about this so the documentation is probably fine but I'm sure I'm not the only one using pass

Docker hub make use of your DockerID (username) and password to login but you have to associate your email to create an account so it was difficult to understand what was wrong. It's not the only registry out there so I understand the documentation is wright but I think that docker hub may require a special mention.
Thanks for your time
Oh by the way I'm using minikube

/question

Hi @Karmavil
It looks to me that part of this story is covered in https://kubernetes.io/docs/concepts/containers/images/#using-a-private-registry and part in https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-secret-by-providing-credentials-on-the-command-line
Do you think you have enough insight into what's not right with the current page to describe the shortcomings? If so, that will let a contributor pick up the work and propose a fix.

Hi @sftim
I'm collecting information.
Meaning that I didn't try authenticate yet using the auth and the real email as credentials, but I can tell for sure that I cannot authenticate using auth an "email"="none"
I have some extra info in a reply to another issue related to minikube.
I would like to know what they think about it because they had an addon (registry-creds) that falls on this issue.  But it makes me think that there was a reason for that.
Maybe docker hub changed something (?) I don't know.
I'm waiting for their feedback because I couldn't find which group is the owner of kubectl or kubeconfig to ask them about this

I should update the description of this issue as soon as possible

This issue is about the part of Kubernetes that runs Pods (that is: nodes). SIG Node is the most relevant SIG here.


Impose a max length validation on the paymentAddress field in purchase

We have no idea what format all the different payment addresses will be for different coins, so we can't make too small of a limit, but something reasonable should be put in to prevent something ridiculous like 10k chars in there.

Using 256 bytes == 4096 bits.

Does this work the same way as these max lengths?
https://github.com/OpenBazaar/openbazaar-go/blob/53451771b1b0d7771120fad770e09dba3a072606/core/listings.go#L28
I assumed those go by character count and not bytes? Was I wrong in that assumption?

(discussed offline)
yes it's by character.
merged


getRequestingIp() return value bug

Hey @selvinortiz
Ran into an issue with the getRequestingIp() method returning a bool value rather than the ip address, just needs the isset() removed from the value returned, see:
https://github.com/selvinortiz/craft-plugin-patrol/blob/f6037183324d6046e4121a9005702b39ff89e6b8/src/services/PatrolService.php#L305
https://github.com/selvinortiz/craft-plugin-patrol/blob/f6037183324d6046e4121a9005702b39ff89e6b8/src/services/PatrolService.php#L309

Fixed in 4.0.1


Wrong error message about vector length in scipy.signal.filtfilt

I think that the message of the ValueError raised by scipy.signal.filtfilt if the input array has the same length of the padding is wrong.
Reproducing code example:

import numpy as np
from scipy import signal

# create coefficients for the filter
order = 4
critical_frequecy = 0.02
b, a = signal.butter(order, critical_frequecy)

# computing the padlen
padlen = 100

# Creating a vector with the same length as padlen
data = np.random.random(padlen)

# The next instruction will raise the error:
# ValueError: The length of the input vector x must be at least padlen, which is 15.
signal.filtfilt(b, a, data, padlen=padlen)

Error message:

This is the error produced by the previous code:
Traceback (most recent call last):
  File "/tmp/example_filltfilt.py", line 17, in <module>
    signal.filtfilt(b, a, data, padlen=padlen)
  File "/tmp/lib/python3.6/site-packages/scipy/signal/signaltools.py", line 3126, in filtfilt
    ntaps=max(len(a), len(b)))
  File "/tmp/lib/python3.6/site-packages/scipy/signal/signaltools.py", line 3176, in _validate_pad
    "padlen, which is %d." % edge)
ValueError: The length of the input vector x must be at least padlen, which is 100.

The error states that the input vector must be at least (>=) padlen, while it must be greater (>) than padlen. Indeed, the comment preceeding the correspondent check in the _validate_pad  used in filtfilt implementation says:

# x's 'axis' dimension must be bigger than edge.

and the condition of the if on the following line confirms this:
if x.shape[axis] <= edge:
Thus the error text message should be changed to:
ValueError: The length of the input vector x must be greater than padlen, which is 100.
The same behaviour is shared by all the filters using _validate_pad.
Scipy/Numpy/Python version information:

1.2.1 1.16.2 sys.version_info(major=3, minor=6, micro=8, releaselevel='final', serial=0)

@piecot this sounds right, can you open a PR to fix it?

Yes, no problem


Mean Python Error:

Hi,
tested "music" today but cannot get it past the errors:
Traceback (most recent call last):
  File "/Users/gabriel/Desktop/note1.py", line 1, in <module>
    from music import *
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/music/__init__.py", line 1, in <module>
    from .utils import H
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/music/utils.py", line 5, in <module>
    from . import core
ImportError: cannot import name 'core' from partially initialized module 'music' (most likely due to a circular import) (/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/music/__init__.py)

Python version is 3.10. error occurs on mac and windows / fresh python install.
from music import *

note = Note(C4, HN)
Play.midi(note)

Or is it the wrong music lib at all?
Regards,
Peter

How did you install it?
Il giorno mer 9 mar 2022 alle 15:43 Peter Gabriel @.***>
ha scritto:

Hi,
tested "music" today but cannot get it past the errors:
Traceback (most recent call last):
File "/Users/gabriel/Desktop/note1.py", line 1, in
from music import *
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/music/init.py", line 1, in
from .utils import H
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/music/utils.py", line 5, in
from . import core
ImportError: cannot import name 'core' from partially initialized module 'music' (most likely due to a circular import) (/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/music/init.py)
Python version is 3.10. error occurs on mac and windows / fresh python
install.
from music import *
note = Note(C4, HN)
Play.midi(note)
Or is it the wrong music lib at all?
Regards,
Peter
—
Reply to this email directly, view it on GitHub
https://github.com/ttm/music/issues/11, or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAA4LHLWKTPD3EFURO26MLDU7C2IXANCNFSM5QJX4TDQ
.
Triage notifications on the go with GitHub Mobile for iOS
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
or Android
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you are subscribed to this thread.Message
ID: @.***>

--
Renato Fabbri

should be solved with version 0.7b3 (published today).


Use chainparams.Name

The network name is hardcoded to testnet.  It should display the chainparams.Name.

I think this is taken care of now.
https://github.com/decred/hardforkdemo/pull/79/commits/13c518168cd36162e87f69d993f5546845691eda


No such module 'SDWebImage'

I have this error in my xcode project, im using xcode 9.3
when i'm trying to build my project or run it on simulator i got this error:
No such module 'SDWebImage'
can you guys help me?

Hi,
Include
#import <SDWebImage/UIImageView+WebCache.h>
in bridging header file of you project and no need to import SDWebImage
Hope this will help


Taxes - Inconsistency in leading 0 in saving tax rate

If you haven’t already, check out our contributing guidelines for onboarding and email<EMAIL_ADDRESS>to request to join our Slack channel!

Version Number: 1.4.57-2
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team
Issue found when executing PR https://github.com/Expensify/App/pull/38733
Action Performed:
Precondition:

User is admin of Collect workspace

Go to staging.new.expensify.com
Go to Profile > Workspaces > Collect workspace
Go to Taxes > Add rate > Value
Enter 01 and save it
Click Value again
Note that 0 is preserved
Click on any existing tax rate
Click Value > Enter 01 > Save
Click Value again
Note that 0 is not preserved

Expected Result:
There should be consistency whether leading 0 in tax rate should be preserved
Actual Result:
In Step 5, 0 is preserved in adding tax rate flow
In Step 9, 0 is not preserved in edit existing tax rate flow
Workaround:
Unknown
Platforms:

Which of our officially supported platforms is this issue occurring on?

[x] Android: Native
[x] Android: mWeb Chrome
[x] iOS: Native
[x] iOS: mWeb Safari
[x] MacOS: Chrome / Safari
[x] MacOS: Desktop

Screenshots/Videos
Add any screenshot/video evidence

https://github.com/Expensify/App/assets/78819774/8e98408a-00f6-46cb-b2a5-f0eef104d71a
View all open jobs on GitHub

Proposal
Please re-state the problem that we are trying to solve in this issue.
Taxes - Inconsistency in leading 0 in saving tax rate
What is the root cause of that problem?
The AmountSelectorModal component state is not updated after first opening
What changes do you think we should make in order to solve the problem?
Add below code here
useEffect(()=>{
    setValue(value)
}, [value])

What alternative solutions did you explore? (Optional)

reviewing now!

Could not repro, and low value

@dylanexpensify It still reproducible
https://github.com/Expensify/App/assets/46921547/0b4d1353-9c1c-499a-bb6c-9ad0dd4bc124


feat(analytics): add consent mode v2

Description
Adding consent mode v2 to firebase analytics.
Reference: https://developers.google.com/tag-platform/security/guides/app-consent
Related Issues
Fixes https://github.com/firebase/flutterfire/issues/12148
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).
This will ensure a smooth and quick review process. Updating the pubspec.yaml and changelogs is not required.

[x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
[ ] My PR includes unit or integration tests for all changed/updated/fixed behaviors (See [Contributor Guide]).
[x] All existing and new tests are passing.
[ ] I updated/added relevant documentation (doc comments with ///).
[x] The analyzer (melos run analyze) does not report any problems on my PR.
[x] I read and followed the [Flutter Style Guide].
[x] I signed the [CLA].
[x] I am willing to follow-up on review comments in a timely manner.

Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?

[ ] Yes, this is a breaking change.
[x] No, this is not a breaking change.

Thanks for the PR, @matinzd. As mentioned in the issue: https://github.com/firebase/flutterfire/issues/12148, we're discussing internally the shape of the API before rolling out 👍

I cannot run the example app since there is something wrong with the pod install.
Semantic Issue (Xcode): Use of undeclared identifier 'FIRAnalytics'
Semantic Issue (Xcode): Use of undeclared identifier 'FIRConsentTypeAnalyticsStorage'
...

Although pod install succeeds, FirebaseAnalytics pod folder is empty.

Updated cocoapods and example app is now working. For some reason, the pods where not being copied to the corresponding folder. Example app works both on iOS and Android.

Any updates? @russellwheatley

@matinzd - not as such. Will let you know when it has been decided 👍

@matinzd - not as such. Will let you know when it has been decided 👍

Is there an estimated time for the decision to approve the PR?

@matinzd thank you already for your effort implementing this!
Are you also aiming to provide the functionallity to FlutterFire WEB with this PR? https://firebase.google.com/docs/reference/js/analytics#setconsent_1697027

@Sese-Schneider
IMO, it's better to merge iOS and Android first and then have the web implemented in a separate PR.

@Sese-Schneider
IMO, it's better to merge iOS and Android first and then have the web implemented in a separate PR. For now, it seems like it's not priority at all as this PR is officially one month old and all of our campaigns paused due to this being a blocker for us.

I am gonna adjust the PR tonight. Thanks for the feedback!

@matinzd - we are looking to get this released next week, let me know if you have the time to complete, if not, I can take over. Thanks 😄

Hey!
Will update it tonight.

Fixed some formatting issues. Can you rerun the workflows @russellwheatley ?

Rebased again. I reverted the change for firestore formatting.

I guess it's ready now.

@matinzd
I've enabled 4 consents in the firebase analytics code but in the "Verbose" log we can see only 3 consents granted. I did not see "adPersonalization" consent property.
Do you know why?
How to enable verbose log you can check this link?

"

@matinzd
FYI, I copied your code from PR.
I've enabled 4 consents in the Firebase analytics code but in the "Verbose" log I can see only 3 consents granted. I did not see "adPersonalization" consent property.
Do you know why?
How to enable a verbose log you can check this link?

"

Which consent is missing in verbose log?

adPersonalization

adPersonalization

@matinzd

I couldn't find any issues with adPersonalizationSignalsConsentGranted key. It seems everything is in order. Keys are being properly passed into the platform method channel and on the native side, we have the same key as well. I am feeling that it's not showing up in the verbose log or it's just a user property which you can see in the log.

I couldn't find any issues with adPersonalizationSignalsConsentGranted key. It seems everything is in order. Keys are being properly passed into the platform method channel and on the native side, we have the same key as well. I am feeling that it's not showing up in the verbose log or it's just a user property which you can see in the log.

yes, I agree with what you say ("about key passed properly."). And if your feeling is right, then It's okay.
Thanks for quick response. @matinzd

@russellwheatley ?

Hey @matinzd - I just realised the integration tests are failing and need updating here: https://github.com/firebase/flutterfire/blob/master/tests/integration_test/firebase_analytics/firebase_analytics_e2e_test.dart#L211-L228
Update to this should work:
test(
      'setConsent',
      () async {
        await expectLater(
          FirebaseAnalytics.instance.setConsent(
            analyticsStorageConsentGranted: true,
            adStorageConsentGranted: true,
            adPersonalizationSignalsConsentGranted: true,
            adUserDataConsentGranted: true,
            functionalityStorageConsentGranted: true,
            personalizationStorageConsentGranted: true,
            securityStorageConsentGranted: true,
          ),
          completes,
        );
      },
    );

Fixed. If anything else popped up, feel free to push to the branch 👍