Codeline Policy

_ Main Line_, Task Branch, and Release Line all follow different rules and have different stability requirements. The pattern describes how to use and enforce rules for working with a given codeline to keep your ecosystem active.

Similar Structure, Different Purpose

A codeline is a branch, and branches are structurally the same. What differentiates one codeline from another is how you work with it and identify it. Working on a different kind of codeline requires a context shift, and you want to minimize cognitive overhead.

Documentation can add overhead, but relying on undocumented shared understanding may not scale well as new team members grow. Documented rules need to be kept up to date with changing needs, so you need a way to identify when rules should change and a mechanism for updating them promptly.

One way of encouraging consistent compliance with rules is automation. Automation, like rules, may not cover all scenarios, so any automation needs to be flexible.

The rules for a codeline need to be clear, easy for developers to follow, and adaptable.

Define the Rules in Context

** For every codeline, define a Codeline Policy to help developers decide what process to follow before integrating code changes from another work stream to the codeline. Use automation to reduce cognitive overhead.**

A Codeline Policy should include:

The rules can be as detailed or simple as the team needs, and requirements can be enforced by convention, tooling, or automation.

A common approach is to document the rules either in a README in the code repository or in a document on a team Wiki and then add automation to your build system and CI pipeline.

Some examples

Here are some examples of how the code line policies might vary between branches. Adapt rules that make sense for your team

For the Main Line:

For a Task Branch:

For a Release Line:

Each of these criteria can be enforced by hand or by tools. For example, you can create a task branch:

You probably already have some conventions that you use for branches. This pattern suggests simply that you:

The important thing is that it’s straightforward to know what the branch is for.

Cautions

Useful policies are brief, automated, or both. Don’t spend too much energy on documentation. Or overthinking the policy.

Any rules will likely have exceptions you didn’t consider, so — especially for automated gates in the CI pipeline — allow for overrides. For example, you may have a test coverage check, which is a good proxy for “Did you write a test?” but in some cases, a reduction in coverage is acceptable, Or there may be cases when skipping a Code Review makes sense.

Next Steps