Last feature in feature collection has extraneous comma

Thank you for making this Ian.
The last feature obtained contains an extraneous comma which breaks most parsers and validators.
See as an example. https://github.com/opencleveland/clecrime/commit/9d3550152589be253584cea95dd2654d4119df22

Hmm, the best thing to do is probably to install https://github.com/openaddresses/machine:
git clone https://github.com/openaddresses/machine
cd machine
python setup.py install

...and then run openaddr-esri2geojson <esri_url> <output_geojson_filename>
I've been keeping the ESRI-related stuff up to date in machine and not here. I should probably pull it out into this repo and then use this module in machine. Until then, the above will have to work.

@iandees I was just going to ask if we could get this on pip. Would you like some help

extracting the esri stuff from machine to this repo
getting this repo on pypi
having openaddress/machine depend on an esri-dump package?

Actually, it doesn't look like the openaddr-esri2geojson has the same subdivision strategy. Instead it looks like it tries to enumerate all the object ids and paginate through them.
Unfortunately, that depends upon the server supporting the ReturnIdsOnly argument, which was added in ArcGIS REST Server v.10.
The subdivide method used in this repo will work with older versions. Why is the subdivide method not in openaddr-esri2geojson?

@fgregg Good timing! We were actually just thinking about extracting the esri2geojson bits from machine and making a separate module.
I'm planning on starting on it tomorrow morning. If I run out of time or something I'll ping you and take you up on your offer for help!

I actually had some time today. Let me push up where I got.
On Sat, Aug 13, 2016 at 9:51 PM Ian Dees<EMAIL_ADDRESS>wrote:

@fgregg https://github.com/fgregg Good timing! We were actually just
thinking about extracting the esri2geojson bits from machine and making a
separate module.
I'm planning on starting on it tomorrow morning. If I run out of time or
something I'll ping you and take you up on your offer for help!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/iandees/esri-dump/issues/1#issuecomment-239652942,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAgxbcuGsLSE0uOzZmq6kf1XPraC5Jo6ks5qfoK-gaJpZM4GOtlw
.

I made a repo here: https://github.com/openaddresses/py-esri-dump

The extraneous comma has been destroyed!


A cross border power plant is missing in both countries

Following #133, I've looked at Châtelard-Vallorcine power plant located in France next to the Swiss border.
https://www.openstreetmap.org/relation/8277085
I fail to explain why it is missing from stats for both countries.
The actual power plant is located in France but it collects water from both France and Switzerland.
Any idea?

Oh, that's an excellent edge case. The code assumes that power plants will always be contained within a single country. If I changed this to ST_Intersects it would appear under both countries, which is also not ideal.
https://github.com/openinframap/openinframap/blob/dd5fb9fbe2332a507b3ffb9ab93fa2e566bc68be/web-backend/data.py#L30
I could count plants against the country which contains the most of their area, but I suspect this might be too slow.
I assume this also affects the Itaipu Dam which is a rather more significant plant!

A better way could be to focus on generators instead of the whole relation.
For Chatelard-Vallorcine, all generators are in France (the border was actually moved to build the plant). It is connected to both grids.
For Itaipu, it is split in two parts I think.

I'm running a query to see how many of these plants there are. I wonder if the best approach would be to use some special tagging on the plant object so we can also indicate how much power goes to each country.

Quite a few which have this problem actually - full list below.
These seem to be split into three categories:

Hydro plants which cross the border, as previously mentioned
Wind farms mapped as relations where the convex hull of the wind farm overlaps the border but the turbines are all in one country
Other plants which are very close to the border, but don't cross it. This may indicate a CRS discrepancy between the OSM data and the boundary data (which doesn't come from OSM)

  osm_id   |                                               name                                               | count
-----------+--------------------------------------------------------------------------------------------------+-------
 -12860028 | Windpark Weijerswold                                                                             |     2
 -12848416 | Zonnepark Sas van Gent-Zuid                                                                      |     2
 -11667964 | Борисоглебская ГЭС-8                                                                             |     2
 -10602656 | Windpark Netterden                                                                               |     2
 -10245510 | Хидроелектрана Ђердап I                                                                          |     2
  -9670137 | ∅                                                                                |     2
  -9491855 | Meenadreen Wind Farm                                                                             |     2
  -9350407 | Marker vindpark                                                                                |     2
  -8384695 | Slieve Rushen Wind Farm                                                                          |     2
  -8277085 | Centrale de Châtelard-Vallorcine                                                                 |     2
  -7646101 | Complejo Hidroeléctrico Salto Grande                                                             |     2
  -6271685 | Porțile de Fier II                                                                               |     2
  -2717022 | Windpark Andau-Halbturn                                                                          |     2
  -1999097 | Wasserkraftwerk Schärding-Neuhaus                                                                |     2
  15917174 | Kerncentrale Doel                                                                                |     2
  27201008 | Rheinkraftwerk Säckingen                                                                         |     2
  27661875 | Kraftwerk Passau-Ingling                                                                         |     2
  30752840 | 위원댐                                                                                |     2
  32236291 | Usina Hidrelétrica de Itaipu                                                                     |     2
  74727575 | 水丰水库 / 수풍언제                                                                              |     2
  83231884 | Wasserkraftwerk Oberaudorf-Ebbs                                                                  |     2
  90163313 | Дністровська гідроелектротанція Nº2 (ГЕС-2) / Centrala Hidro-Electrică de pe Nistru nr.2 (CHE-2) |     2
 100687348 | Kraftwerk Laufenburg                                                                             |     2
 117383681 | Elektrownia Wodna Gubin                                                                          |     2
 150766122 | Flusskraftwerk Rott                                                                              |     2
 154182360 | Centrale A                                                                                |     2
 168864999 | Kraftwerk Jochenstein                                                                            |     2
 178474700 | Elektrownia Wodna Przysieka                                                                      |     2
 208623457 | Centrale elettrica Castasegna                                                                    |     2
 242193001 | Wasserkraftwerk Ering-Frauenstein                                                                |     2
 361882096 | Central Hidroeléctrica de Cedillo                                                                |     2
 418179055 | St. Lawrence-Franklin D. Roosevelt Power Project                                                 |     2
 460356978 | Amistad Power Plant                                                                              |     2
 477673855 | 수풍수력발전소                                                                                |     2
 494784854 | Slieve Rushen Wind Farm                                                                          |     2
 550513867 | Laufwasserkraftwerk Grevenmacher                                                                 |     2
 647259841 | Central hidroelèctrica Castro I                                                                  |     2
 654066147 | Centrale hydroélectrique de Marckolsheim                                                         |     2
 682313154 | ∅                                                                                |     2
 705880545 | Straness Wind Farm                                                                               |     2
 706302417 | Crighshane Wind Farm                                                                             |     2
 753131894 | ХЕ Зворник                                                                                |     2
 753131895 | ХЕ Бајина Башта                                                                                |     2
 871650676 | Proposed Meenbog Wind Farm                                                                       |     2
 907385266 | Usina                                                                                |     2
(45 rows)

I wonder if the best approach would be to use some special tagging on the plant object so we can also indicate how much power goes to each country.

It's not necessary power driven deterministic (but market or financially driven) and described in often private documentation.
It depends on bilateral agreements, water sharing policies, and so on...
Chatelard-Vallorcine makes its own business every day and then give stakeholders back their profit according to their share every year.
Physically, the grid decides and it's always dynamic.
The list is a good outlook

Wind farms mapped as relations where the convex hull of the wind farm overlaps the border but the turbines are all in one country

Using generators instead hull can solve the problem

Other plants which are very close to the border, but don't cross it. This may indicate a CRS discrepancy between the OSM data and the boundary data (which doesn't come from OSM)

That's what I wanted to investigate at first. Why didn't you used OSM data for borders?

That's what I wanted to investigate at first. Why didn't you used OSM data for borders?

I need to know the extent of Exclusive Economic Zones so I can assign offshore wind farms to the correct country, and OSM doesn't have these mapped in a usable way.

Seems legit indeed

Linvasselv hydro power plant is also a complicated one.
The generator hall under ground is located in Sweden, but the water is taken from Limingen lake in Norway.
It has two generators, a 48MW for Sweden and a 25MW one for Norway and has shared operations between a Norwegian and Swedish company.

If I changed this to ST_Intersects it would appear under both countries, which is also not ideal.

I think, between the two non ideal scenarios, that the less bad one is if it shows up in both countries. That way at least you can intersect those lists and remove duplicates. This way, you have nothing to do, they are just missing.


Steering ignores mouse acceleration(enhanced pointer precision)

I recently tried using your program for asseto corsa and it worked perfectly, but the problem is it ignores mouse acceleration/enhanced pointer precision. This makes it impossible for me to drive properly since when I originally learnt mouse steering on LFS ~3 years ago I did so with mouse acceleration active.
I'm not sure if there is anything you can do about this (a way to toggle raw input on/off, or if you can't do that with vjoy maybe you could add your own mouse acceleration setting?), but if you can I'd greatly appreciate it.

Yes it ignores it, because of raw input, one thing that I can recommend is using Intercept Mouse Accel Filter, which I am using too

Thanks for the advice, I spent a few hours trying to get something that felt right but didn't succeed, guess I'll try some more another time. Great program though.


feat!: Switch to aztec_backend that uses upstream BB & UltraPlonk

Related issue(s)

Resolves #991
Description
This updates the aztec_backend dependencies to the latest commit, which has started depending on upstream barretenberg and switches to UltraPlonk.
Since BB has a lot of dependencies to be built, @kobyhallx and I have added a Nix flake to the repository to manage this dependency.
I've updated the workflows to use Nix to run clippy and cargo tests.
This is currently a draft because more work needs to be done to update values in the tests, and it seems that there is a CRS bug in BB because we are getting a panic when trying to run the prove_and_verify tests. Will need to work with @vezenovm and @kevaundray to sort that out.
Summary of changes

Dependency additions / changes

Test additions / changes

Checklist

[ ] I have tested the changes locally.
[ ] I have formatted the changes with Prettier and/or cargo fmt with default settings.
[ ] I have linked this PR to the issue(s) that it resolves.
[ ] I have reviewed the changes on GitHub, line by line.
[ ] I have ensured all changes are covered in the description.

Documentation needs

[ ] This PR requires documentation updates when merged.

Additional context

Blocked by https://github.com/AztecProtocol/barretenberg/pull/338 and https://github.com/noir-lang/barretenberg-sys/pull/12 (which is also waiting on a resolution to 338)

