[Question] Hue Motion Sensor, green indicator LED

Hi there.  :/
I added the Motion Sensor with the hue app but disabled, switched it off there.
Running the homepridge-hue Plugin on my Raspberry Pi the new Sensor was detected immediately with motion, light and temperature which is great.
I configured a new routine in the Eve App and everything seems to work when motion is detected.
But the green indicator LED on the hue Motion Sensor did not work. I only notice this when I'm in the original hue App and configure the sensor intensity.
What am I doing wrong?
Thanks in advance for you help and reply.

But the green indicator LED on the hue Motion Sensor did not work.

By default, this indication is off.  I don't think you can turn it on using the Hue app.  Using the Hue API, you need to set the ZLLPresence sensor's config.ledindication to true.  Sorry, no support for this yet in homebridge-hue, so you need to use the CLIP API debugger or ph.sh:
ph_put /sensors/xx/config '{"ledindication": true}'

I only notice this when I'm in the original hue App and configure the sensor intensity.

While calibrating the sensor, the Hue app sets config.usertest, which enables the LED indication and makes sure the sensor doesn't go to sleep.  The sensor switches config.usertest off automatically after two minutes.  The sensitivity is set to config.sensitivity.  En/disabling the sensor in the Hue app changes config.on.  The motion sensor still works when this is set, but the resources on the Hue bridge aren't updated, effectively disabling the sensor.

I configured a new routine in the Eve App and everything seems to work when motion is detected.

Yeah, luckily Apple fixed the bug in tvOS 11 (issue #118).

Thanks @ebaauw
I have to ask something else. As mentioned, hue motion sensor is new to me.
Is it correct that I do have to turn hue motion sensor "on" in the hue App to work with homebridge-hue? In the hue App itself all three option with "do nothing". Is that correct? 🤔
Thanks again.

The Hue app just creates rules on the Hue bridge, to turn on or off the lights when motion is detected below a certain ambiant lightlevel.  If you use HomeKit automations instead, you might not need the Hue bridge rules.  homebridge-hue just looks at the sensor resource - it doesn’t need any bridge rules.

Thank you @ebaauw . But the device itself has to be turned "on" in the hue App, although I don't use it HomeKit with the Hue App or anything else like your Plugin? Correct?

For the moment thats.

Yes, that’s what I meant with en/disabling the sensor.  The switch on the first screen links to config.on.

So I understand that everything is okay the way I did it. ;)
One really last question... In the Eve App I see the Light lux sensor which is gerat.
I configured a rule for the bathroom that when motion is detected my speaker turns on.
A second rule when no motion is detected turn the speaker off. I tried to do something more usable not just turning off. Because when under the shower no motion is detected. So I used the lux as a requirement when <X (because the light is off) only then turn off when no motion is detected. But that was not working very reliable because the bathroom door was open or something else.
Any tip how to configure my scenario the best way? When entering the bathroom speaker on and when no movement is detected longer than xx minutes or lux is <X ?? Something like this.
I noticed that the lux is not updating very reliable even when clearly the light from 76.5 lux is switched off so it must be a significant lower lux. But the sensor only updates the lux only when movement is detected. But when I leave the bathroom and then switch off the light there is no motion in the bathroom and lux didn't update. 🙄😬

One really last question

Don't make any promises you cannot keep ;-)

I noticed that the lux is not updating very reliable even when clearly the light from 76.5 lux is switched off so it must be a significant lower lux. But the sensor only updates the lux only when movement is detected.

The sensor wakes up when motion is (no longer) detected to report this change to the Hue bridge.  Changes to light level or temperature don't wakeup the sensor once it's asleep, so it looks like it only updates these when motion has been detected.  If you monitor the sensor's Last Updated, you'll see that it wakes up spontaneously every five minutes to update the lightlevel and temperature (and presence, actually).  So the lights should be turned off in your case, but it might take up to five minutes.

Any tip how to configure my scenario the best way?

The real issue is that you want to turn off the speaker when you leave the bathroom, not when motion is no longer detected.  I implemented this using Hue bridge rules, the motion sensor in the bathroom and and the motion sensor in the connecting room/hallway, in combination with a CLIPGenericStatus sensor that keeps the bathroom state.  See https://github.com/ebaauw/ph.sh.

But when I leave the bathroom and then switch off the light

Huh?!  You want to switch off your speaker automatically, but the lights manually?  That is so 20th century.

Huh?! You want to switch off your speaker automatically, but the lights manually? That is so 20th century.

🤣 You are so right about the light in the bathroom.
And as always, thanks for all the great explanation. 👍🏻

Sorry to hijack the thread, but do you know if the 'heartbeat' can be started and the cache file accessed via the http API? I can't see any reference to it - only for the sdk.

I never used the Hue SDK, only the REST API.  Afaik, the SDK wraps around the REST API, so whatever you do in the SDK (caching, heartbeat) will not be visible in the REST API.  Better ask these kind of questions on the Hue development forum (https://developers.meethue.com/forum).

Thanks!


Network and config files

Hi Andre,
Would it be possible to share the .mibDeep and .migCfg files for the H&E epithelium model?
Thank you!

@ajr82 I have contacted the first author (@SahPet) and he will send me the files soon. I will let you know when they are ready to download :]

@ajr82 seems like people are on winter holiday in Norway this week. Hence, I cannot access and upload the model files until next week.

Hi ajr82!
Sorry about the late reply. Here are the best performing U-nets for the HE-dataset with input 256x256 and 512x512. They are additionally trained with hardmining so slightly better performance than the once in the paper. Ilya Belevic and I have experimented with training Google DeepLabV3plus with Resnet18 as a backbone lately with DeepMIB, which further increases performance (Ilya will probably realease this addtion to DeepMIB shortly). Here are the U-nets (*.mibDeep files) shared on my Google Drive: https://drive.google.com/drive/folders/1CgLdIpiM7Rn2v30V0NLor0tTtZmllD7Y?usp=sharing
There is a bit sparse augmentation during training, so they can probably be further improved with optimization of augmentation settings. I may post a similarly trained deeplabV3plusResnet18 *.mibdeep files here as well shortly.

@SahPet important that we post the models used for the paper here, at least firstly.

Hi @andreped and @SahPet, thank you very much!

Hi again @ajr82! So I added a IBDColEpi HE trained deeplabV3resnet18 *.mibDeep-file now too. It achieves a mean IoU score of 0.9710 on the IBDColEpi dataset. Added to the same folder: https://drive.google.com/drive/folders/1CgLdIpiM7Rn2v30V0NLor0tTtZmllD7Y?usp=sharing
Compared to the U-nets the GPU-requirement for training is much smaller, the size of the mibdeep-file is much smaller, running inference is faster - it's generally quite a bit better than the U-nets. They have a tendency to overfit, but nothing you can't adjust for using heavy augmentation during training. I'm not quite ready to share the mibcfg file yet for this one, need to figure out if it's going to be part of a publication first.

@SahPet important that we post the models used for the paper here, at least firstly.

I'll do that later. We can share additional network files if we want too though.

@ajr82 the best performing models (512, separate models for HE and CD3) have been uploaded to the Google Drive:
https://drive.google.com/drive/folders/1eUVs1DA1UYayUYjr8_aY3O5xDgV1uLvH
Download the zip file "trained-models.zip".
I have also sent a request to DataverseNO to get the models added there as well.
However, we cannot upload the models to the github itself, as github is not meant to store these types of data. They simple are too large. I will update the README when this is done.
Note that you only need the .mibDeep files to use the two models in MIB. The .mibCfg files are not needed.

@andreped and @SahPet Thank you very much!

@SahPet important that we post the models used for the paper here, at least firstly.

It's there now (https://drive.google.com/drive/folders/1CgLdIpiM7Rn2v30V0NLor0tTtZmllD7Y?usp=sharing). We can of course share additional network files if we want too though.

Hi again @ajr82! I was going to add a IBDColEpi HE trained deeplabV3resnet18 *.mibDeep-file, but need to figure out if it's going to be part of a publication first.

It would be nice to see the outcome of this model too. We eventually plan on publishing giving due credit to you both.  If the deeplabv3resnet18 model cannot be used to analyze data that will be published, we will not use it for the publication.

The U-Net model should work quite well. There will always be a better model in the future. We will let you know when it is available.


Unable to connect to the database when building the app (MySQL-MariaDB)

