MM-14723 - Add System Console setting to enable/disable bot accounts

Summary
This pull request adds a new System Console setting to enable/disable the creation of bot accounts. New setting is under System Console > Features like so:

I verified that changing the setting would change the setting on the server side on config.json.
Ticket Link
#10776 on mattermost-server
Related Pull Requests
The related server changes can be found here

Setup Test Server label detected. Spinmint test server created if build succeeds (checks pass and no conflicts with base branch).

Spinmint test server created at: https://i-0777f0ea253d5e9c5.test.spinmint.com
Test Admin Account: Username: sysadmin | Password: sysadmin
Test User Account: Username: user-1 | Password: user-1
Internal IP: <IP_ADDRESS>
Instance ID: i-0777f0ea253d5e9c5

@jasonblais So this section is handled in the integrations/bots/bots.jsx component, but I am kind of unsure how to check the config flag here? Apologies since I am not well versed in JS/react.

Spinmint test server destroyed

Setup Test Server label detected. Spinmint test server created if build succeeds (checks pass and no conflicts with base branch).

Spinmint test server created at: https://i-095b1fbe057fbb067.test.spinmint.com
Test Admin Account: Username: sysadmin | Password: sysadmin
Test User Account: Username: user-1 | Password: user-1
Internal IP: <IP_ADDRESS>
Instance ID: i-095b1fbe057fbb067

Spinmint test server destroyed

Setup Test Server label detected. Spinmint test server created if build succeeds (checks pass and no conflicts with base branch).

Spinmint test server created at: https://i-0400a7c307c9aab15.test.spinmint.com
Test Admin Account: Username: sysadmin | Password: sysadmin
Test User Account: Username: user-1 | Password: user-1
Internal IP: <IP_ADDRESS>
Instance ID: i-0400a7c307c9aab15

@andresoro Looking really good. Just three asks:

Jesse had a note about using consistent prefixes here: https://github.com/mattermost/mattermost-webapp/pull/2751#discussion_r281771007

Looks like Enable Bot Account Creation is missing a colon at the end

Question/note about "Add Bot Account" button when setting is disabled: https://github.com/mattermost/mattermost-webapp/pull/2751#pullrequestreview-236117545

@jasonblais With regard to your first point, it was changed in
63b8d00. I am fixing the second point in the next commit. As for the last point, I am unsure with how to get the current config state in that component (components/integrations/bots.jsx). My initial idea is to import the getConfig method from mattermost-redux/selectors/entities/general and check the flag from there.

Thank you @andresoro!
@lieut-data would you have insight on if the approach suggested would help hide the "Add Bot Account" button as described here

As for the last point, I am unsure with how to get the current config state in that component (components/integrations/bots.jsx). My initial idea is to import the getConfig method from mattermost-redux/selectors/entities/general and check the flag from there.

@andresoro, yes, importing getConfig is definitely the right approach. You can see this already being done in the connector for this backstage component, so it should be a trivial addition of a new prop to the component to decide whether or not to show the button.
Let me know if I can help further!

@lieut-data I've made some progress with this but I found that the CreateBotAccounts flag is not present in the config returned by getConfig.

@andresoro, ah, yes -- that's something I missed in the server PR, since at the time it wasn't "used" client-side outside of the system console.
You'll want to update https://github.com/mattermost/mattermost-server/blob/b561d7900c224794e93123d46cf203e7287515aa/config/client.go#L15 to send down the new configuration flag, after which it should be available.

@lieut-data Thanks for the update! I got it working so I'll push the changes and create a new PR for the server with new config flag.

Spinmint test server destroyed

Setup Test Server label detected. Spinmint test server created if build succeeds (checks pass and no conflicts with base branch).

Spintmint test server creation failed. See the logs for more information.

OK fixed the lint error. Apologies for the number of commits with respect to actual changes 😅. Not too familiar with react/JS but this has been a good learning opportunity.

@andresoro Looks like the build failed. The error message is:
 FAIL  components/integrations/bots/bots.test.jsx
  ● Console

    console.error tests/setup.js:55
      Warning: Failed prop type: The prop `createBots` is marked as required in `Bots`, but its value is `undefined`.
          in Bots

  ● components/integrations/bots/Bots › bots

    Unexpected console logsWarning: Failed prop type: The prop `createBots` is marked as required in `Bots`, but its value is `undefined`.
        in Bots

      66 | afterEach(() => {
      67 |     if (logs.length > 0 || warns.length > 0 || errors.length > 0) {
    > 68 |         throw new Error('Unexpected console logs' + logs + warns + errors);
         |               ^
      69 |     }
      70 | });
      71 |

      at Object.<anonymous> (tests/setup.js:68:15)

Would you please take a look at this?

@hanzei This was an issue I was running into before I made the changes to the server. I think a good option is to just drop the isRequired tag.

Setup Test Server label detected. Spinmint test server created if build succeeds (checks pass and no conflicts with base branch).

Spinmint test server created at: https://i-0c4b2d877244a054e.test.spinmint.com
Test Admin Account: Username: sysadmin | Password: sysadmin
Test User Account: Username: user-1 | Password: user-1
Internal IP: <IP_ADDRESS>
Instance ID: i-0c4b2d877244a054e

@jasonblais I definitely missed the i18n update. For your second point, it seems to be working on my machine as intended. I'm using make run from the mattermost-server master branch. Maybe the test server isn't using the change we made in this PR?