Are https://github.com/noir-lang/noir/issues/1069 and https://github.com/noir-lang/noir/issues/1074 similar to the CRS bug encountered?

@Globallager no, those seem to be due to a bad/buggy library that aztec_backend is using to download the CRS. We need to replace it but it hasn't been a high priority.

First Mac OS runner has passed CI checks :)

I'll need to adjust the required checks again once we have approvals.


Fetch Azure DevOps organization metrics and write to CSV.

To fetch Azure DevOps organization metrics and write to CSV, you can use the following command:
node src/index.js ADO-org -o  -t
Replace <organization> with the name of your Azure DevOps organization and <PAT> with your personal access token.
This command will fetch the necessary data from your Azure DevOps organization and export a CSV file containing a list of each project, as well as the repositories and pull requests in each project. The CSV file will be exported to a new directory within the project's root directory.

https://github.com/github/gh-migration-analyzer/issues/31#issue-1693446537


Don't trigger an update when moving cursor after saving

When saving a buffer neovim increments b:changedtick, which causes the
buffer to be refreshed. To avoid this, update b:last_change_tick on
BufWritePost events. Fixes issue #2421

I figured out that the following scenario is still broken with linters that only work on saved files:

Open a python file with lint warnings or errors (like TODOs)
The lint results are properly displayed
Change something, like adding a line before the TODO
Switch to another window and come back to Oni
The lint is rerun with didOpen... which assumes the document is the same than the one on disk: the lint marks are broken.

In such a case we would need to tell apart didOpen on saved files and those on dirty files.

@cbosdo  thanks for the PR 👍 I think its worth noting that #2330 changes the changed tick functionality (removes it actually) and instead uses the new neovim updates api so it might be worth keeping that in mind as its possible that once that comes in the changes here might no longer apply or might need to be reworked to work with the new setup

@Akin909 yes @bryphe  mentioned that PR to me on Discord, the PR I made is only a temporary fix to wait until his big effort reaches the repo.

I don't have time to come back to this PR, closing


When autoplay is set and loop is false it is still looping

I want to let swiper automatically start, but not looping. I have the following configuration:
var swiper = new Swiper("#mod-swiper", {
	direction: "horizontal",
	calculateHeight: true,
	speed: 1000,
	paginationClickable: true,
	nextButton: ".swiper-button-next",
	prevButton: ".swiper-button-prev",
	spaceBetween: 10,
	slidesPerView: "auto",
	loop: false,
	autoplay: 10,
	pagination: "#mod-swiper-pagination-container",
	centeredSlides: true,
	effect: "slide",
});

After the page has loaded, swiper starts automatically to iterate trough the slides. After the last slide it starts again by the first one. But it should not as loop is set to false. Is there a configuration setting missing or is it a bug?

Add autoplayStopOnLast: true parameter

Is that parameter documented somewhere, I couldn't find it. Also in the code, it is not defaulted. I suggest either you document it or you remove it.
Honestly that's the parameter I was looking for, but it looked like it is a relic from an older version. That's why I'v opened that issue.


Htmlunit dows not support async js methods

