The rideshare indus­try seems to have been on an unstop­pable tear, run­ning roughshod over reg­u­la­tions, fill­ing the streets with cars, and mak­ing astro­nom­i­cal sums of Wall Street cap­i­tal. But Cal­i­for­nia just tripped up Uber and Lyft’s busi­ness mod­el with pio­neer­ing leg­is­la­tion to rein in the free­wheel­ing ​“gig economy.”

The law, Assem­bly Bill 5 (AB5), passed over­whelm­ing­ly in the Cal­i­for­nia Sen­ate this week and is expect­ed to be signed by Gov­er­nor Gavin New­som soon. It lays out a clear stan­dard, the so-called ​“ABC test,” to ensure employ­ers are prop­er­ly cat­e­go­riz­ing work­ers as inde­pen­dent con­trac­tors, tak­ing into account how much con­trol the com­pa­ny exerts over their work­ing con­di­tions. Under the law, an inde­pen­dent con­trac­tor is defined as a work­er with real auton­o­my: a per­son who (a) is not direct­ly con­trolled by the com­pa­ny, (b) does work in the same trade or field inde­pen­dent of that com­pa­ny, and © is ​“inde­pen­dent­ly estab­lished” as a pro­pri­etor of a sep­a­rate busi­ness in the same sec­tor. Under AB5, if you’re a rideshare dri­ver whose entire liveli­hood depends on the rides your app fun­nels into our smart­phone every hour, you’re like­ly an employ­ee under Cal­i­for­nia law.

The ABC test will cod­i­fy the deci­sion made in a land­mark Cal­i­for­nia Supreme Court case last year, Dynamex Oper­a­tions West, Inc. v. Supe­ri­or Court of Los Ange­les. The Court ruled in favor of deliv­ery ser­vice work­ers who argued they deserved to be clas­si­fied as employ­ees because they were forced to wear the company’s uni­form and dis­play its logo despite being legal­ly deemed ​“inde­pen­dent.” A major goal of the AB5 leg­is­la­tion is to stop employ­ers’ wide­spread abu­sive mis­clas­si­fi­ca­tion of work­ers as inde­pen­dent con­trac­tors, in order to deny them reg­u­lar employ­ment rights and pro­tec­tions, often by insist­ing that their work­ers are mere­ly app users.

Once clas­si­fied as employ­ees under state law, gig work­ers — not just plat­form-based work­ers, but also nail tech­ni­cians, home-repair work­ers and dog walk­ers — would have access to California’s min­i­mum wage, over­time pay, paid rest break, parental leave and work­ers’ compensation.

Yet Uber and Lyft both con­tin­ue to resist AB5, and Uber has even indi­cat­ed that it does not plan to fol­low the law once it goes into effect at the start of 2020. The com­pa­ny argues that nei­ther the com­pa­nies, nor many of their dri­vers, want to be bound by state labor laws and pre­fer to dri­ve Uber as a casu­al side hustle.

But thou­sands of dri­vers are already orga­niz­ing in Cal­i­for­nia for more pow­er over their work­ing con­di­tions. Accord­ing to Bri­an Dol­ber, an orga­niz­er with the Cal­i­for­nia-based Rideshare Dri­vers Unit­ed, a fledg­ling union of 5,000 dri­vers, AB5 paves the way to for­mal union­iza­tion. But Rideshare Dri­vers Unit­ed has not yet decid­ed on what form the union will take. For now, he said, ​“We’re real­ly putting dri­vers’ voic­es first.” Dol­ber added, ​“We want to con­tin­ue orga­niz­ing dri­vers and have dri­vers decide how they want their union to be structured.’