@andresoro you're probably right. @cpanato any thoughts on why changes merged here (https://github.com/mattermost/mattermost-server/pull/10849) would not be reflected in the generated test server above?

Maybe because the package was not built in-time when you request the test server

will request a new test server

Spinmint test server destroyed

Setup Test Server label detected. Spinmint test server created if build succeeds (checks pass and no conflicts with base branch).

Spinmint test server created at: https://i-05ed037309d2c6c32.test.spinmint.com
Test Admin Account: Username: sysadmin | Password: sysadmin
Test User Account: Username: user-1 | Password: user-1
Internal IP: <IP_ADDRESS>
Instance ID: i-05ed037309d2c6c32

@jasonblais can you test it again?

@andresoro @cpanato It's still not working for me (no "Add Bot Account" button when "Enable Bot Account Creation" is enabled)

@jasonblais this is the behavior when the CreateBotAccounts flag is undefined/not found so Bots component defaults to false. Perhaps we can change the default behavior to default to true? This should not happen when the server passes the correct config like in the aforementioned server PR.

@andresoro Makes sense. I'd lean towards approving + merging and we can test on the master branch with changes both from webapp and server reflected.
But just to confirm, with https://github.com/mattermost/mattermost-server/pull/10849, the server passes the correct config and the issue I'm describing shouldn't occur?

@jasonblais Yes it should not occur. I realize my implementation here is a little hackish since it depends on those server changes.

Spinmint test server destroyed


Fix DomainEvents tests against 1.6 until workaround is available

My apologies. I forgot to breakout the Domain Events tests for 1.6, even though the build worked.

Ah, cool.


Fix incorrect test names in math_gpu_test.ts

This change is

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

Comments from Reviewable

Thanks for the fix!