I'm using HtmlUnit 2.52.0
final HtmlPage page = webClient.getPage(href);
page.executeJavaScript(javascript);
where javascript is the following string
var scrollSize = 200;
var period = 300;
var html = false;
function doPeriod() {
return new Promise(resolve => {
setTimeout(() => {
var prev = window.scrollY;
window.scroll(0, window.scrollY + scrollSize);
if (window.scrollY > prev) {
resolve(false);
} else {
resolve(document.body.innerHTML);
}
}, period);
});
}
async function scrolling() {
while (html === false) {
html = await doPeriod();
}
return html;
}
var x = await scrolling();
return  x;
this is perfectly working when I'm running it withing crome browser console on page
https://vesta.am/tv/led
but when I'm running it with htmlunit I'm getting the exception
com.gargoylesoftware.htmlunit.ScriptException: missing ; before statement (injected script#19)
It is because htmlunit does not support javascript async function
is there any other workaround to do this async scrolling and return value to java?

That looks like ES6 JavaScript. I doubt the engine in HtmlUnit is compatible with async

Thanx for responding.
Can you please suggest some solution for scrolling ajax paging scrapping?

@zerofilling - this is outside of Baeldung's remit. However, if I were going to write a screenscraper for a complex HTML5 site, I'd use Selenium and a headless Chrome browser.

Hi,
This seems like an issue with your custom application, and not the code maintained by us.
In this case, I suggest going through StackOverflow; this is a great place to ask more general questions.


Storefront: Header adjustments

Some small adjustments to the menu item border and spacing.
### Tasks
- [x] Finish design of changes
- [x] Develop Header changes

Figma: https://www.figma.com/file/hpNSt9jMeVTH46Fh9TENBE/Storefront?type=design&node-id=1674%3A662&mode=design&t=f8iTQq3zdq6K8Fv4-1

@Thuneer Should this be closed?

Good catch! I will close this.


Out of memory error on making multiple requests

Fixes: #374
Creating a separate axios instance and moving the interceptor code out of the sendRequest() method.
An interceptor was added to the static axios instance on each sendRequest() call which can lead to out of memory issue if hundreds of requests are made as the added interceptor is not ejected after the request is made.

 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: aby040 sign nowYou have signed the CLA already but the status is still pending? Let us recheck it.

Hi @aby040, thanks for this change!  Can you turn on "Allow edits from maintainers" on this PR so that I can make a couple of tweaks before merging?

fwiw it looks like the build failures are due to a newer version of typescript being pulled in by the build than the version used when the original code was written. Probably a side effect of the package-lock.json file being excluded from the repo.

Overall change looks good once we can fix the build issue (probably not an issue in azure-sdk-for-js as we're using a lockfile there locked to node v8 types - a similar thing could be considered for this repo).

Sure @daviwil, I have turned on "Allow edits from maintainers". Please let me know if anything else has to be added from my end for this to get merged.

@bterlson, sorry I didnt get what you meant by

using a lockfile there locked to node v8 types

Shall I make the changes in .scripts/units.ts and lib/policies/msRestUserAgentPolicy.browser.ts to fix the type issues?

Some clarification on next steps would be good. Is the desire to fix the existing build/lockfile issues via a separate issue/PR or to do it as a part of this change?
@bterlson thoughts?

Sorry for the confusing unrelated comment. From my perspective, @aby040's proposal to update .scripts/unit.ts and lib/policies/msRestUserAgentPolicy.browser.ts based on the latest node types seems appropriate, but I'd defer to either @daviwil or @amarzavery

@daviwil I've created #377 to try to address the build issues as a standalone change to unblock this PR. I'm also fine if you instead want to do the code changes that were previously a part of this PR. Any thoughts on how you want to proceed so that we can resolve this issue?

I integrated @princjef's build and CI fixes from #377 and fixed the remaining test issues caused by the interceptor move, so this is ready to be merged.  Thanks to @aby040 and @princjef for the help!

ms-rest-js 1.8.14 is out<EMAIL_ADDRESS>


Link module

A link module would be nice:
You can save a list of links in it and a shortcut for them, like:
u1 => http://www.url.de
ferz => http://example.com
and then you can use a command like: !link u1 or !link ferz to let the bot write this link to the channel.

Implemented in 69f98639a889dc09e5b8caf7461a069fb5250bdf


Why is PNG always referred to distance 802 m?

Linux 19.04, Python 3.7.3, OSMnx 0.10, JupyterLab 1.0.4
I requested info on Stackoverflow but got no answer.
I would like to save SVG and PNG based on the same graph. PNG should keep a different road size according to the type (that's why I am using plot_figure_ground), but the roads position and scale should be the same as in the SVG.
According to distance, SVG resizes correctly, while PNG is always 1 square mile.  If distance is 1/2 mile, roads are slide to the left and cropped.
Am I doing something wrong here?  Is it possible to resize PNG as it is for SVG?
import osmnx as ox
import os
from IPython.display import Image

%matplotlib inline
ox.config(log_file=False, log_console=False, use_cache=True)

PLACE = "aPlace"
NETWORK_TYPE = "drive"

location_point = (50.6233696,12.3007474)
width = 2000;
filename = f"{PLACE}_{width}m_{NETWORK_TYPE}"

# if the graphml file already exists, don't load it again
if os.path.exists(f'data/{filename}.graphml'):
    G  = ox.load_graphml(filename=f'{filename}.graphml')
    GP = ox.load_graphml(filename=f'{filename}_projected.graphml')
    print("found saved graphhml")
else:
    print("graphml not found... loading new data")
    G = ox.graph_from_point(
        location_point,
        distance=width / 2, # <=========================
        distance_type='bbox',
        network_type=NETWORK_TYPE,
        clean_periphery=False,
        # infrastructure='way["highway"~"motorway"]'
    )
    GP = ox.project_graph(G)
    ox.save_graphml(G, filename=f'{filename}.graphml')
    ox.save_graphml(GP, filename=f'{filename}_projected.graphml')
    print("saved")

print(f"\nsaved {filename}.svg")
fig, ax = ox.plot_graph(GP, show=True, save=True, filename=filename, file_format='svg', node_size=0, edge_linewidth=0.3, edge_color="#000000")

print(f"\nsaved {filename}.png")
street_widths = {'footway' : 0.5, 'steps' : 0.5, 'pedestrian' : 0.5, 'path' : 0.5,
                 'track' : 0.5, 'service' : 2, 'residential' : 3, 'primary' : 5, 'motorway' : 6}

fig, ax = ox.plot_figure_ground(G, street_widths=street_widths, show=True, smooth_joints=True, bgcolor="b", edge_color="w", dpi=10,
                               filename=filename, file_format="png")

This isn't an SVG vs PNG issue, but it comes down to the fact that you're using two different plotting functions with very different purposes (plot_graph vs plot_figure_ground). Just pass the dist argument into plot_figure_ground to override its 805-meter default parameterization. It's described in the documentation: https://osmnx.readthedocs.io/en/stable/osmnx.html#osmnx.plot.plot_figure_ground


x/crypto/ssh: ssh connections and channels should be cancelable

When using x/crypto/ssh in a long-running program for communicating with many nodes that may come and go, it is necessary to be able to shutdown started SSH connections and channels cleanly. Currently there are many goroutines leaked.
For example, https://github.com/golang/crypto/blob/master/ssh/connection.go#L79 the DiscardRequests function is launched in its own go routine for each new connection, and there is no way, currently, to shut it down. It thus leaks memory.
Moreover in order to make the internals of the (brilliant, fabulous) ssh library cancellable, each instance of a raw send and receive will need to be put with a select statement that includes a cancellation signal.  I suggest implenting cancellation by adding context.CancelFunc and context.Context to the Config structure.
I've made these changes in a branch, here https://github.com/glycerine/crypto/tree/cancelable
These likely are not perfect or to anyone else's taste exactly, but feel free to mold to taste.
@hanwen this may be of interest.

CC @hanwen @agl

In addition to the branch cited above, my latest working copy is here (https://github.com/glycerine/xcryptossh). Caveat: be aware that this is my current working branch, and as I work on it, it may or may not be build-able. Nonetheless, it is a better and later version (no races, no known leaks, context.Context threaded were possible while preserving the API, etc). If you wish to pull from a repo, the glycerine/xcryptossh one should be preferred over the glycerine/xcrypto in general. Be aware that it may have debugging printfs in.

The example you cite is not a leaked goroutine because the reqs channel will be closed when the connection closes.
I think we should have deadlines on channel receives (not go channels).
As of now, each new session will call the go session.wait() function when the remote remote command/shell is run. This is to provide a exit status via the public session.Wait() function. But my issue is that even if I call session.Close() (whose sole purpose is to close the underlying channel), it's possible for the remote server to never respond to the channel being closed, causing the goroutine that called session.Wait() and the goroutine for go session.wait() to deadlock. Its definitely very unlikely, but possible.
Another possible issue is with channel.SendRequest, it could block if wantReply is true but the server decides to never send back a reply. Unlikely, but possible.
My two examples are special because the server could handle other channels fine, so TCP keep alive and any other lower level timeout would not work. Waiting for a channel response from the server should have deadlines to prevent blockages like this.

update: The idle timeouts work quite well. They are very solid. I returned briefly to an experiment with write deadlines, with the speculative aim of implementing net.Conn. Read deadlines were quickly done and worked fine. However, on the write side, I could not get write deadlines to work. It appears that SSH will happily Write() to an ssh.Channel and return nil error, even if there is never any corresponding Read() on the other end.
If someone smarter than me wants to try their hand at getting write deadlines to work, I invite you to try :)  See the branch write_deadlines. https://github.com/glycerine/xcryptossh/tree/write_deadlines
In particular, run the TestSimpleWriteDeadline test in timeout_test.go, e.g.
$ go test -v -timeout 120m -race -run WriteDeadline

@nhooyr On master of https://github.com/glycerine/xcryptossh/ I shipped SetReadDeadline() as well as SetIdleTimeout(). Give them a try and see if they meet your needs.

"It appears that SSH will happily Write() to an ssh.Channel and return nil error, even if there is never any corresponding Read() on the other end."
Did you expect anything else? In order to know that something is reading on the other end, you'd have to do a network round trip, which is expensive.
go SSH has a 2MB buffer (https://go.googlesource.com/crypto/+/81e90905daefcd6fd217b62423c0908922eadb30/ssh/channel.go#23) similar to OpenSSH.

I don't fully understand the bug.
If a ssh.Channel is closed, all the associated goroutines should exit. If a ssh.Conn is closed, all associated goroutines should exit too. If you find cases where this is not happen, please file bug reports about them.
Similar on close of the channel or connection, all reads/writes will be interrupted, please file bug reports if you find cases where this does not happen.
About cancelation, adding Context throughout will be an invasive API change, which I would rather combine with other API changes, and the net effect would be that the package calls conn.Close() or channel.Close() on timeout.  You might as well do this in the piece of code that has access to the incoming context.

" if I call session.Close() (whose sole purpose is to close the underlying channel), it's possible for the remote server to never respond to the channel being closed"
the channel close should cause session.Wait to return. Can you file a bug if this is not the case?

@glycerine Nice work but it doesn't fit my needs. What I think needs to happen is that every single read from the channel should have a deadline with it so that it does not block forever, if the deadline expires before the read finishes, then the entire connection should be closed. I don't think a idle timeout is necessary if we go with what I described.
@hanwen filed #21699

every single read from the channel should have a deadline with it so that it does not block forever

exactly what SetIdleTimeout() does

if the deadline expires before the read finishes, then the entire connection should be closed.

trivial to add in your application logic when you receive a timeout error from a Channel read.

SetIdleTimeout() doesn't do that because it resets on writes.

SetIdleTimeout() doesn't do that because it resets on writes.

So if a write succeeds but a read doesn't, then that should be a timeout... hmm. maybe. after all, writes success (today I learned) doesn't really mean anything.... thinking...

@nhooyr I added a parameter to SetIdleTimeout() for your scenario. It is in the latest, v3.0.1.
https://github.com/glycerine/xcryptossh/commit/83b535bb64dbee22054b0c69e2cc5e6faa6a20ca
The API now looks like:
SetIdleTimeout(dur time.Duration, writesBump bool) error
where writesBump can be set to false for your use case: writes will not bump the idle timer, and reads will timeout independently of write success. Test of the functionality is in writebump_test.go.  Your use case should probably be the default. After more experience, we may find we don't need or want writesBump == true ever. But for now I've left that option.
Try it out and let me know if it works for you.

I appreciate you putting in the work in to create a prototype. Unfortunately I don't have the time to test it out right now. I'll try and take a look later.
Though, I'm 100% certain we don't need a writesBump bool.
I'm not certain whether SetIdleTimeout is the best API to expose for this. Will think about it and get back to you later. 🤔

Has there been any further development on this front?


pull request for e2e test at 01/06/2017 05:26:13

:white_check_mark: Validation status: passed
For more details, please refer to the build report.
Note: If you changed an existing file name or deleted a file, broken links in other files to the deleted or renamed file are listed only in the full build report.


Latencies when Redis server is down

Hi,
During our tests of redisson, we noticed that if the redis server is down, the latency is around 100ms, no matter what.
This is problematic for our use case because it slows down too much and we would prefer a fast response/error.
After carefully reading configuration options and experimenting with many tests, we could not find a solution.
Do you have an idea of what could provoke this latency ?
Below is a simplified code allowing to reproduce it (no need to launch a redis instance):
package test;

import org.redisson.Redisson;
import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient;
import org.redisson.client.codec.StringCodec;
import org.redisson.config.Config;
import org.redisson.config.SingleServerConfig;

public class RedisDownTest {

    public static void main(String[] args) {
        Config config = new Config();
        config.setCodec(StringCodec.INSTANCE);
        SingleServerConfig singleServerConfig = config.useSingleServer();
        singleServerConfig.setAddress("redis://localhost:6378"); // 6378 is on purpose, there is no redis listening on it
        singleServerConfig.setConnectionMinimumIdleSize(0); // this was set to 0 just to be able to build the client without error
        singleServerConfig.setSubscriptionConnectionMinimumIdleSize(0);
        singleServerConfig.setSubscriptionConnectionPoolSize(0);
        singleServerConfig.setConnectTimeout(50);
        singleServerConfig.setTimeout(50);
        singleServerConfig.setRetryInterval(0);
        singleServerConfig.setRetryAttempts(0);
        singleServerConfig.setReconnectionTimeout(0);
        singleServerConfig.setPingTimeout(0);
        config.setRedissonReferenceEnabled(false);
        RedissonClient redissonClient = Redisson.create(config);

        for (int i = 0 ; i < 20 ; i++) {
            long start = System.currentTimeMillis();
            try {
                RBucket<String> bucket = redissonClient.getBucket("someKey");
                String content = bucket.get();
            } catch (Exception e) {
            } finally {
                long end = System.currentTimeMillis();
                System.out.println("Took: " + (end - start) + "ms");
            }
        }
    }
}

Here are the logs for the last 10 iterations:
Took: 100ms
Took: 98ms
Took: 102ms
Took: 97ms
Took: 100ms
Took: 101ms
Took: 101ms
Took: 98ms
Took: 102ms
Took: 97ms

@fabienrousseau I found where cause this 100ms latency. Based on your example, you have to set the minimum number of timeout, retryInterval, or reconnectionTimeout bigger than 2.
@mrniko I have some questions about this range of code.

Should we add connectTimeout to the array of timeouts?
This issue is caused by picking min timeout. I think it would be better to pick min timeout that bigger than 2.

BTW, I can help with this ticket. :)

@jiminhsieh Awesome
Thanks for your help and showing the code. I've tested with 2ms for retryInterval & reconnectionTimeout and it works (ie a few ms).
I'll let the ticket open because I think the example above is a legitimate config and code might be changed to support it (but feel free to close it).

@jackygurui Do you have any thought about this ticket? Thanks! :)


GL ERROR :GL_INVALID_OPERATION : glDrawElements: Source and destination textures of the draw are the same.

I recently switched from phaser to phaser-ce and everything worked quite nicely except this error.
I've pinpointed it to when I apply a filter to two different sprites using the same texture. That is, something like this:
const s1 = this.game.add.sprite(0, 0, 'spriteKey');
const s2 = this.game.add.sprite(20, 20, 'spriteKey');

const filter1 = new Filter(this.game, null, shaderSource);
const filter2 = new Filter(this.game, null, shaderSource);

s1.filters = [ filter1 ];
s2.filters = [ filter2 ];

The error looks like this:

It doesn't occur in phaser 2.6.2.
It also messes up some rendering. Sprites which use the same key are flashing and teleporting seemingly at random.
The main difference I have been able to find between phaser and phaser-ce is the multi texture feature described in the tutorial. It also seems logical as sprites seem to affect each other. I have no idea how though.
How can I further debug this issue?

Same here its related to my filter that looks like this
this.fragmentSrc = [
        'precision lowp float;',
        'varying vec2 vTextureCoord;',
        'varying vec4 vColor;',
        'uniform sampler2D uSampler;',

        'void main() {',
            'vec4 sum = vec4(0);',
            'vec2 texcoord = vTextureCoord;',
            'for(int xx = -4; xx <= 4; xx++) {',
                'for(int yy = -3; yy <= 3; yy++) {',
                    'float dist = sqrt(float(xx*xx) + float(yy*yy));',
                    'float factor = 0.0;',
                    'if (dist == 0.0) {',
                        'factor = 2.0;',
                    '} else {',
                        'factor = 2.0/abs(float(dist));',
                    '}',
                    'sum += texture2D(uSampler, texcoord + vec2(xx, yy) * 0.002) * factor;',
                '}',
            '}',
            'gl_FragColor = sum * 0.025 + texture2D(uSampler, texcoord);',
        '}'
    ];

any ideas?

I have the same error trying to copy sprite or group more than once using the following method:

create new Phaser.RenderTexture
texture.renderXY(someSprite, 0, 0)
create new image with the given texture
create another sprite with same texture or another created from same sprites

i'm having this problem - not sure what to do as i use custom textures extensively.

@samme There are a few code examples in this issue. What else do you reckon I must provide?

Hi @noseglid, these are helpful but we could use a single runnable example (test case). http://codepen.io/pen?template=vyKJvw

I've pinpointed it to when I apply a filter to two different sprites using the same texture.

http://codepen.io/samme/pen/jBjzGj
When I use the Gray filter on one sprite, the others are distorted, and if I use the filter on two, all but the first are hidden. I don't get a GL_INVALID_OPERATION warning (or any other), though.

create new Phaser.RenderTexture
texture.renderXY(someSprite, 0, 0)
create new image with the given texture
create another sprite with same texture or another created from same sprites

@arovenski I can successfully make 2 sprites from the same RenderTexture: http://codepen.io/samme/pen/oZrrQo?editors=0010
I'm not sure I'm doing the same as your step 4 though. Do you have an example?

When I use the Gray filter on one sprite, the others are distorted, and if I use the filter on two, all but the first are hidden. I don't get a GL_INVALID_OPERATION warning (or any other), though.

Making new issues for these since it's not clear they are the same problem.

Here's a working code example: http://codepen.io/anon/pen/qmdzqJ
(Note that you may need to reload the example after opening dev tools since webgl stops printing after 256 reported errors/warning)
The issue appears for me when I add filters, to two separate sprites, using the same base texture.

http://codepen.io/anon/pen/qmdzqJ

Thanks. For me the sprites blink red and green and I don't see any console warnings/errors. What happens in yours?

This.

Did you reload after you opened devtools?

Got it now. Firefox says

Error: WebGL: texImage2D: Conversion requires pixel reformatting.  phaser.js:17473:5
Error: WebGL: drawElements: Feedback loop detected between tex target 0x0de1, tex unit 0, levels 0-0; and framebuffer attachment 0x8ce0, level 0.  phaser.js:18892:5 [WebGLSpriteBatch.js#L709]

Is it rendering correctly or no?

Just tested your fix on my project with latest master from github and it works like charm! Thank you so much for fixing this and all effort you put into phaser-ce!

Thanks @Xan0C


Added data model for ProgramRequirement

Pre-Flight checklist

[x] Migrations

[x] Migration is backwards-compatible with current production code

[x] Testing

[x] Code is tested
[x] Changes have been manually tested

What are the relevant tickets?
Closes #1066
What's this PR do?
Adds a data model for program requirements
How should this be manually tested?
Migrations should run and tests should pass

Codecov Report

Merging #1070 (15b4e4e) into main (46ecf4d) will decrease coverage by 0.01%.
The diff coverage is 81.48%.

@@            Coverage Diff             @@
##             main    #1070      +/-   ##
==========================================
- Coverage   85.92%   85.91%   -0.02%
==========================================
  Files         285      285
  Lines       10898    10924      +26
  Branches     1174     1179       +5
==========================================
+ Hits         9364     9385      +21
- Misses       1325     1331       +6
+ Partials      209      208       -1

Impacted Files
Coverage Δ

main/settings.py
93.45% <ø> (ø)

courses/models.py
89.80% <80.76%> (-0.72%)
:arrow_down:

courses/admin.py
80.95% <100.00%> (ø)

ecommerce/models.py
88.79% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@pdpinch
I think I've got this where I want it. Some examples of how this would get used:
# which programs is a course in?
Program.objects.filter(requirements__course=course).distinct()

# which courses are in a program?
Course.objects.filter(in_programs__program=program).distinct()

# has a learner passed all the requirements for a certificate?
def has_earned_program_cert(user, program):
    passed_courses = Course.objects.filter(
        in_programs__program=program,
        courserungrade__user=user,
        courserungrade__passed=True,
    )
    root = ProgramRequirement.get_root_nodes().get(program=program)

    def _has_earned(node):
        if node.is_root() or node.is_all_of_operator:
            # has passed all of the child requirements
            return all(_has_earned(child) for child in node.get_children())
        elif node.is_min_number_of_operator:
            # has passed a minimum of the child requirements
            return len(filter(_has_earned, node.get_children())) >= int(node.operator_value)
        elif node.is_course:
            # has passed the reference course
            return node.course in passed_courses

    return _has_earned(root)

has_earned_program_cert(user, program)

Compare has_earned_program_cert to the function in MicroMasters: https://github.com/mitodl/micromasters/blob/master/grades/api.py#L243-L270
A few things to note when comparing these:

Some logic in MicroMasters is in MMTrack, so it's actually a little more complicated than at-a-glance
The MicroMasters implementation doesn't support mutally exclusive electives and would require another data model and more logic to support it

The MicroMasters implementation doesn't support mutually exclusive electives and would require another data model and more logic to support it

How are mutually exclusive electives configured in this model?
To be more specific, how would we model the (current) DEDP requirements, described here: https://micromasters.mit.edu/dedp/course-overviews/
Since this is pretty complex functionality, does it make sense to include a migration or a management command that sets up the DEDP requirements to make development easier?

@pdpinch mutually exclusive courses are modelling here in the tests: https://github.com/mitodl/mitxonline/pull/1070/files#diff-3a704dc028b439e999fab8f01530da708a1eaafe3440a2303460953226b06f26R50-R55
The current DEDP requirements would be modeled like the remainder of that test fixture.

Code looks good. I've applied the schema and added some test rows, but I am not sure about how it's been used. I ran into errors when calling has_earned_program_cert, but that's different issue

That was sorta pseudocode, I didn't test it thoroughly because I want to keep this PR just to the data model but the general idea there of walking the tree will work.


Identify if jupyterhub idle culler by op1st settings can be adjusted for osc workstream

idle-culler reaps every 24h regardless of idility. This should be remedied and if not, do not bring it over.
/cc @MichaelTiemann

PR: https://github.com/os-climate/ops-argocd/pull/2/commits/b7eb21fac8718290c49c8e155dc0010c848a901e


Merge and test new patches for Schematron

Patches are now available that mean that the code can work with SaxonHE 1.2.1, which is supposed to contain fixes for memory leaks. Alf has updated his work, available at https://github.com/JATS4R/jats-validator-docker and reported that memory consumption seems to be improved but it is still exceeding 2GB when using eLife's 'final' schematron file.
Anyhow, this issue covers merging the new patches to update our docker container to the latest version, re-run the memory consumption tests and measure if things have improved or not, and then to make a decision about deploying the new version into the testing system or not.
DoD

[ ] A new deployed version of schematron on the elifesciences kubernetes cluster.

Initial patches merged and built, running tests

Sadly there is no improvement in the memory consumption of the container. I've started capturing the work so far done investigating/resolving the issue in the jats-validator-docker repo, which is a better place for the issue to reside.
https://github.com/elifesciences/jats-validator-docker/issues/3
Hence, closing this ticket.


[Advanced RetrievalAgent]Add advanced retrieval agent

Graph DFS方法（高级版）

[x] self ask https://github.com/PaddlePaddle/ERNIE-Bot-SDK/pull/275
[x] DAG or ToT策略生成sub query  https://github.com/PaddlePaddle/ERNIE-Bot-SDK/pull/275
[x] 稳定性优化
[x] 单测

Codecov Report
Attention: 15 lines in your changes are missing coverage. Please review.

Comparison is base (6fbc099) 69.37% compared to head (f286e6b) 69.17%.
Report is 1 commits behind head on develop.

Files
Patch %
Lines

...agent/src/erniebot_agent/agents/retrieval_agent.py
44.00%
14 Missing :warning:

...ot-agent/src/erniebot_agent/tools/baizhong_tool.py
50.00%
1 Missing :warning:

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #275      +/-   ##
===========================================
- Coverage    69.37%   69.17%   -0.20%
===========================================
  Files           63       64       +1
  Lines         3236     3264      +28
===========================================
+ Hits          2245     2258      +13
- Misses         991     1006      +15

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

 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.You have signed the CLA already but the status is still pending? Let us recheck it.


Index p_index out of size and connect: Condition ' s->slot_map.has(target) ' is true

Fixed duplicate signal connection https://github.com/godotengine/godot/issues/12189

That line was added by @Geequlim in 1473e23df8f8eea3ed0e89c6fabe4a80d17e4727. @Geequlim Could you review it?

That is OK.


build: move to nx

added initial nx.json file
switched some scripts over
it currently works correctly but it's cache for many packages is broken most of the time so it's cache is mostly useless atm until we finetune it

TODO

[ ] set up cloud cache? https://nx.dev/recipes/ci/monorepo-ci-github-actions https://github.com/nrwl/nx-set-shas
[ ] figure out why certain actions aren't caching, probably lacking their output dirs
[ ] verify ci runner is not using parallel
[ ] figure out how to make ci runner only turn off parallel for build steps

I am curious how nx would tie into my approach with templates in https://github.com/latticexyz/mud/pull/599
since packages in templates are linked with link:../../../../packages/* but each template is its own workspace (and not part of the root workspace), I wonder if we can make nx aware of this part of the dependency graph so that it would know that building a template's client dir would need to build the root package's network package, for example

I am curious how nx would tie into my approach with templates in #599
since packages in templates are linked with link:../../../../packages/* but each template is its own workspace (and not part of the root workspace), I wonder if we can make nx aware of this part of the dependency graph so that it would know that building a template's client dir would need to build the root package's network package, for example

Yup nx is powerful enough to set up any build graph.  It has features like named inputs

Can't remove nx-cloud because that's the task runner.   By default it doesn't actually push to cloud but it is the thing that runs the local cache.   It's the default task-runner for nx

For nx to be effective and manageable, I think we're gonna need to create some consistency in our script/task naming between packages.
For example:

build creates all artifacts for publishing and includes things like mud codegen, typechain, forge build, TS -> JS, etc.
some number of common sub-build steps like build:forge that do specific/common things like forge build

each project might need to specify its task ordering/dependencies like "mud codegen before forge build" (so codegen'ed solidity can be compiled) and "typechain after forge build" (so ABIs are available)

Guessing the list will look something like:

build includes some combo of everything below, depending on the package
build:mudcodegen runs mud codegen
build:typechain runs typechain
build:forge runs forge build
build:js runs whatever TS -> JS pipeline (sometimes vite, sometimes tsup, sometimes parcel)

This nx.json that I am adding to optimism repo post bedrock.  Sharing it to explain namedInputs which can help clean up these config files, make them more maintainable, and give you a much smarter cache.
{
  "defaultBase": "develop",
  "affected": {
    "defaultBase": "develop"
  },
  // implicit dependencies will break the cache of everything if they change
  "implicitDependencies": {
    "nx.json": "*"
  },
  "tasksRunnerOptions": {
    "default": {
      "runner": "@nrwl/nx-cloud",
      "options": {
        "cacheableOperations": [
          "lint",
          "build",
          "test",
          "build:contracts",
          "autogen:artifacts"
        ]
      }
    }
  },
  // named inputs are a way of adding a group of files to a name
  "namedInputs": {
    // configs in root of repo.  THese names are names I gave it they don't mean anything magical just variable names
    "configsWorkspace": [
      "{workspaceRoot}/package.json",
      "{workspaceRoot}/tsconfig.json"
    ],
    // configs in individual packages
    "configsProject": [
      "{projectRoot}/foundry.toml",
      "{projectRoot}/tsconfig.json",
      "{projectRoot}/hardhat.config.ts",
      "{projectRoot}/package.json"
    ],
    // these are the default files we want to bust the cache on
    "default": ["{projectRoot}/**/*", "configsWorkspace"],
    // optimism builds stuff into src directory in contracts-bedrock (shame!!!).  This file group I will use later to fix it
    "srcGenerated": [
      "{projectRoot}/src/contract-artifacts.ts",
      "{projectRoot}/src/contract-deployed-artifacts.ts"
    ],
   // this is what most src looks like.  Remove the .spec files ect.   Without this it will depend on literally everything
    "productionSrc": [
      "{projectRoot}/src/**/*",
      "!{projectRoot}/src/contract-artifacts.ts",
      "!{projectRoot}/src/contract-deployed-artifacts.ts",
      "!{projectRoot}/src/**/*.spec.ts"
    ],
    "productionContracts": ["{projectRoot}/contracts/**/*"],
    // combining filegroups into names aggregated file groups
    "production": ["productionSrc", "productionContracts"],
    "testing": ["configsWorkspace", "default"]
  },
  "targetDefaults": {
    "lint": {
      // now I can use my filegroupsin my inputs and outputs
      "inputs": ["{workspaceRoot}/.markdownlint.json", "default"]
    },
    "test": {
      "inputs": ["default", "testing", "^production"],
      "dependsOn": ["^build"]
    },
    "build:contracts": {
      "inputs": [
        "configsProject",
        "productionContracts",
        "^productionContracts"
      ],
      "dependsOn": ["^build"],
      "outputs": ["{projectRoot}/artifacts", "{projectRoot}/forge-artifacts"]
    },
    "autogen:artifacts": {
      "inputs": [
        "configsWorkspace",
        "configsProject",
        "productionContracts",
        "^productionContracts"
      ],
      "dependsOn": ["^build", "build:contracts"],
      "outputs": ["srcGenerated"]
    },
    "build": {
      "inputs": [
        "configsWorkspace",
        "configsProject",
        "production",
        "^production"
      ],
      "dependsOn": ["^build", "autogen:artifacts", "build:contracts"],
      "outputs": ["{projectRoot}/dist"]
    }
  }
}

I've started working on the build scripts in a new branch. Here's what I've got so far:

build:mudcodegen eventually runs mud codegen but for now is tablegen && worldgen && tsgen
build:abi runs forge build for abi files to be used by typechain
build:typechain runs typechain to generate TS types
build:js runs tsup

(Each build:* script also has a corresponding clean:* script, where applicable)
I'll update this list as I go.


[SPARK-49142][CONNECT][PYTHON] Follow up to revert proto to string performance cost

What changes were proposed in this pull request?
In a previous commit a713a66e, log level in the connect client
was lowered from info to debug. As part of that, the explicit
check for logging level was removed.
Revert this change and put the logging level check back.
Why are the changes needed?
The explicit check was there so as to not convert the proto
to a string, done during string interpolation, when not at the
expected log level. Conversion from proto to string can be
expensive for some proto messages.
Does this PR introduce any user-facing change?
A previously reverted perfomance improvement is now
put back in place.
Was this patch authored or co-authored using generative AI tooling?
No.

Merged to master.


Clarify that 60-day window is for individual project

We should clarify (in "details") that the 60-day window in criterion vulnerabilities_fixed_60_days only applies to the individual project.
Some projects are part of a larger umbrella organization/project, and feed to other organizations/projects, in a potentially-complex supply chain.  An individual project cannot necessarily control all the rest of that supply chain, but an individual project can release a fix to the vulnerability.  Once that's available from the project, others can determine how to deal with it (e.g., apply it as a cherry-pick, update to a newer version, or something else).
Here's the current criterion:

There MUST be no unpatched vulnerabilities of medium or high severity that have been publicly known for more than 60 days. [vulnerabilities_fixed_60_days]

Current details:

The vulnerability must be patched and released by the project itself (patches may be developed elsewhere). A vulnerability becomes publicly known (for this purpose) once it has a CVE with publicly released non-paywalled information (reported, for example, in the National Vulnerability Database) or when the project has been informed and the information has been released to the public (possibly by the project). A vulnerability is medium to high severity if its CVSS 2.0 base score is 4 or higher. Note: this means that users might be left vulnerable to all attackers worldwide for up to 60 days. This criterion is often much easier to meet than what Google recommends in Rebooting responsible disclosure, because Google recommends that the 60-day period start when the project is notified even if the report is not public.

I propose adding a note to the details like this:

Also note that this badge criterion, like other criteria, applies to the individual project.  Some projects are part of larger umbrella organizations or larger projects, possibly in multiple layers, and many projects feed their results to other organizations and projects as part of a potentially-complex supply chain.  An individual project often cannot control the rest, but an individual project can work to release a vulnerability patch in a timely way.  Once a patch is available from the individual project, others can determine how to deal with the patch (e.g., they can apply just the patch as a cherry-picked solution, update to a newer version, or something else).

David, I think that this is a good clarification.
There is one other aspect to consider that I neglected to raise.  That is there is a difference between the vulnerabilities created by the "project" (i.e. in the code created by the project) and the vulnerabilities caused by importing modules used by the "project" that have publicly known vulnerabilities.  Some of these "imported" vulnerabilities can be mitigated by the way that the imported component is used, however fixing them is out of the control of the "project" if there is no current fix.  Having said that, for such known vulnerabilities, I think that either mitigation or transparency is to be encouraged.

Thanks!  I agree that there's a difference between (1) what the project creates and (2) what the project imports.  I think this particular criterion should focus only on the first part, what the project creates.  That's certainly the current intent.  After all, the project can clearly directly address this part (they have the knowledge and it's clearly that project's problem).
It's good to address the second part, but we need to define clear and implementable solutions.  One part of the solution is to get those other projects to also pursue badges.  Then they'll have to fix them to retain a badge, and they'll be doing other good things to try to reduce the likelihood of problems in the first place.
Of course, there are other possibilities.  Encouraging projects to use package managers, as well as origin analysis (aka software composition analysis) tools, can very much help.  It's a little challenging to word a criterion that deal with all the many cases.  That might be worth pursuing as a separate issue.

I propose that we just add the clarification as it is. If we can create a new Criterion to deal with reused software, great but let's make that a separate issue.


Try to test component with React generated form svgr

Hi,
I have a little problem with Jest tests runner.
My simple component:
import React from 'react';

import {ReactComponent as CloseIcon} from '../images/close.svg';

const CloseBubble = ({minimize}) => (

         {
            event.preventDefault();
            minimize()
        }} href=''>
            <CloseIcon/>

);

