
    [No. F073018.
    Fifth Dist.
    May 4, 2017.]
    ASSOCIATION OF IRRITATED RESIDENTS et al., Plaintiffs and Appellants, v. DEPARTMENT OF CONSERVATION, Defendant and Respondent; AERA ENERGY, LLC, Real Party in Interest and Respondent.
    
      Counsel
    William B. Rostov and Irene V. Gutierrez for Plaintiffs and Appellants.
    No appearance for Defendant and Respondent.
    Gibson, Dunn & Crutcher, Jeffrey D. Dintzer, Matthew C. Wickersham and Nathaniel P. Johnson for Real Party in Interest and Respondent.
   Opinion

KANE, Acting P.

Association of Irritated Residents, Center for Biological Diversity and Sierra Club filed a petition for writ of mandate in Kern County Superior Court challenging the actions of the Department of Conservation, Division of Oil, Gas, and Geothermal Resources (DOGGR) in issuing permits for 214 new oil wells in the South Belridge oil field of Kern County. The recipient of the separately issued permits was respondent Aera Energy, LLC (respondent). According to the petition, DOGGR failed to comply with the California Environmental Quality Act (Pub. Resources Code, § 21000 et seq.; CEQA) when it issued each individual permit because, allegedly, no CEQA exemption was applicable and DOGGR failed in each instance to conduct any environmental review. Respondent demurred, arguing that res judicata barred the cause of action stated in appellants’ petition based on a final judgment entered in a prior action in Alameda County (the Alameda action). The trial court agreed and sustained the demurrer without leave to amend. In their appeal from the ensuing judgment of dismissal, appellants contend that res judicata did not apply because the judgment in the Alameda action was not on the merits but, instead, was due to a finding of mootness following the enactment of a new law known as Senate Bill No. 4 (2013-2014 Reg. Sess.). We conclude that appellants are correct, which means the trial court erred in sustaining the demurrer on the ground of res judicata. Accordingly, we reverse the judgment, with directions that the trial court enter a new order overruling said demurrer.

FACTS AND PROCEDURAL BACKGROUND

The Alameda Action

We begin by summarizing the Alameda action, since the judgment in that former litigation was the purported basis for the application of res judicata here.

On October 16, 2012, several environmental organizations, including Center for Biological Diversity, Earthworks, Environmental Working Group, and Sierra Club filed what we refer to as the Alameda action, which was a complaint for declaratory and injunctive relief against DOGGR. The complaint alleged that DOGGR had engaged in a consistent “pattern and practice” of issuing permits for oil and gas wells in California without complying with CEQA. In particular, the complaint stated “DOGGR’s practice of approving permits for oil and gas wells after exempting such projects from environmental review or otherwise issuing boilerplate negative declarations finding no significant impacts from these activities undermines the fundamental review requirements of CEQA.” Allegedly, DOGGR’s failure to comply with CEQA was especially “troubling” in light of the well stimulation treatment known as hydraulic fracturing or fracking that had become common practice at oil and gas wells throughout the state. The complaint described the nature of fracking and alleged the existence of potentially significant environmental impacts caused by it. According to the complaint, DOGGR “does not even mention, let alone analyze or mitigate, the potential impacts from fracking” when it issues permits. More broadly, the complaint alleged that DOGGR’s pattern and practice of permitting oil and gas operations in the absence of appropriate CEQA review “causes permanent and/or long-lasting impacts to water quality, air quality, wildlife ... of the areas affected by oil and gas operations.”

The complaint elaborates that DOGGR allegedly “regularly permits new oil and gas wells without any environmental analysis at all” by categorically excluding such projects from CEQA based on purported exemptions that are wholly inapplicable to such activities. The alleged inapplicable exemptions asserted by DOGGR in permitting new oil and gas wells included purported exemptions for “ ‘Existing Facilities’ ” and for minor alterations to land. In instances where DOGGR elected to prepare negative declarations, such documents were allegedly inadequate because they were merely “boilerplate negative declarations that [did] not provide the required environmental review” and failed to describe or evaluate the impacts of hydraulic fracturing. The complaint’s allegations included several examples of individual wells permitted by DOGGR in 2011 and 2012, which DOGGR had either deemed to be exempt from CEQA or approved based on allegedly inadequate boilerplate negative declarations.

Based on the above allegations, the complaint sought declaratory relief that DOGGR’s “pattern and practice” constituted a violation of CEQA. The declaratory relief allegations framed the issue as follows: “DOGGR’s pattern and practice of approving oil and gas wells without any mention, let alone evaluation or mitigation, of the environmental and public health impacts of oil and gas development, including the effects of hydraulic fracturing, is a violation of CEQA.” The nature of the controversy was set forth in similar terms: “There is a present and actual controversy between Plaintiffs and DOGGR as to the legality of these practices that are of an ongoing nature. DOGGR has prejudicially abused its discretion and not proceeded in a manner required by law in that it repeatedly and as a policy, practice, and/or ongoing conduct issues permits for oil and gas wells without conducting proper CEQA review. [¶] . . . Such conduct by DOGGR irreparably harms and will continue to irreparably harm Plaintiffs in that DOGGR’s actions expose Plaintiffs and the public in general to environmental degradation of the public resources of this state due to its failure to evaluate, understand, and mitigate the impacts of oil and gas development, including the effects of hydraulic fracturing.”

The only other cause of action in the complaint filed in the Alameda action was for injunctive relief. The complaint sought injunctive relief ‘“prohibiting the approval of new oil and gas wells until DOGGR complies with its legal requirements to evaluate and mitigate the significant environmental and public health impacts caused by hydraulic fracturing at oil and gas wells.”

On September 20, 2013, while the Alameda action was pending, Governor Brown signed Senate Bill No. 4 into law. Senate Bill No. 4 sought to redress, in a comprehensive fashion, the lack of adequate information, environmental review and regulation of hydraulic fracturing and other well stimulation techniques. (Stats. 2013, ch. 313, §§ 1, 2; see Sen. Rules Com., Off. of Sen. Floor Analyses, Unfinished Business Analysis of Sen. Bill No. 4, as amended Sept. 6, 2013; Sen. 3d Reading Analysis of Sen. Bill No. 4 as amended Sept. 6, 2013.) The passage of Senate Bill No. 4 led the defendants in intervention in the Alameda action (i.e., Western States Petroleum Association, California Independent Petroleum Association, and Independent Oil Producers Agency) to seek dismissal of that action on the ground that the pattern and practice issues alleged in the complaint had been rendered moot by the new law. Before discussing the ruling on that motion by the trial court in the Alameda action (the Alameda court), we shall first briefly summarize the nature and import of Senate Bill No. 4.

The Enactment of Senate Bill No. 4

In passing Senate Bill No. 4, which took effect on January 1, 2014, the Legislature made findings that included the following: ‘“(a) The hydraulic fracturing of oil and gas wells in combination with technological advances in oil and gas well drilling are spurring oil and gas extraction and exploration in California. Other well stimulation treatments, in addition to hydraulic fracturing, are also critical to boosting oil and gas production. [¶] (b) Insufficient information is available to fully assess the science of the practice of hydraulic fracturing and other well stimulation treatment technologies in California, including environmental, occupational, and public health hazards and risks. [¶] (c) Providing transparency and accountability to the public regarding well stimulation treatments, including, but not limited to, hydraulic fracturing, associated emissions to the environment, and the handling, processing and disposal of well stimulation and related wastes, including from hydraulic fracturing, is of paramount concern.” (Stats. 2013, ch. 313, § 1.)