Describe the Bug
Hello, I'm trying to install Umami on my server and I get the following error when I try to build the app following the install page in the docs
Here's a recap from the server
Linux version: Debian GNU/Linux 11 (bullseye)
MariaDB version: mysql Ver 15.1 Distrib 10.5.21-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper
Installed node via fnm.
Node version v20.9.0
NPM version 10.1.0
Yarn version 1.22.21
The git clone https://github.com/umami-software/umami.git command was successfull
Created the .env file with this content:
DATABASE_URL=mysql://stats:<password>@localhost:3306/stats
Note: I am actually able to connect with the command mysql -u stats -p stats as well as via phpMyAdmin version 5.2.1
Note 2: the stats user is granted all privileges on the stats database
Note 3: stats is actually not a reserved word
The yarn install command is working but there are a few warnings (Read that it's not that important on the #2293 issue)
Then the yarn buildcommand fails:

yarn run v1.22.21
$ npm-run-all check-env build-db check-db build-tracker build-geo build-app
$ node scripts/check-env.js
$ npm-run-all copy-db-files build-db-client
$ node scripts/copy-db-files.js
Database type detected: mysql
Copied /home/stats/umami/db/mysql to /home/stats/umami/prisma
$ prisma generate
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (v5.3.1) to ./node_modules/@prisma/client in 138ms

Start using Prisma Client in Node.js (See: https://pris.ly/d/client)
```
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
```
or start using Prisma Client at the edge (See: https://pris.ly/d/accelerate)
```
import { PrismaClient } from '@prisma/client/edge'
const prisma = new PrismaClient()
```

See other ways of importing Prisma Client: http://pris.ly/d/importing-client

$ node scripts/check-db.js
✓ DATABASE_URL is defined.
✗ Unable to connect to the database.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "check-db" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Here's what shows in the MariaDB/MySQL error log:
2023-11-20 20:58:54 76 [Warning] Aborted connection 76 to db: 'unconnected' user: 'unauthenticated' host: '<IP_ADDRESS>' (This connection closed normally without authentication)

Any idea on what is going on or how I could fix this? Thanks!
Note: This is a production server, managed via Virtualmin (NGINX/MariaDB/PHP), and everything is working fine on it.
Database
MySQL
Relevant log output
# Yarn log

yarn run v1.22.21
$ npm-run-all check-env build-db check-db build-tracker build-geo build-app
$ node scripts/check-env.js
$ npm-run-all copy-db-files build-db-client
$ node scripts/copy-db-files.js
Database type detected: mysql
Copied /home/stats/umami/db/mysql to /home/stats/umami/prisma
$ prisma generate
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (v5.3.1) to ./node_modules/@prisma/client in 138ms

Start using Prisma Client in Node.js (See: https://pris.ly/d/client)

import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
```
or start using Prisma Client at the edge (See: https://pris.ly/d/accelerate)
```
import { PrismaClient } from '@prisma/client/edge'
const prisma = new PrismaClient()
```

See other ways of importing Prisma Client: http://pris.ly/d/importing-client

$ node scripts/check-db.js
✓ DATABASE_URL is defined.
✗ Unable to connect to the database.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "check-db" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

# MySQL error log
2023-11-20 20:58:54 76 [Warning] Aborted connection 76 to db: 'unconnected' user: 'unauthenticated' host: '<IP_ADDRESS>' (This connection closed normally without authentication)

Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
Self hosted, Bare Metal server (already in production with several websites on it), Debian 11, Virtualmin, NGINX, PHP-FPM 7.4, Node 20 (LTS)

Finally found where it came from:
My MariaDB install authorized the DB user to connect, but only from localhost host.
Apparently when running the yarn build command, the DB user host is actually <IP_ADDRESS> and not localhost, so that explains why the connections were aborted in the first place.
The solution is to add another user/host couple and allow <IP_ADDRESS> as DB user host.
Closing the issue and hopefully it will help others from Google!


Relax dependency restrictions and fix Travis CI

This was derived from https://github.com/tinfoil/devise-two-factor/pull/70


Formatted code, organized imports and separated tests

Implements #78.

Code cleanup: code formatting and import organization;
Enforced signal processor test and fixed unbound local variable exception when tearing down the default signal processor.

I have to find a better way to assert that the signal processor is being called correctly since raising a warning does not seem to do the trick. I should probably using the warnings package.

If you want to make this project follow PEP8 guidelines, you can pop
 - flake8 .
in the .travis.yml file and something like
flake8==2.4.0
in the requirements.txt file! You can do something similar with import sorting, and I can find that if you're interested.

Thanks. I've used flake8 in the past and found it more annoying than useful especially given the characters per line restriction. I'll stay away from that for now. As for import sorting, good idea, I'll look into it.


How to monitor test error

when I use caffe, I can set the test_interval to monitor how the test error progresses. However, when using caffeonspark, it only shows training error. Is there anything wrong with my solver configuration?
# The train/test net protocol buffer definition
net: "/Users/Red_Hair/Desktop/kaggle_caffe_cnn/kaggle_cnn_stn/kaggle_model_stn.prototxt"
test_net: "/Users/Red_Hair/Desktop/kaggle_caffe_cnn/kaggle_cnn_stn/kaggle_model_stn.prototxt"
# test_iter specifies how many forward passes the test should carry out.
test_iter: 1
# Carry out testing every 500 training iterations.
test_interval: 100
# The base learning rate, momentum and the weight decay of the network.
base_lr: 0.01
momentum: 0.9
weight_decay: 0.0005
# The learning rate policy
lr_policy: "inv"
gamma: 0.0001
power: 0.75
# Display every 100 iterations
display: 50
# The maximum number of iterations
max_iter: 100
# snapshot intermediate results
snapshot: 5000
snapshot_prefix: "mnist_lenet"
# solver mode: CPU or GPU
solver_mode: CPU

Test within training is not supported currently. We expect to have this
function added in coming weeks.
Andy
On Sat, Jun 18, 2016 at 1:27 AM, RedHaur<EMAIL_ADDRESS>wrote:

when I use caffe, I can set the test_interval to monitor how the test
error progresses. However, when using caffeonspark, it only shows training
error. Is there anything wrong with my solver configuration?
The train/test net protocol buffer definition
net: "/Users/Red_Hair/Desktop/kaggle_caffe_cnn/kaggle_cnn_stn/kaggle_model_stn.prototxt"
test_net: "/Users/Red_Hair/Desktop/kaggle_caffe_cnn/kaggle_cnn_stn/kaggle_model_stn.prototxt"
test_iter specifies how many forward passes the test should carry out.
test_iter: 1
Carry out testing every 500 training iterations.
test_interval: 100
The base learning rate, momentum and the weight decay of the network.
base_lr: 0.01
momentum: 0.9
weight_decay: 0.0005
The learning rate policy
lr_policy: "inv"
gamma: 0.0001
power: 0.75
Display every 100 iterations
display: 50
The maximum number of iterations
max_iter: 100
snapshot intermediate results
snapshot: 5000
snapshot_prefix: "mnist_lenet"
solver mode: CPU or GPU
solver_mode: CPU
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/yahoo/CaffeOnSpark/issues/88, or mute the thread
https://github.com/notifications/unsubscribe/AClTePjlrBNH8DLv9ZDTl3S8xiI_KEQZks5qM6v6gaJpZM4I45pf
.

trainwithvalidation is now available. Closing this


Any plans on continuing this?

Hi, as mentioned in the title, do you plan on continuing this wrapper? Implementing searching, creating orders, etc... ?

Hi, sorry for the late reply been pretty busy lately.
I may be looking into implementing authentication which would enable further development like the features you mentioned. Also feel free to contribute if you use it and need these features.


README: Add details for devices registered before PKI

We have users that go to production before they've taken ownership of their PKI. This means the "issuer" of their devices is the Foundries default online CA. We've added a new API to retrieve this so that users can add this value to their allowed CAs list for their EST server.

@mwasilew - FYI. This is what I did to get my device at home working.

LGTM.


Account for max sleep

I've change this to account for max sleep, and I'm now using the suggested macro based approach.

Looks good 👍


Unable to edit Project

ON MAC : ---
If project name is too big then its not wrapping and edit option is not appearing in front of it.
Expected outcome
Edit option should appear.
Actual outcome
I was unable to edit my project since edit option was not appearing.
Versions
App: <IP_ADDRESS>0-stable
Chrome: 54.0.2840.71
Platform: Mac OS X (10_11_4)
Steps to reproduce

Create a project with name larger than the width of left PAN of ARC.

Hi,
Thank you for the issue report. It was fixed with #826
You have old version. Current version is 8.9. Soon you should receive an update from Chrome Web Store.


Combine get_rai() and get_rai_individuals() into new function rai()

Suggested in camtraptor July 2023 coding sprint
get_rai() returns the rai of observations per deployment and species. In contrast with #237, scientificName is always returned.
library(camtraptor)
get_rai(mica, species = "Anas platyrhynchos")
#> There are 3 deployments without observations: 577b543a-2cf1-4b23-b6d2-cda7e2eac372, 62c200a9-0e03-4495-bcd8-032944f6f5a1 and 7ca633fa-64f8-4cfc-a628-6b0c419056d7
#> # A tibble: 4 × 3
#>   deploymentID                         scientificName       rai
#>   <chr>                                <chr>              <dbl>
#> 1 29b7d356-4bb4-4ec4-b792-2af5cc32efa8 Anas platyrhynchos  40.2
#> 2 577b543a-2cf1-4b23-b6d2-cda7e2eac372 Anas platyrhynchos   0
#> 3 62c200a9-0e03-4495-bcd8-032944f6f5a1 Anas platyrhynchos   0
#> 4 7ca633fa-64f8-4cfc-a628-6b0c419056d7 Anas platyrhynchos   0

Created on 2023-07-13 with reprex v2.0.2
get_rai_individuals() returns the rai of individuals per deployment and species. In contrast with #237, scientificName is always returned.
library(camtraptor)
get_rai_individuals(mica, species = "all")
#> # A tibble: 36 × 3
#>    deploymentID                         scientificName       rai
#>    <chr>                                <chr>              <dbl>
#>  1 29b7d356-4bb4-4ec4-b792-2af5cc32efa8 Anas platyrhynchos 131.
#>  2 29b7d356-4bb4-4ec4-b792-2af5cc32efa8 Anas strepera       60.3
#>  3 29b7d356-4bb4-4ec4-b792-2af5cc32efa8 Ardea                0
#>  4 29b7d356-4bb4-4ec4-b792-2af5cc32efa8 Ardea cinerea        0
#>  5 29b7d356-4bb4-4ec4-b792-2af5cc32efa8 Castor fiber         0
#>  6 29b7d356-4bb4-4ec4-b792-2af5cc32efa8 Homo sapiens         0
#>  7 29b7d356-4bb4-4ec4-b792-2af5cc32efa8 Martes foina         0
#>  8 29b7d356-4bb4-4ec4-b792-2af5cc32efa8 Mustela putorius     0
#>  9 29b7d356-4bb4-4ec4-b792-2af5cc32efa8 Vulpes vulpes        0
#> 10 577b543a-2cf1-4b23-b6d2-cda7e2eac372 Anas platyrhynchos   0
#> # ℹ 26 more rows

Created on 2023-07-13 with reprex v2.0.2
We suggest to combine this behaviour into a single function rai() that returns RAI characteristics per deployment and species. Filters are removed from the function, but supported by filters_ functions
get_rai(
  package = NULL,
  group_by = c("deployment", "scientificName") # new param, not sure if other groups make sense
  # ... removed, see filters
  # species = "all" removed, see filters
  # sex = NULL removed, see filters
  # life_stage = NULL, see filters
  # datapkg removed
)

The returned information would be:
deploymentID
scientificName
rai_events # a suggestion, bundles multiple observations within same event to one
rai_observations # same as rai of get_rai
rai_individuals # same as rai of get_rai_individuals

About deprecating vs removing old function: see idea in https://github.com/inbo/camtraptor/issues/237#issuecomment-2247772945


content? method is documented, but is doesn't exist

content? method is documented, but is doesn't exist
https://viewcomponent.org/api.html#content--boolean
Steps to reproduce
Call content? inside a ViewComponent view
Expected behavior
Should return a boolean whether the current component has content or not.
Actual behavior
Raises an exception (NoMethodError)
Gem version: 2.82.0

content? was added in a recent release.


[4.x] Testing tenants is slow

Accordingly to the documentation testing of tenants could be done this way:
<?php

namespace Tests;

use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
    use CreatesApplication;

    protected $tenancy = false;

    public function setUp(): void
    {
        if ($this->tenancy) {
            $this->initializeTenancy();
        }
    }

    public function initializeTenancy($domain = 'test.localhost')
    {
        tenancy()->create($domain);
        tenancy()->init($domain);
    }

    public function tearDown(): void
    {
        config([
            'tenancy.queue_database_deletion' => false,
            'tenancy.delete_database_after_tenant_deletion' => true,
        ]);
        tenancy()->all()->each->delete();

        parent::tearDown();
    }
}

But if there is a lot of tests - it will be very slow. In my case ~3 seconds for each test with more than 1k tests (~50 minutes).

Yeah, it's on my roadmap to make a few traits like those provided by Laravel. (e.g. to only run migrations on phpunit setup rather than every single test setup).
There could be a trait for tests that don't need to know about tenant creation (because they don't test the central app) and only test parts of the tenant app. That trait could create a tenant & DB on phpunit setup and then cleanup after all tests are run.

@stancl I wrote a package the hijacks the Refresh Database trait. I'm not sure, but you may be able to find some useful code in there to make this happen. If I get some free time in the upcoming weeks I might just add it myself. This is a major pain point for us right now too.
https://laravel-news.com/snipe-migrations-laravel-package

Hi @drfraker. Good idea, I'll take a look at your package alongside Laravel traits for some inspiration.

@stancl I also like your idea of a trait that can be added onto test classes to bypass the tenant creation. Like a NoTenants trait. I've also seen where if you add certain keywords to a test name it will do the same thing for more granular control within a test class.
eg. test_it_can_do_something_no_tenants
Within the test case this would be picked up and not add tenants to that particular test. It's helpful when some tests in a class use tenants and others do not. A single trait would not be usable in that case.

to bypass the tenant creation

Just don't do it. Don't create any tenants and just run the tests. The use for that would be limited, though.
I think the opposite would be useful. A trait that creates & deletes the tenant before/after phpunit runs the tests. Any calls related to the current tenant (e.g. tenant-specific calls and inline tenant() calls) require a tenant to be created & identified.
And to test tenant creation using your signup form, you'd use no traits.
So you really only need two things:

a base Laravel TestCase for unit testing classes and feature testing tenant creation
a tenant-aware trait/TestCase that creates & identifies one tenant before the tests and deletes the tenant after the tests

Actually I was thinking about it a bit differently. My thought was to have 1 or more databases for testing tenants. Maybe like tenant_1_db and tenant_2_db. These would be set up beforehand by the developer. Like SnipeMigrations, it will run the migrations once then take a snapshot of the databases in the "clean" state. After initial db intialization by importing the snapshot, the databases would use database transactions for each test so that no actual data gets saved to the test tenant databases. If a tenant migration file changes the app would know about it, re-run the tenant migrations and take a new mysql snapshot for future imports. The "central" database would be pre-seeded with the tenants belonging to the 2 pre-created databases, using custom db names. Snipe already allows a seeder to run before the snapshot is taken.
This way we can avoid the slow part which is database creation and running migrations. Of course if a developer needed more than the pre-provisioned number of tenants for testing they could create a new one in the test. Since this isn't a requirement most of the time the tests should run really fast.
Is there anything that would prevent us from going in this direction?

Hmm, I see. I'll take a deeper look at SnipeMigrations. Skipping the central & tenant DB migration/seeding process even on phpunit setup could speed things up considerably.

This might be related: https://github.com/stancl/tenancy/issues/190#issuecomment-559031731

To add Laravel 7 support faster, I'm putting this off for 2.4.0.

A technique that I'm going to try to adapt is this one that I used to really speed up tests with hyn/multitenant: https://medium.com/@sadnub/faster-multitenant-testing-in-laravel-4769eae4b603. It made a huge difference.
Before that though I need to figure out how to make my existing test work now that I've converted to stancl/tenancy :)
At the moment my problem is that when using a route from within a test e.g.
        $this->post(route('tenant.site.area.store'),
            ['name' => 'New Location'])
            ->assertRedirect(route('tenant.site.area.index'));

I get a 404 error because the url being called is:
https://host.test/site/area
where it should be:
https://tenant.host.test/site/area
The route works fine in the app but the test doesn't know it's in a tenant even though setup has:
        tenancy()->init('testing.host.test');

Any thoughts anyone?

You can specify the domain that the tenant should be redirected to if you enable the TenantRedirect feature.
return redirect()->route(...)->tenant($domain);

Otherwise the app has no way of knowing what domain to use, since tenants can have multiple domains.

Thanks for the response. Don't quite follow how that helps in the test. Certainly with that enabled I can get a redirect to a tenant page:
redirect()->route('tenant.site.area.store')->tenant('testing.host.test')

That works. But I can't post to a route modified by tenant which is what the test needs:
post(route('tenant.site.area.store')->tenant('testing.host.test'),['name' => 'New Location']);

Returns an error: Call to a member function tenant() on string
I would have thought the app/test could know which domain I had initialised from tenancy()->init('testing.host.test');
The app itself is fine because when it is live code the request is coming from the tenant domain. It's only the tests that fail, not the code.

redirect()->route() returns something different than route(). route() returns a string. You need tenant_route() for route strings w/ tenant domains swapped.

I would have thought the app/test could know which domain I had initialised from tenancy()->init('testing.host.test');

No, because testing.host.test is resolved to a tenant id, and each tenant can have an infinite amount of domains.

Thanks - tenant_route() sorted it, I can store the domain in the TenantTestCase and just modify all my tests.
Couldn't find anything in the documentation about the tenant_route() helper but got it in the helpers file.
All the work converting from hyn definitely seems to be worth it though. Great package :)

Looks like this has been added to V3 roadmap 👍🏻
In the meantime has anyone had relative success in setting this up on their own to speed up tests? My current test suite takes about 15 mins to run when using sqlite, and on GitHub actions on a mysql db it takes around 5 hours if it doesn't time out first. It's getting to the point where I will have to try to solve it using @stancl comment from 15 jan as an initial approach. Just wanted to each out and see if anyone has already had any luck with a solution so far.
Cheers 😊

With v3 coming soon, I'd like to make this part of 3.0 or 3.1.

Any updates on this one?

I have had luck using mysql databases. This is a stripped-down version of my test case, the brand model is a wrapper around the tenant this is for V2. The second brand created is used for a couple of edge cases (like making sure commands run for multiple tenants). There are caveats with this approach but if there is interest in this solution I can go into a bit more detail. Running 2000+ tests takes about 5 minutes, was close to an 1+ hours before this change.
abstract class TestCase extends BaseTestCase
{
    use CreatesApplication, RefreshDatabase;

    protected $brand;

    protected bool $tenancy = false;

    protected function setUp(): void
    {
        parent::setUp();

        config(['tenancy.database.prefix' => 'tenant_test_']);
        config(['tenancy.filesystem.suffix_base' => 'tenant_test']);

        if ($this->tenancy) {
            $this->initBrand();

            DB::beginTransaction();
        }
    }

    protected function tearDown(): void
    {
        if ($this->tenancy) {
            DB::rollback();
        }

        parent::tearDown();
    }

    public function initBrand()
    {
        $this->brand = Brand::first();

        Brand::init($this->brand->domain);
    }

    /**
     * Override the refresh trait for the conventional test database.
     *
     * @return void
     */
    protected function refreshTestDatabase()
    {
        config(['tenancy.storage_drivers.db.cache_ttl' => 60]);
        config(['tenancy.database.prefix' => 'tenant_test_']);
        config(['tenancy.filesystem.suffix_base' => 'tenant_test']);

        if (!RefreshDatabaseState::$migrated) {
            $this->artisan('migrate');
            $this->artisan('tenants:migrate');

            if (!Brand::first()) {
                factory(Brand::class)->create([
                    'subdomain' => 'tenant-test',
                ]);
            }
            if (!Brand::skip(1)->first()) {
                factory(Brand::class)->create([
                    'subdomain' => 'tenant-test-2',
                ]);
            }

            $this->app[Kernel::class]->setArtisan(null);

            RefreshDatabaseState::$migrated = true;
        }

        $this->beginDatabaseTransaction();
    }
}

Any updates on this one?

There's this: https://sponsors.tenancyforlaravel.com/frictionless-testing-setup
And I'll be adding database transactions to it soon.

I've run into this issue and wonder what's the best approach currently?

I've run into this issue and wonder what's the best approach currently?

See https://github.com/stancl/tenancy/discussions/579

See https://github.com/stancl/tenancy/discussions/579

@stancl WOW, I only needed to add the following to my testing MySQL Docker container
    tmpfs:
      - /var/lib/mysql

Thank you!

@stancl WOW, I only needed to add the following to my testing MySQL Docker container
    tmpfs:
      - /var/lib/mysql

Thank you!

Is the best practice still reflected in the https://sponsors.tenancyforlaravel.com/frictionless-testing-setup?
It works well.... but it's super slow.  By hooking into the setUp (and tearDown) function, it creates a new tenant for each test method.  Since I create an S3 bucket and Stripe customer whenever a TenantCreated event is called, this obviously adds some overhead to each test method call.  Assuming others have similar Jobs running on the creation of new tenants.
I can't seem to figure out how to create a test tenant once, and clean up once all tests are complete. Is this possible?

@stancl did u add db transactions to it or not ?

Ended up writing my own static method that creates a test tenant once when the first tenant-related test is run. Importantly, this means only one tenant is created.
Additionally, to help with cleanup, this method also keeps track of how many tests need to run, and what the current test is. Then on the last test, it deletes the test tenant (which also triggers the jobs for deleting S3 bucket and Stripe customer).
The trade-off of speed vs. testing best practice (i.e. creating a fresh environment/application for each test) is very clear here. The code I use is super specific to my use case, but happy to answer questions on how it works.
If there's enough interest, I might be able to package it up or create a PR to include as a testing helper trait.

@hackerESQ ur workaround wont work properly in :
php artisan test --parallel

@hackerESQ ur workaround wont work properly in :
php artisan test --parallel

Another tradeoff that is acceptable for my use case...

I was running into this issue as well. I've made a slightly adapted RefreshDatabase trait that works for me. Tests were previously running for more than a second each, with this trait it was reduced back to 300ms (as it was before using multi-database tenancy).
<?php

namespace Tests;

use App\Tenant\Models\Tenant;
use Illuminate\Support\Facades\URL;
use Illuminate\Foundation\Testing\RefreshDatabase;

trait RefreshDatabaseWithTenant
{
    use RefreshDatabase {
        beginDatabaseTransaction as parentBeginDatabaseTransaction;
    }

    /**
     * The database connections that should have transactions.
     *
     * `null` is the default landlord connection
     * `tenant` is the tenant connection
     */
    protected array $connectionsToTransact = [null, 'tenant'];

    /**
     * We need to hook initialize tenancy _before_ we start the database
     * transaction, otherwise it cannot find the tenant connection.
     */
    public function beginDatabaseTransaction()
    {
        $this->initializeTenant();

        $this->parentBeginDatabaseTransaction();
    }

    public function initializeTenant()
    {
        $tenant = Tenant::firstOr(fn () => Tenant::factory()->name('Acme')->create());

        tenancy()->initialize($tenant);

        URL::forceRootUrl('http://acme.localhost');
    }
}

I was running into this issue as well. I've made a slightly adapted RefreshDatabase trait that works for me. Tests were previously running for more than a second each, with this trait it was reduced back to 300ms (as it was before using multi-database tenancy).
....

@erikgaal  solution works great but I can't make it work with --parallel (https://laravel.com/docs/8.x/testing#parallel-testing-and-databases).
Doctrine\DBAL\Driver\PDO\Exception: SQLSTATE[HY000] [1049] Unknown database 'testing_db_test_2'
triying with --recreate-database blindly to see if it works and it does not :p
I will try to go deep to see what is happening

I've been able to use Parallel Testing with php artisan test -p --recreate-databases
<?php

namespace Tests;

use App\Models\Tenant;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\ParallelTesting;
use Illuminate\Support\Facades\URL;

trait RefreshDatabaseWithTenant
{
    use RefreshDatabase {
        beginDatabaseTransaction as parentBeginDatabaseTransaction;
    }

    /**
     * The database connections that should have transactions.
     *
     * `null` is the default landlord connection
     * `tenant` is the tenant connection
     */
    protected array $connectionsToTransact = [null, 'tenant'];

    /**
     * We need to hook initialize tenancy _before_ we start the database
     * transaction, otherwise it cannot find the tenant connection.
     */
    public function beginDatabaseTransaction()
    {
        $this->initializeTenant();

        $this->parentBeginDatabaseTransaction();
    }

    public function initializeTenant()
    {
        $tenantId = 'acme';

        $tenant = Tenant::firstOr(function () use ($tenantId) {
            config(['tenancy.database.prefix' => config('tenancy.database.prefix') . ParallelTesting::token() . '_']);

            $dbName = config('tenancy.database.prefix') . $tenantId;

            DB::unprepared("DROP DATABASE IF EXISTS `{$dbName}`");

            $t = Tenant::create(['id' => $tenantId]);

            if ( ! $t->domains()->count()) {
                $t->domains()->create(['domain' => $tenantId . '.localhost']);
            }

            return $t;
        });

        tenancy()->initialize($tenant);

        URL::forceRootUrl('http://acme.localhost');
    }
}

However, for some tests DatabaseMigrations Trait will be needed instead of RefreshDatabase.
As soon as I need it and get it ready, will also post here.

BTW, did someone find a way to use php artisan schema:dump with multi-database multi-tenancy?

Has anyone been able to get their tests to run fast? None of the above solutions worked for me, not even the one with the sponsors documentation.

any update ? and maybe migrate to using LazilyRefreshDatabase

Nope still slow. Tried a range of things too but it needs to migrate each run. Using on a legacy project and has a lot of migrations.

In my case, I was able to run tests much faster using schema:dump command. To create a tenant schema dump you can run - artisan tenants:run schema:dump

config(['tenancy.database.prefix' => 'tenant_test_']);
        config(['tenancy.filesystem.suffix_base' => 'tenant_test']);

Can you elaborate? Perhaps share some code?

@plakhin did you ever manage to get this to work with DatabaseMigrations, your solution works but it doesn't clear the tables within a test suite. So some of my assertions fail

@francoisauclair911, I've managed to get database refreshing before each test, will post it here later, currently AFK. However it's not as fast as using transactions.

@francoisauclair911.
trait RefreshDatabaseWithTenant
{
    use RefreshDatabase {
        beginDatabaseTransaction as parentBeginDatabaseTransaction;
    }
    ...
    protected static function addAfterClass()
    {
        app()->make('db')->connection()->disconnect();
        tenant()->delete();
    }
    ...

abstract class TestCase extends BaseTestCase
{
    ...
    public static function tearDownAfterClass(): void
    {
        if (method_exists(static::class, 'addAfterClass')) {
            method_exists(static::class, 'addAfterAll')
                ? (new static(fn () => null, '', []))->setUp()
                : (new static())->setUp();
            static::addAfterClass();
        }
        parent::tearDownAfterClass();
    }
    ...

@francoisauclair911.
trait RefreshDatabaseWithTenant
{
    use RefreshDatabase {
        beginDatabaseTransaction as parentBeginDatabaseTransaction;
    }
    ...
    protected static function addAfterClass()
    {
        app()->make('db')->connection()->disconnect();
        tenant()->delete();
    }
    ...

abstract class TestCase extends BaseTestCase
{
    ...
    public static function tearDownAfterClass(): void
    {
        if (method_exists(static::class, 'addAfterClass')) {
            method_exists(static::class, 'addAfterAll')
                ? (new static(fn () => null, '', []))->setUp()
                : (new static())->setUp();
            static::addAfterClass();
        }
        parent::tearDownAfterClass();
    }
    ...

How long would you say it would reduce this Trait?

It depends, just try in your project

I'll reopen this since testing is something we want to focus on in v4 👍🏻

I'll reopen this since testing is something we want to focus on in v4 👍🏻

How are things going with V4?

Here's what I have been using so far and it has been working perfectly
trait WithTenancy
{
    protected function setUpTraits(): array
    {
        $uses = parent::setUpTraits();

        if (isset($uses[WithTenancy::class])) {
            $this->initializeTenancy($uses);
        }

        return $uses;
    }

    protected function initializeTenancy(array $uses): void
    {
        $organization = Organization::firstOr(static fn () => Organization::factory()->create());
        tenancy()->initialize($organization);

        if (isset($uses[DatabaseTransactions::class]) || isset($uses[RefreshDatabase::class])) {
            $this->beginTenantDatabaseTransaction();
        }

        if (isset($uses[DatabaseMigrations::class]) || isset($uses[RefreshDatabase::class])) {
            $this->beforeApplicationDestroyed(function () use ($organization) {
                $organization->delete();
            });
        }
    }

    public function beginTenantDatabaseTransaction(): void
    {
        $database = $this->app->make('db');

        $connection = $database->connection('tenant');
        $dispatcher = $connection->getEventDispatcher();

        $connection->unsetEventDispatcher();
        $connection->beginTransaction();
        $connection->setEventDispatcher($dispatcher);

        $this->beforeApplicationDestroyed(function () use ($database) {
            $connection = $database->connection('tenant');
            $dispatcher = $connection->getEventDispatcher();

            $connection->unsetEventDispatcher();
            $connection->rollBack();
            $connection->setEventDispatcher($dispatcher);
            $connection->disconnect();
        });
    }
}

Then on the tests that need it I just have to reference it like so:
PestPHP
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\WithTenancy;

uses(WithTenancy::class);
uses(DatabaseTransactions::class);

....

PHPUnit
namespace Tests\Feature;

use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\TestCase;
use Tests\WithTenancy;

class ExampleTest extends TestCase
{
	use WithTenancy;
	use DatabaseTransactions;

}

It looks very nice and elegant. But how is the speed? Did you have it in a different way before?

When used with DatabaseTransactions it's very fast (almost like without tenancy) since it only needs to create the tenant database once and then on every subsequent test, it just rolls back any database change done during the test

When used with DatabaseTransactions it's very fast (almost like without tenancy) since it only needs to create the tenant database once and then on every subsequent test, it just rolls back any database change done during the test
PS: I have also setup a custom version of the schema dump functionality for the tenant database

For this to work, do I have to have the database already created and empty?

Fixed in v4

Fixed in v4

When will it be available to the general public?

There's no strict ETA yet. For now it's open in early access to sponsors. See #announcements on our Discord.

Here's what I have been using so far and it has been working perfectly
trait WithTenancy
{
    protected function setUpTraits(): array
    {
        $uses = parent::setUpTraits();

        if (isset($uses[WithTenancy::class])) {
            $this->initializeTenancy($uses);
        }

        return $uses;
    }

    protected function initializeTenancy(array $uses): void
    {
        $organization = Organization::firstOr(static fn () => Organization::factory()->create());
        tenancy()->initialize($organization);

        if (isset($uses[DatabaseTransactions::class]) || isset($uses[RefreshDatabase::class])) {
            $this->beginTenantDatabaseTransaction();
        }

        if (isset($uses[DatabaseMigrations::class]) || isset($uses[RefreshDatabase::class])) {
            $this->beforeApplicationDestroyed(function () use ($organization) {
                $organization->delete();
            });
        }
    }

    public function beginTenantDatabaseTransaction(): void
    {
        $database = $this->app->make('db');

        $connection = $database->connection('tenant');
        $dispatcher = $connection->getEventDispatcher();

        $connection->unsetEventDispatcher();
        $connection->beginTransaction();
        $connection->setEventDispatcher($dispatcher);

        $this->beforeApplicationDestroyed(function () use ($database) {
            $connection = $database->connection('tenant');
            $dispatcher = $connection->getEventDispatcher();

            $connection->unsetEventDispatcher();
            $connection->rollBack();
            $connection->setEventDispatcher($dispatcher);
            $connection->disconnect();
        });
    }
}

Then on the tests that need it I just have to reference it like so:
PestPHP
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\WithTenancy;

uses(WithTenancy::class);
uses(DatabaseTransactions::class);

// ...

PHPUnit
namespace Tests\Feature;

use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\TestCase;
use Tests\WithTenancy;

class ExampleTest extends TestCase
{
	use WithTenancy;
	use DatabaseTransactions;

	// ...
}

Could you share a full implementation with config, testcase and a tenant aware test? :)

@viicslen can you share a complete setup / config? Meaning Pest.php, TestCase, tenant aware test, and a central aware test?

Here is what i have done with mine. I have heavy seeders that import large xmls so i cannot afford to keep migrating and seeding
<?php

namespace Tests;

use App\Models\Tenant;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\URL;

abstract class TestCase extends BaseTestCase
{
    use CreatesApplication;

    protected $tenancy = false;
    /**
     * If true, setup has run at least once.
     *
     * @var boolean
     */
    protected static $setUpRun = false;

    /**
     * Set up the test.
     */
    public function setUp(): void
    {
        parent::setUp();
        if (!static::$setUpRun) {
            Artisan::call('migrate:refresh', ['--seed' => true]);
            static::$setUpRun = true;
            config(['tenancy.database.prefix' => 'yopractice_testing_' . \Str::random() . '_']);
            //create test tenant
            if (!Tenant::count()) {
                $tenant = Tenant::create([
                    'name' => 'Test'
                ]);
                $tenant->createDomain("test");
            }
            //drop our test databases
        }
        if ($this->tenancy) {
            $this->initializeTenancy();
        }
    }

    public function initializeTenancy(): void
    {
        $tenant = Tenant::find(1);
        tenancy()->initialize($tenant);
        URL::forceRootUrl('http://' . $tenant->domains->first()->domain . '.' . config('app.central_domain'));
    }
}

Here's what I have been using so far and it has been working perfectly
trait WithTenancy
{
    protected function setUpTraits(): array
    {
        $uses = parent::setUpTraits();

        if (isset($uses[WithTenancy::class])) {
            $this->initializeTenancy($uses);
        }

        return $uses;
    }

    protected function initializeTenancy(array $uses): void
    {
        $organization = Organization::firstOr(static fn () => Organization::factory()->create());
        tenancy()->initialize($organization);

        if (isset($uses[DatabaseTransactions::class]) || isset($uses[RefreshDatabase::class])) {
            $this->beginTenantDatabaseTransaction();
        }

        if (isset($uses[DatabaseMigrations::class]) || isset($uses[RefreshDatabase::class])) {
            $this->beforeApplicationDestroyed(function () use ($organization) {
                $organization->delete();
            });
        }
    }

    public function beginTenantDatabaseTransaction(): void
    {
        $database = $this->app->make('db');

        $connection = $database->connection('tenant');
        $dispatcher = $connection->getEventDispatcher();

        $connection->unsetEventDispatcher();
        $connection->beginTransaction();
        $connection->setEventDispatcher($dispatcher);

        $this->beforeApplicationDestroyed(function () use ($database) {
            $connection = $database->connection('tenant');
            $dispatcher = $connection->getEventDispatcher();

            $connection->unsetEventDispatcher();
            $connection->rollBack();
            $connection->setEventDispatcher($dispatcher);
            $connection->disconnect();
        });
    }
}

Then on the tests that need it I just have to reference it like so:
PestPHP
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\WithTenancy;

uses(WithTenancy::class);
uses(DatabaseTransactions::class);

// ...

PHPUnit
namespace Tests\Feature;

use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\TestCase;
use Tests\WithTenancy;

class ExampleTest extends TestCase
{
	use WithTenancy;
	use DatabaseTransactions;

	// ...
}

I am having PDOException: SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT trans2 does not exist

In the event it helps someone, here is what I'm doing to test Central and Tenants. I'm using PEST, however it will work just fine with standard PHPUnit.
Database transactions are working for tenants so things are really fast, parallel testing is working, pest is working, code coverage, etc all work.
I'm using Laravel Sail, so you may need to adjust URL's, etc., for other environments.
Of course, make sure you have MySQL setup properly first: https://tenancyforlaravel.com/docs/v3/integrations/sail
Central Tests
<?php

uses(\Illuminate\Foundation\Testing\RefreshDatabase::class);

test('the admin login page returns a successful response', function () {
    $this->get(route('filament.admin.auth.login'))
        ->assertSuccessful();
});

Tenant Tests
<?php

uses(\Tests\Traits\RefreshDatabaseWithTenant::class);

test('the portal login page returns a successful response', function () {
    $this->get(route('filament.portal.auth.login'))
        ->assertSuccessful();
});

Here is my tests/Traits/RefreshDatabaseWithTenant.php. It is based on @plakhin and other's posts from this thread.
<?php

namespace Tests\Traits;

use App\Models\Tenant;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\ParallelTesting;
use Illuminate\Support\Facades\URL;

trait RefreshDatabaseWithTenant
{
    use RefreshDatabase {
        beginDatabaseTransaction as parentBeginDatabaseTransaction;
    }

    /**
     * The database connections that should have transactions.
     *
     * `null` is the default landlord connection, used for system-wide operations.
     * `tenant` is the tenant connection, specific to each tenant in the multi-tenant system.
     */
    protected array $connectionsToTransact = [null, 'tenant'];

    /**
     * We need to hook initialize tenancy _before_ we start the database
     * transaction, otherwise it cannot find the tenant connection.
     * This function initializes the tenant setup before starting a transaction.
     */
    public function beginDatabaseTransaction()
    {
        // Initialize tenant before beginning the database transaction.
        $this->initializeTenant();

        // Continue with the default database transaction setup.
        $this->parentBeginDatabaseTransaction();
    }

    /**
     * Initialize tenant for testing environment.
     * This function sets up a specific tenant for testing purposes.
     */
    public function initializeTenant()
    {
        // Hardcoded tenant ID for testing purposes.
        $tenantId = 'foo';

        // Retrieve or create the tenant with the given ID.
        $tenant = Tenant::firstOr(function () use ($tenantId) {

            /**
             * Set the tenant prefix to the parallel testing token.
             * This is necessary to avoid database collisions when running tests in parallel.
             */
            config(['tenancy.database.prefix' => config('tenancy.database.prefix') . ParallelTesting::token() . '_']);

            // Define the database name for the tenant.
            $dbName = config('tenancy.database.prefix') . $tenantId;

            // Drop the database if it already exists.
            DB::unprepared("DROP DATABASE IF EXISTS `{$dbName}`");

            // Create the tenant and associated domain if they don't exist.
            $t = Tenant::create(['id' => $tenantId]);
            if (!$t->domains()->count()) {
                $t->domains()->create(['domain' => $tenantId]);
            }

            return $t;
        });

        // Initialize tenancy for the current test.
        tenancy()->initialize($tenant);

        // Set the root URL for the current tenant.
        URL::forceRootUrl('http://foo.localhost');
    }
}

Maybe 0.5 to 1s for the trait initialization and then 0.05s to 0.2s per test after that in the same class. Running tests in parallel cut the time down a bit more.  It is very similar to running tests without tenancy with DatabaseTransactions given that it is exactly the same concept.
I do a lot of TDD so slow tests freak me out. 🤣
I'll setup is nearly fully credited to @plakhin (https://github.com/archtechx/tenancy/issues/250#issuecomment-927124384)

The solution @citricguy provided works perfectly. However, I am using SQLite so I had to make some modifications.
For the people interested:
public function initializeTenant()
    {
        // Hardcoded tenant ID for testing purposes.
        $baseDomain = 'dabeda2.test';
        $tenantId = 'pest';
        $tenantDomain = $tenantId.'.'.$baseDomain;

        // Retrieve or create the tenant with the given ID.
        $tenant = Tenant::firstOr(function () use ($tenantId, $tenantDomain) {

            /**
             * Set the tenant prefix to the parallel testing token.
             * This is necessary to avoid database collisions when running tests in parallel.
             */
            config(['tenancy.database.prefix' => config('tenancy.database.prefix').ParallelTesting::token().'_']);

            // Define the database name for the tenant.
            $dbName = config('tenancy.database.prefix').$tenantId;

            // Drop the database if it already exists.
            $dbPath = database_path("{$dbName}");

            // Check if the file exists and delete it
            if (File::exists($dbPath)) {
                File::delete($dbPath);
            }

            // Create the tenant and associated domain if they don't exist.
            $t = Tenant::create(['id' => $tenantId]);
            if (! $t->domains()->count()) {
                $t->domains()->create(['domain' => $tenantDomain]);
            }

            return $t;
        });

        // Initialize tenancy for the current test.
        tenancy()->initialize($tenant);

        // Set the root URL for the current tenant.
        URL::forceRootUrl("http://$tenantDomain");
    }

The solution proposed by @citricguy did it for me. I suggest that a (similar) trait should be included with the package.
These tests all took 1+ seconds before 🚀👏🏼

@citricguy Could you maybe post your Pest.php file and TestCase.php files as well? Just curious about how you implemented them. I keep getting this error:
Illuminate\Database\QueryException: SQLSTATE[25001]: Active sql transaction: 7 ERROR:  CREATE DATABASE cannot run inside a transaction block

@citricguy @karsvaniersel  I have tried following the examples you have proposed and it definitely improved the time it takes to run tests.
However, the trait does not seem to re-initialize the tenant on subsequent tests. The first test always passes, further tests return SQLSTATE[HY000]: General error: 1 no such table: tenants (Connection: sqlite, SQL: select * from "tenants" limit 1)
I am using Pest with Sqlite. Can you see any obvious issues? It never executes the callback of Tenant::firstOr() on any tests except test number one in sequence.
TLDR: Tenant is successfully created on the first test, but never gets refreshed and recreated on future tests and cannot find table tenants.
TestCase
<?php

namespace Tests;

use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Illuminate\Support\Facades\Http;

abstract class TestCase extends BaseTestCase
{
    protected function setUp(): void
    {
        parent::setUp();
        Http::preventStrayRequests();
    }
}

Pest.php
<?php

uses(Tests\TestCase::class)->in('Feature', 'Unit');

expect()->extend('toBeOne', fn () => $this->toBe(1));

Trait
<?php

namespace Tests\Traits;

use App\Models\Tenant;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\ParallelTesting;
use Illuminate\Support\Facades\URL;

trait RefreshDatabaseWithTenant
{
    use RefreshDatabase {
        beginDatabaseTransaction as parentBeginDatabaseTransaction;
    }

    /**
     * The database connections that should have transactions.
     *
     * `null` is the default landlord connection, used for system-wide operations.
     * `tenant` is the tenant connection, specific to each tenant in the multi-tenant system.
     */
    protected array $connectionsToTransact = [null, 'tenant'];

    /**
     * We need to hook initialize tenancy _before_ we start the database
     * transaction, otherwise it cannot find the tenant connection.
     * This function initializes the tenant setup before starting a transaction.
     */
    public function beginDatabaseTransaction()
    {
        // Initialize tenant before beginning the database transaction.
        $this->initializeTenant();
        // Continue with the default database transaction setup.
        $this->parentBeginDatabaseTransaction();

    }

    /**
     * Initialize tenant for testing environment.
     * This function sets up a specific tenant for testing purposes.
     */
    public function initializeTenant()
    {
        // Hardcoded tenant ID for testing purposes.
        $baseDomain = 'domain.test';
        $tenantId = 'pest';
        $tenantDomain = $tenantId.'.'.$baseDomain;

        // Retrieve or create the tenant with the given ID.
        $tenant = Tenant::firstOr(function () use ($tenantId, $tenantDomain) {
            /**
             * Set the tenant prefix to the parallel testing token.
             * This is necessary to avoid database collisions when running tests in parallel.
             */
            config(['tenancy.database.prefix' => config('tenancy.database.prefix').ParallelTesting::token().'_']);

            // Define the database name for the tenant.
            $dbName = config('tenancy.database.prefix').$tenantId;

            // Drop the database if it already exists.
            $dbPath = database_path("{$dbName}");

            // Check if the file exists and delete it
            if (File::exists($dbPath)) {
                File::delete($dbPath);
            }

            // Create the tenant and associated domain if they don't exist.
            $t = Tenant::create(['id' => $tenantId]);
            if (! $t->domains()->count()) {
                $t->domains()->create(['domain' => $tenantDomain]);
            }

            return $t;
        });

        // Initialize tenancy for the current test.
        tenancy()->initialize($tenant);

        // Set the root URL for the current tenant.
        URL::forceRootUrl("http://$tenantDomain");
    }
}

Test
<?php

uses(\Tests\Traits\RefreshDatabaseWithTenant::class);

it('will assert 2 times 2 equals 4', function (): void {
    $this->assertEquals(4, 2 * 2); // always passes
});

it('will assert 2 plus 2 equals 4', function (): void {
    $this->assertEquals(4, 2 + 2); // only passes if the first is removed
});


Gradual typing

Elvish currently lacks a static typing system. The basics could be taken from Typed Racket.
Some points:

Besides typed arguments, functions have typed output. This makes it possible to type-check pipelines.
(Maybe) Instead of requiring type annotations for functions, infer their types.

Open questions:

Should Evaluator be type-aware?

Status quo: The compiler does type checking whenever applicable; the evaluator is purely dynamic. Individual issues will be opened separately.


bundleDependency as a quick attempt work-around for the npm v3 node_m…

…odule topology shift

this should fix the npm v3 perf issue, tested it with other bundledPackages.
I don't have permissions to merge/release so i'll have to sit tight.

Added you to npm and GH, also published as 0.2.3.


Api rate limiting vs resource starvation

[ ] Document "idle time" spent waiting for resources due to api rate limiting
[ ] Determine if increasing api rate limits for Contentful will decrease "idle time" for developers

Aha! Link: https://dfds.aha.io/features/CLOUD-59

I did a test and decreased the limit (on our end) from 55 to 20, about 60% decrease. We run a PR build and Node Page Queries wait time was increased by 60% and Normal Fetching was increased by 30% at the end the build took 33-40% more time than the baseline (55 q/s)


sd_card interfacing error (IDFGH-136)

I am trying to run the example provided with esp-idf at examples/storage/sd_card. I have uncommented the #define USE_SPI_MODE line. After flashing, running make monitor results in the following output:
I (0) cpu_start: App cpu up.
I (209) heap_init: Initializing. RAM available for dynamic allocation:
I (216) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (222) heap_init: At 3FFB2A20 len 0002D5E0 (181 KiB): DRAM
I (228) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (234) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (241) heap_init: At 4008929C len 00016D64 (91 KiB): IRAM
I (247) cpu_start: Pro cpu start user code
I (265) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (267) example: Initializing SD card
I (267) example: Using SPI peripheral
I (267) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
Name: APPSD
Type: SDSC
Speed: default speed
Size: 1904MB
CSD: ver=0, sector_size=512, capacity=3899392 read_bl_len=10
SCR: sd_spec=2, bus_width=5
I (527) example: Opening file
E (527) sdspi_host: sdspi_host_start_command: cmd=24 error=0x108
E (537) sdmmc_cmd: sdmmc_write_sectors_dma: sdmmc_send_cmd returned 0x108
E (537) diskio_sdmmc: sdmmc_write_blocks failed (264)
E (547) sdspi_host: sdspi_host_start_command: cmd=24 error=0x108
E (557) sdmmc_cmd: sdmmc_write_sectors_dma: sdmmc_send_cmd returned 0x108
E (557) diskio_sdmmc: sdmmc_write_blocks failed (264)
I (567) example: File written
I (567) example: Renaming file
Task watchdog got triggered. The following tasks did not reset the watchdog in time:
 - IDLE (CPU 0)
Tasks currently running:
CPU 0: main
CPU 1: IDLE
E (5577) sdspi_host: sdspi_host_start_command: cmd=24 error=0x107
E (5587) sdmmc_cmd: sdmmc_write_sectors_dma: sdmmc_send_cmd returned 0x107
E (5587) diskio_sdmmc: sdmmc_write_blocks failed (263)
E (5597) example: Rename failed

I have tried adding the recommended external pull-up resistors for SD mode to no avail. The hardware connection is as recommended. i.e:
#define PIN_NUM_MISO 2
#define PIN_NUM_MOSI 15
#define PIN_NUM_CLK  14
#define PIN_NUM_CS   13

What may be the cause of the failure?

i have the exact same problem with 1-wire SPI.

Hello @cryarchy and @SebiTimeWaster,
could you please tell me what ESP32 model, board and SD card are you using?
@cryarchy

I have tried adding the recommended external pull-up resistors for SD mode to no avail.

SD mode (SDIO/SDMMC) uses different protocol and GPIO pins number than SPI mode.

I am closing this issue due to no response. Feel free to reopen when needed.


Add a bindable for supported window modes per platform

Most of the time the supported window modes will never change, but some laptops support switching to “tablet” mode, which could potentially remove windowed as an option.
This PR also removes the borderless option from macOS, as there is currently no difference in the implementation between that and fullscreen framework-side (Apple discourages exclusive fullscreen, although it is technically possible).

Looks like alt-enter regressed on macOS.

Looking at it now, will require a change to DesktopGameWindow.CycleMode to fix the shortcut behaviour, and probably a change to TrackedSetting to only show the supported modes.
Since CycleMode is virtual in GameWindow, it might be nice to find a neater way to handle it automatically.

The fullscreen setting OSD in osu! is part of OnScreenDisplay, and is handled automatically with Enum.GetValues.
After discussion with @peppy, it may be enough for now to display all WindowModes in the OSD as we currently do and have alt+enter just skip over the ones that are not available.


Fixed hard coded path to CUDA

Change the path used in head with the relative path that users are able to change. The new path mirrors the path checked in the preceding if.

Base changes were an attempt to apply this to the dev branch first, but github's gui didn't do what I expected. Applied to master then cherry-picked to dev.

Base changes were an attempt to apply this to the dev branch first, but github's gui didn't do what I expected. Applied to master then cherry-picked to dev.


Add scenarios to test payment integration

Scenarios
1-
"""
#. Get wallet
#. Create a reservation, should succeed
#. Make sure you have enough TFT Tokens that cover the reservation amount
#. User should transfer the amount in TFT, should succeed
#. Check if the exact amount left the user wallet, should succeed
#. Check the reservation is Done, should be "deployed"
"""
2-
"""
#. Get wallet
#. Create a broken reservation that will fai later on, reservation state should be "sign"
#. Make sure you have enough TFT Tokens that cover the reservation amount
#. User should transfer the  in TFT, should succeed
#. Check the broken reservation state, should be "Error"
#. Make sure the user got back his TFT
"""
3-
"""
#. Create new wallet with zero TFT, should succeed
#. Create a reservation, reservation state should be "pay"
#. User should pay the farmer, should fail with no enough amount
"""

script:
https://github.com/threefoldtech/jumpscaleX_libs/commit/2b901d210d5157b7ca2b68eb2058eed6d2287d59

Added one more scenario: https://github.com/threefoldtech/jumpscaleX_libs/commit/f25fc417e28ae96e5614dfb6d023045436873316


Bump development deps

This bumps the various pre-commit dependencies and extends codespells reach.

This is ready for review/merge


Roll tester version

Description
Includes a fix to a startup race condition and log truncation that should make sure strings aren't cut off

Need to bump again since meta broke us

Landing to fix build

still lgtm


Add Homebrew formula

Would you please add a Homebrew formula like https://github.com/eugenesvk/homebrew-dupe-krill/blob/main/Formula/dupe-krill.rb (can be autoupdated on releases with this github action https://github.com/marketplace/actions/homebrew-bump-formula) to make deduping easier to install/use?

Does it require any changes to this repo? I think anyone can propose a Homebrew formula – so please do that.

yes it does, I don't know how to track releases on your repo, so I can only create a "static" formula that would need manual version bumps when this repo releases something new as opposed to you adding a CI workflow that does it automatically after each release and updates your tap (or in the future the hombrew core tap)
Re. proposing to include in the main homebrew repo, don't think it's popular enought to be included there (also that would require change from donwloading your released artifacts to a build from source, which I haven't tried as DL is just simpler)

I have tags for releases: https://github.com/kornelski/dupe-krill/tags
I don't know how Homebrew tracks releases, but it manages to do it for my gifski tool :https://github.com/Homebrew/homebrew-core/blob/92bfa4ee6b2841ecbcd272cdebb4cb004b8e585b/Formula/gifski.rb

that may be it https://docs.brew.sh/Brew-Livecheck

Ah, I got confused by a bad memory of failing livechecks due to a change in tagging scheme, but otherwise it's indeed possible to use the linked action to livecheck-poll this repo and upate formula on new tags
Still think it'd be better to have an official formula with an action that's hooked into the app release process directly, but at least the autoupdate issue is solved for me, cheers!

Anyway, the tags exist: https://github.com/kornelski/dupe-krill/tags

The tags exist, but the downloads don't, so I see that workflow failing since it can't download the latest tag


Postal Vita Port issues , green message doesnt dissapear

Hello, i noticed a issue with Postal on ps vita, the message for configuration loading stay in the top left corner, and wont dissapear.
If anyone have a solution, i tried to re install from scratch , remove all my document about lolicon plugin, but the message is still there and wont go away when i play Postal.
It is this port of Postal http://wololo.net/2019/01/06/postal-vita-released-going-postal-on-your-beloved-psvita-is-now-totally-possible/

I mange to "fix it".
Simply re-install LOLIcon.
Then remove ALL lolicon folder in UR0: , when you reboot the vita, error message is going to appear.
So, just open the LOLIcon plugin menu ( arrow up + select ), go to OSD option, put the hide error message on 1. Then SAVE AS MAIN.
When you will load postal next time, maybe you will see the error again, return to the menu of LOLIcon, select again the hide error message and turn it on, then save it for postal. Reload the game and you should be fine.
BTW, the message will still appear as soon as you return into the menu of LOLIcon, so you better not open it again. If you do it, you will have to reload the game to hide the message again.
I hope this can be really fixed because postal is really fun on vita !


this.setState not work in Mixins.

Use react-data-grid to build a grid, using preact-compat + preact-cli but received:
Uncaught (in promise) TypeError: this.setState is not a function
at Object.updateScroll (react-data-grid.js?57d0:13603)
at Object.metricsUpdated (react-data-grid.js?57d0:13603)
at Object.updateMetrics (react-data-grid.js?57d0:5664)
at Object.componentDidMount (react-data-grid.js?57d0:5664)
at Object.chainedFunction [as componentDidMount] (react-data-grid.js?57d0:9915)
at flushMounts (preact.js?10a9:103)     at renderComponent (preact.js?10a9:318)
at rerender (preact.js?10a9:38)     at
console log this on updateScroll when exception,
It seems there is not this.setState, but this.state exists.
check __proto__ too
I think maybe there is some problem to applyMixins to copy methods into react object?
Package Version:
preact: 8.2.6
preact-cli: 1.4.1
preact-compat: 3.17.0
react-data-grid: 2.0.73
preact.config.js
export default function (config, env, helpers) {
  /** you can change config here * */
  config.plugins = config.plugins.filter(v => (v.constructor.name !== 'UglifyJsPlugin'));
  console.log(config.resolve);
}

alias:
   { 'preact-cli-entrypoint': ...,
     style: ...,
     'preact$': ...,
     react: 'preact-compat',
     'react-dom': 'preact-compat',
     'create-react-class': 'preact-compat/lib/create-react-class',
     'react-addons-css-transition-group': 'preact-css-transition-group',
     'preact-cli/async-component': ... } }

alias seems already contain create-react-class.

Hello @jchbh-duplicate ,
i am having the same issue.
Did you find any solution?

Also having this issue. Any solutions to mixins?

Is anyone still using mixins?

With Preact X we removed support for mixins. They've been long deprecated (even in React). Please switch to ES6 classes, plain functions, or hooks to share code across components.


python310Packages.spglib: 2.1.0 -> 2.2.0

Automatic update generated by nixpkgs-update tools. This update was made based on information from passthru.updateScript.
meta.description for python310Packages.spglib is: Python bindings for C library for finding and handling crystal symmetries
meta.homepage for python310Packages.spglib is: https://spglib.github.io/spglib/
meta.changelog for python310Packages.spglib is: https://github.com/spglib/spglib/raw/v2.2.0/ChangeLog
Updates performed

Ran passthru.UpdateScript

To inspect upstream changes
Impact
Checks done

built on NixOS
The tests defined in passthru.tests, if any, passed
found 2.2.0 with grep in /nix/store/r0whl9k62n74q0vm28qp0im96g2f5ci6-python3.10-spglib-2.2.0
found 2.2.0 in filename of file in /nix/store/r0whl9k62n74q0vm28qp0im96g2f5ci6-python3.10-spglib-2.2.0

Rebuild report (if merged into master) (click to expand)

14 total rebuild path(s)

14 package rebuild(s)

First fifty rebuilds by attrpath
python310Packages.atomman
python310Packages.boltztrap2
python310Packages.phonopy
python310Packages.pymatgen
python310Packages.seekpath
python310Packages.spglib
python310Packages.sumo
python311Packages.atomman
python311Packages.boltztrap2
python311Packages.phonopy
python311Packages.pymatgen
python311Packages.seekpath
python311Packages.spglib
python311Packages.sumo

Instructions to test this update (click to expand)

Either download from Cachix:
nix-store -r /nix/store/r0whl9k62n74q0vm28qp0im96g2f5ci6-python3.10-spglib-2.2.0 \
  --option binary-caches 'https://cache.nixos.org/ https://nix-community.cachix.org/' \
  --option trusted-public-keys '
  nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
  cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
  '

(The Cachix cache is only trusted for this store-path realization.)
For the Cachix download to work, your user must be in the trusted-users list or you can use sudo since root is effectively trusted.
Or, build yourself:
nix-build -A python310Packages.spglib https://github.com/r-ryantm/nixpkgs/archive/6152597e3f8ca90b07d79367651145d65a525de7.tar.gz

Or:
nix build github:r-ryantm/nixpkgs/6152597e3f8ca90b07d79367651145d65a525de7#python310Packages.spglib

After you've downloaded or built it, look at the files and if there are any, run the binaries:
ls -la /nix/store/r0whl9k62n74q0vm28qp0im96g2f5ci6-python3.10-spglib-2.2.0
ls -la /nix/store/r0whl9k62n74q0vm28qp0im96g2f5ci6-python3.10-spglib-2.2.0/bin

Pre-merge build results
We have automatically built all packages that will get rebuilt due to
this change.
This gives evidence on whether the upgrade will break dependent packages.
Note sometimes packages show up as failed to build independent of the
change, simply because they are already broken on the target branch.
nixpkgs-review took longer than 45m and timed out

Maintainer pings
cc @PsyanticY for testing.

Already on staging-next.


Linter Idea: DisableLinterReason

This one might be far-fetched, but maybe not. When disabling linters inline, as documented in the README, I want to see a comment above the scss-lint:disable instruction that explains why individual linter(s) are being disabled via source. Therefore:
Bad
// scss-lint:disable BorderZero
p {
  border: none;
}

Good
// This file uses `border: none` for reasons and things. See http://some-discussion.
// scss-lint:disable BorderZero
p {
  border: none;
}

One implementation difficulty would be that I think Sass parses these lines into one comment node, not two. Hrm...

The issue you're referring to about multi-line comments being parsed as a single comment is captured here: #373.
As for the linter request: yes, I think this is an odd thing to lint, but happy to merge a pull request.

Implemented in #519. Thanks!


Please help

Good afternoon, first of all, thank you for your work. It is very interesting. I am a java developer in production so I don't have much expertise in python. When I run the example from your youtube, I will give an error at the end.
Please tell me how much more difficult it would be to apply here rest communication by post request, if not difficult.
below is the description of the error:
(mpt30_final) D:\Develop\NeuronNetwork\Mpt30\mpt_30B_inference>python inference.py
Fetching 1 files: 100%|██████████████████████████████████████████████████████████████████████████| 1/1 [00:00<?, ?it/s]
Traceback (most recent call last):
File "D:\Develop\NeuronNetwork\Mpt30\mpt_30B_inference\inference.py", line 49, in
llm = AutoModelForCausalLM.from_pretrained(
File "C:\Users\j0sch\miniconda3\envs\mpt30_final\lib\site-packages\ctransformers\hub.py", line 157, in from_pretrained
return LLM(
File "C:\Users\j0sch\miniconda3\envs\mpt30_final\lib\site-packages\ctransformers\llm.py", line 203, in init
if not Path(model_path).is_file():
File "C:\Users\j0sch\miniconda3\envs\mpt30_final\lib\pathlib.py", line 958, in new
self = cls._from_parts(args)
File "C:\Users\j0sch\miniconda3\envs\mpt30_final\lib\pathlib.py", line 592, in _from_parts
drv, root, parts = self._parse_args(args)
File "C:\Users\j0sch\miniconda3\envs\mpt30_final\lib\pathlib.py", line 576, in _parse_args
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Found the reason, did not carefully look at your explanations. And thanks again for your work.


Added more explanation around merging.

I had a bit of difficulty figuring out how to use mocha with coveralls. Mocha has its own JSON output, but it is not compatible with coveralls and so the merge silently failed. I had to debug to figure out what was going on. I've added a mocha example to the documentation about merging in external data, and a warning log message if data cannot be merged, so hopefully others will find this painless in future.

That's why the feature is marked experimental in readme ;)

Fair enough! I'm quite happy to have it working. :)
On Wed, Feb 18, 2015 at 1:13 PM, Ilya Baryshev<EMAIL_ADDRESS>wrote:

That's why the feature is marked experimental in readme ;)
—
Reply to this email directly or view it on GitHub
https://github.com/coagulant/coveralls-python/pull/61#issuecomment-74915964
.


Yes, Ipredator supports DNSSEC

Official website of Ipredator states its resolvers support DNSSEC.
Action required: update resolvers list, put “yes” into column “DNSSEC validation”.

Updated, thanks!


Solve FUSE flush issue

solves #17649

alluxio-bot, merge this please

alluxio-bot, merge this please


Investigate if date inputs become gray on Mac Safari; if so, make it darker

Google a11y testers reported that dates (only in the past?) inputted into <input type="date"> fields on macOS Safari render as a light gray, which doesn't have enough contrast to meet a11y standards.

I haven't been able to reproduce on Chrome, and I can't see why this would be happening, but it would be great if someone could try to reproduce the issue.

Is this only on Mac?
Is this only for dates in the past?
Is this only using screen readers?

If we can reproduce this light-gray text problem and can identify when it occurs, let's change it to use darker text that has a contrast ratio of 4.5:1 or greater (as per a11y guidelines).
Tester's original report

ENVIRONMENT:
OS | Browser | Screen Reader
macOS Big Sur:11.4| Safari Version 14.1.1 (166<IP_ADDRESS>.4)
Tool Used: Color contrast Analyser

STEPS TO REPRODUCE:

Browse the above URL on Safari.
Linear navigate to 'Continue' button and activate.
Linear navigate to submit button and activate.
Linear navigate to the 'program for question lifecycle' program and activate the 'Apply' button.
Linear navigate to the 'Continue' button and activate.
Add backdated value for the date (The numeric value will be light gray)
Validate the color contrast of the numeric date value.

ACTUAL RESULT: Date value (light gray on white) has insufficient color
the contrast of 2.4:1

EXPECTED RESULT: Color contrast ratio for regular size text should be at least 4.5:1

Doesn't reproduce on safari on mac.


This will never work with an AMD GPU, even with more than 16GB of VRAM, right?

Even on Linux, can Trellis ever work on an AMD GPU?

PyTorch and llama-cpp work just fine on amd. So it's possible I would imagine.
But I guess if they were gonna do it, they would do it from the start.
They are using libraries like FlexiBox, Kaolin and nvdiffrast which dont support amd.

Don't forget about MacOS too


text marking - fade in animation

Description Issue #92
Added a smooth animation to the text markings
image/video
https://github.com/OpenCovenant/quill/assets/57508905/cb7a9dcb-9d24-42bb-949c-ffda0ffb305d

That looks awesome! Well done. The code looks good from a first look, I guess it should be extended not just to typo markings but to loanword and stylistic markings as well (see line 301 in the same file), but that's trivially doable.
I am trying to think from a user's POV, and I imagine a case in which there is a lot of text in the editor with many markings, and the user types one more word (which will marked), unfortunately from what I can tell all markings (including the previous ones and the new one) will have this fade-in effect, but I believe only the "latest" one should have it (in order to signal to the user that these new markings i.e. the ones with the fade-in effect are the ones that have just been generated, and everything else is as it was). I believe adding such a thing would require some sort of "state" (i.e. knowing which is the latest markings or not) which may or may not

@AndiBraimllari Right, making changes to the .css file will not be enough to achieve this, are you okay with me tinkering with the other files? the problem here is that the elements are being created outside of the html file, since thats the case i need to be able to write some logic within home component or the text-marking am not too sure yet, i have some ideas but i need to test them first.

You're exactly right, home component or the text-marking file is where I'd also focus on, feel free to tinker with these files.
I think it is pretty interesting to design such a change (how do we calculate the state changes? how do we store the "state" to begin with? what should we include in the state? what data structure do we need?). I think tests here are pretty critical (more so from a user's POV, so we know what we want, rather than to actually test the code).
Feel free to ask any questions that come to mind!

@AndiBraimllari Great! I'll go ahead and start working on this then, and if I have any questions regarding the structure of the code or anything else I'll go ahead and let you know.

Awesome, some ideas that are coming to mind.

the state can be Markovian (only the present matters for the future), i.e. we can only keep the last state
perhaps we can store the inner HTML of the editor, then iterate each paragraph (skip the ones that are identical to the current one), and the iterate the children (or markings, or both) of the paragraphs that are different,
cleanup has to be done (remove any CSS classes that aren't relevant, cleanup the state etc)
input of the function that determines which markings should be

old editor
new editor
current markings

and of course the output should be a list of markings that should have the fade-in effect
this function should graciously fail if it is canceled right away (i.e. any styling that is being done will have to be interrupted if the user clears the editor, some other marking occurs etc).

These are some design thoughts that came to mind while thinking about this. Wrote them in case they might be helpful to you, but of course feel free to implement it how you best see fit.

@AndiBraimllari Right! i've applied a few concept including some of the methods you've mentioned, i have come up with a solution but am still not quite happy with it. I might try a few other things before, and do some more testing.
https://github.com/OpenCovenant/quill/assets/57508905/39d392e2-9bd8-4dca-b3a3-684fb58b99a4

Looks very good!
What do you think about this behavior? I feel it is necessary in the cases of text with many markings.
Keep it up, and of course if you'd like to discuss technical details I'm more than happy to do so, simply let me know.

Yes, i agree with you. It makes for a better user experience and will make the service seem more premium. And thank you, i will if i need further guidance.

New Feature Description
You can now expect to get individual animation for any node that has been added, updated, or removed, this includes any node that could be potentially added at any specific index/place.
Issues
As of now, i have yet to run into any issues. I initially wanted to include all of the logic within the home.compoent.ts file however, some delay was occurring which made it difficult to implement within that specific file. Solution: I applied all of the logic within the text-marking.ts which in the end turn out to be the better solution. The code is by no means perfect and any feedback is welcomed.
Demonstration Video
https://github.com/OpenCovenant/quill/assets/57508905/77e7bdec-21e4-4582-80f0-045444b8d4d5
Additional Comments
Feel free to make any suggestion regarding the code structure.
@AndiBraimllari

Hey, I'll write more specific feedback soon. In the meanwhile, can you write some tests for this? Also, you can try running npm run prettier:fix to format it a bit. You can also add function return types to some methods.

I've added some (mostly superficial) comments. Please focus on writing some tests first so we can have some cases to develop and test against.
I will have a deeper look into the logic of this implementation afterwards. Regardless, it seems promising, I simply want to have the code be a bit more rigid.

Details:
@AndiBraimllari Thanks! I appreciate the feedback.

Nested if's - I can definitely break it down a bit further, the only issue i have with the logic is that i will have to move it back to the markText function instead of having it within it's own function, there seems to be something happening when moving the logic within it's own function. Nevertheless, i can reduce and break some stuff down to make it cleaner.

The inline styling - I initially had it as a class but ran into a few issues, i've already fixed those issues so i can definitely switch to a class instead (thanks for reminding me).

Invalid index - That was mainly for me to test a few things, i simply forgot to remove them.

Test cases - i can definitely add some test cases, the existing test cases might need to be updated to work with the current logic do you want me to update them? the span classes will require to have the new class added.

final Comments
Will start working on the changes as soon as possible.

Details:
@AndiBraimllari Thanks! I appreciate the feedback.

Nested if's - I can definitely break it down a bit further, the only issue i have with the logic is that i will have to move it back to the markText function instead of having it within it's own function, there seems to be something happening when moving the logic within it's own function. Nevertheless, i can reduce and break some stuff down to make it cleaner.
The inline styling - I initially had it as a class but ran into a few issues, i've already fixed those issues so i can definitely switch to a class instead (thanks for reminding me).
Invalid index - That was mainly for me to test a few things, i simply forgot to remove them.
Test cases - i can definitely add some test cases, the existing test cases might need to be updated to work with the current logic do you want me to update them? the span classes will require to have the new class added.

final Comments
Will start working on the changes as soon as possible.

Awesome!

Only do such refactoring if you genuinely believe that it will improve readability, if you don't see an easy way of doing it please don't over-engineer it preemptively.
Alright, if you run into issues again you can keep it in-lined again.
Alright.
Yes, please update them.

@AndiBraimllari I will thanks, and yes the last PR i made, i created some changes to clean the code a bit and didn't test it, i assumed that everything was going to work properly but i was wrong. Am almost done with the changes, i updated the logic and seems to be working a lot better. i am however, still working on the test cases, Am currently running into some issues with the old test cases where some nodes (span elements) may sometimes include the new class and sometimes they don't i believe it may have something to do with a delay, since the result always changes, i added a temporary fix where i remove the animation class before comparing the result. I added a few of my own test cases with the animation class and they seem to be working well am not too sure about the others just yet. Maybe you have some ideas about this. I can commit another PR so you can take a look at this more in depth if you want. I've already done all of the clean up and have improved the logic as well.

Hey, no worries, feel free to push all the code here and I will take a look.

@AndiBraimllari Let me know if anything else looks off, i'd be happy to take a look at it and fix it. Regardless, Am still going to be working on this code, and any feedback will help.

I'll provide a proper review within 24 hours!

Something that I noticed while running this. It seems that the second marking does not have this fade-in effect applied. It could be due to the fact that markText is called for each paragraph, https://github.com/OpenCovenant/quill/blob/main/src/app/home/home.component.ts#L248 and that the state that you keep in the variables in the text-marking.ts file is kept across markText calls and that in turn might cause an issue.
Can you confirm that this is a bug?
Screencast from 10-04-2023 10:23:21 PM.webm

Please write a test about this, and push it even if it fails.

You can store such variables (e.g. highlightedMarkingWords, lastHighlightedMarkingWords, ...) in https://github.com/OpenCovenant/quill/blob/main/src/app/home/home.component.ts#L248, so that they pertain to each paragraph call, and they are available in the markText method as arguments, and then you might also not need methods such as isLastCall because you'll know when markText has finished. Let me know if I'm overlooking something

@AndiBraimllari Yes am currently working on that issue. The problem i have here is that with a new line involved there seems to be a seperate p element created containing a different set of typo's, what i need here is the total number of marked text but because the markedText function thats being used from home.component calls this multiple times for every new p element am unable to get the exact total number.

Yup, see my last comment, perhaps you can try storing such code in the home component right before or during each paragraph call to markText. I assume you should have access to what you need there?
By the way, writing such code is not easy, writing the markText method took me some effort, you've already done an impressive job so far :)
If you want me to spend more time with this bug, please let me know and I'll do so.

@AndiBraimllari The isLastcall that i created is based on the total of number of textMarkings but once again because the function is being called multiple times whenever a new line is created am only able to get the total number of typo's from the elements that were from one p. i was trying really hard to avoid using any other components but yeah it would be a lot easier if i can also modify the home.component.ts file

Feel free to make changes anywhere you see fit, no reason for me to stop you from writing a better implementation.

@AndiBraimllari Thanks i will, that's going to make it a bit easier for me to work on this.

@AndiBraimllari Hey sorry it's taking so long, i've already fixed the newline issue, but found yet another thing that needs to be fixed. Am not really sure if your aware or maybe am missing something but there seem to be an issue related to duplicated typo's and spaces where the  hightlighted text for both the space and the duplication seems to disappear after a second call. I though it had something to do with my code but after testing it, i realized it was something outside my own code.
Note: in the video am running the program without my code.
https://github.com/OpenCovenant/quill/assets/57508905/629fade0-7fc5-47ee-aa4e-afb920afb692

Hey, first off, no worries, we don't really have any urgency :)
I'll try to break some things down in a comment below.

You'll notice that we support markings that overlap (imagine an entire sentence marked in blue, and it has a typo, the red and the green marking would both be shown). This is the case for the "asd" marking. The first marking is about consecutively written words, which are usually a writing mistake by the user (this happens basically in any language, in English think of "He was was jogging"), Additionally, the repeated word is a typo, therefore we see such markings as in the screenshot.

Regarding the marking for too many spaces, this one is a bit tricky. To explain this, think of markings for sentences and markings for words on their own. When it comes to processing, the period in a sentence is not necessarily what marks the ending of a sentence, as it can be used for abbreviations (think in English of "He was writing i.e. he was using a pencil.")
The "asd asd" you add in the end of the video seem to throw the processing of the sentence a bit off, and therefore ignoring the multiple spaces marking, which I guess we should improve.

If you believe that any of this prohibits you in implementing this feature, then please let me know (or simply create a ticket and we will highly prioritize it).

@AndiBraimllari Oh i see, but wouldn't the typo still need to be listed on the side and not be taken out, so for example on the first run we had 'asd asd', 'asd', 'asd', ' ', listed and on the second run only 'asd', 'asd', remain, and both the space and the duplicate get taken of the list. Either way if that's normal, then i might have a way to work around it to get my code working properly.

Both markings (multiple subsequent spaces and consecutively repeated word) are implemented at the sentence level (because you need more “context” than just each word in itself, and a sentence basically is defined here if it ends with a comma AND the next word starts with a capital letter (otherwise it could be an abbreviation, hard to tell).
in reality this wouldn’t really be an issue because sentences usually end with a period and thr next letter after that is a capital letter (in your video try writing “Asd asd” in the end instead). I don’t think your code should really depend on such a behavior.
As always, frel free to ping me, happy to help :)

@AndiBraimllari Awesome! I appreciate the explanation. And i will thanks.

Do you plan to make further changes here? Is it ready to be reviewed again?

@AndiBraimllari Yes i believe it should be ready now, Everything seems to run smooth with this new implementation, not a whole lot was changed, i tried making some big changes inside of the home.component but unfortunately, it didn't work out as i plan so i decided to keep it somewhat the same. I tested this for a while now and haven't come up with any bugs except one, but i haven't been able to replicate the bug again. The bug if i remember correctly happen because the number of text markings increased and became greater then the number of words listed, i had printed to the console and saw that the consumableTextMarkings had somehow identified the normal text as typo's, so there was a mixture of both typos and regular text being listing inside of the array. Let me know if there's anything else you want me to do here. Or if you know anything about the bug i mentioned earlier.