export default CloseBubble;

test class:
import CloseBubble from '../CloseBubble';

describe('CloseBubble', () => {
    test('sample', () => {
        expect(1).toBe(1);
    });
});

And after I run this test I got following error:
  ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs></defs><title>cancel_icon</title><path class="cls-1" d="M52.08,50,70.32,31.84a1.49,1.49,0,0,0-2.11-2.11L50,47.87,31.82,29.63a1.8,1.8,0,0,0-2.22,0,1.82,1.82,0,0,0,0,2.21L47.85,50.09,29.6,68.23a1.47,1.47,0,0,0,0,2.12,1.74,1.74,0,0,0,2.22,0L50.06,52.1,68.31,70.35a1.73,1.73,0,0,0,2.21,0,1.46,1.46,0,0,0,0-2.12Z"/></svg>
                                                                                ^

    SyntaxError: Unexpected token <

       9 |             minimize()
      10 |         }} href=''>
    > 11 |             <CloseIcon/>
      12 |
      13 |

      14 | );

      at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:316:17)
      at Object.<anonymous> (src/components/CloseBubble.js:11:14)

What I've do wrong?

It looks like a babel-loader is missing somewhere.

I did handle with this by added following conf to the package.json:
"jest": {
  "moduleNameMapper": {
    "\\.svg": "svgr/webpack"
  }
}

