Experimental: Unified Data Model

This is a shot at unifying the data model thru the flow.
Please see UnifiedDataModel.md

Minutes from @arvuce22 , @parijatm, @soneryaldiz :
How could a PDK abstraction be organized? Here is one way:
# This is defined in ALIGN-Public
class BaseMOS(ABC):
    @abstractmethod
    def generate(circuit: Subcircuit, constraints: list, max_variants: int)
               -> (abstract_name: str, concrete_to_canvas: dict[str, Canvas])
         pass

# Below are defined in PDK module
class CanvasPDK(Canvas):
    def __init__(flavor=1)
        # defines generators regions, vias, wires, different templates based on flavor
        pass

class MOS(BaseMOS):
    def __init__(self):
        pass
    def generate(subcircuit, constraints, max_variants):
        grid_v1 <= constraints['use_wide_grid']
        abstract_name = "guid"
        concrete_to_canvas = dict()
        for flavor in flavors:
            concrete_to_canvas["concrete_name"] = CanvasPDK(grid_v1)
            call_internal_generator(...)
        return (abstract_name, concrete_to_canvas)

class RES(BaseRES):
    pass

Could MOS array generation be generalized and ported to ALIGN-Public? Array generation is not realizable across process technologies easily due to layout dependent effects, design rules that are not captured in the current PDK abstraction, device type (planar, finfet, soi, gaa, ...). Yet there could be utility functions that can be provided by ALIGN-Public such as the one below:
def interleave_pattern(l: list, style: str) -> list of lists
    pass

How about passive arrays?
How passives appear in a netlist depends on the methodology. Examples:
netlist 1:
    R1 <ports> r=10
    R2 <ports> r=20
netlist 2:
    .model tfr w=10
    x1     <ports> tfr w=10
    x2[0] <ports> tfr w=10
    x2[1] <ports> tfr w=10

If compiler detects that x1 and x2 need to be interleaved or arrayed (R-R, C-2C arrays) for matching, how should the layout of this array be generated?

ALIGN-Public offers a procedural place and route capability for such arrays
pro: fast
con: i) not trivial to do in track-limited nodes, ii) has to anticipate PlaceOnGrid constraints and non-uniform grids
ALIGN-Public auto-generates constraints and handoff problem to automated PnR.
Example of binary array:
GroupBlocks x1, x2[0], x2[1]
AlignInOrder x2[0], x1, x2[1]     // if interleaving needed
Example of thermo array (R-ladder):
GroupBlocks x1, x2, x3, x4, x5

Per feedback from @stevenmburns  and @parijatm , revised the UnifiedDataModel.md

@kkunal1408 , could you please review this proposal?

Looks good to me.
Some comments from my side:

Constraints are associated with the subcircuit definition.
What are the style options for interleaving?


Migrate delete trigger modal to be pure

Summary
Migrate delete trigger modal to be pure.
Ticket Link
mattermost-server/issues/7675
Checklist

[x] Added or updated unit tests (required for all new features)

Thanks @tkbky!
We'll merge this later after 4.4 RC1 cut.


NOT_BRACKETING_INTERVAL in event detection for rare reset cases

In ODE, when an event generates a RESET_STATE, the step is truncated, state is reset, and the next step will start from the event date. In some cases, either due to the reset itself or to numerical noise as the step interpolator changes, the value g(t_event) may change sign. This case has been considered in EventState.findRoot, with the following code:
    final double newGa = f.value(ta);
    if (ga > 0 != newGa > 0) {
        // both non-zero, step sign change at ta, possibly due to reset state
        beforeRootT = ta;
        beforeRootG = newGa;
        afterRootT = minTime(shiftedBy(beforeRootT, convergence), tb);
        afterRootG = f.value(afterRootT);
    }

However, in the next lines, these variables are not used when starting the search loop, the initial values ta and ga are used:
  // loop to skip through "fake" roots, i.e. where g(t) = g'(t) = 0.0
  // executed once if we didn't hit a special case above
  double loopT = ta;
  double loopG = ga;
  while ((afterRootG == 0.0 || afterRootG > 0.0 == g0Positive) &&
         strictlyAfter(afterRootT, tb)) {
      ....
  }

When the reset has changed the sign of ga, and there is also a second zero in the first half of the check interval (i.e. between ta and (ta+tb)/2), then f(ta), f((ta+tb)/2) and f(tb) all have the same sign. This triggers a NOT_BRACKETING_INTERVAL exception when solver.solveInterval() is called.
The following test case reproduces the error:
    @Test
    public void testResetChangesSign() {
        OrdinaryDifferentialEquation equation = new OrdinaryDifferentialEquation() {
            public int getDimension() { return 1; }
            public double[] computeDerivatives(double t, double[] y) { return new double[] { 1.0 }; }
        };

        LutherIntegrator integrator = new LutherIntegrator(20.0);
        final double small = 1.0e-10;
        ResetChangesSignGenerator eventsGenerator = new ResetChangesSignGenerator(6.0, 9.0, -0.5 * small);
        integrator.addEventHandler(eventsGenerator, 8.0, small, 1000);
        final ODEStateAndDerivative end = integrator.integrate(equation, new ODEState(0.0, new double[1]), 100.0);
        Assert.assertEquals(2,                 eventsGenerator.getCount());
        Assert.assertEquals(9.0,               end.getCompleteState()[0], 1.0e-12);
        Assert.assertEquals(9.0 + 0.5 * small, end.getTime(),             1.0e-12);
    }

    private class ResetChangesSignGenerator implements ODEEventHandler {

        final double y1;
        final double y2;
        final double change;
        int count;

        public ResetChangesSignGenerator(final double y1, final double y2, final double change) {
            this.y1     = y1;
            this.y2     = y2;
            this.change = change;
            this.count  = 0;
        }

        public double g(ODEStateAndDerivative s) {
            return (s.getCompleteState()[0] - y1) * (s.getCompleteState()[0] - y2);
        }

        public Action eventOccurred(ODEStateAndDerivative s, boolean increasing) {
            return ++count < 2 ? Action.RESET_STATE : Action.STOP;
        }

        public ODEState resetState(ODEStateAndDerivative s) {
            return new ODEState(s.getTime(), new double[] { s.getCompleteState()[0] + change });
        }

        public int getCount() {
            return count;
        }

    }

Changing the initialization of loopT (resp. loopTG) to afterRootT (resp. afterRootT) solves this specific case, but it breaks OverlappingEventsTest.
The same issue exists in Orekit (but I have no test case for it).

Nice find!
If I remember my own work correctly I think it was supposed to not execute the loop in this case. But perhaps if f(ta + convergence) is zero or there is a second root in that short interval it wouldn't work. Needs some more thought...

I tried to solve it but did not succeed yet.
I guess that the culprit is in the snippet
if (ga > 0 != newGa > 0) {
        // both non-zero, step sign change at ta, possibly due to reset state
        beforeRootT = ta;
        beforeRootG = newGa;
        afterRootT = minTime(shiftedBy(beforeRootT, convergence), tb);
        afterRootG = f.value(afterRootT);
    }

We should probably compare the sign of newGa and the boolean g0positive to see if we have a new
root that appeared due to reset and it should be reported as a new event occurring (I guess this is what this snippet does), or if it is the same root we already handled and that moved (this is what happens in the bug), and in this case I think it should be ignored, looping with shifttedBy(t, convergence) until we are past the already handled root, and we can search for the next root that occurs in the step (otherwise findRooot would not have been called) once we are sure we won't trigger a non-bracketing exception.
I am however not sure about this analysis, and will not be able to look at it before some time.
@wardev , could you have a look at it?

Finally found some free cycles to solve this.

Nice fix, glad you figured it out. I added some tests for reverse integration as well.


404 - Page not found - New VM - Availability Options

Link to article:
https://docs.microsoft.com/en-us/azure/virtual-machines/windows/regions-and-availability
Problem:
404 - Page not found

@bgalanis Transferred to that repo: https://github.com/MicrosoftDocs/azure-docs/issues/35706


chore: cleanups and serde feature

Add serde support but hide it behind feature serde
Cleanup in API. len and capacity are mapped to vec.len() and vec.capacity().
Other minor cleanups.
Moved all tests to /tests
Moved example to examples/. Removed duplicate examples.
Limit many functions visibility to private. more to come in next PR.

cc: @purnatag

@sn99 I am merging it since i need it a bit urgently.


Sequence Ctrl+K Ctrl+0 fails to execute

Despite that the docs say

Fold All (Ctrl+K Ctrl+0) folds all regions in the editor.

this sequence has no effect on the folds, and leave the status bar saying:

EDIT: On V1.41.1 https://i.imgur.com/buSySUk.png Windows 7 64-bit.

You probably didn't press Ctrl+0

/needsMoreInfo
Is it reproducible with all extensions disabled?
You can try this with F1 and >Developer: Reload Window With Extensions Disabled
Do you have any keymap extension or custom keybindings configured for these combinations?
What are your VSCode version and OS?