Fix TM permissions (#32) and add BWAPI 4.4.0 support (#34)

Update 2019-03-24: the original plan was to add support for BWAPI 4.3.0 and that is how this pull request was originally written, but the plan changed to only add support for BWAPI 4.4.0, not 4.3.0 too. So I have edited this issue to replace references of BWAPI 4.3.0 with just BWAPI 4.4.0 (even though the commit history will show that 4.3.0 was added then 4.4.0 added then 4.3.0 removed).
Changes are included for these issues:
#32
#34
I've included the TournamentModule.dll & JAR files that I compiled, but my bot (ZZZKBot) competed in AIIDE/CIG competitions in the past, so I realize you may want to compile them yourself to ensure they are trustworthy.  You can check that the file checksums of other files like the official BWAPI.dll are correct.
If you use my TournamentModule.dll file for BWAPI 4.2.0 and/or 4.4.0, note that as I mentioned in the commit messages, for BWAPI 4.2.0 I used Microsoft Visual Studio Community 2017 version 15.7.4 (linking with an unpacked and unaltered https://github.com/bwapi/bwapi/releases/download/v4.2.0/BWAPI.VS.<IP_ADDRESS>z). For BWAPI 4.4.0 I used Microsoft Visual Studio Community 2017 version 15.9.8 (linking with an unpacked and unaltered https://github.com/bwapi/bwapi/releases/download/v4.4.0/BWAPI.7z although I had to build BWAPILIB.lib myself because the official releases no longer provide it). They are later versions of Visual Studio 2017 than was used to build the official BWAPI 4.2.0, so it may require client machines to have a more recent version of the Microsoft Visual C++ Redistributable for Visual Studio 2017 installed. E.g. can get the latest version from https://support.microsoft.com/en-au/help/2977003/the-latest-supported-visual-c-downloads. I haven't tested upgrading the redist though - it worked for me, but that may be because I already had a more recent version installed.  The DLL for 4.1.2 should not need an updated redist.
I built the JARs using jdk-8u201-windows-i586.exe. client.jar needed to be updated. I also pushed the updated server.jar & results_parser.jar but I'm not sure whether I needed to, because I only changed some comments in the src/objects folder.

Been kind of busy, just tagging @richard-kelly so he can have a look at this eventually

I gather that BWAPI 4.3.0 crashes a lot due to issues relating to the new latency compensation logic, so let's put this pull request on hold until sometime after the next version is released, which I expect will be quite soon, and see how it goes on BASIL and/or SSCAIT first.

Update: I've added support for BWAPI 4.4.0 and removed support for BWAPI 4.3.0.  Should be good to go.  Note: BASIL has supported BWAPI 4.4.0 for 10 days now (although I don't know whether any bots are using it) and  SSCAIT doesn't support BWAPI 4.4.0 yet.

I tested the new tournament modules and a 4.40 bot in our tournament setup. Thanks @chriscoxe !


Container keep restarting with "Monit daemon with PID 1 awakened"

Hey @kijart , thank you very much for this image. After some time the container begins restarting with "Monit daemon with PID 1 awakened" message. Do you know how to resolve it? ATM I use kijart/monit:1.2.0 with following configuration:
# All settings can be found on https://mmonit.com/monit/documentation/monit.html
# Check all services every n seconds
set daemon 30

# Start the web interface on localhost:2812. Also needed for the CLI to work.
# https://mmonit.com/monit/documentation/monit.html#TCP-PORT
set httpd port 2812
	allow confi:dential

# Add a custom mailserver through which monit will send alerts
# https://mmonit.com/monit/documentation/monit.html#Setting-a-mail-server-for-alert-delivery

SET MAILSERVER email.com
	PORT 587
	USERNAME very
	PASSWORD secret
	using TLSV1

# Adjust the contents and format of the mail
# https://mmonit.com/monit/documentation/monit.html#Message-format

set mail-format {
	from: important@mycompany
}

# Activate mail alerts and set mail adresses
# Mails are sent once on alert and once on recovery
# https://mmonit.com/monit/documentation/monit.html#Setting-a-mail-server-for-alert-delivery
#  SET ALERT mail-address [[NOT] {event, ...}] [REMINDER cycles]
SET ALERT boss@mycompany REMINDER 120
check system localhost
	if loadavg(5min) > 2 then alert
	if memory > 50% then alert

check filesystem localhost-sda1 with path /dev/sda1
	if SPACE usage > 30% then alert

check host sentry with address important.host
	group common
	if failed
		port 443
		protocol https
		request /auth
		status = 200
		content = "csrfmiddlewaretoken"
		certificate valid > 28 days
		timeout 10 seconds
	then alert
[....]

Hi @Bessonov I have not had time to check if the problem is specific or general, have you been able to find out more?
As reference, an old but similar issue I have found in a mailing lists

I got the exact same issue and did not find a way to solve it yet.


Path for Eclipse is generated improperly

We configured apt-plugin according to the documentation and ./gradlew build run just fine.
Unfortunatelly when I execute ./gradlew eclipse the source folder added to the classpath is being set to: build/generated/source which causes Eclipse to think, that apt.main.mypackage is a package. And that causes compilation errors because under apt/main/mypackage classes have package mypackage, not apt.main.mypackage
Setting source folder location manually to: build/generated/source/apt/main instad of build/generated/source solves the problem.
Can you please change it in your plugin?

I'd be happy to fix the plugin… iff it was responsible for that behavior. But the plugin specifically does not configure those paths (build/generated/source/…) in Eclipse due to how Eclipse is incapable of separating out main and test configurations; and configures the output of annotation processing to .apt_generated instead (where Eclipse will put all output from both main and test classes processing): https://github.com/tbroyer/gradle-apt-plugin/blob/v0.10/src/main/groovy/net/ltgt/gradle/apt/AptPlugin.groovy#L132
Do you have a small project available online that reproduces the problem? Could it be due to some other plugin you're using?

Yes I have, but how can it help if you closed the issue as invalid?
On the other hand - you don't have to point src folder to main & test together. If you treat them separately - it works just fine (build/generated/source/apt/main & build/generated/source/apt/test) and should solve the issue

Sorry if I wasn't clear. I know the apt-gradle-plugin is not responsible for your Eclipse configuration; and I'm offering some help to help you diagnose it.

On the other hand - you don't have to point src folder to main & test together. If you treat them separately - it works just fine (build/generated/source/apt/main & build/generated/source/apt/test) and should solve the issue

You're misunderstand the problem here.
In an Eclipse project there's no distinction between main and test classes, only one build path for both, and only one output folder (that ./gradlew eclipse configures as bin/); and when you configure annotation processing, there's only one factory path and one output folder for the generated sources (which the apt-gradle-plugin configures as .apt_generated/).
FWIW, I just ran ./gradlew eclipse on a small project and cannot find any mention of build/generated/source (or even build/ for that matters) in the generated files (.project, .classpath, .settings/org.eclipse.jdt.core.prefs, .factorypath, and .settings/org.eclipse.jdt.apt.core.prefs). Tried with both Gradle 3.0 and 3.5, and apt-gradle-plugin 0.10.

Ok, now I see the problem.
With the "plain" configuration we were not able to use generated classes in our code (I see that .apt_generated is being used in configuration but after ./gradlew build it's empty. All classes are being generated to ${buildDir}/generated/source
That is why we needed to use:
sourceSets {
    main {
        java {
            srcDirs = ['src/main/java', "${buildDir}/generated/source"]
        }
        resources {
            srcDirs = ['src/main/resources', 'src/main/sql']
        }
    }
}

in our build.gradle file.
When I changed ${buildDir}/generated/source to ${buildDir}/generated/source/apt/main everything is working.
The question is - why .apt_generated is empty? Try it yourself (with and without sourceSets) - my project is in attachment: showcase.zip

.apt_generated is where Eclipse will write the generated sources, when it itself processes annotations. If you don't intend to use Eclipse's built-in support for annotation processing (and instead prefer to run Gradle to compile sources and write generated sources), then I suppose you're asking for a way to apply both eclipse and net.ltgt.apt plugins without the net.ltgt.apt plugin configuring Eclipse; similar to #45 for IntelliJ IDEA.

I would like to ask how the STS used to customize the source code path. @tbroyer  @eximius313

could you please be more specific? I'd like to help but I'm not sure what you need.

A custom annotation processor is needed to generate the output path of the source code.But this is already a problem.
Referring to this answer https://github.com/gradle/gradle/issues/4956
thank you very much for your answer.


Added the toIntegerList() function

This function is inspired by toIntegerList() in OpenCypher.
The function toIntegerList() takes a list of values and produces a new list containing only the integer values. If any values cannot be converted to an integer, they will be represented as null in the returned list.
The result of the toIntegerList() function is a list that contains the converted elements. The converted values in the list can be either integer values or null, depending on the input value.
Also added the regression tests.

@M4rcxs , this fails the regression build. Could you look into why this is occurring? Thanks

@M4rcxs , this fails the regression build. Could you look into why this is occurring? Thanks

@dehowef The error was in the expected part of the regression test, but I fixed it!

Looks good now~, please refer to the message I commented on #1016 Thank you~


[Task] Add github-actions

This task comes under the sprint for code quality update and version-migration.
To add github-actions for issues / pull-requests, including depandabot.yaml

Solved in #10


cmd/compile: redundant instructions after inlining

Go version
go version devel go1.24-7fcd4a7 Mon Aug 19 23:36:23 2024 +0000 linux/amd64
What did you do?
I was reading https://www.dolthub.com/blog/2024-08-23-the-4-chan-go-programmer and there was a piece of code that caught my attention (keep in mind that it is a contrived example, but could reveal a bigger problem). So I decided to check the generated assembly (https://go.godbolt.org/z/oxqbPnPxn).
package test

func f() {
	i := 1
	setInt1(&i)
}

func setInt1(i *int) {
	setInt2(&i)
}

func setInt2(i **int) {
	setInt3(&i)
}

func setInt3(i ***int) {
	setInt4(&i)
}

func setInt4(i ****int) {
	****i = 100
}

What did you see happen?
In some of the functions there were redundant instructions (marked with ; REDUNDANT).
setInt4 is compiled to:
MOVQ    (AX), AX
MOVQ    (AX), AX
MOVQ    (AX), AX
MOVQ    $100, (AX)
RET

setInt3 is compiled to:
MOVQ    AX, command-line-arguments.i+8(SP) ; REDUNDANT
MOVQ    (AX), AX
MOVQ    (AX), AX
XCHGL   AX, AX
MOVQ    $100, (AX)
RET

setInt2 is compiled to:
MOVQ    AX, command-line-arguments.i+8(SP)  ; REDUNDANT
LEAQ    command-line-arguments.i+8(SP), AX  ; REDUNDANT
MOVQ    (AX), AX                            ; REDUNDANT
MOVQ    (AX), AX
XCHGL   AX, AX
XCHGL   AX, AX
MOVQ    $100, (AX)
RET

setInt1 is compiled to:
(...stack handling...)
MOVQ    AX, command-line-arguments.i+24(SP)  ; REDUNDANT
LEAQ    command-line-arguments.i+24(SP), AX  ; REDUNDANT
MOVQ    AX, command-line-arguments.i(SP)     ; REDUNDANT
LEAQ    command-line-arguments.i(SP), AX     ; REDUNDANT
MOVQ    (AX), AX                             ; REDUNDANT
MOVQ    (AX), AX                             ; REDUNDANT
NOP
XCHGL   AX, AX
XCHGL   AX, AX
MOVQ    $100, (AX)
(...stack handling...)
RET

What did you expect to see?
I expected to see no redundant instructions.

Related Issues and Documentation

cmd/compile: elide unnecessary copies #54613
cmd/compile: inefficient assembly code generated by simple loop&branch code #48882
cmd/compile: unnecessary array copying in for range loop #33838 (closed)
cmd/compile: (dev.typeparams) assembly generated for a simple generic function is massive #46998 (closed)
cmd/compile: incomplete optimization of inlining leads to useless instructions. #15152 (closed)
cmd/compile: redundant moves and stack variables when function using bits.Add64 is inlined #33349
cmd/compile: redundant jumps #14277 (closed)
cmd/compile:  optimize dead store #50325
cmd/compile: code generates unnecessary mov-s #65192
cmd/compile: replace indirect call with direct call when target is known after inlining #32577 (closed)

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

cc @golang/compiler @randall77

This happens without inlining: https://go.godbolt.org/z/v58b47zf3
I know why it fails, there is a systemic tradeoff in most of the compiler only operating on SSA values, when you store things in memory (&i) a lot of optimization information is lost, here in this case nilcheckelim abandon.
So only the outer most *& pair is being optimized because the ****p is never stored in memory.
Solving this for all possible cases is impossible, and getting right often is extremely costy both in term of compilation time and compiler code complexity which is a tradeoff the go compiler usually do not accept.
The CPU perform store → load forward at runtime, I doubt this has huge cost impact at runtime.

I have an idea on how to cheaply improve this extremely naive example but this wont solve much more cases.

Well I was only able to improve the situation slightly:
    # /tmp/a.go
    00000 (3) TEXT command-line-arguments.f(SB), ABIInternal
    00001 (3) FUNCDATA $0, gclocals·g2BeySu+wFnoycgXfElmcg==(SB)
    00002 (3) FUNCDATA $1, gclocals·EaPwxsZ75yY1hHMVZLmk6g==(SB)
    00003 (3) FUNCDATA $2, command-line-arguments.f.stkobj(SB)
v6  00004 (+4) MOVQ $1, command-line-arguments.i-24(SP)
v27 00005 (+5) LEAQ command-line-arguments.i-24(SP), AX
v10 00006 (5) MOVQ AX, command-line-arguments.p1-8(SP)
v16 00007 (+6) LEAQ command-line-arguments.p1-8(SP), AX
v14 00008 (6) MOVQ AX, command-line-arguments.p2-16(SP)
v24 00009 (+9) MOVQ command-line-arguments.p2-16(SP), AX
v26 00010 (9) MOVQ (AX), AX
v28 00011 (9) MOVQ $100, (AX)
b1  00012 (10) RET
    00013 (?) END

I removed the in the way nilchecks, which removes one more load, however then the dead stores become in the way and I don't know of a cheap way to run theses during late opt.
I think this fall in the « passes ordering is hard » kind of camp, given it would solve itself if we reran the core generic passes in a loop until things stabilize but that expensive.


@unovis/vue : Peer Dependency Update

Shouldn't @unovis/vue v1.3.3 have a peer dependency of @unovis/ts v1.3.3 and not 1.2.1?

@errantmind Thanks for bringing this to our attention! We've released version 1.3.4 that fixes it.

Thanks


allow default configuration of flags

Currently I'm using lebab with the Sublime Text plugin.  I converted all my files using it and then realized that nodejs 6.3.1 doesn't support commonjs import/export syntax so I want it to always be off.  The only way I could figure out how to achieve this was to modify the executable to modify the options object as such:
try {
  options = parseCommandLineOptions(process.argv);
  options.transforms.commonjs = false;
}

A great feature would be to have a system similar to .jshintrc configs so that you could define the options you want for certain directories, or at least a global config file for options.

You can use --disable commonjs to disable the commonjs transform.
I don't really see a need for config file. Our assumption has been that Lebab is a tool one doesn't really use continuously, rather you'll use it once to transform your files and then be done with it.


[WIP] Adding BytesRead to LogSource

What does this PR do?
Getting rid of BytesRead Attribute and instead pushing it into Log Source underneath Info section
Motivation
Creating a centralized place so logs attribute can be rendered from 1 singular place.
Additional Notes
Still working on how to separate the key BytesRead into 2 different words so down the road other attributes can be easily split from camel-cases accordingly.
Test/QA
Building the agent and send logs to see if the attribute get rendered correctly (still needs work)

You have to update Line 203 here as the type changed and Load() is no longer available on that property. So it's causing the build to fail 😄


Making scintilla.Styles assignable?

So, let's say you made scintilla.Styles not just readonly?  This would allow people to create their own StyleCollection() as an object and then simply assign that object to scintilla.Styles.
Does that sound like a reasonable idea?  Is there a major reason that that would be impossible?
If this is doable, my ultimate goal was to take any of the user-rolled themes that may end up in the Wiki (or any I create for my project) and start adding them to a "managed" DLL of styles that someone can simply include in their project through nuGet to have access to predefined styles for different languages without having to copy/paste examples from the wiki if they didn't care about customizing it themselves.  In essence, making a "companion" package to Scintilla that has Scintilla has a prereq. And everything would be simpler if I could just assign the resultant StyleCollection to the scintilla.Styles property.
Managed DLL:
namespace Serysoft.ScintillaNET.Syntax
{
    public class Styler
    {
        private Highlighter highlighter;

        /// <summary>
        ///
        /// </summary>
        /// <param name="language"></param>
        /// <param name="theme"></param>
        public Styler(Languages language, Themes theme)
        {
            switch (language)
            {
                case Languages.Cpp:
                    highlighter = new Cpp(theme);
                    break;
            }
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="scintilla"></param>
        public void Set(Scintilla scintilla)
        {
            scintilla.Lexer = highlighter.Lexer;
            scintilla.SetKeywords(0, highlighter.Keywords[0]);
            scintilla.Styles = highlighter.Theme;
        }
    }

    public class Cpp : Highlighter
    {
        /// <summary>
        ///
        /// </summary>
        /// <param name="theme"></param>
        public Cpp(Themes theme)
        {
            base.Lexer = Lexer.Cpp;
            base.Keywords = this.Keywords;

            switch (theme)
            {
                case Themes.Light:
                    base.Theme = this.Light;
                    break;

                case Themes.Dark:
                    base.Theme = this.Dark;
                    break;
            }
        }

        /// <summary>
        ///
        /// </summary>
        private List<string> Keywords
        {
            get
            {
                List<string> list = new List<string>();

                list.Add("keywords");

                return list;
            }
        }

        /// <summary>
        ///
        /// </summary>
        private StyleCollection Light
        {
            get
            {
                StyleCollection styles = new StyleCollection(new Scintilla());

                styles[Style.Cpp.String].ForeColor = Color.Red;

                return styles;
            }
        }

        /// <summary>
        ///
        /// </summary>
        private StyleCollection Dark
        {
            get
            {
                throw Exceptions.DarkNotImplemented;
            }
        }
    }
}

Code Implementation:
Styler styler = new Styler(Languages.Cpp, Themes.Light);
styler.Set(code);

Technically what you're suggesting is probably possible, but in practice it’s much harder that you might realize; because when you disconnect the StyleCollection you're really disconnecting the styles. To do that we would need to store every style property locally so that when you eventually marry the StyleCollection and the Scintilla control you can then push all the style properties you had previously stored locally to the Scintilla control. In an earlier iteration of ScintillaNET I pursued an idea like this and gave up on it because it seemed like a lot of work for a little gain. In the end I decided to “accept the original Scintilla API for what it is and not try to coerce it into a .NET-style API when it should not or could not be" as noted in the project README.md.
Now, that being said I think there is still a way to do what you want without having to separate the styles and StyleCollection. Essentially you want a wrapper class that will make it possible to set the lexer and styles in one easy property and there is no reason you still couldn't do something like that.
I think if you modified your example to pass the Scintilla argument in the Styler.Set method to the Highlighter, the Highlighter could do the work of setting the styles--without first having to store them locally:
namespace Serysoft.ScintillaNET.Syntax
{
    public class Styler
    {
        private Highlighter highlighter;

        public Styler(Languages language, Themes theme)
        {
            switch (language)
            {
                case Languages.Cpp:
                    highlighter = new Cpp(theme);
                    break;
            }
        }

        public void Set(Scintilla scintilla)
        {
            // Rather than 'apply' the data stored in the Highlighter, pass control to it
            highlighter.Set(scintilla);
        }
    }

    public class Cpp : Highlighter
    {
        public Cpp(Themes theme)
        {
            base.Theme = theme;
        }

        private List<string> Keywords
        {
            get
            {
                List<string> list = new List<string>();

                list.Add("keywords");

                return list;
            }
        }

        internal void Set(Scintilla scintilla)
        {
            // This is where a highlighter configures Scintilla the way it wants to
            scintilla.Lexer = Lexer.Cpp;
            scintilla.SetKeywords(0, Keywords[0]);

            switch(theme)
            {
                case Themes.Light:
                    scintilla.Styles[Style.Cpp.Comment].ForeColor = Color.Green;
                    scintilla.Styles[Style.Cpp.Number].ForeColor = Color.Blue;
                    // etc..
                    break;

                case Themes.Dark:
                    throw Exceptions.DarkNotImplemented;
                    break;
            }
        }
    }
}


Add size method to TSDataset class

Before submitting (must do checklist)

[x] Did you read the contribution guide?
[x] Did you update the docs? We use Numpy format for all the methods and classes.
[x] Did you write any new necessary tests?
[ ] Did you update the CHANGELOG?

Proposed Changes

Closing issues

closes https://github.com/etna-team/etna/issues/235

We should update CHANGELOG.md file.


[GLUTEN-1632][CH]Daily Update Clickhouse Version (20241219)

Auto commit by gluten daily build, please check the build status and merge it if it's green.

Rebase failed with https://github.com/ClickHouse/ClickHouse/pull/72481


cost-model container is running and responding to the healthz endpoint, but the response is empty.

The Kubecost cost-analyzer service is properly configured and exposing port 9003 for the cost-model container. The service is targeting the correct port (9003) and has an endpoint pointing to the cost-model container's IP (<IP_ADDRESS>:9003).
When you executed the curl command inside the cost-analyzer-frontend container to access the healthz endpoint of the cost-model container (http://localhost:9003/healthz), it returned an empty response. This indicates that the cost-model container is running and responding to the healthz endpoint, but the response is empty.

Hi @VenkySubbaraj, is this a problem with the kubectl cost CLI tool?
It sounds like you're reporting something unrelated, in which case I recommend reaching out via a GitHub issue on our Helm chart (https://github.com/kubecost/cost-analyzer-helm-chart/issues/new/choose) or in the Kubecost Slack.

As a note, /healthz is supposed to respond with a 200 and nothing else. What are you actually seeing in terms of data/ui?


Remove master/1.x from jammy stemcell pipeline

We've never really made use of this and the rebase of 1.x on top of master is causing conflicts.
Instead of using ubuntu-jammy/master and ubuntu-jammy/1.x the pipeline now expects a branch called just ubuntu-jammy, so master will need to be pushed there as part of this.
Screenshot of a the pipeline flown as a test:

Hey @ramonskie, we talked at the FIWG meeting about this. This came out of failures in the 1.x rebase caused by code being merged/reverted into the 1.x branch.
We're going to fix the rebase problem with a force push that removes the merged code, but we thought just eliminating the master/1.x branches was a good simplification of the pipeline anyway.
Thoughts?

The reason we still keep the extra line was that we could still release 1x if master failed. If needed. This does not happen verry much. The other thing is is that we need to adjust the ci code a bit. If we are going to remove the 1.x branch but im Okay with that if it makes everyone s job easier. It will also reduce resources like the extra dev stemcells etc. So thats a nice bonus


OSoftRefsHashMap: avoid NPE while evicting entries (fix for #6686)

Pull request derived from #6686.

Hi,
I'm going to close this because we don't usually accept pull request on master, the active branches right now are the 2.2.x and develop, i cherry-picked your fix there so no need to do another PR.
Regards


"Making a thread dump" -- wrong command given

Making a thread dump
says to run on Linux/Mac
jstack $(ps aux | grep -m1 dbeaver | awk '{print $2}') > thread-dump.txt

Chances are,
$(ps aux | grep -m1 dbeaver | awk '{print $2}')

will retrive the PID of the native launcher process /usr/bin/dbeaver instead of the expected JVM.
Presuming that there should be one JVM running DBeaver at any given time, the command should be modified to rather look for the JVM process:
jstack $(ps aux | grep java | grep dbeaver | awk '{print $2}') > thread-dump.txt

Agreed.

Fixed.


How to use behind proxy?

Question
I set these parameters in tusd.
["--s3-bucket","bucketname","--s3-endpoint","http://minio-server:9000","--base-path","/bsh/oss/files/","--expose-metrics","false","--behind-proxy","true"]

in nginx
proxy_set_header Host $host:$server_port;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    # proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Proto https;
    proxy_request_buffering off;
    proxy_buffering off;
    proxy_http_version 1.1;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    client_max_body_size 0;

In actual production, there is an F5 agent in front of the nginx.
Now the phenomenon is:
The first request sent by the browser to save JSON was the HTTPS protocol, and it also responded. But the second request became http. Now Google is not allowed to send HTTP in HTTPS.

In actual production, there is an F5 agent in front of the nginx.

What does that mean? Is there the F5 agent is use when you made these screenshots? If so, the F5 agent must be configured as well.
Also, there are multiple proxy_set_header X-Forwarded-Proto instructions in your config. Try to only keep the proxy_set_header X-Forwarded-Proto https; one.

The current situation is as follows:

F5 agent is configured by the third party enterprise.
SSL certificate is configured on F5 proxy
There is no SSL certificate on my own nginx proxy, and the internal forwarding uses http
X-Forwarded-Proto I also tried to write a "HTTPS"

Tips:
Actually, I haven't used F5 myself, so I don't know what can be configured on F5. Do you know about F5 agent?

@Acconut
In addition, I want to confirm one thing.
Is the rule of the second HTTP request returned after the first request is sent?
Because I also found that if I remove the part of the location matching in the proxy process, the second request will also remove this part, which is different from the URL sent for the first time

@Acconut
In addition, I want to confirm one thing.
Is the rule of the second HTTP request returned after the first request is sent?
Because I also found that if I remove the part of the location matching in the proxy process, the second request will also remove this part, which is different from the URL sent for the first time

Do you know about F5 agent?

No, your description is the first time I hear about F5.

X-Forwarded-Proto I also tried to write a "HTTPS"

Did you also try with lowercase https?

Is the rule of the second HTTP request returned after the first request is sent?
Because I also found that if I remove the part of the location matching in the proxy process, the second request will also remove this part, which is different from the URL sent for the first time

Sorry, but I do not understand what you mean here. Can you rephrase this?

Is the whole upload process divided into two steps

Upload JSON with file information

Upload the actual file

Now, the first step is successful (I've seen the JSON file in Minio). It's a request for HTTPS.
But in the second step, it shows an HTTP request. Then it was rejected by the browser.
The endpoint I configured in tus JS clinet is:
https://www.xxx.com.cn/bsh/oss/files/
I've always configured lowercase HTTPS.

This is the first request. It carries a Location

@Acconut The Location above is an HTTP protocol

@lshz0088 There are still multiple proxy_set_header X-Forwarded-Proto instructions in your configuration. Please remove these conflicting instructions.

I had this problem using and nginx-based kubernetes ingress proxy. The solution was to add something like this:
proxy_redirect http://mydomain.tld https://mydomain.tld;
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect

Thank you for your input, @sean9999. That's very helpful if people come across this issue in the future.
Since I haven't heard back from the original author @lshz0088, I am going to close this issue. If the problem comes back, feel free to open a new ticket.


I wish /docs/getting-started-guides/docker/ What year is it? These instructions are from a snapshot months ago, missing critical refactorings

Please merge from release 1.2
https://github.com/kubernetes/kubernetes/blob/release-1.2/docs/getting-started-guides/docker.md
It includes setting a default DNS server (which I struggle to get to work), and simplifies the instructions into a single docker command.
Unless you find that these instructions get more reliably up than in version 1.2 please roll forward to 1.2

Done.

Note: Please don't file any more issues regarding the 1.2 import. See this message for details on how the 1.2 import is aligning with the repo switchover. Thanks!
https://groups.google.com/forum/#!topic/kubernetes-dev/UedwIYb-fHg


auditok: init at 0.2.0

Description of changes
Add auditok python package needed for ffsubsync

Things done

Built on platform(s)

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

[ ] For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
[ ] 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
[ ] Tested basic functionality of all binary files (usually in ./result/bin/)
23.05 Release Notes (or backporting 22.11 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
[ ] (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes

[ ] Fits CONTRIBUTING.md.

@Arguggi I'm interested in packaging ffsubsync, and could pick this one up if you're no longer working on it.

@Benjamin-L Since this is a blocker for something that you and @Arguggi both explicitly mention wanting to get into nixpkgs, my opinion (as a non-committer...) is that it's fair to go ahead and pick this up in a new PR (but it might be a kind gesture to defer to this PR if @Arguggi notices this discussion and starts addressing the feedback from Doron and Pol).

OP hasn't responded in 3 months for requests by reviewers. Let's close this. They can open a new one when ready.

Thanks @Benjamin-L  for the updated PR, for some reason github decided to not send any notifications so I missed these comments.

@Arguggi thanks! If you're interested, there's a final PR for ffsubsync here: https://github.com/NixOS/nixpkgs/pull/258465.


Suggestion: typeof arg in conditional type uses typeof passed value, rather than declared type of parameter

A workaround I attempted for #21879 was to use typeof on a function argument in a conditional type, to indicate which callback parameters were relevant. The code was this:
interface Foo { kind: 'foo'; }
interface Bar { kind: 'bar'; }

function mapFooOrBar<R>(
    foobar: Foo | Bar,
    mapFoo: typeof foobar extends Foo ? ((value: Foo) => R) : ((impossible: never) => never),
    mapBar: typeof foobar extends Bar ? ((value: Bar) => R) : ((impossible: never) => never),
): R {

With the idea being that if I call mapFooOrBar(foo, for foo: Foo, I should expect that mapBar will never be called, and thus never have a parameter and never have a return value.
But the problem is that typeof foobar extends Bar is always true, because typeof foobar evaluates to Foo | Bar—its declared type. It would be better if typeof here used the type of the actual passed value, rather than the function parameter declaration type.
Using a generic here does not work, because for example you could write mapFooOrBar<Foo, {}>(foobar, for foobar: Foo & Bar (nevermind that Foo & Bar is impossible for these definitions of Foo and Bar, TS allows it), allowing the user to claim no Bar will be passed while actually passing a value that is a Bar.
For backwards compatibility/corner-cases, a new keyword might be better than typeof. I don't currently have a good suggestion for what that would be, though.

typeof operator evaluates immediately, so typeof foobar is literally telling the compiler, go get the type annotation on foobar and put it here,  which is Foo | Bar.
What you want here is a generic type parameter:

function mapFooOrBar<T extends Foo | Bar, R>(
    foobar: T,
    mapFoo: T extends Foo ? ((value: Foo) => R) : ((impossible: never) => never),
    mapBar: T extends Bar ? ((value: Bar) => R) : ((impossible: never) => never),
): R

I also addressed already why a generic parameter is not workable in this situation. What I need is a way to refer to exactly what typeof would produce on the argument passed in, which may not match the type passed to the generic argument (in the explicit case) or the type inferred for the generic parameter (in the implicit case).

not sure i understand what you mean.

See also the linked #21879 for why your suggestion doesn't work, and why making it work has already been rejected.

typeof as an operator has a clear and a well defined behavior, not sure why it is related to this issue..

#21879 does not work because of the generic parameter, and the possibility that the generic parameter does not precisely match the type of foobar.
I am therefore looking for alternatives.
Some way of referencing the actual type of foobar would be such an alternative. This suggestion is that either typeof could be extended to have this function in this use-case, or else another keyword similar to typeof but effectively delaying that evaluation could be a solution.


SwiftUI Publisher Example App

Also I was wondering whether we're happy to take on the additional work of maintaining an extra example app? Do you think that we need to keep both UIKit and SwiftUI examples?

My answer is yes. It's good to have example apps for currently used iOS technology where SwiftUI is a more futuristic approach than UIKit. Maintaining it is not a big deal, and we are sure that ably-cococa and ably aat swift are working properly with SwiftUI.

Are we planning to add a subscriber example app too?

I don't think we need to create a SwiftUI example since we are sure that everything works properly just having the Publisher App. But if you think it's necessary (and why it is?) I can create some simple SwiftUI Subscriber App


SignalSlice Type doesn't match the return object.

can we please add   InitialStateStreams  to the type definition for SignalSlice?
I spent a while trying to figure out why I couldn't see the initial values streams on my state object until I realised that it was missing from the type definition.
@joshuamorony is it intended to be missing at the current stage?

Thanks @LukeEdgecock-Bennett I've put up a PR for this


RigidBody3D and CharacterBody3D do not register collision

Tested versions
Tested in:
v4.3.stable.official [77dcf97d8]
v4.0.stable.official [92bee43ad]
System information
Godot v4.3.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 (NVIDIA; <IP_ADDRESS>34) - AMD Ryzen 5 5600G with Radeon Graphics (12 Threads)
Issue description
When a RigidBody collides with a CharacterBody (e.g. an object falls on top of the player) the RigidBody will register its _on_body_entered event. However, if the CharacterBody collides with the RigidBody (e.g. the player walks into an obstacle), said RigidBody will not have its _on_body_entered event triggered.
In both cases the CharacterBody does register the collision since move_and_slide returns True (as seen in the minimal reproduction project)
Steps to reproduce
Create a RigidBody3D or 2D with a collision shape.
Create a CharacterBody 3D or 2D (matching the RigidBody) with a collision shape.
Create a ground-plane for the RigidBody to sit on, or set RigidBody gravity to 0 to keep it in case (in MRP a ground-plane is added).
Drop the RigidBody on top of the Character by placing it above the CharacterBody. Note how this will trigger a _on_body_entered event.
When the CharacterBody is given a script to move into the RigidBody, the even is not triggered.
Minimal reproduction project (MRP)
MRP.zip

Note that the MRP has both a reproduction for the 2D and 3D setup.

This is a tricky one. Basically, the move_and_slide function does this:

scan ahead
obstacle detected?
change velocity

It's not a real collision in terms of the physics engine.
Best use an Area3D around the player for object interactions.

This is a tricky one. Basically, the move_and_slide function does this:
* scan ahead

* obstacle detected?

* change velocity

It's not a real collision in terms of the physics engine.
Best use an Area3D around the player for object interactions.

In that case should I assume this is intended behaviour?
If so, it feels a bit specific that collisions don't get detected one way, but do get detected the other way


Bug fix: infinite loop when the current working directory doesn't exist

To reproduce:
mkdir /tmp/foo
cd /tmp/foo
rmdir /tmp/foo
exec zsh -f
source ~/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

Press a and zle will hang.

Thanks.  Triaged.  Milestoned 0.9.0 because it's not a regression, though realistically I'd like to see it in 0.8.0 or, failing that, 0.8.1.  No time to test or review right now, sorry.

@romkatv thank you for the minimal reproducer. Thoughts on
diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh
index e59c61c..24d0b75 100644
--- a/highlighters/main/main-highlighter.zsh
+++ b/highlighters/main/main-highlighter.zsh
@@ -1210,6 +1210,9 @@ _zsh_highlight_main_highlighter_check_path()
   # Check if this is a blacklisted path
   if [[ $expanded_path[1] == / ]]; then
     tmp_path=$expanded_path
+  elif ! [[ -e . ]]; then
+    # If $PWD doesn't exist, relative paths are impossible
+    return 1
   else
     tmp_path=$PWD/$expanded_path
   fi

Am I missing an edge case?

No time to test or review right now, sorry.

This is not blocking me in any way (I never delete my current directory), so take your time.

@romkatv thank you for the minimal reproducer. Thoughts on

Your version of the patch has a race condition (so it can still go into an infinite loop) and doesn't colorize any files if the current directory doesn't exist (even though some files could still be colorized).