
Summary
Key points of this document
- 1. Focusing on feature development does not mean eliminating manual work
- 2. Overall picture of the path
- 3. Quint / Apalache and CUE / Bazel: Stopping logic before release
Overview
The reason for delays in feature development is not a lack of writing, but rather that the places to fix and the procedures for releasing are different each time. This includes specification gaps, configuration discrepancies, large PRs, deployment and release being the same operation, and people manually catching and reverting production errors. Our development standard is to connect this friction to a single change's path, separating the roles of CUE and Bazel, Quint and Apalache, trunk-based development and Stacked PRs, feature flags, Sentry, and scheduler-based auto-healing, and fixing their order. The goal is not to increase the number of tools, but to reduce manual bug fixes and deployments, and to shift human focus back to the meaning of the work and the judgment of exceptions.
1. Focusing on feature development does not mean eliminating manual work
The phrase "developers only need to write business logic" does not mean abandoning verification. It means shifting the place of verification from human memory and large diffs to contracts, models, small PRs, flags, and monitoring.
Toil arises from repetitions like these: configuration file keys differing per environment; conditions like "do not double-count payment retries" only existing in comments; features being in one giant PR, making reviews and reverts heavy; reaching all users the moment it's released to production; and people judging flags and reverts based on error notifications.
These topics have been covered in separate documents: types and constraints with CUE and Bazel, state transitions with Quint and Apalache, build speed and cost, and Sentry-initiated automatic recovery. This paper organizes the order and boundaries when connecting them as a single path.
- Humans judge: the meaning of contracts, new states, whether to release, and whether to promote exceptions to the source of truth.
- Machines do first: validation, generation, differential testing, small integrations, flag closing, and audit trail preservation.
- Must not remain: deploying large PRs to production as-is, equating deployment with release, and automated fixes without monitoring.
2. Overall picture of the path
A single change flows in the following order. If it fails midway, it does not proceed downstream.
Defects stopped upstream are returned to CUE or Quint. Gaps found in production downstream are also recirculated to the same source of truth after closing the flag. We do not operate by leaving automatically fixed diffs only in generated artifacts or production configurations.
3. Quint / Apalache and CUE / Bazel: Stopping logic before release
Formal verification and the source of truth for contracts are covered in a separate document, "Development Standards for a Pipeline of CUE, Quint, Apalache, and Bazel." Their role here is solely to serve as the entry point for the deployment path.
Quint models behaviors that break over time and in parallel, such as authentication, payment, retries, and disaster recovery. Apalache checks invariants within a specified number of steps and returns counterexamples before implementation. CUE statically validates data structures, configurations, allowed transitions, and feature flag schemas. Bazelcue vet orchestratesquint verify generation and testing via a dependency graph.
If this layer is weak, both trunk-based development and feature flags become mechanisms for rapidly distributing broken logic. Before speed, we place conditions that must not be violated into the source of truth.
- Quint and Apalache do not inspect implementation binaries; they inspect models.
- We do not let CUE write all state machine paths. Flag names, schemas, and allowed transitions are in CUE, while execution paths are in Quint.
- Bazel does not define invariants; it is responsible for executing and reproducing tests.
4. Trunk-based development and Stacked PRs: Splitting changes into reviewable sizes
The practice of putting large features into a single PR increases conflicts and wait times. We integrate frequently into the trunk (main) and treat changes as a stack of small, dependent PRs. Reviews and CI are run at this granularity. We use Graphite to manage the stack, and GitHub as the repository's source of truth and merge queue.
The purpose of splitting into smaller units is not to increase the number of visible PRs. It is to confine the rollback scope to that single step when a failure occurs. Formal verification and Bazel's differential testing are well-suited for this granularity. We can pinpoint what broke—whether it's the contract, model, or implementation—using target labels.
On the other hand, simply splitting things into smaller units means unfinished features will reach production users. This is why the next layer, feature flags, becomes necessary.
- The integration target is the trunk. Long-lived feature branches are not standard.
- Do not mix contract changes, UI, and infrastructure in a single PR.
- We do not remove tests to speed up CI. We keep the core
quint verifyand contract verification.
5. Feature Flags: Separating Deployment and Release
We separate putting code into the trunk and deploying artifacts to production from showing features to users. While a flag is off, that path is deployed but not public.
Flag names, types, default values, and target environments are managed with CUE schemas. We do not add keys directly to production configuration files on the fly. For flags used as kill switches, their initial values and behavior when closed are part of the specification. Ambiguity about what remains or disappears after closing can turn automatic fallback into another failure.
The more flags you add, the harder it becomes to test combinations. Long-term "flags kept just in case" are equivalent to contract bloat. Flags that have completed their public release have an expiration date for removal.
- Deployment: Placing artifacts into the production execution environment.
- Release: Open the flag and deliver it to users.
- Evacuate: If errors exceed the threshold, close the corresponding flag. Contain the scope of impact before rolling back the binary.
6. Sentry and Scheduler: Close first, fix later
Production errors are captured by Sentry. It records the stack, release, flag status, and which change was made. We will not operate by simply having people read notifications; the first automated action is not a fix. It is about minimizing impact.
The scheduler activates when the defined threshold is exceeded. The priority order is as follows:
- Close the flag for the relevant feature. Stop the spread of the outage.
- Create an Issue. Include the context for reproduction, the flag name, relevant Bazel targets, and the name of any Quint invariants.
- If necessary, rebuild and run verification. Only propose PRs for fixes that have passed verification and have an audit trail.
The path for automatically fixing code and deploying it to production is detailed in the auto-healing design in a separate document. The commitment in this paper is to maintain the order: kill switch and audit trail first, automatic correction later. Automatic corrections without stopping conditions quickly distribute broken changes.
- Good for automation: Flag OFF, Issue creation, re-execution of target tests, recording of impact scope.
- Humans remain for: Corrections that change the meaning of a contract, money and authorization, and the decision to reopen a flag.
- What not to do: Unmonitored automatic merges, corrections to only artifacts, automatic operations on flags without defined closing conditions.
7. Synergies that arise when connected
Each layer has meaning on its own. When connected, the following cycle can be formed.
Quint counterexamples are returned as updates to CUE's transition table or flag assumptions. Stacked PRs allow these updates to be reviewed as small, incremental steps. Flags allow verified code to be deployed to production in advance, delaying only its public release. Sentry errors, along with the flag and release information, are passed to the scheduler, and the names of closed flags become input for the next Quint and CUE.
With this cycle, nighttime incident response isn't about "reverting everything or keeping everything," but rather "closing the relevant release, preserving evidence, and reverting to the original the next morning." Developers' focus shifts from emergency screen fixes to unbreakable conditions and the next small change.
On the other hand, if any part of the cycle is merely decorative, the whole system loses credibility. If a flag is outside the schema, the kill switch won't work. If there's no flag name in the Issue, the reason for closing it won't be preserved the next day. If the model omits real-world failures, a green checkmark is false reassurance. Connection is also the task of aligning the names of inputs and outputs at each layer.
8. How to introduce it, and the scope of not over-introducing it
Learning costs and initial build costs cannot be ignored. If everything is introduced at once as a "complete form," the team's work will become solely about connecting tools. Even with our company's standards, the scope of application expands from the core.
Existing type generation, CI costs, and auto-heal stop conditions will inherit the policies of their respective documents. This paper adds the positioning of treating them as "a single path to return to feature development."
- Things to put in place first: Quint for state transitions that would cause significant damage if broken, such as money, authorization, re-execution, and tenant boundaries.
- Things to put in place first: Flag schema and behavior when closed.
- Things to put in place first: Linking Sentry errors to releases and flags.
- Things to put in place first: Flag OFF when a threshold is exceeded.
- Things that can wait: Detailed modeling of screens.
- Things that can wait: Automatic PRs for all errors.
- Things that can wait: Mass addition of flags.
- Things that can wait: Just expanding the inspection scope
quint verify.
9. Our company's adoption policy
This is the standard from verification to release, incident, and feedback. Instead of re-selecting monitoring and deployment tools for each project, this order is made the default. If it is deviated from, the reasons related to existing assets, laws, and operational systems will be recorded in the design documentation.
Fixing a standard does not prohibit future changes. It means being able to explain which layers' inputs and outputs will be misaligned when changes are made.
- CUE / Quint / Apalache / Bazel: The authoritative source and execution of specifications and verification. For details, refer to the formal verification document.
- Trunk-based development and Stacked PRs: Graphite and GitHub. Integrate in small increments.
- Feature flags: Separation of deployment and release. Schema is CUE. Define kill switches from initial values until after they are closed.
- Sentry and Scheduler: Detection, flag OFF, Issue, re-verification. Automatic correction is only within the stopping conditions.
10. Summary: Put fast delivery and the ability to stop early on the same path.
CUE and Quint define what is allowed and how transitions can occur in advance. Bazel runs those checks in the same order every time. Stacked PRs break down changes into reviewable sizes. Feature flags separate deployment from visibility. Sentry and the scheduler close broken public releases early and return the reasons to the authoritative source.
There is no need to adorn this configuration as a perfect ideal. If connections are severed, only speed remains. If order can be maintained, the friction of bug fixes and deployments decreases, and people can return to the meaning of features and whether to elevate exceptions to the authoritative source. That is the essence of the standard: focusing on feature development.