/needsMoreInfo
Is it reproducible with all extensions disabled?

Relevance? I'm reporting on the standard distribution.
Do you see the same on the standard distribution?

Do you have any keymap extension or custom keybindings configured for these combinations?

I have whatever the standard distribution provides and no more.

What are your VSCode version and OS?

V1.41.1, Windows 7 64-bit.

Relevance? I'm reporting on the standard distribution.

Because you omitted a lot of fields form issue template and your report had no information to help triage issue, until you added it.
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- Please search existing issues to avoid creating duplicates. -->
<!-- Also please test using the latest insiders build to make sure your issue has not already been fixed: https://code.visualstudio.com/insiders/ -->

<!-- Use Help > Report Issue to prefill these. -->
- VSCode Version:
- OS Version:

Steps to Reproduce:

1.
2.

<!-- Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes/No

Without this info it is impossible to tell what is your setup, if it's really an issue with VS Code etc.
Reasoning is simple - there is a ton of reports that use outdated version of VS Code, have extension that are root cause of problem or have keybindings installed/configured and wonder why default doesn't work.

Do you see the same on the standard distribution?

I see no issues with Stable and Insiders builds (https://code.visualstudio.com/insiders/), however I'm on Windows 10.
So after you provided at least some info it might be OS specific if you have no extensions and no changes to keybinding.
You also can check Insiders build (link above) to see if Electron update helps.

So after you provided at least some info it might be OS specific

Anyone here got it to work on Windows 7?

if you have no extensions

I do have extensions - those included as standard.

and no changes to keybinding.

None I know of.

@chrisjj I cannot reproduce. In a vanilla VS Code installation, Ctrl+K Ctrl+0 works fine:

@alexdima, Thanks but needsMoreInfo :) Which OS?

@chrisjj I am trying to reproduce your issue on Windows. Our default keybindings are the same both on Windows 7 or Windows 10. Have you tried commenting out your keybindings.json? Have you tried disabling all of your extensions? Are you pressing Ctrl+K Ctrl+0 or Ctrl+K 0 (the Ctrl must be pressed for the second part of the chord too).

@chrisjj I am trying to reproduce your issue on Windows. Our default keybindings are the same both on Windows 7 or Windows 10.

Have you got it to work on Windows 7?

Have you tried commenting out your keybindings.json?

No.

Have you tried disabling all of your extensions?

"Your extensions"? I haven't added any. The only extensions are those included as standard, to my knowledge.

Are you pressing Ctrl+K Ctrl+0 or Ctrl+K 0 (the Ctrl must be pressed for the second part of the chord too).

As I said, Ctrl+K Ctrl+0. Thanks for checking though.

@chrisjj
What does VS Code detect when you press the desired key combination? Please hover over the input box and take a screenshot:

Perhaps the keybinding Ctrl+0 does not reach VS Code due to other software on your machine?

It is possible. But the press has no visible effect on any other program.

What does VS Code detect when you press the desired key combination?

When I press Ctrl+0? As I said, it leaves the status bar saying "Waiting for second key of chord".

Please hover over the input box and take a screenshot:

Does this suffice?  https://i.imgur.com/mucHrhT.png
Have you got this to work on Windows 7?

@chrisjj Can you please try to check if VS Code receives the keybinding? This is possible to check by opening your keybindings.json file and clicking the blue button and pressing the key combination like I do in the following GIF:

@chrisjj Can you please try to check if VS Code receives the keybinding? This is possible to check by opening your keybindings.json file and clicking the blue button and pressing the key combination like I do in the following GIF:

On pressing Ctrl+0 I get this:

@chrisjj This indicates that VS Code does not receive Ctrl+0 on your system. This is most likely caused by 3rd party software that "eats up" keybindings. Can you confirm that Ctrl+0 works for you in any other application on the same machine?

@chrisjj This indicates that VS Code does not receive Ctrl+0 on your system. This is most likely caused by 3rd party software that "eats up" keybindings.

Could be.

Can you confirm that Ctrl+0 works for you in any other application on the same machine?

No. But I have none that says it uses it.
Can you suggest a tester program?


[AIML-ADC-8348] Provide more user friendly error messages for quota issues or name conflicts

Issue #, if available: AIML-ADC-8348
Description of changes:

Provide more user friendly error messages for quota issues or name conflicts (all in a central location)
Updates to reducer to capture errors
Fix error response notification
Fix model notification that incorrectly referenced "endpoint"

Tested name conflicts with training, labeling, endpoint, endpoint config, models, notebooks.
Tested quotas by creating two ml.m5.12xlarge notebooks. Account limit is 1. (yes, I turned them off afterwards)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

I have a bug where start/create notebooks errors are handled differently. Need to find where the differences are and make them the same


getMaxVoltage() does not handle ADS1113

Perhaps related to this issue.
ADS1113 has no gain control and the maximum voltage is fixed to ±2.048 V.
Usually, to convert the ADC readings to a voltage you would write:
float voltage = _ads1113.toVoltage(_ads1113.readADC(0));

but toVoltage() calls getMaxVoltage() and this does not handle the ADC1113:
float ADS1X15::getMaxVoltage()
{
  switch (_gain)
  {
    case ADS1X15_PGA_6_144V: return 6.144;
    case ADS1X15_PGA_4_096V: return 4.096;
    case ADS1X15_PGA_2_048V: return 2.048;
    case ADS1X15_PGA_1_024V: return 1.024;
    case ADS1X15_PGA_0_512V: return 0.512;
    case ADS1X15_PGA_0_256V: return 0.256;
  }
  _err = ADS1X15_INVALID_VOLTAGE;
  return _err;
}

because in the inizialization:
ADS1113::ADS1113(uint8_t address, TwoWire *wire)
{
  _address = address;
  _wire = wire;
  _config = ADS_CONF_NOCOMP | ADS_CONF_NOGAIN | ADS_CONF_RES_16 | ADS_CONF_CHAN_1;
  _conversionDelay = ADS1115_CONVERSION_DELAY;
  _bitShift = 0;
  _maxPorts = 1;
}

the ADS_CONF_NOGAIN would prevent any handling of the gain, falling back to a wrong one (ADS1X15_PGA_6_144V):
void ADS1X15::setGain(uint8_t gain)
{
  if (!(_config & ADS_CONF_GAIN)) gain = 0;
  switch (gain)
  {
    default:  //  catch invalid values and go for the safest gain.
    case 0:  _gain = ADS1X15_PGA_6_144V;  break;
    case 1:  _gain = ADS1X15_PGA_4_096V;  break;
    case 2:  _gain = ADS1X15_PGA_2_048V;  break;
    case 4:  _gain = ADS1X15_PGA_1_024V;  break;
    case 8:  _gain = ADS1X15_PGA_0_512V;  break;
    case 16: _gain = ADS1X15_PGA_0_256V;  break;
  }
}

uint8_t ADS1X15::getGain()
{
  if (!(_config & ADS_CONF_GAIN)) return 0;
  switch (_gain)
  {
    case ADS1X15_PGA_6_144V: return 0;
    case ADS1X15_PGA_4_096V: return 1;
    case ADS1X15_PGA_2_048V: return 2;
    case ADS1X15_PGA_1_024V: return 4;
    case ADS1X15_PGA_0_512V: return 8;
    case ADS1X15_PGA_0_256V: return 16;
  }
  _err = ADS1X15_INVALID_GAIN;
  return _err;
}

To ensure compatibility of the library across all the supported devices, I think it should handle the ADS1113 properly and getMaxVoltage() should return 2.048, perhaps forcing the "gain" to ADS1X15_PGA_2_048V.

Thanks for the issue,
Need to dive into the details / data sheet, had a quick look and I think I understand the problem (bug).
Coming days I will be rather busy so I try to free time for this coming week.

Note

ADS1013 idem
need tracking type ?

@Mark-81
Gave it some thought and read some datasheet pages and came to the following fix which is minimalistic.
The user cannot set the _gain anymore and the maxVoltage() will now return 2.048 as it should.
//  ADS1x13 has no gain so set default.
//  Table 8. Config Register Field Descriptions
void ADS1113::setGain(uint8_t gain)
{
  _gain = ADS1X15_PGA_2_048V;  //  fixed
}

Will push the develop branch in a few minutes.

@Mark-81
Added some more code to make it robust. Added an example to test it.
pushed the develop branch

should add a unit test for this.

@Mark-81
Develop branch looks stable now, can you test if it works now for the ADS1113?
Thanks,

@RobTillaart yeah, it seems to work fine now! Thanks for your quick fix!


IPTT: Vertical space appearing/disappearing when I expando/collapso.

To reproduce the issue, play with the Expand all / Collapse all function. Note the difference in spacing between rows when expanded vs. collapsed. Screenshots below.
I think we should remove the spacing between indicator rows when expanded -- looks a bit awkward and comes across as uninentional. But I would actually like to keep the spacing between disaggregation types -- it's actually quite effective for separating parallel disaggregations. (If that's high LOE to remove space in one place but not the other, then my preference would be to remove all spacing.)