But now, I have a following error when I try to render a React component inside test:
it('test', () => {
    const minimize = sinon.spy();
    const toJSON = renderer.create(<CloseBubble minimize={minimize}/>).toJSON();
    console.log(toJSON);
});

  console.error ../../../node_modules/react-test-renderer/cjs/react-test-renderer.development.js:5206
    The above error occurred in the <svgrLoader> component:
        in svgrLoader (created by CloseBubble)
        in a (created by CloseBubble)
        in div (created by CloseBubble)
        in CloseBubble

    Consider adding an error boundary to your tree to customize error handling behavior.
    Visit https://fb.me/react-error-boundaries to learn more about error boundaries.

TypeError: Cannot read property 'async' of undefined
    at svgrLoader (/node_modules/svgr/lib/webpack.js:20:25)
    at mountIndeterminateComponent (/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:4137:15)
    at beginWork (/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:4541:16)
    at performUnitOfWork (/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7377:16)
    at workLoop (/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7406:26)
    at renderRoot (/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7437:9)
    at performWorkOnRoot (/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8012:24)
    at performWork (/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7933:9)
    at performSyncWork (/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7910:5)
    at requestWork (/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7810:7)
    at scheduleWorkImpl (/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7685:13)
    at scheduleWork (/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7645:12)
    at scheduleRootUpdate (/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8273:5)
    at updateContainerAtExpirationTime (/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8301:12)
    at Object.updateContainer (/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8328:14)
    at Object.create (/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9009:18)
    at Object.<anonymous> (/src/components/__tests__/CloseBubble.test.js:25:29)
    at Object.asyncFn (/node_modules/jest-jasmine2/build/jasmine_async.js:82:37)
    at resolve (/node_modules/jest-jasmine2/build/queue_runner.js:52:12)
    at new Promise (<anonymous>)
    at mapper (/node_modules/jest-jasmine2/build/queue_runner.js:39:19)
    at promise.then (/node_modules/jest-jasmine2/build/queue_runner.js:73:82)
    at <anonymous>

