---
title: "Roll out settings and data files like code · Agent Wranglers"
url: https://agentwranglers.se/playbook/engineering/build-test-and-deploy/staged-config-rollouts
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Roll out settings and data files like code

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers). Updated 2026-10-21.

For AI agents: [llms.txt](https://agentwranglers.se/llms.txt) is a short guide that sends you to the rules your problem needs, and [rules.json](https://agentwranglers.se/playbook/engineering/rules.json) holds every rule of this playbook as JSON.

- Level: Required
- Chapter: [Build, test and deploy](https://agentwranglers.se/playbook/engineering/build-test-and-deploy)
- Rule: Validate every change to settings, rules and generated data files before it ships, and roll it out in stages like code. A service that cannot load a new file keeps running on the last good one.
- Risk: The app down or unusable
- How: Many outages start with a settings or data file pushed everywhere at once. Check each file against a schema and its limits, such as size and number of entries, in CI and again when the service loads it. Send it through the same stages as a release, as [Release to a small share first](https://agentwranglers.se/playbook/engineering/build-test-and-deploy/staged-rollouts) describes. Keep the last file that loaded. When a new one fails, keep using the old one and alert a person. Keep every version in version control, so a rollback is one step. Feature flags follow [Separate deploying from releasing](https://agentwranglers.se/playbook/engineering/running-in-production/deploy-is-not-release).
- Check: Push a broken settings file to staging, such as one with twice the allowed entries. The service keeps serving with the old file, logs the rejection and sends an alert. The release history shows every settings change in production passed the same stages as code.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JavaScript example

```js
import { readFileSync } from 'node:fs';

const MAX_RULES = 200;
let currentRules = loadRules('/etc/shop/rules.json');

function loadRules(file) {
  const rules = JSON.parse(readFileSync(file, 'utf8'));
  if (!Array.isArray(rules) || rules.length > MAX_RULES) throw new Error(`Invalid rules file ${file}`);
  return rules;
}

export function reloadRules(file) {
  try {
    currentRules = loadRules(file);
  } catch (error) {
    alertOnCall(`Kept the last good rules. ${error.message}`);
  }
}
```

### Python example

```python
import json

MAX_RULES = 200

def load_rules(path):
    with open(path) as file:
        rules = json.load(file)
    if not isinstance(rules, list) or len(rules) > MAX_RULES:
        raise ValueError(f"Invalid rules file {path}")
    return rules

current_rules = load_rules("/etc/shop/rules.json")

def reload_rules(path):
    global current_rules
    try:
        current_rules = load_rules(path)
    except (OSError, ValueError) as error:
        alert_on_call(f"Kept the last good rules. {error}")
```

## Sources

- [Google SRE Workbook on canarying releases](https://sre.google/workbook/canarying-releases/)
- [Google SRE Workbook on configuration design](https://sre.google/workbook/configuration-design/)

## Related rules

- [Release to a small share first](https://agentwranglers.se/playbook/engineering/build-test-and-deploy/staged-rollouts) in Engineering
- [Separate deploying from releasing](https://agentwranglers.se/playbook/engineering/running-in-production/deploy-is-not-release) in Engineering

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/engineering/build-test-and-deploy/staged-config-rollouts">Agent Wranglers engineering playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Build releases only in CI and verify them before deploy](https://agentwranglers.se/playbook/engineering/build-test-and-deploy/build-in-ci-and-verify)
- [Build, test and deploy](https://agentwranglers.se/playbook/engineering/build-test-and-deploy)