Collapsed

Expanded

This was addressed incidentally with #2141. The extra rows have been replaced with extra-wide borders:

@axoplasm Noticing some line thickness variation in the leftmost column:

Fixed in PR #2183

Looks good! The thicker border now extends to the edge.


Upgrade to Camel 3.19.0

@tadayosi wonder if you could have time to upgrade to latest camel release, thanks


🚀 [Misc] - Project setup

Use Case
This issue is to add some structure and order to the project as well as some POCs.
Problem
N/A
Solution
N/A
Alternatives considered
N/A
Additional context
No response
Code of Conduct

[X] I agree to follow this project's Code of Conduct and Contributing Guidelines

Re open to fix swiftlint errors


Add Sourcify support for proxies and beacons

It'd be great for the plugin to be able to verify in Sourcify the proxies/beacons it deploys.

We use hardhat-verify. Does it support Sourcify? If not, that's probably a better place to start.

We use hardhat-verify. Does it support Sourcify? If not, that's probably a better place to start.

Yes, hardhat-verify supports Sourcify, I was able to verify the implementation contract with it.


Add option to verify run results against some 'gold' results (e.g. generated by unmodified Numpy)

Completed in Q3 2021


add the catalog endpoint

make the service configurable through the service file
parse configuration into brokerapi.Service
refactor Config and service api endpoints

finishes #5

We think it would make more sense to have the info describing the services be in separate files, similar to how the old ruby broker worked. It would make it much easier to maintain that functionality, both when using the broker stand alone and with the bosh-release. Maybe have the config contain the location of a directory to load service jsons from.

What do we need flags for? You could just make a field in the config that is the location of a dir to load the service files from.

oh I was thinking ./broker -config [path] -service [path]
relative / absolute path in the config file is kinda ugly.

How would the -service flag work with multiple services? I like the idea of a directory or just providing a list of files. Unless the flag was to signal the array of filenames.

generally you can use flags to path a slice through. like the following:
./broker -config [path] -service [path1] -service [path2]
e.g., similar to how ops files are passed through to a bosh cli.
If a directory, it should be internal and we should just read everything in it, rather than making it part of the config but that is implicit logic which is hard to reason about. In case of the broker bosh release, those yml files get passed into the deployment as bosh opsfiles .

closed in favor of #23


ouput file

Environment
"unbuild": "^2.0.0"
node: 16.20.0
Reproduction
non
Describe the bug
没有根据 package.json 的字段生成相应文件，后缀应该是 .js & .cjs

Additional context
No response
Logs
No response

package.json 有配置 "type": "module"

build.config.js
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
  entries: ['src/index'],
  clean: true,
  declaration: true,
  rollup: {
    emitCJS: true
  }
})

main 和 module 字段写反了，请忽略...修正后表现一样

Hi. sorry the question is unclear please reopen with reproduction


Load From Checkpoint

Is it not possible to load from a checkpoint?
When using the same --id parameter the train.py script will restart at Epoch 0, but it would be very helpful if the training could restart where it left off.
Alternatively, is there a PyTorch pretrained model for the ADE20K dataset to get started with?

@adamhrv This is in my plan. I will release the model weights soon.

I would also appreciate a pretrained model :)


Pack native libs in .net core fashion

Warning: This PR won't pass CI before merge, unless adding a temporary workaround commit. You can do all the checks at local to validate it does work.
I've done the validations on Windows. Since there's no runtime gap unlike Mono comparing with .Net Framework, I except mac and Linux to simply success.
Motivation
.NET Core introduces a better way to configure native dependencies via package. Now legacy technologies get dropped and .NET Core is the only supported runtime for desktop, it's time to reform from various workarounds and get served by toolset conventions. The Xamarin builds ships totally different assets and won't be affected by this.
Changes
The native libraries located in runtimes/<rid>/native/ are well-handled by the dotnet sdk. No more need to manually setting path/naming conventions for them.
Calls to SetDllDirectory for Windows will be removed from framework.
Linux users no longer require to set the environment variable LD_LIBRARY_PATH.
dotnet publish will handle them properly. Deploy script should be updated to depend on it; old implications about file layout may break.
It will remove other OS's assets when packaging for specific OS. I can see .dll and .so in macOS package now.
Framework package changes to targeting both .NET Core and .NET Standard, and reference native libs package only for .NET Core target.
This can prevent miss-installing for the native package, as it's only designed for .NET Core.
Cross-framework targeting will be required further for framework, because .NET Core will be the only framework that's null-annotated in 1 year.
Size of framework NuGet package will be duped, because it contains assemblies for both framework. It's no harmful as the package is small enough today (~2.5M), and will only affect development machine.
Validating
Why requiring manual validation
Though most parts of dotnet toolset handle it well, ProjectReference doesn't know about native dependencies. It will copy the files to the correct layout, but missing project.assets.json and .deps.json entries for them. This will result in DllNotFoundException at runtime, because CLR won't just load anything inside runtimes\<rid>\native folder. It only load known dependencies.
I have spent a whole day investigating if I can inject something into .deps.json. The task creating it accepts some dependency lists, but they won't be used. It follows exactly project.assets.json, which is generated by one concrete task. Copying them directly aside executable will have other problems too.
Since native libs seldom get updated, and ships in different pace comparing to framework, I think the best solution is to only consume it via package reference.
If the package following new convention hasn't be published to NuGet gallery, it can't be consumed by CI since we don't have nightly feeds like .NET official. Thankfully, NuGet provides capability to test package consuming at local machine.
Steps to validate
Based on the latest commit.

Create a package with higher version than stable.

cd osu.Framework.NativeLibs
dotnet pack -p:version=9999.9.9

Put the package into local feed
Assuming directory ~\.nuget\hook\

dotnet nuget push .\bin\Debug\ppy.osu.Framework.NativeLibs.9999.9.9.nupkg -s ~\.nuget\hook\

or
nuget.exe push .\bin\Debug\ppy.osu.Framework.NativeLibs.9999.9.9.nupkg -Source ~\.nuget\hook\

Update the package reference in framework project to using the higher version, and restore it with local feed
You can it directly in Visual Studio's NuGet setting, or restore using

 dotnet restore -s ~\.nuget\hook\

It's recommended to close your IDE and clean all the bin and obj folder before restore to ensure they're clean.

Build SampleGame.Desktop and desktop tests.
Check SampleGame.Desktop.deps.json. Search for bass.dll, libbass.so and libbass.dylib, you should find entries for them.
If there are native assets out of runtime folder, that's directly put outside or in x86/x64/x86-64 folder, remove them to avoid misleading.

Run the sample game and visual tests. You shouldn't suffer DllNotFoundException.

Switch to the game repo. Install the latest package using

cd osu.Desktop
dotnet add package -v 9999.9.9 -s ~\.nuget\hook\ ppy.osu.Framework.NativeLibs

Verify desktop game also works. The new package is compatible with old framework, because workarounds are simply no-op when CLR can locate them.

Verify dotnet publish -r also works.
Be aware that if runtime identifier are specified, native assets will be put out directly, not in runtimes folder.

Don't forget to clean your NuGet global cache at ~\.nuget\packages\ppy.osu.Framework.NativeLibs\9999.9.9.

Interesting! How come this doesn't build both netstandard and netcoreapp when building the desktop project? Was that a recent change? iirc I originally multi-targetted with the move to netstandard, but it used to compile all targets back then.

How come this doesn't build both netstandard and netcoreapp when building the desktop project?

Seems that transitive Build task will only build the dependent one; dotnet build or Pack will build them both.

Was that a recent change?

I introduced in this PR, because this package layout is only designed for netcoreapp.
If targeting other framework, the user will need to handle native assets manually. They can still use <PackageTargetFallback>, but should not get the package automatically.

I originally multi-targetted with the move to netstandard, but it used to compile all targets back then.

Multi-targeting will be required soon when we enable nullable reference types. Looking forward, I think it's OK to do this earlier.

So... Why won't this pass CI before merge? The issues that appveyor lists are actual issues as far as I'm seeing - code was altered and usings aren't required. Not sure what the TypeExtensions error is all about though.

Tests cannot run because workarounds of old package layout are removed. I sayed that when I was trying to make ProjectReference work.
After the investigation I did, the workarounds can still exist because they are no harmful to the new package layout. Once new layout are published, they can be safely removed then.

The inspection on TypeExtensions should be a bug of 2019.2.1. Once I updated to 2019.2.3 it disappears.

Force pushed to remove the commit that removes old workaround.
Now it should pass CI, but CI cannot inform what will happen. Because no ProjectReference, every later update to native libraries should be tested manually, using the instructions I described.

Personally I think this is fine, both the duping of the osu.Framework assembly and the manual validation of native libs.
Thoughts @peppy ?


Using FluentResults inside a MediatR validation pipeline