@piotrooo I believe this is due to not having an async/await transformer in the pipeline.

@piotrooo how did you fix this issue? I ran into the same thing. Adding
  "moduleNameMapper": {
    "\\.svg": "@svgr/webpack"
  }

was already helpful, but now I am stuck with the same problem.

Minimal application showcasing the problem: https://github.com/rwieruch/svgr-async-bug

@rwieruch it is impossible to use the webpack loader in Jest, you can't do that.
I don't know what is the best option to do it but the use-case is not relative to SVGR, you should look for using webpack + Jest together. Maybe build a bundle with webpack, then using this build in Jest.

That's too bad in my opinion. Not related to this library, but to not being able to combine Jest and Webpack. That's one of the most often used testing setups I have seen out there. It works standalone with its custom setup stuff, but now not being able to add a third-party to the combination is bad for the ecosystem, because I am just not able to test the components using SVG anymore. I try to find a solution for the Jest + Webpack problem. Thanks for your help!
Maybe keeping the issue open helps others as well. Maybe we can find a solution together!

Yeah I agree, but you have this problem with all Webpack loaders + Jest.

I didn't handle it at all... Workaround which works for me, generating icons while bundling package.
npm script:
"generate-icons": "node_modules/.bin/svgr --no-title src/images/ --out-dir src/icons && echo Done. Building project...",

Disclaimer
This is very naive way! Should be treated as a workaround not a final solution.

We created a simple mock for the svgr loader and mapped to it in the jest config:
svgrMock.js
module.exports = 'IconMock'

In your package.json e.g.
"jest": {
  "moduleNameMapper": {
    "\\.svg": "<rootDir>/__mocks__/svgrMock.js"
  }
}

Your snapshots will include all properties on the icon components, so they will be tested.

I need to try this! Thank you @marco-streng 💯

It worked for me! 🎉  🎉  🎉
thanks @marco-streng!

module.exports = 'IconMock' not work for me.
I use svgr like this:
import { ReactComponent as Logo } from '../assets/logo.svg'

Then I changed svgrMock.js to:
module.exports = { ReactComponent: 'IconMock' }

Tests pass.

Thanks @leoendless, I updated the readme.

@neoziro Whereabouts is this info in the readme? I found this thread first.

I think the section has disappeared. We should add a section "Testing" on the website.

Hey 👋 !
I was having issue with both solution on React 16.8.3, React warns about casing.
console.error node_modules/react-dom/cjs/react-dom.development.js:506
      Warning: <IconMock /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.
          in IconMock
          in div
          in Unknown (created by WrapperComponent)
          in WrapperComponent

because, tests were render something like <IconMock className="aweome-classname" /> instead of  <icon-mock className="aweome-classname" />
Finally i was able to make it work with:
module.exports = { ReactComponent: 'icon-mock' }

and now everything is ok

Hey  !
I was having issue with both solution on React 16.8.3, React warns about casing.
console.error node_modules/react-dom/cjs/react-dom.development.js:506
Warning: <IconMock /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.
          in IconMock
          in div
          in Unknown (created by WrapperComponent)
          in WrapperComponent

because, tests were render something like <IconMock className="aweome-classname" /> instead of <icon-mock className="aweome-classname" />
Finally i was able to make it work with:
module.exports = { ReactComponent: 'icon-mock' }

and now everything is ok

Thanks man, that worked like a charm, thanks a lot.

It worked for me with the solution provided by @marco-streng Thank you!
Since everything is mocked now, I assume SVG icons will be excluded from visual regression testing now. Would be great to find a solution to still render the SVGs for these kind of tests, but I haven't found one.

For what it's worth, identity-obj-proxy seems to work just fine for this use case.

@isaachinman  identity-obj-proxy does work but still getting the casing warning 🤷♂ . I wish there was a way to configure that.

If you need to support both
import logoURL from '../assets/logo.svg'
and
import { ReactComponent as Logo } from '../assets/logo.svg'
Then your svgrMock.js should be
const svgr = String('SvgrURL');
svgr.ReactComponent = 'SvgrMock';

module.exports = svgr;

If you need to support both
import logoURL from '../assets/logo.svg'
and
import { ReactComponent as Logo } from '../assets/logo.svg'
Then your svgrMock.js should be
import React from 'react';

export default 'SvgrURL';
function SvgrMock(props) { return ; }

export const ReactComponent = SvgrMock;

Maybe we should add a section in the documentation to document how to test with SVGR. Do someone want to create it?

Does this also work with typescript?
I tried to use this configuration but it didn't work

Any luck?

@vgm106 and @bobysf12 for what it worth, i'm able to make it work with this trick for TypeScript

Does this also work with typescript?
I tried to use this configuration but it didn't work

@bobysf12 did you solve this problem and how ????

Does this also work with typescript?
I tried to use this configuration but it didn't work

@bobysf12 did you solve this problem and how ????

Hey @Milos5611, I added this in jest configuration
    moduleNameMapper: {
        "^.+\\.svg": "<rootDir>/src/__mocks__/svgrMock.ts",
    },

and here's the svgrMock.ts:
// @ts-ignore
import * as React from "react";
export default "SvgrURL";
export const ReactComponent = "div";

@Milos5611