Crit­ics of AB5 point to the poten­tial loss of ​“flex­i­bil­i­ty” once gig work­ers are regard­ed as employ­ees. How­ev­er, labor advo­cates dis­miss the flex­i­bil­i­ty ques­tion as con­cern trolling by the bill’s cor­po­rate foes. Nayan­tara Mehta of the Nation­al Employ­ment Law Project argues that cur­rent labor laws do not auto­mat­i­cal­ly exclude jobs with irreg­u­lar hours, such as union nurs­es and con­struc­tion work­ers, from being employ­ees. Besides, AB5 deals with the degree of con­trol a com­pa­ny exerts over a work­er, not how the sched­ule is set. ​“Courts have found that just because a work­er has a flex­i­ble sched­ule doesn’t mean she is some­how trans­formed into the oper­a­tor of her own busi­ness — the true bench­mark of inde­pen­dent con­trac­tor sta­tus,” writes Mehta.

More­over, the fix­a­tion on flex­i­bil­i­ty elides the real­i­ty of many gig jobs. Work­ers’ sched­ules may be unsta­ble, but not by choice: Often work­ers are glued to their phones so they can scram­ble for what­ev­er rides pop up on their phone, or get paid for each man­i­cure they do or each burg­er they deliv­er. Their pay could be so dis­mal that work­ers ​“flex” them­selves into exhaustion.

“We dri­ve and we dri­ve and we dri­ve,” said Nicole Moore of Rideshare Dri­vers Unit­ed, who helped coor­di­nate a rideshare strike in May. ​“We don’t have din­ner with our kids, we don’t do all the things that we’re sup­posed to be doing in life. Yet we’re expect­ed to pay the rent, we’re expect­ed to put food on the table, and try to make a bet­ter life for our kids.”

This is not the first time Uber’s inde­pen­dent con­trac­tor sys­tem has been chal­lenged. Var­i­ous law­suits in recent months have sought to estab­lish work­ers’ for­mal employ­ment rights, with mixed results. Uber man­aged to wrig­gle out of two law­suits in March, which togeth­er set­tled for $20 mil­lion with 13,600 dri­vers — but did not address their sta­tus as non-employ­ees. Mean­while, grow­ing efforts to orga­nize rideshare dri­vers, par­tic­u­lar­ly the New York Taxi Work­ers Alliance, have helped win increased labor pro­tec­tions at the state and local lev­el, includ­ing a min­i­mum wage for dri­vers in New York City.

Fac­ing the prospect of their pay­rolls becom­ing sad­dled with thou­sands of brand new work­ers, gig-com­pa­ny exec­u­tives are pan­ick­ing. Uber and Lyft spent a total of about $750,000 lob­by­ing the Cal­i­for­nia leg­is­la­ture, along­side oth­er pro­fes­sion­al and indus­try asso­ci­a­tions that sought exemp­tions from the law. In the end, Uber and Lyft were not grant­ed the carve-out they were hop­ing for in the bill, but oth­er trades — includ­ing real estate and insur­ance agents, doc­tors, engi­neers, archi­tects and lawyers — were exempted.

Now Uber, Lyft and Door­Dash are report­ed­ly join­ing forces to fight AB5 using a time-hon­ored Cal­i­for­nia polit­i­cal strat­e­gy: invest­ing $90 mil­lion on a bal­lot ini­tia­tive ask­ing vot­ers to over­turn the law and erect a dif­fer­ent legal régime for gig work­ers, which might include some weak­er ben­e­fits and pay standards.

So the gig econ­o­my’s lead­ing lights are bent on fight­ing the law until the bit­ter end. But in this next round of legal bat­tles, California’s new law, which is based on a Supreme Court rul­ing and reflects grow­ing pub­lic dis­il­lu­sion­ment with the gig econ­o­my titans, might final­ly put the brakes on the plat­form economy’s reg­u­la­to­ry rollbacks.

Moore is hope­ful that the law can help nar­row the gulf between Uber exec­u­tives and dri­vers. ​“There’s no dif­fer­ence between my human­i­ty and their human­i­ty, sha says, adding: ​“The basic Amer­i­can agree­ment is that yes, be inno­v­a­tive, become a mil­lion­aire, build your own busi­ness, but the Amer­i­can com­pro­mise is that you will need to share some of those mil­lions with the peo­ple who do the work in your com­pa­ny, so that they can also afford to take a Lyft.”