Hi there,
First off, this is a great library and I'm a big fan of it!
I initially followed this article but instead of reinventing the wheel I started using FluentResults in my Fluent Validation pipeline. Basically all responses coming from my CQRS Queries are wrapped in the Result object, this avoids having to work with exceptions as a method of error handeling.
However, I can't get my pipeline to play nice:
    public class ValidationPipeline<TRequest, TResponse>
        : IPipelineBehavior<TRequest, TResponse>
        where TResponse : class
        where TRequest : IRequest<TResponse>
    {
        private readonly IValidator<TRequest> _compositeValidator;

        public ValidationPipeline(IValidator<TRequest> compositeValidator)
        {
            _compositeValidator = compositeValidator;
        }

        public async Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate<TResponse> next)
        {
            var result = await _compositeValidator.ValidateAsync(request, cancellationToken);

            if (!result.IsValid)
            {
                Error error = new Error();
                var responseType = typeof(TResponse);

                foreach (var validationFailure in result.Errors)
                {
                    Log.Warning($"{responseType} - {validationFailure.ErrorMessage}");
                    error.Reasons.Add(new Error(validationFailure.ErrorMessage));
                }
                // This always returns null instead of a Result with errors in it.
                var f = Result.Fail(error) as TResponse;
                return f;

                // This causes an exception saying it cannot find the constructor.
                var invalidResponse =
                        Activator.CreateInstance(invalidResponseType, null) as TResponse;

            }

            return await next();
        }
    }

I also have to somehow convert the Result object back to TResponse, where TResponse is always a Result
Any suggestions are greatly appreciated!
Edit: Could the Result constructor be made public instead of internal?

Hi,
thanks for the feedback! I also used Mediatr in a couple of projects - some with and some without the result pattern.
I would prefer the following way:
 public class ValidationPipeline<TRequest, Result<TResponse>>
        : IPipelineBehavior<TRequest, TResponse>
        where TResponse : class
        where TRequest : IRequest<Result<TResponse>>
    {
        private readonly IValidator<TRequest> _compositeValidator;

        public ValidationPipeline(IValidator<TRequest> compositeValidator)
        {
            _compositeValidator = compositeValidator;
        }

        public async Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate<TResponse> next)
        {
            var result = await _compositeValidator.ValidateAsync(request, cancellationToken);

            if (!result.IsValid)
            {
                Error error = new Error();
                var responseType = typeof(TResponse);

                foreach (var validationFailure in result.Errors)
                {
                    Log.Warning($"{responseType} - {validationFailure.ErrorMessage}");
                    error.Reasons.Add(new Error(validationFailure.ErrorMessage));
                }

                return Result.Fail<TResponse>(error);
            }

            return await next();
        }
    }

I'am not sure if its 100% buildable - but I think you will get the point. In this solution it is explicit that you use the Result object, its typesafe and you don't need Reflection magic. What do you think? Is it helpful?

This is how I am using FluentResults with FluentValidation and Mediatr on my current project:
public class RequestValidationBehaviour<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
    where TRequest : CommandBase
    where TResponse : Result
{
    private readonly ValidationService _validationService;
    private readonly ILogger<TRequest> _logger;

    public RequestValidationBehaviour(IEnumerable<IValidator<TRequest>> validators, ILogger<TRequest> logger)
    {
        _validationService = new ValidationService(validators);
        _logger = logger;
    }

    public async Task<TResponse> Handle(TRequest command, CancellationToken cancellationToken, RequestHandlerDelegate<TResponse> next)
    {
        var validationResult = _validationService.ValidateCommand(command);

        if (validationResult.IsFailed)
        {
            return validationResult as TResponse;
        }

        var handlerResult = await next();

        var result = _validationService.EvaluateResults(command.IgnoreWarnings, validationResult, handlerResult);

        return result as TResponse;
    }
}

public class ValidationService
{
    public IEnumerable<IValidator> FluentValidators { get; }

    public ValidationService(IEnumerable<IValidator> fluentValidators)
    {
        FluentValidators = fluentValidators;
    }

    public Result ValidateCommand<TCommand>(TCommand command) where TCommand : CommandBase
    {
        var result = Result.Ok();

        if (!FluentValidators.Any())
        {
            return result;
        }

        var context = new ValidationContext<TCommand>(command);

        var failures = FluentValidators
            .Select(v => v.Validate(context))
            .SelectMany(validationResult => validationResult.Errors)
            .Where(f => f != null)
            .ToList();

        if (failures.Count == 0)
        {
            return result;
        }

        Log.Warning("One or more validation failures have occurred.: {Name} {@ValidationErrors} {@Request}",
            command.GetType().Name, failures, command);

        if (failures.Any(x => x.Severity == Severity.Error))
        {
            return Result.Fail("Validation failures")
                .WithValidationResults(failures);
        }

        if (failures.Any(x => x.Severity == Severity.Warning))
        {
            if (command.IgnoreWarnings)
            {
                return Result.Ok()
                    .WithValidationResults(failures);
            }
            else
            {
                return Result.Fail("Validation failures")
                    .WithValidationResults(failures);
            }
        }

        return result;
    }

    public Result EvaluateResults(bool ignoreWarnings, params Result[] results)
    {
        var result = Result.Merge(results);

        if (result.HasErrors())
        {
            return result;
        }

        if (result.HasWarnings() && ignoreWarnings == false)
        {
            return result.WithReason(new TreatWarningsAsErrors());
        }

        return result;
    }
}

Before the handler runs, I validate the command. After the handler completes, I process any Results that came back from the domain.
I have extended Results to include Warnings. As I'm only validating commands, I am not returning any data and so don't use the Result response. That being said, I do return the new ID in the Create command, but I do that with a Success Reason:
public class RecordsCreatedSuccess : Success
{
    public List<int> NewIds { get; }

    public RecordsCreatedSuccess(int id)
        : base("Record created")
    {
        NewIds = new List<int> {id};
    }

    public RecordsCreatedSuccess(List<int> newIds)
        : base("Records created")
    {
        NewIds = newIds;
    }
}

@mwhelan nice approach to validation. Is it possible to see the full source code? Specifically thinking about the extensions you've made to Results and such.

Sure, you can see the full thing in a sample I use for one of my open source projects. It's a bit experimental, so I welcome any feedback on how it might be improved.
If you want to understand the end-to-end, have a look at the ToDoController. You can also see how I map fluent results that come back from Mediatr handlers to ASP.Net Core action results using extension methods.

@mwhelan Thanks for the reply and sample code. Your project was quite advanced for my level of C#, but I got a good idea of how to use the Result type, so thanks for that.

Thank you very much @altmann and @mwhelan!
@altmann, I tried your solution but I couldn't get it to work but after some trial and error I found the reason it didn't work which I have corrected in my version below. I'm also very happy I didn't have to resort to the reflection nonsense and the end-result is very clean. :)
@mwhelan, I would not have figured out the above solution without your great example!
Incidentally, it was both the code samples you provided that allowed me fix it. There were 2 errors in the @altmann sample which I have fixed below:
ValidationPipeline.cs
// "ValidationPipeline<TRequest, Result<TResponse>" should be "ValidationPipeline<TRequest, TResponse>"
// This was causing a build error: Type parameter 'Result' hides class 'Result'
public class ValidationPipeline<TRequest, TResponse>
    : IPipelineBehavior<TRequest, TResponse>
    where TResponse : Result
    where TRequest : IRequest<Result>
{
    private readonly IValidator<TRequest> _compositeValidator;

    public ValidationPipeline(IValidator<TRequest> compositeValidator)
    {
        _compositeValidator = compositeValidator;
    }

    public async Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate<TResponse> next)
    {

        var result = await _compositeValidator.ValidateAsync(request, cancellationToken);

        if (!result.IsValid)
        {
            Error error = new Error();
            var responseType = typeof(TResponse);

            foreach (var validationFailure in result.Errors)
            {
                Log.Warning($"{responseType} - {validationFailure.ErrorMessage}");
                error.Reasons.Add(new Error(validationFailure.ErrorMessage));
            }
            // "Result.Fail<TResponse>(error);" should be "Result.Fail(error) as TResponse;"
            // This caused a build error as it could not implicitly cast this to TResponse,
            // I tried to solve this by adding "as TResponse" but this in turn caused the return value to always be null;
            // The solution was to remove the "<TResponse>" and then it worked!
            return Result.Fail(error) as TResponse;
        }

        return await next();
    }
}

CreatePlexAccountCommand.cs
public class CreatePlexAccountCommand : IRequest<Result<PlexAccount>>
{
    public PlexAccount PlexAccount { get; }

    public CreatePlexAccountCommand(PlexAccount plexAccount)
    {
        PlexAccount = plexAccount;
    }
}

public class CreatePlexAccountCommandValidator : AbstractValidator<CreatePlexAccountCommand>
{
    public CreatePlexAccountCommandValidator()
    {
        RuleFor(x => x.PlexAccount.Id).Equal(0).WithMessage("The Id should be 0 when creating a new PlexAccount");
        RuleFor(x => x.PlexAccount.Username).NotEmpty().MinimumLength(5);
        RuleFor(x => x.PlexAccount.Password).NotEmpty().MinimumLength(5);
        RuleFor(x => x.PlexAccount.DisplayName).NotEmpty();
    }
}