Thanks @bobysf12 .
For everyone else that configuration changes don't work, I had configuration in my jest.config
 transform: {
    "^.+\\.tsx?$": "ts-jest",

but instead i should be
 "^.+\\.tsx?$": <rootDir>/node_modules/babel-jest"

If you need to support both
import logoURL from '../assets/logo.svg'
and
import { ReactComponent as Logo } from '../assets/logo.svg'
and worked for styled-components
Then your svgrMock.js should be
import React from 'react';

export default 'SvgrURL';
const SvgrMock = React.forwardRef((props, ref) => );

export const ReactComponent = SvgrMock;

This worked, however it shows a console error message:
<SvgrURL /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.
adjusting it to
import React from 'react';

const SvgrMock = React.forwardRef((props, ref) => );

export const ReactComponent = SvgrMock;
export default SvgrMock;

did the trick for me

In case this helps anyone, I got this to work with Typescript like so:
import React, { SVGProps } from 'react';

const SvgrMock = React.forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>((props, ref) => (
  <svg ref={ref} {...props} />
));

SvgrMock.displayName = 'SvgrMock';

export const ReactComponent = SvgrMock;
export default SvgrMock;

I had to also change the mock file's extension to .tsx so make sure to update the path in your Jest config moduleNameMapper accordingly
Note: The displayName part is not essential but eslint was yelling at me that Component definition is missing display name.

Mine still not solved it' throwing the following error event after mocking
Cannot create styled-component for component: undefined.
import { ReactComponent as ScreenShare } from<EMAIL_ADDRESS>
Error:
When using SVG in a styled component:
Cannot create styled-component for component: undefined.
const ScreenShareIcon = styled(ScreenShare)``;
When using directly
C:\Users\d-Evil\venuiq-microsite\src\assets\icons\pip.svg:1
({"Object.":function(module,exports,require,__dirname,__filename,global,jest){
SyntaxError: Unexpected token '<'
svgrMock.js
import React from 'react';

const SvgrMock = React.forwardRef((props, ref) => );

export const ReactComponent = SvgrMock;
export default SvgrMock;

jest.config.js
moduleNameMapper: {
    '^@/(.*)$': '<rootDir>/src/$1',
    '\\.(css|less)$': 'identity-obj-proxy',
    '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/src/__mocks__/fileMock.js',
    '\\.svg$': '<rootDir>/__mocks__/svgrMock.js',
  },

If you need to support both
import logoURL from '../assets/logo.svg'
and
import { ReactComponent as Logo } from '../assets/logo.svg'
and worked for styled-components
Then your svgrMock.js should be
import React from 'react';

export default 'SvgrURL';
const SvgrMock = React.forwardRef((props, ref) => );

export const ReactComponent = SvgrMock;

This worked, however it shows a console error message:
<SvgrURL /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.
adjusting it to
import React from 'react';

const SvgrMock = React.forwardRef((props, ref) => );

export const ReactComponent = SvgrMock;
export default SvgrMock;

did the trick for me

In case this helps anyone, I got this to work with Typescript like so:
import React, { SVGProps } from 'react';

const SvgrMock = React.forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>((props, ref) => (
  <svg ref={ref} {...props} />
));

SvgrMock.displayName = 'SvgrMock';

export const ReactComponent = SvgrMock;
export default SvgrMock;

I had to also change the mock file's extension to .tsx so make sure to update the path in your Jest config moduleNameMapper accordingly
Note: The displayName part is not essential but eslint was yelling at me that Component definition is missing display name.

This was the only thing that worked for me.
I am using Next.js + SVGR + typescript
thanks mate.

With solutions above, I can't really test that the import of my svg file is correct.
Both
import { ReactComponent as IconCorrectPath } from<EMAIL_ADDRESS>and
import { ReactComponent as IconWrongPath } from<EMAIL_ADDRESS>will pass the test.
What can I do if I want my test to fail when path to my svg is wrong ?
Thanks

module.exports = 'IconMock' not work for me.
I use svgr like this:
import { ReactComponent as Logo } from '../assets/logo.svg'

Then I changed svgrMock.js to:
module.exports = { ReactComponent: 'IconMock' }

Tests pass.

tnk you so much

Hi there,
thanks a lot for providing solutions for this issue.
I am using NextJS 12.1.4 with Typescript, React Testing Library and SVGR. So I can import SVGs like this: import ChevronLeftIcon from './chevron-left.svg'
Here is my jest.config.js:
const nextJest = require('next/jest')
const createJestConfig = nextJest({
  dir: './',
})

const customJestConfig = {
  moduleDirectories: ['node_modules', '<rootDir>/src/'],
  testEnvironment: 'jest-environment-jsdom',
  moduleNameMapper: {
    '\\.svg$': '<rootDir>/src/__mocks__/svgrMock.tsx',
  },
}

module.exports = createJestConfig(customJestConfig)

and src/__mocks__/svgrMock.tsx as suggested by @ybentz.
import React, { SVGProps } from 'react'

const SvgrMock = React.forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(
    (props, ref) => <svg ref={ref} {...props} />,
)

SvgrMock.displayName = 'SvgrMock'

export const ReactComponent = SvgrMock
export default SvgrMock

When running a test of a component including an SVG, I get the following error.
console.error
    Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.

    Check the render method of `Loader`.
        at Loader (.../src/components/atoms/Loader/Loader.tsx:11:36)
        at div
        at button
        at Button (.../src/components/atoms/buttons/Button/Button.tsx:19:5)

      15 |         }`}
      16 |     >
    > 17 |         <LoaderIcon />
         |                       ^
      18 |

      19 | )
      20 |

      at printWarning (node_modules/react/cjs/react-jsx-runtime.development.js:117:30)
      at error (node_modules/react/cjs/react-jsx-runtime.development.js:93:5)
      at jsxWithValidation (node_modules/react/cjs/react-jsx-runtime.development.js:1152:7)
      at Object.jsxWithValidationDynamic [as jsx] (node_modules/react/cjs/react-jsx-runtime.development.js:1209:12)
      at Loader (src/components/atoms/Loader/Loader.tsx:17:23)
      at renderWithHooks (node_modules/react-dom/cjs/react-dom.development.js:14985:18)
      at mountIndeterminateComponent (node_modules/react-dom/cjs/react-dom.development.js:17811:13)

I spent hours trying to solve this, but I couldn't find a solution that worked yet.
I am using
"react": "17.0.2",
"react-dom": "17.0.2"
"@svgr/webpack": "^5.5.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^12.1.4",
"@testing-library/user-event": "^14.0.4",

Thanks for your help :)

Hey @denisbarriere, Try require.resolve to moduleNameMapper
moduleNameMapper: {
    '\\.svg$': require.resolve('<rootDir>/src/__mocks__/svgrMock.tsx'),
},

Hi there, thanks a lot for providing solutions for this issue.
I am using NextJS 12.1.4 with Typescript, React Testing Library and SVGR. So I can import SVGs like this: import ChevronLeftIcon from './chevron-left.svg'
Here is what I have in next.config.js:
webpack(config) {
    config.module.rules.push({
        test: /\.svg$/,
        use: ['@svgr/webpack'],
    })

    return config
},

Here is my jest.config.js:
const nextJest = require('next/jest')
const createJestConfig = nextJest({
  dir: './',
})

const customJestConfig = {
  moduleDirectories: ['node_modules', '<rootDir>/src/'],
  testEnvironment: 'jest-environment-jsdom',
  moduleNameMapper: {
    '\\.svg$': '<rootDir>/src/__mocks__/svgrMock.tsx',
  },
}

module.exports = createJestConfig(customJestConfig)

and src/__mocks__/svgrMock.tsx as suggested by @ybentz.
import React, { SVGProps } from 'react'

const SvgrMock = React.forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(
    (props, ref) => <svg ref={ref} {...props} />,
)

SvgrMock.displayName = 'SvgrMock'

export const ReactComponent = SvgrMock
export default SvgrMock

When running a test of a component including an SVG, I get the following error.
console.error
    Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.

    Check the render method of `Loader`.
        at Loader (.../src/components/atoms/Loader/Loader.tsx:11:36)
        at div
        at button
        at Button (.../src/components/atoms/buttons/Button/Button.tsx:19:5)

      15 |         }`}
      16 |     >
    > 17 |         <LoaderIcon />
         |                       ^
      18 |

      19 | )
      20 |

      at printWarning (node_modules/react/cjs/react-jsx-runtime.development.js:117:30)
      at error (node_modules/react/cjs/react-jsx-runtime.development.js:93:5)
      at jsxWithValidation (node_modules/react/cjs/react-jsx-runtime.development.js:1152:7)
      at Object.jsxWithValidationDynamic [as jsx] (node_modules/react/cjs/react-jsx-runtime.development.js:1209:12)
      at Loader (src/components/atoms/Loader/Loader.tsx:17:23)
      at renderWithHooks (node_modules/react-dom/cjs/react-dom.development.js:14985:18)
      at mountIndeterminateComponent (node_modules/react-dom/cjs/react-dom.development.js:17811:13)

I spent hours trying to solve this, but I couldn't find a solution that worked yet. I am using
"react": "17.0.2",
"react-dom": "17.0.2"
"@svgr/webpack": "^5.5.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^12.1.4",
"@testing-library/user-event": "^14.0.4",

Thanks for your help :)

Having exactly the same issue, same tech stack. Any help would be much appreciated!
@oh3vci I tried what you said but getting the same error.

Funny thing:
Here is my moduleNameMapper
moduleNameMapper: {
    '\\.(svg+[?]+icon)$': '<rootDir>/__mocks__/svg.tsx',
    '\\.svg$': '<rootDir>/__mocks__/svg.tsx',
    '\\.(jpg|jpeg|png|gif|webp|avif|svg+[?]+image)$': '<rootDir>/__mocks__/next/image.tsx',
    '\\.(css|sass|scss)$': '<rootDir>/__mocks__/styleMock.ts',
  },

As you can see I have two svg options point to the same config file; one for svgs with icon query, and one for files with regular svg extension.
Any svg with .svg?icon query passes the test even though both options point to the same config file __mocks__/svg.tsx
So I console logged the outcome of __mocks__/svg.tsx and here it is
-> For .svg?icon which passes the test
{
        '$$typeof': Symbol(react.element),
        type: {
          '$$typeof': Symbol(react.forward_ref),
          render: [Function (anonymous)] { displayName: 'svg' }
        },
        key: null,
        ref: null,
        props: {},
        _owner: null,
        _store: {}
}

-> For .svg which fails the test
{
        '$$typeof': Symbol(react.element),
        type: {
          src: '/img.jpg',
          height: 24,
          width: 24,
          blurDataURL: 'data:image/png;base64,imagedata'
        },
        key: null,
        ref: null,
        props: {},
        _owner: null,
        _store: {}
}

Finally here is my __mocks__/svg.tsx
import React, { SVGProps } from 'react';

const SvgrMock = React.forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>((props, ref) => (
  <svg ref={ref} {...props} />
));
SvgrMock.displayName = 'svg';

export default SvgrMock;

export const ReactComponent = SvgrMock;

This suggests that the regular svgs (without query) do not pass through the __mocks__/svg.tsx file, therefore are not transformed into React functions and give the following error:
React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.

I haven't migrated to Next v12 yet so I'm not talking from experience and this is just a guess. In v12.1 Next added built-in support for Jest, I'm assuming that means they added some additional transformations to handle images including SVGs among other things which is why your plain .svg files are being transformed before being passed to SVGR (I'm assuming that because of the blurDataURL field which is a Next Image component thing). I think this discussion is relevant to your issue but doesn't seem like there are any suggestions for fixes.

This works for me (instead of "\\.svg$" or "^.+\\.svg")
// jest.config.js

moduleNameMapper: {
  '^.+\\.(svg)$': '<rootDir>/__mocks__/svg.js',
}
moduleDirectories: ['node_modules', '<rootDir>/']

We created a simple mock for the svgr loader and mapped to it in the jest config:
svgrMock.js
module.exports = 'IconMock'

In your package.json e.g.
"jest": {
  "moduleNameMapper": {
    "\\.svg": "<rootDir>/__mocks__/svgrMock.js"
  }
}

Your snapshots will include all properties on the icon components, so they will be tested.

We created a simple mock for the svgr loader and mapped to it in the jest config:
svgrMock.js
module.exports = 'IconMock'

In your package.json e.g.
"jest": {
  "moduleNameMapper": {
    "\\.svg": "<rootDir>/__mocks__/svgrMock.js"
  }
}

Your snapshots will include all properties on the icon components, so they will be tested.

WOW It worked for me, Thank you

We created a simple mock for the svgr loader and mapped to it in the jest config:
svgrMock.js
module.exports = 'IconMock'

In your package.json e.g.
"jest": {
  "moduleNameMapper": {
    "\\.svg": "<rootDir>/__mocks__/svgrMock.js"
  }
}

Your snapshots will include all properties on the icon components, so they will be tested.

We created a simple mock for the svgr loader and mapped to it in the jest config:
svgrMock.js
module.exports = 'IconMock'

In your package.json e.g.
"jest": {
  "moduleNameMapper": {
    "\\.svg": "<rootDir>/__mocks__/svgrMock.js"
  }
}

Your snapshots will include all properties on the icon components, so they will be tested.

WOW It worked for me, Thank you

This works for me (instead of "\\.svg$" or "^.+\\.svg")
// jest.config.js

moduleNameMapper: {
  '^.+\\.(svg)$': '<rootDir>/__mocks__/svg.js',
}
moduleDirectories: ['node_modules', '<rootDir>/']

Thank you, it works for me

 '^.+\\.(svg)$': '<rootDir>/__mocks__/svg.js'

This is awesome. Fixed for me with Next 13 + Jest 29 + svgr 6.5

If you need to support both
import logoURL from '../assets/logo.svg'
and
import { ReactComponent as Logo } from '../assets/logo.svg'
and worked for styled-components
Then your svgrMock.js should be
import React from 'react';

export default 'SvgrURL';
const SvgrMock = React.forwardRef((props, ref) => );

export const ReactComponent = SvgrMock;

This worked, however it shows a console error message:
<SvgrURL /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.
adjusting it to
import React from 'react';

const SvgrMock = React.forwardRef((props, ref) => );

export const ReactComponent = SvgrMock;
export default SvgrMock;

did the trick for me

This is working for me but svg component doesn't have any child components in it. It is just imported as

It's kind of blank svg.
Please any suggestions would be appreciated.

For me, Jest complained about "SvgrMock" not being a valid URL (TypeError: Invalid URL: SvgrMock). Changing the default export in svgrMock.tsx to:
export default SvgrMock

solved that. Now I get the following error instead...
error Command failed with signal "SIGSEGV".


feat(forge): add forge sig-collision cmd

Motivation
Easily check for colliding function selectors between two different contracts, especially useful when working with contracts that rely con delegating calls to others.

Solution
add forge sig-collision command to scan two contracts and look for matches between their functions' selectors.
example
forge sig-collision ./proxy.sol:Proxy ./implementation.sol:Token
where proxy.sol:Proxy is:
pragma solidity ^0.8.0;

