Governed Rules
A business rule may change over time: a lending threshold can be revised, or a new policy can take effect on a particular date. A filename alone does not explain which policy a program represents. A governed rule adds an identifier, version, and optional author and effective dates to the Devlish source.
That identity travels with the compiled bytecode. It gives test reports, release records, and execution logs a shared way to refer to the rule. Adding identity is the first step in that workflow; it does not by itself approve the rule or restrict where it may run.
Declare rule identity
Section titled “Declare rule identity”A Rule: header describes the program before its executable statements. The identifier names the rule across versions, and the version distinguishes one revision from another. Both are required. Effective dates describe when a revision applies.
The following example represents a lending rule that declines a debt-to-income ratio above 0.43. It expects positive monthly_income and a monthly_debt value supplied by the caller:
Rule: id: lending.dti_check version: 1.2.0 author: Risk Operations effective from 2026-01-01 effective until 2026-12-31
Require monthly_income > 0 otherwise fail with "Income must be positive"debt_ratio equals monthly_debt divided by monthly_income
If debt_ratio is greater than 0.43: Respond with "declined"
Respond with "approved"The compiler includes this metadata in the executable package, allowing a caller to inspect which rule it is invoking.
Select a version by date
Section titled “Select a version by date”When you have several candidate versions of the same rule, an as-of date selects the version whose effective window covers that date. Devlish rejects gaps, overlapping windows, or candidates with mismatched identifiers rather than choosing silently.
Given two such source files, select the version in force on July 1:
devlish run lending-v1.dvl lending-v2.dvl --as-of 2026-07-01Inspect identity in JavaScript
Section titled “Inspect identity in JavaScript”An application using the JavaScript Runtime can inspect a loaded tool’s identity before running it. Once you have loaded the compiled package as tool, read tool.info.rule:
console.log(tool.info.rule);// {// id: "lending.dti_check",// version: "1.2.0",// author: "Risk Operations",// effectiveFrom: "2026-01-01",// effectiveUntil: "2026-12-31"// }This property is null when the artifact has no governed rule identity.
Continue through testing and release
Section titled “Continue through testing and release”Evidence Bundles test a specific compiled version. Controlled Releases record its proposal, approval, and publication. Audit and Replay connect actual executions to the artifact and captured data. Read them in that order to follow a rule from authoring through use.