public class CreateAccountHandler : BaseHandler, IRequestHandler<CreatePlexAccountCommand, Result<PlexAccount>>
{
    private readonly IPlexRipperDbContext _dbContext;

    public CreateAccountHandler(IPlexRipperDbContext dbContext)
    {
        _dbContext = dbContext;
    }

    public async Task<Result<PlexAccount>> Handle(CreatePlexAccountCommand command, CancellationToken cancellationToken)
    {
        Log.Debug("Creating a new Account in DB");

        await _dbContext.PlexAccounts.AddAsync(command.PlexAccount);
        await _dbContext.SaveChangesAsync(cancellationToken);
        await _dbContext.Entry(command.PlexAccount).GetDatabaseValuesAsync();

        return ReturnResult(command.PlexAccount, command.PlexAccount.Id);
    }
}

I tested my Queries and Commands and everything seems to be working!
Thanks again for the help!

thanks @JasonLandbridge , I'm glad it helped.

@JasonLandbridge @mwhelan Thanks for all the responses. I think this is a very interesting and great sample of using FluentResult in combination with MediatR. I spend today some time to create a solution for some common usecases with MediatR.

Command with Result (Returntype: Task<Result>)
Command without Result (Returntype: Task)
Query with Result (Returntype: Task<Result<QueryResponse>>)
Query without Result (Returntype: Task<QueryResponse>)

I tried @JasonLandbridge solution but it don't work in usecase Query with Result in which the ValidationPipeline is not executed at all. In usecase Command with Result your solution works. Is is really working? What did you do that it works?
I made a new branch features/MediatRSample with all the code which is necessary to test the MediatR ValidationPipeline. My solution which is based from all your answers works in all success cases in all above usecases but don't work in the fail case of usecase Query with Result. The problem is that validationResult as TResponse returns null but should return a failed result of type Result<T>.
public class ValidationPipelineBehavior<TRequest, TResponse>
        : IPipelineBehavior<TRequest, TResponse>
        where TResponse : ResultBase
    {
        public async Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate<TResponse> next)
        {
            var validationResult = await ValidateAsync(request);
            if (validationResult.IsFailed)
            {
                return validationResult as TResponse;
            }

            return await next();
        }

        private async Task<Result> ValidateAsync(TRequest request)
        {
            // do here some validation, for example with fluentvalidation
            return Result.Fail("Validation failed");
        }
    }

I added a unit test which also face the problem that result as TResponse returns null. I think the problem is something with casting generic types and that the generic type is not known at compile time. If you have any hints please let me know.
        [TestMethod]
        public void ImplicitCastOperator_ReturnFailedGenericValueResult()
        {
            var result = Result.Fail("First error message");

            // Act
            var convertedResult = ConvertTo<Result<SampleResponse>>(result);

            // Assert
            convertedResult.IsFailed.Should().BeTrue();
        }

        public TResponse ConvertTo<TResponse>(Result result) where TResponse : ResultBase
        {
            return result as TResponse;
        }

Another story: Our solution works only with Autoface, Unity, ... but not with the asp.net core build in Microsoft dependency injection package because the Microsoft dependency injection package doesn't consider constraints and so the ValidationPipeline is injected in all usecases which is not correct. @jbogard already created an issue in the Microsoft dependency injection repository.

@altmann, the result as TResponse; returning a null was the exact problem I was stuck on. I managed to solve it my case, and I will take a look at your branch and see if i can fix it.
Also, I'm probably the biggest fan of FluentResults ever because I'm making a Typescript version of FluentResults as we speak, with the same syntax so it should work 1 on 1. It's called FluentTypeResults and I have just finished converting everything to Typescript, and now I will test it out in my own project.
The idea behind is to have my .NET Core WebApi always return a Fluent Result.  And then in my Vue.js/Typescript front-end cast the API response to a Typescript Result and from there check if there are any errors which I would like to show to the user :D
Let me know is this is good or bad practice because I couldn't find any articles or resources on this.

@altmann, the result as TResponse; returning a null was the exact problem I was stuck on. I managed to solve it my case, and I will take a look at your branch and see if i can fix it.
Also, I'm probably the biggest fan of FluentResults ever because I'm making a Typescript version of FluentResults as we speak, with the same syntax so it should work 1 on 1. It's called FluentTypeResults and I have just finished converting everything to Typescript, and now I will test it out in my own project.
The idea behind is to have my .NET Core WebApi always return a Fluent Result.  And then in my Vue.js/Typescript front-end cast the API response to a Typescript Result and from there check if there are any errors which I would like to show to the user :D
Let me know is this is good or bad practice because I couldn't find any articles or resources on this.
Edit: wrong account..

@altmann, the result as TResponse; returning a null was the exact problem I was stuck on. I managed to solve it my case, and I will take a look at your branch and see if i can fix it.

This would be great! Let me know if you know the a solution.

Also, I'm probably the biggest fan of FluentResults ever because I'm making a Typescript version of FluentResults as we speak, with the same syntax so it should work 1 on 1. It's called FluentTypeResults and I have just finished converting everything to Typescript, and now I will test it out in my own project.
The idea behind is to have my .NET Core WebApi always return a Fluent Result. And then in my Vue.js/Typescript front-end cast the API response to a Typescript Result and from there check if there are any errors which I would like to show to the user :D
Let me know is this is good or bad practice because I couldn't find any articles or resources on this.

I created an issue #56 so that we can discuss this topic separately.

@altmann, I have been trying to find a solution for the past several hours but I can't get it to work. I'm stuck on the validation pipeline not being called whatever I do or change. I can however confirm its working in my own project, on queries and commands with results.
I will make an repository now with a working sample of how I have everything setup and then it might be easier to figure out where the problem lies.

@altmann, okay scratch that.. In my project it's also not working, the pipeline is never called and instead it was validating against the web API layer in which I also have Fluent Validation integrated. Which caused me to wrongly assume that it is working, I tried it with my queries and commands directly and none of it is working :(
Apologies for the misleading, I am now trying to find a solution here: FluentResultMediatr
I'm now at the same point where either the validation pipeline is not called, or it is called if is just have a typeless Result in my query but then I can't convert the Result to TResponse since I end up with null.
I think I should first solve the pipeline not being called and once that is working I should be able to convert Result correctly to TResponse.

I managed to resolve the TResponse to null issue, but it does require a public parameterless constructor in Result:
public class ValidationPipeline<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
        where TResponse : ResultBase, new()
        // We need a common parent between Result and Result<T>,
        // and we need the new() constraint because we're going to instantiate the TResponse
        // The new() constraint does require a parameterless constructor in ResultBase,
        // otherwise the pipeline is not called
    {
        private readonly IValidator<TRequest> _compositeValidator;

        public ValidationPipeline(IValidator<TRequest> compositeValidator)
        {
            _compositeValidator = compositeValidator;
        }

        public async Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate<TResponse> next)
        {

            var result = await _compositeValidator.ValidateAsync(request, cancellationToken);

            if (!result.IsValid)
            {
                Error error = new Error();
                var responseType = typeof(TResponse);
                Type[] typeParameters = responseType.GetGenericArguments();

                foreach (var validationFailure in result.Errors)
                {
                    error.Reasons.Add(new Error(validationFailure.ErrorMessage));
                }

                // Instantiate the TResponse
                var f = new TResponse();
                // Add error, this is a bit hacky as I didn't have an easy way to add an error to ResultBase
                f.WithReason(error);
                // Returns non-null and valid result of type TResponse
                return f;
            }

            return await next();
        }
    }

I imported FluentResults into the project directly and made the changes to the Result constructor, everything can be found here: FluentResultMediatr

Thanks @JasonLandbridge for your time and for your solution. I think its no problem to make the constructor public so that the combination of MediatR and FluentResults works without reflection.
I will have a look at your solution today or the next days and will respond here.

Awesome, thanks!

@JasonLandbridge I have a look yesterday evening and your solution works in all usecases in success and failed state. Congratulations. The problem is that you also add this method to ResultBase which return ResultBase which is not expected as consumer. Consumer use Result and Result and know nothing about ResultBase. I will have a look at this the next days.
        public ResultBase WithReason(Reason reason)
        {
            Reasons.Add(reason);
            return this;
        }

Nice! Yeah me adding the WithReason to ResultBase was more to showcase the fix to get the Errors from FluentValidation into the Result.Fail() but now I realize I'm returning a ResultBase and not a Result.
That is the tricky issue, the ResultBase is the only common parent between Result and Result<T> which is why I added the WithReason to ResultBase because I could otherwise not add errors to the TResponse and have the ValidationPipeline be called at the same time.
If I change to, as a constraint, where TResponse : Result, new() then the ValidationPipeline does not get called anymore in the case of Result<T>, and if change it to where TResponse : Result<object>, new() then I am faced with an Autofac exception which I don't really understand. I figured we could maybe have two validation pipelines, one for Result and another for Result<T> but so far Result<T> is only called in the case of where TResponse : ResultBase, new(), and then we have gone full circle again.
It might be noted that that the ValidationPipeline always returns a Result.Fail() if the validation fails, regardless of if the TResponse is Result or Result<T> and thus doesn't have to be typed like Result<T> for it to work. If the validation is successful then it will call next(), which is a callback and continues on from there. Which means the ValidationPipeline isn't concerned with the T in Result<T> as in the case of failure the Result.Value is always default(T) and therefore always returns a Result.Fail().
This might help a bit in finding a solution but this was what I found out so far. No rush and I'm already gratefull that you're willing to take a look at this 👍