contract Proxy {
    uint256 public initializer;
    mapping(address => uint256) private _balances;
    uint256 private _totalSupply;

    string public name;
    string public symbol;

    address public proxyOwner;
    address public implementation;
    int lock;

    constructor(address implementationaddr) {
        proxyOwner = msg.sender;
        _setImplementation(implementationaddr);
    }

    modifier onlyProxyOwner() {
        require(msg.sender == proxyOwner);
        _;
    }

    function upgrade(address newimplementation) external onlyProxyOwner {
        _setImplementation(newimplementation);
    }

    function _setImplementation(address imp) private {
        implementation = imp;
    }

    fallback () external {
        address impl = implementation;

        assembly {
            calldatacopy(0, 0, calldatasize())
            let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)
            returndatacopy(0, 0, returndatasize())

            switch result
            case 0 { revert(0, returndatasize()) }
            default { return(0, returndatasize()) }
        }
    }

    function compile_performance_mint(bytes16) external {
        implementation.delegatecall(abi.encodeWithSignature(
            "mint(address,uint256)", proxyOwner, 1000
        ));
    }

    function create_alternative_balance(bytes16) external {
        implementation.delegatecall(abi.encodeWithSignature(
            "balanceOf(address)", proxyOwner
        ));
    }

    function collate_propagate_storage(bytes16) external {
        implementation.delegatecall(abi.encodeWithSignature(
            "transfer(address,uint256)", proxyOwner, 1000
        ));
    }
}

and implementation.sol:Token is:
pragma solidity ^0.8.0;

contract Token {
    uint256 public initializer;
    mapping(address => uint256) private _balances;
    uint256 private _totalSupply;

    string public name;
    string public symbol;

    event Transfer(address indexed from, address indexed to, uint256 value);

    constructor() {
        name = "ABM frens token";
        symbol = "ABM";
        _totalSupply =<PHONE_NUMBER>00000;
    }

    function initialize(
        string memory _name,
        string memory _symbol,
        uint256 initialSupply,
        address _bob,
        address _mallory
    )
        public
    {
        require(initializer == 0);
        initializer += 1;
        name = _name;
        symbol = _symbol;
        _mint(msg.sender, initialSupply/3);
        _mint(_bob, initialSupply/3);
        _mint(_mallory, initialSupply/3);
    }

    function balanceOf(address account) public view virtual returns (uint256) {
        return _balances[account];
    }

    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _totalSupply += amount;
        unchecked {
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);
    }

    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);
    }

    function transfer(address to, uint256 amount) public virtual returns (bool) {
        address owner = msg.sender;
        _transfer(owner, to, amount);
        return true;
    }

    function burn(uint256 amount) public virtual {
        _burn(msg.sender, amount);
    }

    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);
    }
}

outputs >
./proxy.sol ./implementation.sol
The two contracts have the following methods whose signatures clash: [
    (
        "collate_propagate_storage(bytes16)",
        "burn(uint256)",
    ),
    (
        "initializer()",
        "initializer()",
    ),
    (
        "name()",
        "name()",
    ),
    (
        "symbol()",
        "symbol()",
    ),
]

I haven't looked closely at this PR yet, but generally supportive of it as this is useful. Some thoughts:

We're checking selector collisions, not signatures, so we might want to rename things
A popular request is a command to list all selectors in a project, so we might instead want something like forge selectors which can have subcommands such as:

forge selectors collision for what this PR does
forge selectors list <options> to list function selectors and/or error selectors and/or event sigs for certain/all files in a project
forge selectors upload would replace the existing forge upload-selectors

I didn't know of all the requests regarding selectors, should we open an issue to collect desired functionalities for subcommands of forge selectors?
I can rewrite this to correct the naming of stuff and make it a subcommand.
Glad to work on other subcommands as well!

That sgtm, thanks!


difference between inertia matrix from MuJoCo and libfranka when simulating a frankaemika panda robot arm

Hi,
I'm a student and I'm trying to use MuJoCo for simulating a frankaemika panda robot arm.
I'm looking for some help understanding the inertia matrix mjData.qM.
The value of the inertia matrix from the MuJoco simulation (mjData.qM) differs significantly from the inertia matrix provided by the libfranka API (franka::model.mass) for exactly the same joint configuration. Even after being converted to the dense matrix and reshaped to the corresponding size (7 x 7) of the inertia matrix from libfranka using the mj_fullM method.
What is the reason for this difference or is there something you have to take in account when using mjData.qM that I am missing ?

Sorry, we don't know what is happening inside libfranka. If you have specific questions about MuJoCo's inertia matrix we can answer them.


Upgrade JQuery from v1.11.3 (security)

https://github.com/pallets/werkzeug/blob/master/werkzeug/debug/shared/jquery.js#L1
Running some Security software on our libraries shows that the werkzeug package has a security vulnerability (WS-2017-0195) simply because its using an old version of jquery.js v1.11.3
Anything post v3.0.0 should satisfy the vulnerability

In v2.2.4 and previous, a lowercasing logic was used on the attribute names and was removed in v3.0.0. Because of this, boolean attributes whose names were not all lowercase cause infinite recursion, and will exceed the stack call limit.

We can upgrade it, but the debug middleware itself is a much larger security hole. Don't use it in production.

Addressed by https://github.com/pallets/werkzeug/pull/1390


x265: fix cross-compiling to armv7

Description of changes
I'm actually not entirely sure why https://github.com/nixos/nixpkgs/commit/bba26b6dfc45cb739439d7bd5269f41f2baf9e92 broke cross to armv7, but this change fixes it and I figure less bash array manipulation is better for everyone.

Things done

Built on platform(s)

[x] x86_64-linux
[ ] aarch64-linux
[ ] x86_64-darwin
[ ] aarch64-darwin

For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)

[ ] sandbox = relaxed
[ ] sandbox = true

[ ] Tested, as applicable:

NixOS test(s) (look inside nixos/tests)
and/or package tests
or, for functions and "core" functionality, tests in lib/tests or pkgs/test
made sure NixOS tests are linked to the relevant packages

[ ] Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
[x] Tested basic functionality of all binary files (usually in ./result/bin/)
24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)

[ ] (Package updates) Added a release notes entry if the change is major or breaking
[ ] (Module updates) Added a release notes entry if the change is significant
[ ] (Module addition) Added a release notes entry if adding a new NixOS module

[x] Fits CONTRIBUTING.md.

Add a :+1: reaction to pull requests you find important.

@ofborg build pkgsCross.armv7l-hf-multiplatform.x265

I agree that it helps, but it's actually very.. interesting?..
Without this patch:

With this patch:

I wrote this in the PR description but I actually don't know why this fixed the issue...as it appears like a no-op to me as well. I can look into it a little bit later today

I can't find any documentation on the cmakeStaticLibFlags attribute, and the only place it gets referenced ever is within this derivation (check with grep -R "cmakeStaticLibFlags" $(nix eval nixpkgs#path)). This derivation seems to only use that attribute if multibitdepthSupport == true, as defined by the preConfigure.
From what it looks like, it looks like the flags added in both the previous commit and this one are straight up being ignored. This is of course from my own limited understanding of the cmake build pipeline in a stdenv derivation, so take it with a grain of salt.

@Frontear Yep that was totally it, a similar diff where we append the cross-compilation cmake flags at the very beginning of preConfigure (prior to the manual cmake calls) also works. @Atemu I updated the commit to contain this information.


[SPARK-14004][SQL] NamedExpressions should have at most one qualifier

What changes were proposed in this pull request?
This is a more aggressive version of PR #11820, which not only fixes the original problem, but also does the following updates to enforce the at-most-one-qualifier constraint:

Renames NamedExpression.qualifiers to NamedExpression.qualifier
Uses Option[String] rather than Seq[String] for NamedExpression.qualifier

Quoted PR description of #11820 here:

Current implementations of AttributeReference.sql and Alias.sql joins all available qualifiers, which is logically wrong. But this implementation mistake doesn't cause any real SQL generation bugs though, since there is always at most one qualifier for any given AttributeReference or Alias.

How was this patch tested?
Existing tests should be enough.

Test build #53534 has started for PR 11822 at commit c1f08b0.

Personally, I had once been quite confused by the fact that NamedExpression.qualifiers is a Seq[String] and thought that attributes can be qualified with multiple qualifiers like db.table.column. That's why current version of AttributeReference.sql joins all qualifiers using . rather than picking the first one.
I believe it's safe and good to enforce the at-most-one-qualifier constraint at type level unless there do exist valid cases where using multiple qualifiers makes sense but haven't been implemented in Spark SQL yet.
cc @marmbrus @rxin @yhuai

Test build #53534 has finished for PR 11822 at commit c1f08b0.

This patch fails Spark unit tests.
This patch merges cleanly.
This patch adds no public classes.

Merged build finished. Test FAILed.

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/53534/
Test FAILed.

Test build #53540 has started for PR 11822 at commit 59241ec.

Test build #53540 has finished for PR 11822 at commit 59241ec.

This patch passes all tests.
This patch merges cleanly.
This patch adds no public classes.

Merged build finished. Test PASSed.

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/53540/
Test PASSed.

Test build #53601 has started for PR 11822 at commit cbef382.

Test build #53601 has finished for PR 11822 at commit cbef382.

This patch passes all tests.
This patch merges cleanly.
This patch adds no public classes.

Merged build finished. Test PASSed.

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/53601/
Test PASSed.

Overall LGTM, I think it's more clear to have qualifier as a Option instead of Seq.

Test build #53681 has started for PR 11822 at commit 9d7b1db.

LGTM pending tests.  The original signature is from very early on when I thought you could refer to a table both by name and alias.

Test build #53681 has finished for PR 11822 at commit 9d7b1db.

This patch passes all tests.
This patch merges cleanly.
This patch adds no public classes.

Merged build finished. Test PASSed.

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/53681/
Test PASSed.

Thanks! Merging to master.


Move response error to azure-core

After discussing with @JonathanGiles, renamed HttpResponseError to ResponseError and is now moved from experimental to azure-core package. Also, deleted TimeInterval from azure-core-experimental as the arch board feedback was to move this type to azure-monitor-query package.

Is there anything outside of core experimental using this type?

Is there anything outside of core experimental using this type?

Yes, azure-monitor-query is using it. I will update it in a separate PR to take an unreleased dependency on azure-core.