To accomplish the objectives stated above, Senate Bill No. 4 added a number of new statutory provisions, including sections 3150 to 3161. Sechons 3150 to 3159 establish the operative definitions of some of the essenhal terminology. “ ‘Hydraulic fracturing’ ” is defined as “a well stimulation treatment that, in whole or in part, includes the pressurized injection of hydraulic fracturing fluid or fluids into an underground geological formation in order to fracture or with the intent to fracture the formation, thereby causing or enhancing, for the purposes of this division, the production of oil or gas from a well.” (§ 3152.) “ ‘[Wjell stimulation treatment’ ” is defined as ‘“any treatment of a well designed to enhance oil and gas production or recovery by increasing the permeability of the formation. Well stimulation treatments include, but are not limited to, hydraulic fracturing treatments and acid well stimulation treatments.” (§ 3157, subd. (a).) “ ‘Acid well stimulation treatment’ ” means ‘“a well stimulation treatment that uses, in whole or in part, the application of one or more acids to the well or underground geologic formation. The acid well stimulation treatment may be at any applied pressure and may be used in combination with hydraulic fracturing treatments or other well stimulation treatments.” (§ 3158.)

Sections 3160 and 3161 contain the relevant substanhve terms of Senate Bill No. 4. Under these sechons, the Legislature provided for greater disclosure of information, scientific study, and environmental review of well stimulation treatments, including hydraulic fracturing and acid well stimulation. We briefly highlight below some of the particular measures enacted by the Legislature in these sections of Senate Bill No. 4.

First, by January 1, 2015, the Natural Resources Agency had to ‘“cause to be conducted, and completed,” an independent, peer-reviewed scientific study of well stimulation treatments, including hydraulic fracturing and acid well stimulation treatments. (§ 3160, subd. (a).) The study had to provide an evaluation of ‘“the hazards and risks and potenhal hazards and risks that [such] well stimulation treatments pose to natural resources and public, occupational, and environmental health and safety.” (Ibid.)

Second, by January 1, 2015, DOGGR was required to adopt new regulations specific to hydraulic fracturing and other well stimulation treatments. (§ 3160, subd. (b)(1)(A).) The new regulations were to include, among other provisions, disclosure requirements (such as the composition and disposition of well stimulation fluids), and needed revisions to existing rules and regulations governing construction of wells and well casings to ensure the integrity of wells, well casings, and the geologic and hydrologic isolation of the oil and gas formation during and following well stimulation treatments. (§ 3160, subd. (b)(1)(A).)

Third, Senate Bill No. 4 required that DOGGR prepare a comprehensive environmental impact report (EIR) pursuant to CEQA “to provide the public with detailed information regarding any potential environmental impacts of well stimulation in the state.” (§ 3161, subd. (b)(3)(A).) This EIR had to be certified by DOGGR “no later than July 1, 2015,” and it had to “address the issue of activities that may be conducted as defined in Section 3157 and that may occur at oil wells in the state existing prior to, and after, January 1, 2014.” (§ 3161, subd. (b)(3)(B)(i) & (ii).) In light of the broad scope of this statewide EIR, it appears the Legislature was requiring in this instance the preparation of an overarching or programmatic EIR, as distinguishable from a project-specific review of individual oil and gas wells.

Fourth, Senate Bill No. 4 created a new and distinct permit requirement for conducting a well stimulation treatment on an oil or gas well. Under Senate Bill No. 4, “prior to performing a well stimulation treatment on a well, the operator[] shall apply for a permit” from DOGGR. (§ 3160, subd. (d)(1).) Moreover, a well stimulation treatment “shall not be performed on any well without a valid permit.” (§ 3160, subd. (d)(3)(B).) In an application for a well stimulation treatment permit, the operator was to provide certain information and plan specifications, including the well identity and location, the time period during which the well stimulation treatment was planned to occur, a water management plan, a groundwater monitoring plan, and a description of the setting or proximity of the planned well stimulation treatment in relation to other features that may be impacted by the induced fractures or other modifications. (§ 3160, subd. (d)(l)(A)-(G).) “In considering the permit application, the [head of DOGGR][] shall evaluate the quantifiable risk of the well stimulation treatment.” (§ 3160, subd. (d)(3)(C).)

If granted, the permit is valid for one year. (§ 3160, subd. (d)(4).) Once the permit is issued, tenants and property owners within a specified radius of the well must be notified, and property owners may request water quality sampling and testing, including baseline and followup measurements, regarding any nearby water well or surface water suitable for drinking or irrigation purposes. (§ 3160, subd. (d)(6) & (7).) The operator of the well must provide 72 hours’ advance notice to DOGGR prior to the actual start of the well stimulation treatment in order to allow DOGGR staff to witness the treatment. (§ 3160, subd. (d)(9).)

The permit required by Senate Bill No. 4 for hydraulic fracturing and other forms of well stimulation treatment is separate from and in addition to the permit needed to initially drill (or to redrill) an oil well under section 3203. However, if applied for concurrently, DOGGR has discretion to treat them together as an application for a single, combined authorization. (§ 3160, subd. (d)(2)(A).)

Fifth, until the new regulations were issued and took effect, and while the statewide scientific study and EIR were being completed, the Legislature established a temporary or interim statutory regime to address well stimulation requests by operators between the effective date of Senate Bill No. 4 on January 1, 2014, and the effective date of the new regulations on July 1, 2015. In this regard, section 3161, subdivision (b), provided as follows: “[DOGGR] shall allow, until regulations specified in subdivision (b) of Section 3160 are finalized and implemented, and upon written notification by an operator, all of the activities defined in Section 3157, [i.e., well stimulation treatments, including hydraulic fracturing and acid well stimulation treatments,] provided all of the following conditions are met: [¶] (1) The owner or operator certifies compliance with paragraph (2) of subdivision (b) of, paragraphs (1), (6), and (7) of subdivision (d) of, and paragraph (1) of subdivision (g) of, Section 3160. [¶] (2) The owner or operator shall provide a complete well history, incorporating the information required by Section 3160, to [DOGGR] on or before March 1, 2015. [¶] (3) [¶] (A) [DOGGR] commences the preparation of an environmental impact report (EIR) pursuant to [CEQA], to provide the public with detailed information regarding any potential environmental impacts of well stimulation in the state.[] [¶] . . . [¶] (4) [DOGGR] ensures that all activities pursuant to this section fully conform with this article and other applicable provisions of law on or before December 31, 2015, through a permitting process.” (Italics added.)

Additionally, until the new regulations became effective on July 1, 2015, DOGGR was required to adopt temporary, emergency regulations to implement the above described interim regime set forth in subdivision (b) of section 3161. (§3161, subd. (c).) Among the temporary emergency regulations was California Code of Regulations, title 14, section 1783, subdivision (b) (eff. until July 2015), which stated: ‘“As directed in Public Resources Code section 3161, [DOGGR] must allow, and will allow, well stimulation to proceed if the operator has provided all of the required information and certifications.”

Sixth, and finally, Senate Bill No. 4 “does not relieve [DOGGR] or any other agency from complying with any other provision of existing laws, regulations, and orders.” (§ 3160, subd. (n).) Presumably, this general provision would mean that Senate Bill No. 4 did not relieve DOGGR of its responsibility to comply with CEQA where applicable.

The Dismissal Motion and Judgment in the Alameda Action

Shortly after the enactment of Senate Bill No. 4, the defendants in intervention in the Alameda action (i.e., Western States Petroleum Association, California Independent Petroleum Association, and Independent Oil Producers Agency) filed a motion to dismiss or, alternatively, for judgment on the pleadings. The motion was on the ground that the issues raised in the complaint were rendered moot by the passage of Senate Bill No. 4. Among other things, the motion by the defendants in intervention argued as follows: “Plaintiffs’ Complaint challenges DOGGR’s pattern and practice in approving oil and gas wells involving hydraulic fracturing under CEQA. By this manner of alleging their claims, Plaintiffs have not challenged specific, individual approvals, but rather challenge DOGGR’s ongoing pattern and practice. The pattern and practice alleged by Plaintiffs in their Complaint has ended as a result of the Legislature’s passage of [Senate Bill No.] 4. Any alleged deficiencies in DOGGR’s past pattern and practice are irrelevant to its conduct going forward under the new law. Regardless of whether Plaintiffs agree with the new practice set forth in [Senate Bill No.] 4, that practice has been mandated by the Legislature, and therefore, Plaintiffs’ claims about DOGGR’s prior practice are moot.”

In its written order of January 29, 2014, the Alameda court agreed with the moving parties that the issues raised in the complaint had become moot or otherwise nonjusticiable by virtue of the enactment of Senate Bill No. 4, and on that basis it granted the motion to dismiss and/or for judgment on the pleadings. The Alameda court clarified in its order that it was granting the motion on grounds of both mootness and lack of ripeness: ‘“The Industry Groups[, i.e., the defendants in intervention,] frame the motion as presenting issues of mootness. The court agrees that the issue is one of justiciability generally, but finds that it concerns both ripeness and mootness.”

In its ruling, the Alameda court delineated which claims it considered to be moot and which it considered to be unripe for adjudication. It did so by dividing its justiciability analysis into four parts: (1) DOGGR’s policy or practice before January 1, 2015; (2) DOGGR’s policy or practice after January 1, 2015; (3) DOGGR’s review of individual wells before January 1, 2015; and (4) DOGGR’s review of individual wells after January 1, 2015. As to DOGGR’s policy or practice before January 1, 2015, the court held the “Motion to dismiss as moot is GRANTED.” (Italics added.) The Alameda court found all such claims were moot because, under section 3161, subdivision (b), “[DOGGR] ‘shall allow’ all of the activities defined in Section 3157[, i.e., fracking,] provided certain conditions are met.” Because this new provision gave “clear directions to issue permits if the requirements of [section] 3161 [, subdivision ](b) are met,” the complaint’s challenge to DOGGR’s policy or practice “before 1/1/15” under the prior legal setting was found to be moot. As to DOGGR’s policy or practice “after 1/1/15,” the Alameda court granted the motion to dismiss because the claims were “not ripe.” (Italics added.) The Alameda court held these claims were not ripe for adjudication because the future practices of DOGGR regarding the issue of fracking would presumably be impacted by the results of the scientific study, the EIR, and the future new regulations. At the time of the ruling, the studies and EIR were not completed and new regulations were not in effect. Finally, as to DOGGR’s review of individual wells, whether before or after January 1, 2015, the Alameda court granted the motion to dismiss because ‘“[t]he complaint never sought relief based on DOGGR’s review of individual wells.”

Based on the above analysis, the Alameda court granted the motion and held ”[t]he case is DISMISSED.” On January 29, 2014, a judgment in the Alameda action was entered in favor of the defendants in intervention and DOGGR. No appeal was taken from that judgment.

The Present Action Filed in Kern County

On November 12, 2014, appellants filed a petition for writ of mandate in the Kern County Superior Court. The petition alleged that during the period between July 2014 and the filing of the petition, DOGGR had issued ”214 individual permits to [respondent] to drill new wells in the South Belridge Oil Field . . . without completing the environmental review required by CEQA.” According to the petition, respondent subsequently notified DOGGR of its intention “to use hydraulic fracturing (commonly known as Tracking’) techniques on at least 144 of these wells,” and DOGGR has allegedly allowed respondent’s use of fracking on said 144 wells. However, the petition was not concerned solely with fracking, and it alleged that there were potential adverse environmental impacts with oil drilling and production in general. The petition alleged that DOGGR serves as the “lead agency” for CEQA purposes regarding all oil wells in Kern County. Further, the petition alleged that DOGGR was required to comply with CEQA for each approval of the 214 drilling permits by conducting adequate environmental review in each instance, but it failed to do so. Allegedly, no exemptions to CEQA were applicable. In the prayer for relief, appellants’ petition requested that the trial court set aside its approvals of the 214 drilling permits and order DOGGR to comply with CEQA for each and every one of the 214 drilling permits.

Respondent and DOGGR separately demurred to the petition on distinct grounds. Respondent’s demurrer was on the ground of res judicata, based on the judgment in the Alameda action. Alternatively, respondent argued that Senate Bill No. 4 precluded all of appellants’ CEQA claims because, during the interim statutory regime under section 3161, subdivision (b), well stimulation requests by operators would have to be allowed. DOGGR’s demurrer took a different approach. DOGGR demurred on the ground that exemptions to CEQA were applicable to the permits in question. Although DOGGR’s demurrer is not at issue in the present appeal, we briefly summarize DOGGR’s ground for demurrer in the trial court because it sheds light on DOGGR’s position on the CEQA issues.

DOGGR’s demurrer prefaced its claims of CEQA exemption(s) by informing the trial court of the environmental setting and history of the South Belridge oil field: “The 214 new wells Petitioners challenge are part of the large, established, and densely-developed South Belridge oil field. This oil field has been in existence since long before the enactment of CEQA, and throughout this time, operators have been allowed to drill by right” under the oversight of DOGGR as to “how, when, and where a new well may be drilled.” “The South Belridge oil field is located in Kern County, west of State Route 33, and between the junctions of State Route 45 to the north, and State Route 58 to the south. It is approximately ten miles long by two miles wide, an area covering 12,800 acres of land. [Citation.] The field was discovered in 1911 and has been in operation ever since. The South Belridge oil field contains 29,960 total oil wells, 10,696 of which are currently active. [Citation.] As of 2012, it was the third most productive oil field in California, and the sixth most productive oil field in the United States, producing some 23.6 million barrels of oil. [Citation.] [¶] . . . [¶] When the field operator seeks to add new wells within the South Belridge oil field, the operator must submit a ‘notice of intention to commence drilling’ form, otherwise known as an ‘NOI,’ to [DOGGR]. (Pub. Resources Code, § 3203.) [DOGGR] staff then have 10 working days to either approve the NOI via a ‘Permit to Conduct Well Operations,’ or to ‘require other pertinent information to supplement the notice’ via a ‘Letter of Abeyance.’ (Pub. Resources Code, § 3203.) [¶] Based on the long history of activity in the South Belridge oil field, [DOGGR] staff’s high degree of familiarity with oil extraction methods in the field, and decades-long continuous operations in the South Belridge oil field, [DOGGR] issued approvals in response to the NOIs for the 214 well permits at issue in this litigation. [Citation.] The permits issued in this case were typically conditioned on requirements to prevent ‘blow out’ events at the well head, to ensure adequate cementing and completion of the wells, to conduct mechanical integrity tests, to ensure avoidance of exposure to hydrogen sulfide gas, to ensure proper disposal of drilling fluids (in conformance with Regional Water Quality Control Board standards), and to ensure conformance with statutory requirements regarding any well stimulation activities.” Based on the above quoted description, DOGGR argued that the well approvals at issue were exempt under CEQA under the recognized exemptions for ongoing projects (i.e., the wells were a negligible part of a massive ongoing project in existence pre-CEQA), and for minor alterations of existing facilities.

At the hearing on the demurrer to the petition, the trial court explained it would be overruling DOGGR’s demurrer because it believed that the CEQA exemption issues could not be resolved at the pleading stage in this case, but were more factual in nature. Thus, the oral argument was primarily devoted to respondent’s demurrer on the ground of res judicata. After hearing extensive argument on that issue, the trial court sustained respondent’s res judicata demurrer with leave to amend. All other grounds asserted for demurrer, including the demurrer by DOGGR, were overruled.

On May 15, 2015, appellants filed their first amended petition for writ of mandate (the amended petition) in the trial court, seeking to plead additional facts to address the trial court’s ruling on res judicata. The allegations of the amended petition alleged that the prior judgment in the Alameda action was not on the merits, and it did not concern individual wells. Further, the amended petition clarified DOGGR’s permitting duties, explaining that in order to drill and operate oil wells in California, an operator must first obtain a permit from DOGGR under section 3203, and that permitting of these wells has environmental effects. After Senate Bill No. 4 became law, a permit would also be required to conduct well stimulation activities such as fracking. Allegedly, the notices of intent filed by respondent in seeking each of the 214 permits to drill did not mention respondent’s intention to conduct well stimulation activities such as fracking. After receiving the permits to drill, respondent subsequently filed well stimulation notices pursuant to Senate Bill No. 4, which proposals were approved by DOGGR for at least 144 of the challenged wells.

Respondent once again demurred, asserting that res judicata applied. DOGGR demurred on the same grounds as it did in the first demurrer. The trial court granted judicial notice of the records in the Alameda action relevant to the issue of res judicata. The trial court concluded that appellants’ amended petition involved the same issues (i.e., same cause of action), essentially the same parties, and that the judgment in the Alameda action was on the merits. Therefore, the trial court sustained respondent’s demurrer on res judicata grounds, this time without leave to amend. In light of the res judicata ruling that would terminate the entire action, the trial court found it unnecessary to consider DOGGR’s demurrer.

Based on its demurrer ruling, a judgment of dismissal was entered by the trial court and a notice of entry of judgment was served on November 2, 2015. Appellants’ timely notice of appeal followed.

DISCUSSION

I. Standard of Review

On appeal from a judgment dismissing an action after sustaining a demurrer, we review de novo whether the complaint states facts sufficient to constitute a cause of action under any legal theory. (McCall v. PacifiCare of Cal., Inc. (2001) 25 Cal.4th 412, 415 [106 Cal.Rptr.2d 271, 21 P.3d 1189]; Cantu v. Resolution Trust Corp. (1992) 4 Cal.App.4th 857, 879 [6 Cal.Rptr.2d 151].) “We give the complaint a reasonable interpretation, reading it as a whole and its parts in their context. [Citation.] Further, we treat the demurrer as admitting all material facts properly pleaded, but do not assume the truth of contentions, deductions or conclusions of law.” (City of Dinuba v. County of Tulare (2007) 41 Cal.4th 859, 865 [62 Cal.Rptr.3d 614, 161 P.3d 1168].) In reviewing the sufficiency of the complaint, we may also consider matters that are subject to judicial notice. (Blank v. Kirwan (1985) 39 Cal.3d 311, 318 [216 Cal.Rptr. 718, 703 P.2d 58].)

“[W]hen [a demurrer] is sustained without leave to amend, we decide whether there is a reasonable possibility that the defect can be cured by amendment: if it can be, the trial court has abused its discretion and we reverse; if not, there has been no abuse of discretion and we affirm. [Citations.] The burden of proving such reasonable possibility is squarely on the plaintiff.” (Blank v. Kirwan, supra, 39 Cal.3d at p. 318.)

Because it is a question of law, we review de novo the trial court’s conclusion that res judicata was applicable in this case. (Noble v. Draper (2008) 160 Cal.App.4th 1, 10 [73 Cal.Rptr.3d 3]; Louie v. BFS Retail & Commercial Operations, LLC (2009) 178 Cal.App.4th 1544, 1553 [101 Cal.Rptr.3d 441].)

II. Res Judicata Not Applicable

Appellants contend the trial court erred in applying res judicata because, among other reasons, the judgment in the Alameda action was not on the merits. In discussing appellants’ contention, we begin with a brief overview of the necessary elements for application of res judicata.

A. Overview of Res Judicata

“ ‘Res judicata’ describes the preclusive effect of a final judgment on the merits. Res judicata, or claim preclusion, prevents relitigation of the same cause of action in a second suit between the same parties or parties in privity with them. . . . [Citation.] Under the doctrine of res judicata, if a plaintiff prevails in an action, the cause is merged into the judgment and may not be asserted in a subsequent lawsuit; a judgment for the defendant serves as a bar to further litigation of the same cause of action.” (Mycogen Corp. v. Monsanto Co. (2002) 28 Cal.4th 888, 896-897 [123 Cal.Rptr.2d 432, 51 P.3d 297], fn. omitted (Mycogen).) Three elements must exist for res judicata (or claim preclusion) to apply: “ ‘(1) the decision in the prior proceeding is final and on the merits; (2) the present proceeding is on the same cause of action as the prior proceeding; and (3) the parties in the present proceeding or parties in privity with them were parties to the prior proceeding.’ ” (Planning & Conservation League v. Castaic Lake Water Agency (2009) 180 Cal.App.4th 210, 226 [103 Cal.Rptr.3d 124].) To put it another way, res judicata or claim preclusion ‘“arises if a second suit involves (1) the same cause of action (2) between the same parties [or their privies] (3) after a final judgment on the merits in the first suit.” (DKN Holdings LLC v. Faerber (2015) 61 Cal.4th 813, 824 [189 Cal.Rptr.3d 809, 352 P.3d 378].) “Only a final judgment on the merits between the same parties or their privies and upon the same cause of action is entitled to the res judicata effect of bar or merger.” (Busick v. Workmen’s Comp. Appeals Bd. (1972) 7 Cal.3d 967, 974 [104 Cal.Rptr. 42, 500 P.2d 1386].)

The rationale for applying res judicata where a judgment was on the merits has been explained as follows: ‘“This requirement is derived from the fundamental policy of the doctrine, which gives stability to judgments after the parties have had a fair opportunity to litigate their claims and defenses.” (7 Witkin, Cal. Procedure (5th ed. 2008) Judgment, § 370, p. 994; see Palma v. U.S. Industrial Fasteners, Inc. (1984) 36 Cal.3d 171, 182 [203 Cal.Rptr. 626, 681 P.2d 893] [same].) ‘“The rule is based upon the sound public policy of limiting litigation by preventing a party who has had one fair trial on an issue [or cause of action] from again drawing it into controversy.” (Bernhard v. Bank of America (1942) 19 Cal.2d 807, 811 [122 P.2d 892].)

If the prior judgment was not on the merits, then res judicata is not applicable and it does not have the effect of barring the subsequent action. (See Goddard v. Security Title Ins. & Guar. Co. (1939) 14 Cal.2d 47, 52 [92 P.2d 804] (Goddard) [‘“a judgment not rendered on the merits does not operate as a bar”].) According to appellants, the judgment in the Alameda action was not on the merits because it was grounded on findings of mootness and/or unripeness that did not determine the underlying claims relating to DOGGR’s pattern and practice of failure to comply with CEQA. As set forth in the analysis below, we believe appellants are essentially correct. We begin our discussion by explaining why, as a broad or general principle, a judgment of dismissal entered on grounds of mootness or unripeness would not be on the merits.

B. Judgment Based on Mootness Not on the Merits

“A judgment is on the merits for purposes of res judicata ‘if the substance of the claim is tried and determined . . . .’ [Citation.]” (Johnson v. City of Loma Linda (2000) 24 Cal.4th 61, 77 [99 Cal.Rptr.2d 316, 5 P.3d 874]; see 7 Witkin, Cal. Procedure, supra, Judgment, § 370, p. 995.) This may include a judgment of dismissal following a general demurrer or a dismissal motion if the disposition was plainly reached ‘“on a ground of substance.” (Goddard, supra, 14 Cal.2d at p. 52; see 7 Witkin, Cal. Procedure, supra, Judgment, § 375, pp. 1001-1002.) ‘“[I]t is the nature of the action and the character of the judgment that determines whether it is res judicata.” (Goddard, supra, at p. 54.)

A classic example of a judgment that is not on the merits is one resulting from the defense of laches, because laches ‘“has nothing to do with the merits of the cause against which it is asserted.” (Johnson v. City of Loma Linda, supra, 24 Cal.4th at p. 77 [latches constitutes an affirmative defense “ ‘which does not reach the merits of the cause’ ”].) Other examples of judgments that are not on the merits include the following: a judgment on statute of limitations grounds (Mid-Century Ins. Co. v. Superior Court (2006) 138 Cal.App.4th 769, 776 [41 Cal.Rptr.3d 833] [noting “ ‘ ‘“the purpose served by dismissal on limitations grounds is in no way dependent on nor reflective of the merits—or lack thereof—in the underlying action” ’ ”]; Koch v. Rodlin Enterprises (1990) 223 Cal.App.3d 1591, 1596 [273 Cal.Rptr. 438] [“[t]ermi-nation of an action by a statute of limitations is deemed a technical or procedural, rather than a substantive, termination”]); a judgment based on lack of jurisdiction (Nichols v. Canoga Industries (1978) 83 Cal.App.3d 956, 967 [148 Cal.Rptr. 459]; Finnie v. District No. 1-Pacific Coast Dist. etc. Assn. (1992) 9 Cal.App.4th 1311, 1318-1319 [12 Cal.Rptr.2d 348]); and a judgment or dismissal for lack of prosecution (Mattern v. Carberry (1960) 186 Cal.App.2d 570, 572 [9 Cal.Rptr. 137]). In each of these instances of terminations that were not on the merits, the substance of the underlying claim was never tried or determined; instead, the outcome was reached on procedural or technical grounds that did not resolve or depend on the claim’s merits.

By parity of reasoning, we believe that a judgment entered on the ground of mootness and/or lack of ripeness of the issues is likewise not on the merits. Indeed, as will be seen, such grounds for dismissal are typically reasons for declining to reach the merits. Because the Alameda court purportedly dismissed the Alameda action on the basis that there was no justiciable controversy present due to mootness and unripeness, we now explain the meaning of those two concepts and then apply that discussion to our consideration of the nature of the judgment in the Alameda action.

“California courts will decide only justiciable controversies. [Citations.] The concept of justiciability is a tenet of common law jurisprudence and embodies ‘[t]he principle that courts will not entertain an action which is not founded on an actual controversy . . . .’ [Citations.] Justiciability thus ‘involves the intertwined criteria of ripeness and standing. A controversy is “ripe” when it has reached, but has not passed, the point that the facts have sufficiently congealed to permit an intelligent and useful decision to be made.’ [Citation.] But ‘ripeness is not a static state’ [citation], and a case that presents a true controversy at its inception becomes moot ‘ “if before decision it has, through act of the parties or other cause, occurring after the commencement of the action, lost that essential character” ’ [citation].” (Wilson & Wilson v. City Council of Redwood City (2011) 191 Cal.App.4th 1559, 1573 [120 Cal.Rptr.3d 665] (Wilson & Wilson).)

A claim is unripe for adjudication where there is not an actual controversy within the context of a sufficiently definite or concrete set of facts, such as where “ ‘parties seek a judicial declaration on a question of law, though no actual dispute or controversy ever existed between them requiring the declaration for its determination.’ ” (Wilson & Wilson, supra, 191 Cal.App.4th at p. 1573.) The ripeness requirement prevents courts from issuing purely advisory or hypothetical opinions. (Pacific Legal Foundation v. California Coasted Com. (1982) 33 Cal.3d 158, 170 [188 Cal.Rptr. 104, 655 P.2d 306]; see 1A Cal.Jur.3d (2014) Actions, § 39, pp. 83-85.) It is “primarily bottomed on the recognition that judicial decisionmaking is best conducted in the context of an actual set of facts so that the issues will be framed with sufficient definiteness to enable the court to make a decree finally disposing of the controversy.” (Pacific Legal Foundation v. California Coasted Com., supra, at p. 170.)

Moot cases entail the same justiciability concerns, but are “ ‘[t]hose in which an actual controversy did exist but, by the passage of time or a change in circumstances, ceased to exist.’ ” (Wilson & Wilson, supra, 191 Cal.App.4th at p. 1573.) “A case is considered moot when ‘the question addressed was at one time a live issue in the case,’ but has been deprived of life ‘because of events occurring after the judicial process was initiated.’ ” (Id. at p. 1574.) In summary, a moot case is one in which there may have been an actual or ripe controversy at the outset, but due to intervening events, the case has lost that essential character and, thus, no longer presents a viable context in which the court can grant effectual relief to resolve the matter. (Ibid.)

A few examples may clarify how events occurring after the commencement of a case can result in its mootness. For instance, a lawsuit challenging the validity of city resolutions to approve the construction of a retail development project became moot once that project was substantially completed. (Wilson & Wilson, supra, 191 Cal.App.4th at pp. 1575-1580, 1585.) A proceeding challenging a civil service eligibility list promulgated by the county civil service commission was found to be moot once the former list had expired and been superseded by a new list. (Wilson v. L. A. County Civil Service Com. (1952) 112 Cal.App.2d 450, 453-454 [246 P.2d 688]; see Daily Journal Corp. v. County of Los Angeles (2009) 172 Cal.App.4th 1550, 1557 [92 Cal.Rptr.3d 219] [case moot where challenged contract had expired, a new bidding process took place, and the court could not award the contract to disappointed bidder].) Moreover, an intervening change in the law that is the crux of a case may result in mootness. For example, repeal or modification of a statute under attack, or subsequent legislation correcting a challenged deficiency, can render a case moot. (See, e.g., Callie v. Board of Supervisors (1969) 1 Cal.App.3d 13, 18 [81 Cal.Rptr. 440]; Bravo Vending v. City of Rancho Mirage (1993) 16 Cal.App.4th 383, 393 [20 Cal.Rptr.2d 164]; see also Colony Cove Properties, LLC v. City of Carson (2010) 187 Cal.App.4th 1487, 1509 [114 Cal.Rptr.3d 822] [challenged moratorium ordinance had expired; thus, the challenge was moot]; cf. Davis v. Superior Court (1985) 169 Cal.App.3d 1054, 1057-1058 [215 Cal.Rptr. 721] [“enactment of subsequent legislation does not automatically render a matter moot [since] [t]he superseding changes may or may not moot the original challenges”].)

In East Bay Mun. Utility Dist. v. Department of Forestry & Fire Protection (1996) 43 Cal.App.4th 1113 [51 Cal.Rptr.2d 299], the petitioners challenged the pattern and practice of the defendant, Department of Forestry and Fire Protection (CDF), in causes of action for declaratory and injunctive relief. Allegedly, CDF’s pattern and practice did not comply with CEQA regarding timber harvest plans. The petitioners had also challenged, by writ of mandate, the adequacy of a particular timber harvest plan. (East Bay, supra, at p. 1119.) Prior to trial of the declaratory relief action, but after a negative ruling on the writ proceeding, CDF adopted a new policy that changed its requirements and practices for timber harvest notices in a way that corrected the challenged deficiencies. As a result of CDF’s new policy, the trial court denied declaratory and injunctive relief. The Court of Appeal affirmed, explaining there was no longer an ongoing controversy: “[T]he trial court could reasonably conclude that once CDF had changed its policy, there was no longer an ongoing controversy because the challenged practice had been abandoned.” {Id. at p. 1132.) Although the opinion did not label the resulting lack of an ongoing controversy as mootness, in essence that is what it was. As correctly noted by appellants, East Bay’s outcome is similar in rationale to the decision in the Alameda action. Both apparently found no actual or justiciable controversy existed after a material change occurred to the policy or law upon which the original claim had rested.

Regardless of the nature of the intervening events that lead to a finding of mootness, a common denominator in mootness cases is that the court expressly or impliedly concludes there is no longer an existing controversy before it upon which effectual relief may be granted. This is true by definition—i.e., the lack of an actual justiciable controversy is what constitutes both mootness and unripeness. (Wilson & Wilson, supra, 191 Cal.App.4th at pp. 1573-1574.) Since, when mootness is found, the court is saying in essence there is no ongoing justiciable controversy before it, such a finding leads to a decision to dismiss the action without reaching the merits of the underlying claim. The following quotations serve to substantiate these points. “ ‘ ‘“A judicial tribunal ordinarily may consider and determine only an existing controversy, and not a moot question or abstract proposition.” ’ ” (Consumer Cause, Inc. v. Johnson & Johnson (2005) 132 Cal.App.4th 1175, 1183 [34 Cal.Rptr.3d 258].) The duty of every court “ ‘is to decide actual controversies by a judgment which can be carried into effect, and not to give opinions upon moot questions or abstract propositions, or to declare principles or rules of law which cannot affect the matter in issue in the case before it.’ ” (Consol, etc. Corp. v. United A. etc. Workers (1946) 27 Cal.2d 859, 863 [167 P.2d 725] [dismissal of appeal warranted if issue moot].) Again, “ ‘[although a case may originally present an existing controversy, if before decision it has, through act of the parties or other cause, occurring after the commencement of the action, lost that essential character, it becomes a moot case or question which will not be considered by the court.’ ” (3 Witkin, Cal. Procedure, supra, Actions, § 32, p. 98, italics added, quoting Wilson v. L. A. County Civil Service Com., supra, 112 Cal.App.2d at p. 453.) Where such mootness exists, proceeding further with the case “ ‘can have no practical effect or cannot provide the parties with effective relief. [Citation.]’ ” (People v. Risk (2008) 163 Cal.App.4th 1370, 1380 [78 Cal.Rptr.3d 455].) “When events render a case moot, the court, whether trial or appellate, should generally dismiss it.” (Wilson & Wilson, supra, at p. 1574; accord, Consumer Cause, Inc. v. Johnson & Johnson, supra, at p. 1183 [once previously ripe case became moot because ‘“plaintiff discovered that the allegations of the complaint were wrong,” i.e., the defendants were not violating the statute at issue, there was ‘“no longer a controversy before the trial court, and the court should have exercised its discretion by refusing to decide it”].)

Based on the foregoing summary of the law, we believe that a judgment of dismissal based on a finding of mootness or lack of ripeness is not a determination of the substance of the underlying claim; that is, it is not on the merits. This observation follows from what we have said about the nature of such grounds for dismissal, including that mootness and unripeness are about justiciability (as distinct from the substance of the claims) and typically function as reasons for declining to reach the merits, due to the perceived lack of justiciability. Moreover, in view of our discussion regarding res judicata and the concepts of mootness/ripeness, we believe that where a court decides that a claim is moot or unripe, and dismisses the claim on that basis, the resulting judgment of dismissal would be on technical or procedural grounds that are distinct from an actual determination of the substance of the claim. In short, such a judgment would not be on the merits.

C. The Judgment in the Alameda Action

According to appellants, the judgment in the Alameda action was clearly and specifically premised on the Alameda court’s finding that the statutory claims in that case were rendered moot or unripe by the passage of Senate Bill No. 4. Respondent counters that in the process of discussing mootness, the Alameda court actually reached and determined the merits. In our opinion, appellants’ position is the correct one. As confirmation of why this is so, we briefly reiterate the context and nature of the judgment in the Alameda action.

Soon after the enactment of Senate Bill No. 4, the defendants in intervention in the Alameda action filed their motion to dismiss or, alternatively, for a judgment on the pleadings. The motion was on the ground that the issues raised in the complaint were mooted by the passage of Senate Bill No. 4. In essence, the motion asserted that in light of the comprehensive changes to the applicable law brought about by the passage of Senate Bill No. 4, the allegations relating to DOGGR’s historical pattern and practice were no longer relevant. In its written order of January 29, 2014, the Alameda court agreed with the moving parties that the issues raised in the complaint had become moot or otherwise nonjusticiable by virtue of the enactment of Senate Bill No. 4 and, on that basis, it granted the motion to dismiss and/or for judgment on the pleadings. In so ruling, the Alameda court appears to have accepted the rationale that because Senate Bill No. 4 enacted significant new directives and comprehensive solutions to the problem of lack of adequate review of fracking and other well stimulation treatments, DOGGR’s former pattern and practice was no longer at issue or relevant. The Alameda court expressly stated in its order that it was granting the motion on grounds of both mootness and lack of ripeness: “The Industry Groups[, i.e., the defendants in intervention,] frame the motion as presenting issues of mootness. The court agrees that the issue is one of justiciability generally, but finds that it concerns both ripeness and mootness.”

As noted, the Alameda court delineated which claims it considered to be moot and which it considered to be unripe for adjudication. It did so by dividing its justiciability analysis into four parts: (1) DOGGR’s policy or practice before January 1, 2015; (2) DOGGR’s policy or practice after January 1, 2015; (3) DOGGR’s review of individual wells before January 1, 2015; and (4) DOGGR’s review of individual wells after January 1, 2015. As to DOGGR’s policy or practice before January 1, 2015, the court held the “Motion to dismiss as moot is GRANTED.” (Italics added.) The Alameda court found all such claims were moot because, under section 3161, subdivision (b), “[DOGGR] ‘shall allow’ all of the activities defined in Section 3157[, i.e., fracking,] provided certain conditions are met.” Because this new provision gave “clear directions to issue permits if the requirements of [section] 3161 [, subdivision ](b) are met,” the complaint’s challenge to DOGGR’s policy or practice “before 1/1/15” under the prior legal landscape was found to be moot. As to DOGGR’s policy or practice “after 1/1/15,” the Alameda court granted the motion to dismiss because the claims were “not ripe.” (Italics added.) The Alameda court held these claims were not ripe for adjudication because the future practices of DOGGR on the issue of fracking would presumably be impacted by the results of the scientific study, the EIR, and future new regulations. At the time of the ruling, the studies and EIR were not completed and new regulations were not in effect. Finally, as to DOGGR’s review of individual wells, whether before or after January 1, 2015, the Alameda court granted the motion to dismiss because “[t]he complaint never sought relief based on DOGGR’s review of individual wells.”

Based on the above mootness/unripeness analysis, the Alameda court granted the motion and held “[t]he case is DISMISSED.” On January 29, 2014, a judgment in the Alameda action was entered in favor of the defendants in intervention and DOGGR. No appeal was taken from that judgment.

We think the Alameda court made it sufficiently clear that its ruling was on the grounds of mootness and lack of ripeness. As the order in that action reflects, the court was not resolving the merits of the underlying claims as to DOGGR’s prior policies, patterns and/or practices because the legal or statutory landscape governing DOGGR’s responsibilities had so significantly changed due to the enactment of Senate Bill No. 4. In other words, the Alameda court did not address whether DOGGR had complied with CEQA in the past since doing so was unnecessary or pointless; the new law, with its new directives—which would govern decisions and practices moving forward—eliminated the need to examine past practices. Thus, instead of reaching the substance of the underlying claims, the Alameda court expressly announced that it was dismissing the action on justiciability grounds due to both mootness and lack of ripeness. Because that is so, we conclude the judgment in the Alameda action was not on the merits and, hence, cannot support res judicata.

D. Respondent’s Argument

We briefly address respondent’s position on this issue. Respondent argues the Alameda court did reach the merits, in light of the fact that in the court’s written order it spelled out certain ramifications of Senate Bill No. 4 on the matter of DOGGR’s role with respect to well operators’ requests to engage in fracking. In particular, the Alameda court noted that Senate Bill No. 4’s “shall allow” language in section 3161, subdivision (b), would require DOGGR to grant approval to fracking requests during the interim period set forth in that subdivision if the operators in question met all of the statutory conditions. We disagree with respondent’s argument that the Alameda court, by making such comments about Senate Bill No. 4, was actually reaching and determining the substance of the underlying pattern and practice claims. Rather, in our interpretation of the Alameda court’s order, the court was stating its understanding of one of the significant impacts of Senate Bill No. 4 for the purpose of demonstrating that the pattern and practice claims were rendered moot. The Alameda court was saying, in effect, whatever DOGGR may have been required to do under the past legal setting, under Senate Bill No. 4 it was now required to issue permits for fracking where the statutory conditions of section 3161, subdivision (b), were met. In so stating, the Alameda court was laboring to show that under Senate Bill No. 4 the law had so significantly changed that it would make no sense to attempt to address the past pattern and practice claims alleged against DOGGR in that case. In short, the Alameda court was justifying its finding of mootness, and it did so by using a specific example of how the new law would bring material changes to DOGGR’s approach and responsibilities relating to requests for fracking. For these reasons, we conclude the crux of the Alameda court’s ruling was mootness, not a determination of the merits. In the final analysis, respondent’s arguments on this point are not persuasive.

For similar reasons, we reject respondent’s suggestion that the Alameda court’s observations about the impact of section 3161, subdivision (b), amounted to the actual adjudication of a substantive defense that led to the complaint’s dismissal. To reiterate, the Alameda court was simply explaining its mootness ruling, not disposing of the case based on a defense. In so holding, we are not denying the relevance of the terms of section 3161, subdivision (b), to the question of whether or not DOGGR complied with its legal responsibilities in approving fracking on a particular occasion, assuming the approval in question was within the parameters of that subdivision. What we are saying is that, regardless of the extent to which this statutory provision (§3161, subd. (b)) may be asserted for that purpose, the Alameda court did not dismiss the Alameda action due to a determination of a defense thereto. To the contrary, the record shows that the Alameda court dismissed that action based on its assessment that the substance of the underlying claims was not justiciable due to mootness and unripeness.

E. Other Res Judicata Issue

In addition to their assertion that the judgment in the Alameda action was not on the merits, appellants also argue in their appeal that res judicata was inapplicable for a second reason: namely, that the Alameda action did not involve the same cause of action as in the present case. One of the elements of res judicata is that the two proceedings involve the same cause of action. (Mycogen, supra, 28 Cal.4th at pp. 896-897.) On this issue, appellants claim the causes of action in the two cases were different and distinguishable for several reasons, including the following: First, the Alameda action was addressing an overall pattern and practice that did not concern DOGGR’s approvals of individual oil wells; whereas, the present case involved DOGGR’s conduct in approving 214 individual site-specific oil wells. Second, the approval of the 214 oil wells in the present case was subsequent to, and not within the scope of, the cause of action pled in the Alameda action. Third, the present case allegedly involved different CEQA violations (i.e., different modes or methods of inadequate compliance), under different facts, than were alleged in the Alameda action.

Respondent disagrees, contending that the causes of action were the same based on a close comparison of the allegations and an analysis of the primary right involved in each case. The gist of respondent’s position, as stated in its appellate brief, is as follows: “The [Alameda] Complaint and the Amended Petition seek redress for the same injury by invoking the same primary right.” Respondent continues, explaining that the plaintiffs in the Alameda action allegedly “sought relief from the injury caused to their primary right to avoid environmental harm by DOGGR’s failure to undertake any environmental review of oil and gas well approvals. That cause of action is indistinguishable from the cause of action pled here. [Citation.] In both cases, the primary right involves the purported right to be informed about the potential environmental impacts from oil and gas development. [Citations.] The primary duty alleged is DOGGR’s corresponding obligation to inform the public of any potential environmental impacts prior to approving new oil and gas wells, with the wrongful act being DOGGR’s alleged continued practice of not conducting this environmental review under CEQA prior to issuing such approvals.” Respondent adds, as further support for its position, that if the plaintiffs in the Alameda action had prevailed (keeping in mind that the Alameda action had included a request for injunctive relief as to future approvals), DOGGR would have been subject to that ruling with respect to its conduct in the present case.

Having summarized the parties’ respective positions on this complex issue, we find it unnecessary to decide the matter. Resolution of this issue is unnecessary in light of our conclusion herein that the judgment in the Alameda action was not on the merits.

F. Conclusion and Disposition

The Alameda court dismissed the action on the ground of mootness and lack of ripeness. Thus, the Alameda action was terminated on justiciability grounds, not on the merits, and respondent has failed to convince us otherwise. (See Vella v. Hudgins (1977) 20 Cal.3d 251, 257 [142 Cal.Rptr. 414, 572 P.2d 28] [burden of proving that the requirements for application of res judicata have been met is upon the party seeking to assert it as a bar].) Because the judgment was not on the merits, res judicata was inapplicable and the trial court erred in sustaining the demurrer on that ground. Accordingly, we reverse the judgment, with directions that the trial court enter a new order overruling said demurrer.

III. Motion To Dismiss

After this appeal was fully briefed, respondent filed a motion to dismiss the appeal on collateral estoppel grounds ‘“due to the now-final judgment in the similar case of Sierra Club v. California Department of Conservation, et al. (Kern County Superior Court, [2016,] Case No. BCV-15-101300-RST)” (hereafter Sierra Club v. DOGGR). In its supplemental brief in support of its motion to dismiss the appeal, respondent maintains the trial court in Sierra Club v. DOGGR considered the identical issue involved in the present appeal—namely, whether the judgment in the Alameda action barred under the doctrine of res judicata subsequent CEQA challenges to DOGGR’s approval of oil and gas wells. Furthermore, the trial court in Sierra Club v. DOGGR determined that res judicata did apply in that case (based on the judgment in the Alameda action) and entered a dismissal judgment on that ground, which became final when Sierra Club failed to file an appeal in that case. According to respondent’s supplemental brief, “[u]nder these circumstances, the judgment in Sierra Club v. DOGGR is the first final judgment to resolve the same issue between the same parties,” and that first, final judgment precludes the same issue being raised in the present appeal.

Appellants filed a supplemental brief in opposition to the motion to dismiss appeal. Appellants argue that respondent has failed to demonstrate that collateral estoppel is applicable. Among other things, appellants point out that there is no actual identity of the issues between Sierra Club v. DOGGR and the present case. Additionally, appellants argue respondent has failed to show privity of the parties. Therefore, appellants insist that we should deny the motion to dismiss. On balance, we agree with appellants.

Collateral estoppel ‘“precludes relitigation of issues argued and decided in prior proceedings.” (Lucido v. Superior Court (1990) 51 Cal.3d 335, 341 [272 Cal.Rptr. 767, 795 P.2d 1223], fn. omitted.) Collateral estoppel (also referred to as issue preclusion) applies (1) after final adjudication (2) of an identical issue (3) actually litigated and necessarily decided in the first suit and (4) asserted against one who was a party in the first suit or in privity with that party. (DKN Holdings LLC v. Faerber, supra, 61 Cal.4th at p. 825.) ‘“The party asserting collateral estoppel bears the burden of establishing these requirements.” (Lucido v. Superior Court, supra, at p. 341.)

Although collateral estoppel (unlike res judicata) does not require the same cause of action to be present in the two proceedings, the issue litigated must be identical. (DKN Holdings LLC v. Faerber, supra, 61 Cal.4th at p. 824.) “The ‘identical issue’ requirement addresses whether ‘identical factual allegations’ are at stake in the two proceedings, not whether the ultimate issues or dispositions are the same.’ ” (Lucido v. Superior Court, supra, 51 Cal.3d at p. 342; accord, Diocese of San Joaquin v. Gunner (2016) 246 Cal.App.4th 254, 266 [200 Cal.Rptr.3d 825].) Where the subsequent action involves only parallel facts, but a different historical transaction, the application of the law to the facts is not subject to collateral estoppel. (Chern v. Bank of America (1976) 15 Cal.3d 866, 871-872 [127 Cal.Rptr. 110, 544 P.2d 1310].) “ ‘[I]f the very same facts and no others are involved in the second case, ... the prior judgment will be conclusive as to the same legal issues which appear .... But if the relevant facts in the two cases are separable, even though they be similar or identical, collateral estoppel does not govern the legal issues which recur in the second case.’ ” (Flores v. Transamerica HomeFirst, Inc. (2001) 93 Cal.App.4th 846, 852 [113 Cal.Rptr.2d 376] [holding that although legal principles of unconscionability and the relevant contractual language were essentially the same, the fact that the two cases involved separate loan transactions and separate parties meant there was no identity of issues]; see Younger v. Jensen (1980) 26 Cal.3d 397, 411 [161 Cal.Rptr. 905, 605 P.2d 813] [no identity of issues where subpoena served on different party in second case; thus, it did not involve the same transaction or set of events].)

We agree with appellants that collateral estoppel is inapplicable because the ultimate legal issue of the res judicata effect of the Alameda action to a particular subsequent claim or proceeding has been, in each case, applied in factually distinct circumstances. As a result, in comparing the present case with the Sierra Club v. DOGGR case, identical factual allegations were not at stake in each to reflect the legal issue was truly identical for purposes of collateral estoppel. The present case seeks a determination that DOGGR’s failure to conduct any CEQA analysis when permitting respondent to drill 214 new oil wells in South Belridge oil field was unlawful. On the other hand, in Sierra Club v. DOGGR, Sierra Club challenged the approvals by DOGGR of five separate projects proposing exploratory oil and gas wells in five different locations in Kern County on the ground that the negative declarations issued by DOGGR for those projects were inadequate under the circumstances, and EIR’s should have been prepared. In comparing the two cases, it is clear that the two cases are factually distinct in several respects, including differences in oil drilling projects, locations, oil companies that owned and operated the wells at issue, and different factual and legal challenges under CEQA. Because the two cases involve separate sets of factual events, and distinct conduct on DOGGR’s part with respect to CEQA, including different locations, operators and approvals, we conclude that the identity of issues requirement is not satisfied. (See, e.g., Oro Fino Gold Mining Corp. v. County of El Dorado (1990) 225 Cal.App.3d 872, 878-880 [274 Cal.Rptr. 720] [CEQA decision regarding mineral exploratory permit in one case did not involve same issue as the second case, due to factual differences; thus, collateral estoppel inapplicable].) Due to such differences factually, we are unable to definitely conclude that the ultimate legal issue of whether the judgment in the Alameda action was res judicata in each distinct matter was identical. Consequently, collateral estoppel does not apply.

Secondly, we agree with appellants that respondent has not met its burden of showing privity. To invoke collateral estoppel, respondent must prove that “the party against whom preclusion is sought” is “the same as, or in privity with, the party to the former proceeding.” (Lucido v. Superior Court, supra, 51 Cal.3d at p. 341.) The present action involves three appellants (i.e., Association of Irritated Residents, Center for Biological Diversity and Sierra Club), of which only Sierra Club was involved in the Sierra Club v. DOGGR case. Although it is true that (1) Sierra Club was a party in both cases and (2) all three appellants share similar environmental concerns and interests regarding oil well operations, we do not believe that these facts, under the totality of circumstances here, were sufficient to establish that Association of Irritated Residents and Center for Biological Diversity were in privity with Sierra Club regarding the Sierra Club v. DOGGR litigation.

The privity element of collateral estoppel includes a fairness and due process aspect. “ ‘ “ ‘[T]he determination of privity depends upon the fairness of binding [a party] with the result obtained in earlier proceedings in which it did not participate.’ ” ’ ” (Planning & Conservation League v. Castaic Lake Water Agency, supra, 180 Cal.App.4th at p. 229.) “ ‘ “In the context of collateral estoppel, due process requires that the party to be estopped must have had an identity or community of interest with, and adequate representation by, the losing party in the first action as well as that the circumstances must have been such that the party to be estopped should reasonably have expected to be bound by the prior adjudication.” ’ ” (Rodgers v. Sargent Controls & Aerospace (2006) 136 Cal.App.4th 82, 92 [38 Cal.Rptr.3d 528].) “ ‘ “The ‘reasonable expectation’ requirement is satisfied if the party to be estopped had a proprietary interest in and control of the prior action, or if the unsuccessful party in the first action might fairly be treated as acting in a representative capacity for the party to be estopped. [Citations.] Furthermore, due process requires that the party to be estopped must have had a fair opportunity to pursue his claim the first time. [Citation.]” [Citation.]’ ” (Ibid.)

Here, there is no evidence that Association of Irritated Residents or Center for Biological Diversity had a reasonable expectation of being bound by the Sierra Club v. DOGGR action, or that they received adequate representation therein, or otherwise had any control or impact over the outcome thereof. Declarations submitted by counsel for appellants Association of Irritated Residents and Center for Biological Diversity in opposition to the motion to dismiss the instant appeal assert that these organizations did not know of, follow, or expect to be bound by, the litigation in Sierra Club v. DOGGR; nor did they have the ability to control the course of that litigation, because Sierra Club prosecuted that case on its own.

Additionally, according to the declaration filed by Sierra Club’s associate attorney, that organization decided to appeal the judgment in the Sierra Club v. DOGGR case, but ‘“[d]ue to a clerical error” in that firm’s office, the appeal was not timely filed. If we found that Sierra Club’s blunder created collateral estoppel against Association of Irritated Residents and Center for Biological Diversity, it would unfairly deprive these other appellants from ever having an opportunity to resolve on appeal the issues vigilantly raised in the present case, even though they had no input, involvement or control over what happened in the Sierra Club v. DOGGR case. Under the circumstances, even if there was a general awareness that Sierra Club was involved in another oil well case, it could not have been anticipated by the other appellants herein that Sierra Club would, through an utter lack of diligence or vigor in that other case, derail appellants’ ability to proceed in the present appeal. (See Planning & Conservation League v. Castaic Lake Water Agency, supra, 180 Cal.App.4th at pp. 230-231 [no inference of privity where presumed common interests and virtual representation effectively abdicated by lack of vigor in representation].) Under all of the circumstances, we are not persuaded that privity should be inferred.

Based on the foregoing, respondent’s motion to dismiss the instant appeal on the ground of collateral estoppel is denied.

DISPOSITION

The judgment of the trial court is reversed. The matter is remanded to the trial court with instructions to enter a new order overruling respondent’s res judicata demurrer to the amended petition. Costs on appeal are awarded to appellants.

Franson, J., and Smith, J., concurred.

The petition of real party in interest for review by the Supreme Court was denied August 23, 2017, S242962. Werdegar, J., did not participate therein. 
      
       Unless otherwise indicated, further statutory references are to the Public Resources Code.
     
      
       As will be discussed herein. Senate Bill No. 4 (2013-2014 Reg. Sess.) constituted a significant change to the legal background in which DOGGR operates, particularly concerning certain oil and gas well stimulation practices such as hydraulic fracturing (also known as fracking). Senate Bill No. 4 took effect on January 1, 2014, and its statutory provisions include sections 3150 to 3161 (Stats. 2013, ch. 313, § 2, enacting Sen. Bill No. 4; hereafter Senate Bill No. 4).
     
      
       The complaint was entitled “VERIFIED COMPLAINT FOR DECLARATORY AND INJUNCTIVE RELIEF” (Center for Biological Diversity v. Department of Conservation (Super. Ct. Alameda County, 2014, No. RG12-652054)). We refer to it as simply the complaint.
     
      
       The validity of these past individual well permits were not challenged in the Alameda action, but were set forth in that pleading as examples of DOGGR’s historical pattern and practice.
     
      
       Sections 3150 to 3161 were codified as new article 3 (under the heading “Well Stimulation”), under chapter 1, of division 3 (“Oil and Gas”), of the Public Resources Code. Other statutes enacted or revised by Senate Bill No. 4 addressed penalties for noncompliance, further reporting and disclosure requirements, and groundwater monitoring. (§§ 3213, 3215, 3236.5; Wat. Code, § 10783; see Stats. 2013, ch. 313. §§ 3-5, 7, enacting Sen. Bill No. 4.)
     
      
       In June 2014, an amendment to Senate Bill No. 4 stated that, although the regulations must be finalized by January 1, 2015, the effective date of the regulations was extended to July 1, 2015. (Stats. 2014, ch. 35, § 131, enacting Sen. Bill No. 861 (2013-2014 Reg. Sess.); see § 3161, subd. (a).)
     
      
       Portions of the draft EIR prepared by DOGGR in early 2015 were submitted for judicial notice in the proceedings below. The draft EIR stated it was broad in scope (i.e., statewide), programmatic in nature, and did not consider individual oil and gas wells. We note that under the CEQA guidelines (Cal. Code Regs., tit. 14, § 15000 et seq.), a “program EIR” is described at California Code of Regulations, title 14, section 15168. Under that section, “Subsequent activities . . . must be examined in the light of the program EIR to determine whether an additional environmental document must be prepared.” (Cal. Code Regs., tit. 14, § 15168, subd. (c).)
     
      
       The code defines an “[o]perator” as “a person who, by virtue of ownership, or under the authority of a lease or any other agreement, has the right to drill, operate, maintain, or control a well or production facility.” (§ 3009.) Thus, other than needing to obtain any required permits, the operator is the person having the right to drill or operate a well, whether by virtue of ownership or contract.
     
      
       Section 690 states: “The Division of Oil, Gas, and Geothermal Resources shall be in charge of a chief, known as the State Oil and Gas Supervisor.” (See § 3004 [“ ‘Supervisor’ means the State Oil and Gas Supervisor”]; § 3106, subd. (a) [duties of the supervisor are to “supervise the drilling, operation, maintenance, and abandonment of wells ... so as to prevent, as far as possible, damage to life, health, property, and natural resources . . . [, including] damage to underground and surface waters suitable for irrigation or domestic purposes by the infiltration of . . . detrimental substances”].)
     
      
       This is the statewide EIR referred to above. The requirement that DOGGR conduct a statewide EIR “does not prohibit” the preparation of an EIR by a local agency. (§3161, subd. (b)(3)(C).)
     
      
       To the extent that section 3160, subdivision (n) (i.e., DOGGR is not relieved from complying with other laws) is arguably in conflict with section 3161, subdivision (b) (i.e., during special interim period, DOGGR “shall allow” fracking if enumerated statutory conditions met, yet enumerated conditions did not include CEQA compliance), we do not believe the present appeal is the proper occasion to resolve that conflict.
     
      
       The Alameda court’s use of January 1, 2015, as an analytical dividing line was apparently based on its assumption that the new regulations would take effect on that date, thereby ending the interim regime under section 3161, subdivision (b), at that time. However, as noted above (see fn. 6, ante), in a subsequent followup amendment to Senate Bill No. 4, the effective date of the regulations was extended to July 1, 2015. Thus, the Alameda court’s date-specific analysis makes better sense if the reader understands the referenced date should be July 1, 2015.
     
      
       The order stated the motion was granted “without prejudice to any claims for failure to comply with 14 California Code of Regulations section 1761, et seq.” This was apparently a reference to the temporary or emergency regulations in place during the interim regime before the new regulations took effect (i.e.. Cal. Code Regs., tit. 14, §§ 1761, 1780-1783.3 [versions eff. until July 1, 2015]).
     
      
       The doctrine of res judicata also precludes a party from engaging in piecemeal litigation by splitting a single cause of action and relitigating the same cause of action on a different legal theory or for different relief. (Mycogen. supra. 28 Cal.4th at pp. 896-897.) Similarly, res judicata bars litigation not only of matters that were actually litigated, but also of matters that could have been litigated as paid of the same cause of action. (Citizens for Open Government v. City of Lodi (2012) 205 Cal.App.4th 296, 324 [140 Cal.Rptr.3d 459].)
     
      
       “ ‘The controversy must be definite and concrete, touching the legal relations of parlies having adverse legal interests. [Citation.] It must be a real and substantial controversy admitting of specific relief through a decree of a conclusive character, as distinguished from an opinion advising what the law would be upon a hypothetical state of facts.’ ” (Pacific Legal Foundation v. California Coastal Com., supra. 33 Cal.3d at pp. 170-171.)
     
      
       An issue, although technically moot, may still be addressed by a court under certain exceptions to the mootness doctrine, such as to resolve a question of public importance where the issue is likely to recur. (See Californians for Alternatives to Toxics v. Department of Pesticide Regulation (2006) 136 Cal.App.4th 1049, 1069-1070 [39 Cal.Rptr.3d 393].) The Alameda court did not proceed under an exception to the mootness rule, but dismissed the action because of mootness and lack of ripeness.
     
      
       The contrast between a determination based on mootness and one based on the merits was discussed in a peculiar' procedural setting in Coalition for a Sustainable Future in Yucaipa v. City of Yucaipa (2011) 198 Cal.App.4th 939 [130 Cal.Rptr.3d 520], After a judgment was appealed but before the appellate court could decide the matter, the basis for the judgment became moot. In that instance, the appellate court could simply dismiss the appeal itself, but that would leave the judgment in place. A bare reversal of the judgment would imply that further proceedings should take place in the trial court on the complaint, but that would be inappropriate in view of the case’s mootness. According to the Court of Appeal, the better approach would be to reverse the judgment, with directions to the trial court to dismiss the action as moot. (Id. at p. 943, following Paul v. Milk Depots. Inc. (1964) 62 Cal.2d 129, 134-135 [41 Cal.Rptr. 468, 396 P.2d 924].) In doing so, an appellate court following this approach “should make clear that the reversal of the judgment is not based on its merits, but based on its mootness.” (Coalition for a Sustainable Future in Yucaipa v. City of Yucaipa, supra. at p. 945.)
     
      
       The issue here is not whether the Alameda court’s ruling was correct; that is, our appeal does not concern whether the Alameda court properly decided the entire case was moot, but only that it did so decide and that it did make mootness/unripeness the basis for its judgment of dismissal.
     
      
       As to the Alameda court’s selection of January 1, 2015, as an analytical dividing line, see footnote 12, ante.
      
     
      
       The Alameda court identified that timeframe as prior to January 1, 2015. See footnote 12, ante, concerning the use of that date. Due to a subsequent revision to Senate Bill No. 4, the correct date for purposes of the court’s analysis was July 1, 2015.
     
      
       It bears noting that the Alameda court’s description of the “shall allow” language in section 3161, subdivision (b), comes entirely within the context of its mootness discussion.
     
      
       Our understanding of the Alameda court’s order is consistent with the mootness rationale of the dismissal motion itself, with which the Alameda court apparently agreed. Under the rationale of that motion, the advent of Senate Bill No. 4—with its new directives to DOGGR on issues such as fracking, information gathering, scientific study and environmental review— meant that questions relating to DOGGR’s past pattern and practice under the former legal setting had become largely academic or irrelevant.
     
      
       At oral argument, the parties had contrasting views on how broad or how narrow the allegations were in the Alameda action. We think the more important factor in this case is what the Alameda court actually did in its order; that is, it expressly declined to reach the merits of the pattern and practice claims because it clearly believed and expressly stated that the entire case was rendered nonjusticiable by Senate Bill No. 4.
     
      
       California’s res judicata doctrine is based upon the primary right theory. (Mycogen, supra, 28 Cal.4th at p. 904.) Two proceedings are on the same cause of action if they are based on the same “primary right.” (Ibid,: see Federation of Hillside & Canyon Assns. v. City of Los Angeles (2004) 126 Cal.App.4th 1180, 1202 [24 Cal.Rptr.3d 543].) Under this theory, a cause of action is “ ‘comprised of a “primary right” of the plaintiff, a corresponding “primary duty” of the defendant, and a wrongful act by the defendant constituting a breach of that duty. [Citation.] The most salient characteristic of a primary right is that it is indivisible: the violation of a single primary right gives rise to but a single cause of action. [Citation.] . . .’ ” (Mycogen, supra, at p. 904.)
     
      
      
         Sierra Club v. DOGGR was filed on October 22, 2015. Appellants note that due to the short statute of limitations for negative declarations, the subject negative declarations were probably issued in approximately September 2015.
     
      
       Respondent submitted exhibits relating to the Sierra Club v. DOGGR case for our judicial notice, including the underlying petition by Sierra Club, the demurrer, the supporting, opposing and reply papers in connection with the demurrer, the trial court’s ruling on demurrer, and the judgment. We grant respondent’s request for judicial notice.
     
      
       Because the focus is on the identity of issues litigated and not the identity of the cause of action, the question of identity of issues is not determined under the primary rights theory: “[T]he primary rights theory does not relieve the party asserting collateral estoppel from its obligation to demonstrate the issue actually litigated and finally decided in the first action, regardless of legal theory advanced, is identical to the factual issue as to which preclusion is sought.” (Johnson v. GlaxoSmithKline, Inc. (2008) 166 Cal.App.4th 1497, 1518 [83 Cal.Rptr.3d 607].)
     
      
       Additionally, the challenged conduct in the Sierra Club v. DOGGR case apparently occurred in approximately September 2015 (see fn. 25, ante). The only portion of the Alameda court’s ruling that hypothetically could apply would be the portion thereof dismissing the post January 1, 2015 pattern and practice claims on unripeness grounds; whereas, the present action involved 2014 approvals that could only have related to the mootness portion of the Alameda court’s ruling. This is yet another difference between the two cases that weighs against a finding of identical issues.
     
      
       When a nonparty to the prior lawsuit, like respondent here, asserts collateral estoppel, “ ‘[a] particular' danger of injustice alises.’ ” (People v. Union Pacific Railroad Co. (2006) 141 Cal.App.4th 1228, 1244 [47 Cal.Rptr.3d 92], quoting Vandenberg v. Superior Court (1999) 21 Cal.4th 815, 829 [88 Cal.Rptr.2d 366, 982 P.2d 229].) Thus, courts must closely examine “ ‘whether nonmutual use of the doctrine is fair and appropriate.’ [Citation.] In considering whether collateral estoppel is fair and consistent with public policy, particular consideration should be given to whether there was an opportunity for appellate review of adverse rulings.” (People v. Union Pacific Railroad Co., supra, at p. 1244.)
     