@JasonLandbridge Based on your idea to create an TResponse with new TResponse() the solution is now the following:
if (validationResult.IsFailed)
{
   var result = new TResponse();

   foreach (var reason in validationResult.Reasons)
      result.Reasons.Add(reason);

   return result;
}

Mediatr Sample
I only have to make the constructors of Result and Result<T> public which is okay for me. A new method WithReason(...) is not necessary because the Property Reasons is from type List<Reason> so its possible to easily add new reasons over the property. For me it was a suprise that the property Reasons is from type List<Reason> and not from type ReadOnlyList<Reason>. With ReadOnlyList the list would be protected from the outside and the list could only be manipulated over the Result public interface like WithReason(...), WithError(...) etc. I would like that but I will not change that in the future to prevent breaking changes.
Next steps:

I will make constructors public and create a new version of the package. Probably v2.1
I will add the mediatr code as sample and reference it in the readme

Thanks for all!

Awesome @altmann, thank you very much!

New package is available via nuget which support mediatr usecase. See https://www.nuget.org/packages/FluentResults/2.1.0
The full functional sample code can be found here: https://github.com/altmann/FluentResults/tree/master/src/FluentResults.Samples.MediatR/MediatRLogic
Thanks for all the input and support! Issue closed

Good news update. In link https://github.com/altmann/FluentResults/issues/54#issuecomment-667670664  it states:
‘Another story: Our solution works only with Autoface, Unity, ... but not with the asp.net core build in Microsoft dependency injection package because the Microsoft dependency injection package doesn't consider constraints and so the ValidationPipeline is injected in all usecases which is not correct. @jbogard already created an issue in the Microsoft dependency injection repository.’
This is now supported in Microsoft Dependency Injection in .Net 5.0, as indicated by @jbogard in this article:
https://jimmybogard.com/constrained-open-generics-support-merged-in-net-core-di-container/

@coderdnewbie Thanks for sharing the good news.

Here is my implementation of using MediatR together with FluentResults and FluentValidation
`internal sealed class ValidationPipelineBehaviour<TRequest, TResponse>
: IPipelineBehavior<TRequest, TResponse>
where TRequest : IRequest
where TResponse : ResultBase, new()
{
private readonly IEnumerable<IValidator> _validators;
public ValidationPipelineBehaviour(IEnumerable<IValidator<TRequest>> validators)
    => _validators = validators;

public async Task<TResponse> Handle(
    TRequest request,
    RequestHandlerDelegate<TResponse> next,
    CancellationToken cancellationToken)
{
    if(! _validators.Any())
    {
        return await next();
    }

    var errors = _validators
        .Select(validator => validator.Validate(request))
        .SelectMany(validationResult => validationResult.Errors)
        .Where(validationFailure => validationFailure is not null)
        .Select(failure => new Error(failure.ErrorMessage))
        .Distinct()
        .ToArray();

    if (errors.Any())
    {
        var result = new TResponse();

        foreach (var error in errors)
            result.Reasons.Add(error);

        return result;
    }

    return await next();
}

}`
I can add Validations like this for example:
internal class GetReviewQueryValidator : AbstractValidator<GetReviewQuery> {     public GetReviewQueryValidator()     {         RuleFor(x => x.Id)             .NotEmpty()                         .GreaterThanOrEqualTo(1);     } }
I can have multiple Validators and in the end all validation failures will be put into 1 Result with all failures gathered in the reasons. This is still a work in progress. I don1t use the dogmatic clean architecture, I use hexagonal architecture and this logic is found in the "Core" project (kinda merges the Domain and Application into one). In my API layer I try to map the Result into something more readable:
`public abstract class ApiController : ControllerBase
{
//TODO: figure out how we want to map errors to appropriate staus codes, like 404 Not Found
//currently all failures will be treated as 400 BadRequests
protected IActionResult HandleFailure(Result result) =>
result switch
{
{ IsSuccess: true } => throw new InvalidOperationException(),
_ => BadRequest(
CreateProblemDetails(
"Validation Error",
StatusCodes.Status400BadRequest,
result.Reasons))
};
private static ProblemDetails CreateProblemDetails(
    string title,
    int status,
    List<IReason> reasons) =>
    new()
    {
        Title = title,
        Status = status,
        Type = string.Empty,
        Detail = string.Empty,
        Extensions = { { nameof(reasons), reasons } }
    };

}`
It ends up looking like this:
{   "type": "",   "title": "Validation Error",   "status": 400,   "detail": "",   "reasons": [     {       "message": "'Id' must not be empty.",       "metadata": {}     },     {       "message": "'Id' must be greater than or equal to '1'.",       "metadata": {}     }   ] }
Now I need to figure out how to elegantly map results to better status codes. Like having 404 not found.


Select which test to run via command line arguments

Currently there is no way to select which test to run:
main :: IO ()
main = do
  opts <- execParser optsParser
  let scenario = optsTestScenario opts
  runTests
    [ Test.Cardano.Chain.Block.Bi.tests
    , Test.Cardano.Chain.Block.Validation.tests scenario
    , Test.Cardano.Chain.Common.Lovelace.tests
    , Test.Cardano.Chain.Delegation.Bi.tests
    , Test.Cardano.Chain.Epoch.File.tests
    , Test.Cardano.Chain.Genesis.Json.tests
    , Test.Cardano.Chain.Elaboration.Delegation.tests
    , Test.Cardano.Chain.Ssc.Bi.tests
    , Test.Cardano.Chain.Txp.Bi.tests
    , Test.Cardano.Chain.Txp.Json.tests
    , Test.Cardano.Chain.Txp.Validation.tests scenario
    , Test.Cardano.Chain.Update.Bi.tests
    , Test.Cardano.Chain.Update.Json.tests
    , Test.Cardano.Chain.Block.Validation.Spec.tests
    ]

It would be nice if we could select the test to run using stack in combination with file-watch and ta as follows:
stack test --file-watch --ta "-m *somePattern*"

There are options such as using ghcid, ghci or a combination of both however they have several shortcomings:

No recompilation when stack.yaml or *.cabal files are changed
No recompilation when local dependencies files are changed
Colored output breaks in some cases

Also it might be nice to add a test framework, to avoid rolling our own.

We should be able to write a function that converts from a hedgehog TestGroup to a testy-hedgehog TestTree, which would then give us this functionality out of the box


Ensure widgets re-render only if the right PV has changed.

@TimGuiteDiamond I believe this will catch the multiple render problem.
There's some refactoring to do here, but I'd like you to check that it does indeed fix the problem.

@willrogers have added some tests, as noted here and in #94 the by value tests do not actually appear to be necessary as the same object must be being used to represent this. I would like to add some further tests however related to changing minor elements of objects, such as alarm values and display ranges. Perhaps these will be forced to create entirely new objects which would therefore fail the shallow test.
I think the code should probably be cleaned up a bit, we might add or remove information from pvState arrays in the future, and perhaps a comment explaining why this works with respect to redux?

I refactored a bit. It's worth checking that the actual bug is still fixed!

Looks ok to me.

Merged this into #98 and the above pictures show that indeed only the widgets which is subscribed to a PV value that changes is updated, the other two remain idel. Shown above with React profiler and Chrome devTools.
@willrogers this is ready to merge.
I will use this as a base to perform more testing with respect to an increased number of widgets on the screen.


Parallelize each sample

Hi,
I was running on your tool you a cohort of 70 samples. I was wondering if there was a way to add more threads? or parallelize it somewhere in the code.
Thanks!

See https://slowkow.github.io/picardmetrics/#EXAMPLES

Thank you so much!


docs: healer controller design proposal

Signed-off-by: Prasanna Kumar Kalever<EMAIL_ADDRESS>

As discussed, had opened https://github.com/ceph/ceph-csi/issues/2794 for the VOLUME_CONDITION capability.
Please comment below if we can split this into more granular parts.

We still need to have a description of the procedures that a CSI-driver should implement for this functionality. That description needs to get reviewed and merged in the csi-addons/spec repository before a Kubernetes implementation can be proposed.

I had already opened https://github.com/ceph/ceph-csi/issues/2794, and will update the implementation details there soon.
I will also send the spec changes after some more clarity on the implementation side details(more on the internal structures). Maybe in parallel to the implementation PR.
This is just the overall design idea, for everyone's reference.

CSI-Addons can not send CSI commands, those are reserved for the CO.

