MainworthyDocs Open Mainworthy

How Mainworthy works

A test case describes what you expect the software to do. A result records what happened. When a failure needs judgment, Mainworthy asks a question and records the answer that settles it as a decision. The gate uses results and decisions to tell you whether a commit meets the testing requirements.

How Mainworthy works. Zoom, search and follow a path in the frame, or open it full screen.

Three kinds of record #

Suppose your team tests a checkout page. Mainworthy keeps separate records for what you expect, what happens, and what you decide about it.

  • A case describes what the software should do. It has a title, steps, and expected results. Steps can refer to a specific version of shared steps. Each edit to the content creates a version and keeps the old one. Moving, tagging, or archiving a case adds to its history without creating a version.
  • A result records what happened. A person pressing p in a run, a pipeline uploading JUnit XML, and an AI agent reporting a batch all record results the same way.
  • A decision records an answer that the project's policy accepts. For example, you might answer that a checkout failure is a product bug, or accept an edit to the case. Each decision names who answered and what evidence they had.

If you change your mind, the new decision names the one it replaces. You can still see who made each decision and when. Demo projects are an exception to history retention. After startup, automatic demo refreshes replace their history in the background.

Evidence comes with its basis #

A result's basis says which version of which case the result is for. Mainworthy records how it identified that version.

BasisWhenWhat it means
ExactA run pinned the version, or the test names itThe result is for that version of the case.
AssumedThe test is linked to a caseMainworthy counts the result toward the case's current version.
UnresolvedThe test has no caseThe result counts toward the commit's gate. No case receives credit.

Report results shows how a test gets linked to a case.

Evidence raises questions #

When a failure needs judgment, Mainworthy asks a question. It uses a pattern in the failure message, called a signature, to group failures with the same cause into one question.

If an assertion signature occurs in more than 50 distinct tests across more than five reported files for a commit, Mainworthy splits the question by file. The split starts with the report that crosses both limits and applies to later reports. Each question names its file with "Split by file". Earlier results and answers keep their grouping and effects. Timeouts and infrastructure failures stay grouped.

There are five kinds of question:

  • a proposed edit to a case
  • a test with no case
  • a failed result
  • a finding from a review
  • a request to close a run

Every open question waits in one place, the queue. Decide in the queue lists the answers each kind takes.

Only a decision changes what is current #

A decision can change any of the following.

  • the version of a case that is in force
  • which case a test belongs to
  • how a failure counts
  • whether a run is closed
  • the policy itself

A person can answer a question with one key. If the policy asks nobody, the policy answers automatically as soon as the question comes up. Mainworthy records that decision in the same way.

If the same cause fails again while the decision still applies, Mainworthy uses that decision without asking again. Withdrawing a decision reverses only its effects. The decision and its withdrawal both stay in the record.

Runs and the gate #

A run says which results count and what is needed before the run is complete. Results exist independently of runs.

Mainworthy has two kinds of run.

  • A change run exists for each commit that a pipeline or a person has reported. It counts tests.
  • A planned run is one you start by hand. Each case you pick gets a place in the run, called a slot. The slot keeps the version you picked. People, pipelines and agents can fill the slots. Planned runs explains them.

The gate is the answer for a commit, a change or a run. It has four verdicts, and mainworthy gate exits with a code for each.

VerdictExit codeWhat it needs
passed0Nothing.
failed1A fix. A decision said a failure is real.
blocked2A decision. A failure has no explanation yet, or two results disagree.
pending3Evidence. A report or a shard of a job has not arrived or is still being applied, or nothing was proven. The policy can accept a pipeline's declaration that no tests were required. See reports with no tests.

Mainworthy computes the verdict from the evidence and the decisions in force. The verdict changes when the evidence or decisions change. When you answer a failure in the queue, Mainworthy computes the verdict again at once. If nothing else blocks the gate, excusing a flaky failure can turn the gate green without another pipeline run. A passing retry can do the same without a decision. Changes and the gate has the details.

Policy says who answers #

A project's policy sets who must answer each kind of question and which answers count. Projects start with a built-in policy called a preset.

  • Under loose, the default, ordinary case edits take effect at once. If a failure already occurs on the base commit, the policy excuses it automatically while the evidence holds. A person answers other failures.
  • Under standard, a person reviews an agent's edit before it takes effect.
  • Under strict, a person gives a reason when approving case edits, answering failures and findings, or closing runs. The policy can still track tests without cases automatically.

All presets use the same data. You can switch without migrating anything. Policy compares them.

People, pipelines and agents use the same operations #

The web UI, the mainworthy command, and the HTTP API use the same operations to change project records. An agent can call ten operations directly as tools. For other operations, such as starting a planned run, it uses the command line or the API.

Projects belong to an organisation on the instance. A capability is permission to do something on a project. A grant lists those permissions. Teams are named sets of grants. A person's own grants and their teams' grants add up. The planned team model would give each project one owning team and each member an owner, admin, user, or viewer role.

People, agents, and pipelines can have different permissions on the same project. A pipeline can report results, announce deployments, mark changes as ended, and read the commit's gate. With read, it can also see cases, results, and questions. A pipeline cannot edit cases, answer questions, start planned runs, or administer a project. Mainworthy shows results from agents and asks questions about them. Those results never change a commit's verdict. See people, agents and pipelines for grants and tokens.

Where to go next #

Mainworthy 0.1.0 · Licence · this page is docs/guide/concepts.md in the repository