I'm a bit surprised to hear this @nixpanic , is it restricted anywhere? or at least documented?
I definitely thought the sidecar can call NodeStageVolume() RPC in the nodeplugin pod.

CSI-drivers can decide on their own implementation of healing, maybe they want to call their own NodeStageVolume procedure. Don't mix standard CSI procedures with CSI-Addons procedures.

Yes, definitely the CSI-Addons can implement its own RPC, just wanted to avoid another copy-paste.

CSI-Addons can not send CSI commands, those are reserved for the CO.

I'm a bit surprised to hear this @nixpanic , is it restricted anywhere? or at least documented? I definitely thought the sidecar can call NodeStageVolume() RPC in the nodeplugin pod.

Drivers (at least Ceph-CSI) offer different gRPC servers for different protocols, so it is technically prevented. Mixing protocols does not look like a good practice, or very clean.
If both the CO and CSI-Addons Controller send CSI operations, we break the spec https://github.com/container-storage-interface/spec/blob/master/spec.md#concurrency
A CSI-driver will need to take care that healing does not interfere with actions the CO does. The only practical way to do so, is by using different operations for CSI and CSI-Addons that can coordinate (block/abort/..) concurrent access.

CSI-Addons can not send CSI commands, those are reserved for the CO.

I'm a bit surprised to hear this @nixpanic , is it restricted anywhere? or at least documented? I definitely thought the sidecar can call NodeStageVolume() RPC in the nodeplugin pod.

Drivers (at least Ceph-CSI) offer different gRPC servers for different protocols, so it is technically prevented. Mixing protocols does not look like a good practice, or very clean.
If both the CO and CSI-Addons Controller send CSI operations, we break the spec https://github.com/container-storage-interface/spec/blob/master/spec.md#concurrency
A CSI-driver will need to take care that healing does not interfere with actions the CO does. The only practical way to do so, is by using different operations for CSI and CSI-Addons that can coordinate (block/abort/..) concurrent access.

@nixpanic IIUC, this means even sidecars calling NodeGetVolumeStats is bad?

@Madhu-1 @nixpanic @Rakshith-R Can we finalize this, please? Let me know if we are missing any major calrifications in the design. If not, I hope we can discuss and address any nitty-gritty details in the implementation PR.
Thanks!

@nixpanic IIUC, this means even sidecars calling NodeGetVolumeStats is bad?

Yes. CSI-Addons should not mix calling CSI operations. A CSI-driver will need to provide dedicated CSI-Addons operations that can be called instead. The CSI-driver is then in charge of making sure no conflicting calls from the CO are being processed.

closing this as stale, feel free to reopen when required.


Fix Python workflow triggers

When @frepond opened PR #21, I wasn't able to figure out how to run the
Python workflow jobs which are required for merging. At first I thought
it was because I couldn't find the button to approve them. But I think
it is actually because the triggers for the job were to restrictive.

I'm not familiar with Github workflows (using GitLab at this time). Don't know why it's requesting my approval.

I'm still setting up some of the repo settings so I don't think I have it configured quite right yet.

I think you will need to merge master into your branch now to pickup these changes so that the workflows can run on your PR.


ansys.mapdl.reader can not read large CDB files

🔍 Before submitting the issue

[X] I have searched among the existing issues
[X] I am using a Python virtual environment

🐞 Description of the bug
It seems, that the CDB File reader in ansys.mapdl.reader can not read large files due to the old 32bit problematic.
Disclaimer: I am not that into C++, so take my suggestions with care!
I might have tracked it down to ansys/mapdl/reader/cython/_reader.pyx, where all libc.stdio imports their functions.
https://github.com/pyansys/pymapdl-reader/blob/3c54e59b196688ef99993d5aaf7398ce14abcfcd/ansys/mapdl/reader/cython/_reader.pyx#L162
Uses ftell to get the size, which might be incorrect for large files as shown in the following reproduction section.
I already tried the usual suggestions by using the following extra compile flags in setup.py to get 64bit functionality.
    extra_compile_args = ["-O3", "-w",
                          "-D_FILE_OFFSET_BITS=64",
                          "-D_LARGEFILE64_SOURCE",
                          "-D_LARGE_FILE_SOURCE=1"]

Which hasn't changed anything as the shared library is compiled in 64bit mode anyway:
$ file ansys/mapdl/reader/_reader.cpython-38-x86_64-linux-gnu.so
ansys/mapdl/reader/_reader.cpython-38-x86_64-linux-gnu.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped

The linked libc is a 64bit shared object as well.
As always, thank you for the great work and hopefully it can be fixed easily.
📝 Steps to reproduce
After installation and loading of a rather large CDB file (about 3GB).
python -c "from ansys.mapdl import reader as pymapdl_reader; print(pymapdl_reader.Archive('/path/to/3GB/structure.CDB', parse_vtk=False, verbose=True))"

returns
ANSYS Archive File structure.CDB (About 2.5GB)
  Number of Nodes:              0
  Number of Elements:           0
  Number of Element Types:      0
  Number of Node Components:    0
  Number of Element Components: 0

fsize returns: -1638917353, which looks like a classic overflow.
Alltough a small file loads just fine:
ANSYS Archive File structure.CDB (About 106MB)
  Number of Nodes:              235343
  Number of Elements:           261265
  Number of Element Types:      3
  Number of Node Components:    3
  Number of Element Components: 1

fsize returns: 111023960, which is the correct size.
💻 Which operating system are you using?
Linux
🐍 Which Python version are you using?
3.8
📦 Installed packages
aiohttp==3.7.4.post0
aiosignal==1.2.0
alabaster==0.7.12
ansys-api-mapdl==0.5.1
ansys-api-platform-instancemanagement==1.0.0b3
ansys-corba==0.1.1
ansys-mapdl-core==0.62.1
ansys-mapdl-reader==0.51.5
ansys-platform-instancemanagement==1.0.2
appdirs==1.4.4
async-timeout==3.0.1
attrs==21.2.0
autobahn==21.3.1
Automat==20.2.0
Babel==2.10.1
cached-property==1.5.2
certifi==2021.10.8
cffi==1.14.6
cfgv==3.3.1
cftime==<IP_ADDRESS>
chardet==4.0.0
charset-normalizer==2.0.12
commonmark==0.9.1
constantly==15.1.0
coverage==6.3.1
cryptography==3.4.8
cycler==0.10.0
Cython==0.29.21
distlib==0.3.4
docutils==0.18.1
filelock==3.4.2
flake8==5.0.4
flatbuffers==2.0
fonttools==4.28.3
frozenlist==1.3.0
future==0.17.1
geomdl==5.3.1
git-lfs==1.6
googleapis-common-protos==1.56.3
grpcio==1.47.0
h5py==2.10.0
hyperlink==21.0.0
identify==2.4.12
idna==3.2
imageio==2.9.0
imagesize==1.3.0
importlib-metadata==4.12.0
incremental==21.3.0
iniconfig==1.1.1
Jinja2==3.0.3
joblib==0.14.0
kiwisolver==1.3.2
MarkupSafe==2.1.1
matplotlib==3.4.3
mccabe==0.7.0
meshio==4.4.6
mock==4.0.3
mpi4py==3.0.3
multidict==5.1.0
natsort==8.1.0
netCDF4==1.5.3
nodeenv==1.6.0
numpy==1.21.2
packaging==21.3
petsc4py==3.14.0
pexpect==4.8.0
Pillow==8.3.1
platformdirs==2.4.1
pluggy==1.0.0
pre-commit==2.9.3
protobuf==3.19.4
protoc-gen-swagger==0.1.0
ptyprocess==0.7.0
py==1.11.0
pybind11==2.5.0
pycodestyle==2.9.1
pycparser==2.20
pyflakes==2.5.0
Pygments==2.11.2
pyiges==0.2.1
pyparsing==2.4.7
pytecplot==1.4.2
pytest==6.2.5
pytest-cov==3.0.0
pytest-mock==3.7.0
python-dateutil==2.8.2
pytz==2022.1
pyvista==0.31.3
PyYAML==6.0
pyzmq==22.3.0
recommonmark==0.7.1
requests==2.27.1
rich==12.3.0
scikit-learn==0.23.2
scipy==1.5.4
scooby==0.5.7
setuptools-scm==6.3.2
simple-pid==1.0.1
six==1.16.0
snowballstemmer==2.2.0
Sphinx==3.3.1
sphinx-rtd-theme==0.5.2
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
testfixtures==6.18.3
threadpoolctl==2.0.0
toml==0.10.2
tomli==1.2.2
tox==3.24.5
tqdm==4.62.2
transforms3d==0.3.1
Twisted==21.7.0
txaio==21.2.1
typing-extensions==<IP_ADDRESS>
urllib3==1.26.9
virtualenv==20.13.0
vtk==9.0.3
wslink==1.0.7
yarl==1.6.3
zipp==3.8.0
zope.interface==5.4.0

@Keynaan, sorry for the delayed response. I'm looking into this right now.

Perfectly reproduced this. Coming out with a fix shortly (example requires the fix, so don't run it just yet):
>>> from ansys.mapdl.reader import Archive, save_as_archive
>>> import pyvista as pv
>>> d = 250
>>> grid = pv.UniformGrid(dims=(d, d, d)).cast_to_unstructured_grid()
>>> filename = '/tmp/tmp.cdb'
>>> save_as_archive(filename, grid)
>>> print('File size:', os.path.getsize(filename)//1024**2, 'MB')
File size: 3519 MB
>>> Archive(filename)
ANSYS Archive File tmp.cdb
  Number of Nodes:              0
  Number of Elements:           0
  Number of Element Types:      0
  Number of Node Components:    0
  Number of Element Components: 0

Thanks for your excellent work identifying the issue and reporting your debugging env.

Resolved as of ansys-mapdl-reader==0.52.1.
Thanks again for pointing out this issue.

Perfect! It works. Thank you.


gvm ERROR: Couldn't remove pkgsets

Hello,
I have installed gvm on my Ubuntu 20.4 and wanted to remove some versions so that I could do a fresh install of them since I think that they got corrupted.
$ gvm version
Go Version Manager v1.0.22
I tried (for example):
gvm uninstall go1.17.2
and get this error:
ERROR: Couldn't remove pkgsets
any ideas how to fix this?

you can see #319


Outdated documentation in multilingual chapter

This page: /configuration/multilingual/ contains this outdated (I think) bit of info:

There's
To be done:
Manual link two objects

@giuliaghisini @sneridagh I think this has been done already, right?

yess.. this is done from @sneridagh


Click a certain position with the mouse. Is there any way to get the world POS

sorry, this one hasn't been understood

I forgot to add before. Here's an explanation：
this.renderWindow.getInteractor().onMouseMove()（work）
this.istyle.onMouseMove()（not work）


Attempt to fix HTTP Basic Auth bug.

This still needs tests, but this fix #800.

Automated message from Dropbox CLA bot
@timabbott, it looks like you've already signed the Dropbox CLA. Thanks!

working on this.

@timabbott will unit testing suffice? Or do we need to check this against complete SSO deployment?

I think unit testing should suffice for this


Add lazy load of exclude_list in test262-harness

This PR aims to avoid serialising the exclude_list
before each test_case.
JerryScript-DCO-1.0-Signed-off-by: Adam Kallai<EMAIL_ADDRESS>

LGTM (informal)


[Feature Request] Support for mega.nz

It would be great to have mega.nz support

This is a dupe of #163 - can you add your support to that ticket to get updates - thanks!


Use RAM in test: clear blocks with diff option

I thought it wasn't possible for it to return cleared bytes using RAM but seems possible by using a bigger buffer

Ah I see here:
https://github.com/random-access-storage/random-access-memory/blob/52db73d55d3f4ed011a2b17abbe56fb7ac68be01/index.js#LL5C7-L5C24

cleaner to make it with an explicit page size imo

Just for this test

@mafintosh Ready!


VS Code not recognizing changes to files in Git branch

Issue Type: Bug
On Ubuntu, working on a project with a working Git branch. If I make a change to any file in the project I would expect this change to show up in the Source Control in the left sidebar. However no changes show up, I need to close VS code and open it again for it to recognize that there are changes to the file system compared to the Git branch.
This is a recent problem, I've updated to the latest version and that didn't help. Git is setup to use an ssh key which has a passphrase, normally VS code would prompt me for this password when I start it up but it hasn't done so since the problem started so I'm guessing it's relevant.
VS Code version: Code 1.46.1 (cd9ea6488829f560dc949a8b2fb789f3cdc05f5d, 2020-06-17T21:13:08.304Z)
OS version: Linux x64 4.15.0-1090-oem

System Info

Item
Value

CPUs
Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz (8 x 3204)

GPU Status
2d_canvas: enabledflash_3d: enabledflash_stage3d: enabledflash_stage3d_baseline: enabledgpu_compositing: enabledmultiple_raster_threads: enabled_onoop_rasterization: disabled_offprotected_video_decode: unavailable_offrasterization: disabled_softwareskia_renderer: disabled_off_okvideo_decode: unavailable_offviz_display_compositor: enabled_onviz_hit_test_surface_layer: disabled_off_okwebgl: enabledwebgl2: enabled

Load (avg)
2, 2, 1

Memory (System)
15.36GB (6.69GB free)

Process Argv
--no-sandbox --unity-launch

Screen Reader
no

VM
0%

DESKTOP_SESSION
ubuntu

XDG_CURRENT_DESKTOP
Unity

XDG_SESSION_DESKTOP
ubuntu

XDG_SESSION_TYPE
x11

Extensions (14)

Extension
Author (truncated)
Version

vscode-intelephense-client
bme
1.4.1

bracket-pair-colorizer
Coe
1.0.61

vue-snippets
hol
0.1.11

vscode-peacock
joh
3.7.2

vscode-JS-CSS-HTML-formatter
lon
0.2.3

dotenv
mik
1.0.1

remote-containers
ms-
0.122.1

remote-ssh
ms-
0.51.0

remote-ssh-edit
ms-
0.51.0

remote-wsl
ms-
0.44.4

vscode-remote-extensionpack
ms-
0.20.0

vetur
oct
0.24.0

gitblame
wad
4.0.1

twig
wha
1.0.2

Can reproduce on Windows 10 Pro 1909, same VSCode version (1.46.1) too.
Changed files no longer get highlighted in the Explorer, and changes don't get detected on the Source Control tab unless I manually click on "sync". Autorefresh is enabled in my VS Code settings.

@patrickdamery
You seem to be missing file events. Please go through the following steps:

Run Git: Set Log Level... and choose Trace
Run Git: Show Git Output
Reproduce the issue and wait 10-20 seconds
Paste the whole output here

@nepetadosmil Please file a separate issue, since it's very likely a different one.


Generic field-symbol error in downported code

Downporting following results in syntax error on 7.57:
  FIELD-SYMBOLS <itab> TYPE ANY TABLE.
  LOOP AT <itab> ASSIGNING FIELD-SYMBOL(<row>).
    RETURN.
  ENDLOOP.

Downport:
  FIELD-SYMBOLS <itab> TYPE ANY TABLE.
  FIELD-SYMBOLS <row> LIKE LINE OF <itab>.  "<-- "<ITAB>" is a generic type. Use this type only for typing field symbols and formal parameters.
  LOOP AT <itab> ASSIGNING <row>.
    RETURN.
  ENDLOOP.

(I don't have a 702 system available to test if it works there)

@pokrakam try again, 2.113.82 published

Works, thanks


Allow unfunded recipient when sending SOL

I'll create a PR into the upstream and merge this one manually.


⚠ Bofrost.de has degraded performance

In 1b71c92, Bofrost.de (https://www.bofrost.de) experienced degraded performance:

HTTP code: 200
Response time: 1482 ms

Resolved: Bofrost.de performance has improved in 696cfb5 after 6 minutes.


statefulset: explicit apiVersion and kind for volumeClaimTemplates

The conversion introduced by https://github.com/kubernetes/kubernetes/pull/87706 caused ServerSide-apply to generate a diff when the applied volumeClaimTemplates item has no apiVersion  or kind .
This PR recommends setting apiVersion  and kind .
See https://github.com/argoproj/argo-cd/issues/11143.

...or is SSA doing something wrong? cc @apelisse to check?

@lavalamp You are right, and I don't see why SSA is going thru conversion (we are using apps/v1 StatefulSet).

Anyone having a idea how to fix diff in ServerSideApply with volumeClaimTemplates?
Ping @liggitt @wojtek-t 🙇

I mostly understand what's going on but a few details are still a little fuzzy. What are some minimal steps to reproduce so I can take a better look? Thanks.

It looks like the issue is coming from the way ArgoCD uses SSA (https://github.com/argoproj/argo-cd/issues/11143#issuecomment-1421323586). Closing PR.


Location of the credentials file for Visual Studio

In the commentary section, added the location of the credentials file generated by default for Visual Studio in debugging mode, so beginners can find it more easily.

@googlebot I signed it!


Finishing the cleanups I started in the last PR

The commit message turned out kind of long, so I'm not going to copy it all here.
Finished the clean up I started in the last PR. There was still a lot of "dirty" code in that one, since it was primarily based around adding the Vect3 class and using it all over the place. This one is based around making sure variable names are consistent, namespaces aren't split all over the place, etc.
I also found a number of other issues. Importantly, the Determinant3x3({double, Googol}[3][3]) function was calculating the negative determinant, and doing it in a not quite so obvious way.
Also a memory leak in VHACDImpl::findNearestConvexHull which was new'ing AABBTree's but never deleting them.
There's more detail in the commit message for 55620d which I'm pretty sure covers all the changes. I tested it this time with MSVC that comes with VS2022, as well as GCC10, so hopefully easier to merge this time.

Wow, thanks for all of the work on this. I'm out of town until Wednesday, but I will review and accept this when I'm back.