Behavior and configuration reference¶
This page is the single source of truth for the mechanical rules that every other guide depends on. The tutorials and recipes link here rather than restating them, so there is one place to correct when behavior changes. Command syntax and options are generated from the live parser in the CLI reference.
Source modes¶
Most inspection commands and generate default to head: committed state, not
your unstaged edits. Exceptions are validate-config (and check-config) and
record-derivation, which preserve their working-tree default. Pass the source
explicitly in scripts; see the CLI reference for each command.
| Source | Path set and content | Use it for |
|---|---|---|
head |
One captured commit tree | Pull-request and post-commit CI |
index |
One captured index tree | Pre-commit verification |
working-tree |
Disk bytes for a captured tracked path set | Local editing before you stage |
Six rules follow from that model:
- Source selection is per invocation.
--sourceis not shared shell state. A bare command immediately after--source working-treedefaults toheadagain. Pass the source explicitly to each adjacentverify,status,explain, orwhycommand when you want them to inspect the same view. - Generate and verify with the same source. A lock generated from one snapshot does not describe another.
- Make files Git-known first. After the first commit, untracked files are
excluded from every source. Stage new files before
index; make them Git-known before relying on working-tree glob expansion. headandindexbind the config and the lock too, not just component content. Both are read from the same captured snapshot. This is stricter than 0.10, which could combine staged artifacts with unstaged config.verify --format jsonrecords the exact locations and captured object IDs underinputs; text output names the selected config and lock explicitly. Whenverify --updatesees that the same working-tree config is semantically different, absent, or unreadable, it emits a bounded notice but still regenerates only from the selected snapshot. Add--strict-config-sourceto refuse that update with exit2instead.- Fetch history before using
--changed-fromor agit_tag_prefixversion source. Shallow clones break both. - Make required Git objects local. Boundver resolves the host Git binary outside the inspected repository, requires Git 2.32 or newer, confirms its process-local security configuration, and disables credential prompts, replacement refs, repository hooks, fsmonitor callbacks, and partial-clone lazy fetching for every Git subprocess. Repository/worktree Git clean, smudge, and process filters are also neutralized, so ordinary inspection never executes a filter command from local Git configuration. A missing promised object therefore fails closed instead of turning verification into an undeclared network request. Fetch the complete history and required objects explicitly before verification. Partial clones require Git 2.45 or newer; full repositories retain the Git 2.32 baseline. Submodules remain opaque Gitlinks: a changed checked-out Gitlink is visible, while dirty/untracked content and local filter configuration inside the submodule are not traversed.
Shared checkouts¶
validate-config --source head validates the committed config, paths, version
files, warnings and derivation receipts without capturing the index or writing
index.lock. Uncommitted changes and a lock held by another session do not
change its result. generate --source head likewise reads committed inputs;
it does not require a clean checkout, but writes its output on disk. Do not
let multiple sessions regenerate the same output concurrently.
From v0.17 development, HEAD generation no longer scans the working tree just
to warn about it. Text output still names Source: head. To explicitly request
the old advisory, use generate --source head --inspect-working-tree. That
scan can be expensive, captures the index, and may warn if another session
holds index.lock; it never changes which source gets fingerprinted. The flag
requires HEAD. Explicit inspection still runs with --quiet and writes any
warning to stderr, leaving JSON stdout unchanged.
The index source is different: capturing a coherent index uses git write-tree
and can contend with another index writer. It refuses an unavailable or
conflicted index rather than falling back to HEAD. Default working-tree
validation reads path membership without writing an index tree. Derivation
checks may still require index capture. Never stage another session's changes
merely to make a validation or regeneration command succeed.
Source selection is not deployment evidence. HEAD can include committed but undeployed changes; a successful generation records those selected inputs, not a claim that they were deployed.
A complete staged refresh therefore looks like this:
# Stage every changed input; include boundary.config.json only when it changed.
git add services/payment/main.yaml services/payment/openapi.generated.yaml
boundver generate --source index
git add boundary.lock.json
boundver verify --source index
--changed-from is reporting and scheduling information, not a shortcut.
Boundver still recomputes full lock integrity, so unchanged paths cannot hide
stale metadata in a component you did not touch.
Ordinary text output always names the resolved changed-component paths and
prints an explicit zero result; structured output carries the same selection in
changed_components.
Python load_config contract¶
boundver.load_config(config_path="boundary.config.json", source="working-tree")
loads and validates a config relative to the current Git repository. Use
source="head" or source="index" to read and validate the config and its
declared files from one immutable Git snapshot. The default preserves the
working-tree behavior of the original API.
The function returns only a semantically valid config. A lockfile, malformed
document, empty component map, unknown field/provider, unsafe or missing path,
missing config file, unreadable Git source, or unsupported source mode raises
the exported boundver.ConfigError (also a ValueError). A $schema field is
optional: the packaged schema is authoritative, so a repository cannot weaken
validation by replacing a local schema file.
Custom-provider declarations receive dependency-free structural and reference
validation, but load_config never imports or instantiates their Python code.
Use the explicit trusted opt-in on generate or verify when runtime provider
validation and execution are intended. The internal load_config_file helper
is parse-only and is not part of this validated public contract.
import boundver
try:
config = boundver.load_config(source="index")
except boundver.ConfigError as error:
raise SystemExit(f"invalid Boundver config: {error}")
The Python API requires a Git repository. If Git file listing becomes
unavailable during a working-tree operation after repository validation,
the bounded low-level reader can emit WARNING: git file listing failed;
falling back to filesystem enumeration on standard error and return a
filesystem approximation. Embedders that require fail-closed behavior should
capture standard error and reject that warning. head and index operations
fail with ConfigError instead of approximating an immutable source.
Diagnostic bases¶
The lock does not record its generating source commit. A commit that stores or introduces a lock entry is not proof of that source: locks can be copied, or generated before other changes are committed. Fingerprint equality is not unique source provenance either.
In v0.17 development, why --source head therefore leaves changed-file
attribution unavailable unless you supply --base-ref REF. Fingerprint drift
is still computed and reported. An explicit ref is resolved once to an immutable
commit and compared with the captured current source. This is an operator-chosen
source comparison, not proof that the lock was generated there or deployed.
Empty, whitespace-only, missing and ambiguous refs are usage errors.
index and working-tree diagnostics default to HEAD as a source-comparison
convenience, not as lock-source provenance. Verification still recomputes
fingerprints from the selected source independently of file diagnostics.
explain --source head requires an explicit --base-ref and exits 2 without
one: it has no file comparison to perform without a chosen old source. It does
not infer one from lock history or substitute a root-commit fallback. Fetching
more history alone does not prove where the lock was generated.
When explain finds no changes in the selected source, text output names the
other exact --source forms without silently reading those additional views.
This keeps the result bound to one snapshot while making an adjacent source
switch visible.
Resolved version comparisons¶
In v0.17 development, component why --format json includes version_change:
previous is the version recorded in the lock, current is resolved from the
selected source, and status is changed, unchanged or unavailable.
Missing, invalid or failed version resolution is unavailable; two null values
are not evidence of equal resolved versions. The legacy version field keeps
its fallback behavior and must not be used to determine whether a version moved.
Text output shows the comparison separately. Version movement does not prove
compatibility, deployment, or the lock's generating source. Slice explanations
and generation previews make the same distinction.
Text and JSON presentation¶
Human diagnostics name their selected source. Consumer edges recorded in the
lock have a separate declared-edge section in status, while actual
direct/transitive routing caused by boundary or compatibility drift appears
under Consumer impact in verify and why. The corresponding typed arrays
remain available in JSON.
Actionable selections and routing shown in JSON have a text equivalent. Machine-oriented details such as the complete lockfile object, facet-policy maps, full object identities, and stable field names remain JSON-only where the text command already provides a bounded summary. JSON source/provenance fields and command defaults are unchanged.
Argument and source-ref validation happens before a command result exists.
Consequently, --format json may exit 2 with empty standard output for usage
errors such as an invalid or ambiguous --base-ref; the bounded diagnostic is
written to standard error and is not an instance of the command's JSON schema.
Structured-input limits¶
Config and lock documents are capped at 10 MiB and 100,000 JSON-compatible values with at most 128 nesting levels. JSON receives a conservative lexical token preflight, YAML composition counts nodes and depth before constructing Python containers, and TOML scans array/table structure before invoking its parser. These preflights may reject a document that provably cannot fit the public tree contract; they do not replace the exact post-parse validation. Duplicate object keys, aliases, non-finite numbers, oversized integer or floating-point tokens, and format-specific ambiguous values remain fail-closed.
Repository-relative version files¶
The v0.17 development variant version_source.repo_file reads a version from
a sibling or shared manifest anywhere inside the same repository:
{
"path": "bi-jobs/processor",
"version_source": {
"repo_file": "bi-jobs/processor.service-definition.json",
"field": "image.version"
},
"boundary": {"provider": "leaf", "paths": []}
}
file remains relative to the component; repo_file is always relative to the
repository root, even when the config lives in another directory. Choose one
version-source variant only. No traversal, globs, absolute paths, backslashes,
or drive/ADS colons are permitted. Both file forms use the same strict JSON,
TOML or YAML reader, and the selected version must be text. YAML still requires
the optional parser; no repository code or generator is executed.
HEAD reads the committed file, index reads its staged version, and working-tree reads tracked disk bytes under the existing tracking policy. Symlinks and ancestor reparse points cannot supply version bytes through the source accessor. Missing, untracked or unparseable required versions fail closed rather than falling back to a different source, constant or Git tag.
The declaration participates in semantic-config identity. Existing file
declarations keep their meaning and digest algorithms; adopting repo_file
is an intentional config change requiring a supporting tool/schema and reviewed
lock regeneration. Older clients reject the new variant. It does not require
adding .. support or changing the v4 lock format.
An external version file contributes the resolved version and compatibility
identity, not implicit component exact/behavior/boundary coverage. If the
manifest is itself a published contract, declare that surface separately.
--changed-from includes its readers, any input-owning component, and transitive
version inheritors, while still verifying full lock integrity. Version
inheritance does not invent consumer edges. why and explain can list the
currently declared external version input without labeling it a boundary edit
or treating a version bump as deployment evidence.
For a migration from duplicated Git tags, first compare the file's version to the intended tag, change the declaration in a reviewed commit, and inspect the generated lock. Boundver does not create or delete release tags for you.
Declaration coverage¶
Before auditing selectors, note that an external version source is not automatically a boundary or behavior input; see repository-relative version files.
boundver coverage audits declarations without reading or writing the lock.
It reports two kinds of omission:
- tracked files under a component root that its available
behaviororboundaryselectors do not select; - files matching
coverage.source_indicatorswhose directories are outside every component path and declaredvendored_copiestree.
Exact-only components are complete by construction because exact covers the
tracked component tree. Compatibility identity is not a path selector.
{
"coverage": {
"source_indicators": ["**/*.py", "**/*.ts"],
"exclusions": [
{
"paths": ["services/api/internal/**"],
"facets": ["boundary"],
"reason": "private implementation"
},
{
"paths": ["tools/generated/**"],
"facets": ["ownership"],
"reason": "generated build helpers"
}
]
}
}
Coverage paths are repository-relative and use the same glob semantics and work budgets as other declarations. Exclusions apply only to the named coverage facets and always require a reason. Excluded and uncovered paths are reported separately.
boundver coverage --source head # advisory; exits 0
boundver coverage --source head --strict # exits 1 on uncovered paths
boundver coverage --source index --format json # boundver-declaration-coverage/v2
boundver coverage --source head --summary --strict
boundver coverage --component payment-api --component payment-client --summary
boundver coverage --path-prefix services/payment --limit 2000 --format json
The result names the selected config identity and the JSON Pointer responsible
for every group or exclusion. It reads one source view, follows no symlink, and
does not change config digests, component identities, slices, locks, or
verify results. Ignored untracked files are absent because coverage begins
from Git's tracked path set; a deliberately tracked ignored file remains in the
report.
Large and filtered coverage reports¶
Coverage analyzes the selected scope even when its path listing is shortened.
The default listing limit is 1,000 path entries across all facets and
ownership groups, not 1,000 unique files. A file omitted from both behavior and
boundary declarations contributes two entries. --limit 0 or --summary
prints counts without paths; --limit accepts 0 through 10,000. A separate
512 KiB detail budget may shorten a listing before the requested row limit.
Shell redirection to a file does not remove these limits.
--component NAME is repeatable and audits only those components' facets. It
does not run repository-wide ownership auditing: unowned paths cannot be
attributed to a selected component. --path-prefix PATH is a repeatable union
of literal, repository-relative path prefixes with segment boundaries, not
globs. It narrows both facet paths and ownership paths when ownership auditing
is enabled. Both filters may be combined. The full config must still validate;
filters cannot hide an invalid declaration elsewhere.
The v2 JSON contract records scope and presentation separately:
complete: truemeans analysis finished within the explicit scope. Checkscope.filteredbefore treating it as a whole-repository audit.presentation.total_paths,shown_pathsandomitted_pathscount entries;truncatedsays that paths were omitted from presentation. Each facet or ownership group has fulluncovered_countandexcluded_count, independently of its displayeduncovered_filesandexcludedarrays.okand--strictuse all in-scope findings, including undisplayed paths. A summary or truncated listing can therefore exit 1 even if no uncovered path is displayed. A complete all-excluded report remains advisory-clean.
Existing v1 consumers must explicitly accept and handle v2; the shorter arrays
are no longer exhaustive when presentation is truncated. Matchers retain their
work budgets. Coverage additionally bounds analyzed omitted entries to
1,000,000, facet/ownership groups to 10,000, filters to 256 of each kind, and
the full serialized result to 4 MiB. Exhausting an analysis/result budget exits
2 with no partial-success report; JSON analysis failures have complete: false
and ok: false. These are resource limits, not invitations to weaken policy.
Reasoned coverage.exclusions remain policy decisions. Do not add exclusions
or narrow declarations merely to make a large listing fit; use summary or
presentation filters instead.
Ownership auditing only considers coverage.source_indicators. With no
indicators it has no candidates; a clean result does not establish that every
source file in the repository has a declared owner.
Selector work limits¶
Path-glob matching is case-sensitive and segment-aware. A wildcard-bearing segment is limited to 4,096 UTF-8 bytes and 256 wildcard metacharacters. One compile-and-match invocation may consume at most 100,000 matcher steps.
That primitive ceiling is not reset into an unbounded declaration/file cross-product. Each built-in provider selection, component validation expansion (shared by boundary and behavior), and boundary change-analysis operation gets one 10,000,000-step aggregate budget. Every normalized pattern is compiled once in that operation, and its compilation plus every candidate transition consumes the shared budget. Exceeding it fails closed and asks the user to reduce wildcard declarations or split the component. Literal paths do not enter the glob matcher.
Historical range review¶
verify --changed-from maps changed paths while proving current lock
integrity. It does not compare historical identities. Use review when the
question is which recorded facets moved across a branch and which consumers or
slices need re-verification, including after the target lock has already been
reconciled:
boundver review origin/main..HEAD --merge-base --transitive
boundver review \
--base origin/main \
--target HEAD \
--merge-base \
--format json
The positional and explicit forms are equivalent. BASE..TARGET always means
the two named endpoints; three-dot syntax is rejected. Add --merge-base to
replace the effective base with the unique common ancestor of the resolved
base and target commits. Output records both the requested base commit and the
effective base commit so that choice cannot be hidden.
Before reading content, Boundver resolves each caller-supplied ref exactly once
to an unambiguous commit ID. It then reads the config and lock from immutable
trees reached by those IDs. A ref moving concurrently cannot create a hybrid
result. Text and JSON output identify the requested refs, resolved commits,
tree IDs, and exact COMMIT:path config and lock inputs for both endpoints.
Both endpoints must contain a valid boundary-lock/v4 /
boundver-semantic-config/v3 pair whose config_digest, component set,
consumer graph, slice membership, and project agree. This deliberately rejects
an unreconciled partial update, legacy or incompatible contracts, malformed
digests, and a graph that cannot be reconstructed reliably. Boundver also
recomputes every component and slice from each immutable endpoint and rejects a
stored lock that lags its source tree, even when its config digest is current.
A component-scoped
generation produced by Boundver is accepted because that operation proves all
unselected entries current before writing its coherent result.
This is a workflow precondition, not a compatibility verdict. Reconcile and
commit the lock at each endpoint before invoking review. The commits between
the endpoints may contain stale locks; the two endpoint commits may not. When
source-tree drift is found, the error identifies its exact commit, counts
drifted components, and fully verifies at most the eight nearest first-parent
commits. It checks commits in order without assuming that a lock or config edit
caused the reconciliation, and stops at the first safety guardrail.
Custom-provider declarations skip that search rather than executing repository-
declared Python repeatedly; merely permitting custom providers does not skip it
when the endpoint declares none.
Two repository disciplines follow from that rule:
- An endpoint-reconciled pull-request workflow commits the updated lock on the
branch, verifies
HEAD, and can then usereview --format planfor routing. - A periodic-lock workflow can compare its accepted checkpoints. It cannot use
an unreconciled pull-request tip as a target;
--merge-basechanges only the base and does not relax target validation. Useverify --changed-fromfor current-tree integrity and path reporting, and keep conservative test routing until the target lock is reconciled.
Historical recomputation does not import repository-declared Python by
default. A config using custom providers therefore fails closed unless trusted
automation explicitly adds --allow-custom-providers; checking out a branch
never grants that authority.
All four identities are compared. --facets changes only the recorded
effective policy selection; it never hides an identity transition. Consumer
impact is triggered by boundary/compat transitions or a consumer-graph edit.
For every affected edge, output says whether it exists at the base endpoint,
target endpoint, or both. This conservative union prevents a removed edge from
silently erasing historical impact. Direct impact is the default;
--transitive follows the complete, deterministic downstream closure and maps
changed or impacted components into slices from either endpoint.
For every boundary-facet transition, the machine result also contains one
provider-bound structural report. Each report repeats the base and target
requested ref/commit, effective commit/tree, component path, provider
name/version, and boundary digest so its evidence cannot be detached from the
reviewed artifacts. The provider capability and result identify
boundver-structural-diff/v1. In v0.15,
openapi-canonical is the first built-in that implements this optional
interface. It compares the provider's canonical JSON trees and emits
deterministic RFC 6901 paths classified as added, removed, or changed,
with only the before/after JSON types. It does not copy contract values into
the result. A newly added or removed subtree is represented once at its root;
arrays are compared positionally.
Raw providers remain raw: review reports provider-unsupported rather than
parsing bytes under a new meaning. Component/provider additions, removals, or
version transitions are similarly explicit instead of being compared across
incompatible identities. Structural output is explanatory evidence only. It
does not determine whether an OpenAPI change is backward compatible; use a
format-specific compatibility checker and consumer tests for that decision.
The top-level range complete flag describes the authoritative facet, graph,
and slice comparison. structural_changes.complete separately describes the
optional provider explanations. An unsupported provider therefore does not
invalidate the range review. A structural budget failure sets that report to
complete: false and truncated: true, records limit-exceeded, and emits an
empty document list rather than presenting partial rows as complete.
Graph traversal and slice mapping share one aggregate 250,000-step work budget
and a 100,000-row construction ceiling. Complete JSON and text documents are
capped at 64 MiB. Exceeding any limit
fails with exit 2 before emitting a partial result; a truncated closure is
never presented as an authoritative review.
Supported structural explanations have independent aggregate ceilings across the review: 32 MiB of canonical provider input, 250,000 traversal steps, 20,000 change rows, 16 MiB of retained structural output, 64 nesting levels, and 16 KiB per JSON pointer. The canonical provider's existing per-resolution source and output limits still apply before this diagnostic pass.
The complete machine result uses schema: boundver-review/v1 and is validated
by
spec/cli-output.review.schema.json.
For CI routing, --format plan projects that same in-memory result into
boundver-plan/v1; it does not resolve either ref again:
boundver review \
--base origin/main \
--target HEAD \
--merge-base \
--transitive \
--format plan \
--summary-file boundver-summary.md \
> boundver-plan.json
The plan keeps exact endpoint provenance and effective policy, changed
components/facets, conservative consumer and slice impact, structural evidence,
and deterministic selection arrays for changed, impacted, and combined test
components/slices. Its claim is routing-evidence-only. The contract is
validated by
spec/cli-output.plan.schema.json.
The optional Markdown summary is capped at 50 routing rows and 64 KiB. It says
whether its presentation is complete or truncated and always points back to the
complete JSON as the machine-authoritative result. Structural incompleteness is
reported separately and never disguised as plan incompleteness.
Successful analysis exits 0 even when identities changed because review is
a read-only query. Unreliable analysis exits 2. Run ordinary verify
separately as the current-candidate integrity gate.
Direct endpoint comparison needs both endpoint commits and trees, not every intervening commit. Merge-base mode additionally needs a unique common ancestor. Output always states whether Git reports a shallow repository and the effective history requirement. If an endpoint or merge base is absent, fetch complete history before retrying:
# GitHub Actions
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
Exit codes¶
| Code | Highest selected result |
|---|---|
0 |
Selected facets match |
1 |
Exact or metadata drift |
2 |
Usage, configuration, or digest error |
3 |
Behavior drift |
4 |
Boundary drift |
5 |
Compatibility-family drift |
Those are verify and verification-derived exit meanings. A complete
historical review returns 0 regardless of whether transitions are present;
it returns 2 when an endpoint, history, config, lock, or graph cannot be
reconstructed reliably.
coverage is advisory and returns 0 after any complete report. With
--strict, uncovered paths return 1; reasoned exclusions alone remain
successful. An incomplete coverage analysis returns 2.
When several selected facets drift, the highest severity wins. --fail-fast
limits the returned report to one issue; it does not stop boundver from
evaluating every other component first, so the exit code is still the global
result.
Exit 2 is categorically different from 1 and 3–5. The latter mean
"boundver checked, and something drifted." Exit 2 means boundver could not
perform a reliable check at all. Automation should treat it as a build error,
never as drift to be accepted:
This includes malformed or unavailable configuration and locks, source-capture failures, digest computation errors, unavailable requested facets, derivation failures, and incomplete diagnostics. These safety failures always outrank any ordinary facet drift reported in the same run.
set +e
boundver verify \
--source head \
--facets behavior,boundary,compat \
--format json > boundver-result.json
code=$?
set -e
case "$code" in
0) echo "Declared contracts are current" ;;
2) echo "boundver could not perform a reliable check" >&2; exit 2 ;;
3) echo "Behavior contract changed" >&2; exit 3 ;;
4) echo "Boundary changed; re-verify affected consumers" >&2; exit 4 ;;
5) echo "Compatibility family changed" >&2; exit 5 ;;
*) echo "Unexpected boundver result: $code" >&2; exit "$code" ;;
esac
--format json exposes issues, non-gating observations, bounded safety
notices, selected facets, component selection, update status, exact input
provenance, and typed consumer_impact. review, status, why, diff, slice, and discover
also have --format json. why distinguishes observed_drift from policy-gated
drifted; an exact-only observation does not recommend regeneration when
exact is not gated.
Human-readable output renders every value as one terminal-safe line. Embedded
newlines, carriage returns, C0/C1 controls, DEL, ANSI/OSC introducers, and
Unicode line separators appear as visible escapes; a value beginning with
:: cannot become a GitHub Actions workflow command. Ordinary Unicode remains
readable. The composite Action applies the same rule to each issues and
observations item before joining items with newlines. Structured JSON output,
including consumer_impact, preserves the exact machine data instead.
Diagnostic limits¶
Configuration, lock-generation, and verification failures retain at most 256
diagnostic entries and 256 KiB of UTF-8 text in total; each entry is capped at
8 KiB. When either aggregate limit is reached, boundver stops collecting and
adds one DIAGNOSTICS TRUNCATED sentinel. The operation remains failed and
verify --format json carries the sentinel in issues, so the composite
Action exposes the same condition rather than turning omitted failures into a
successful result. Exit code 2 is used when truncation prevents a reliable
classification.
Consumer graph limits¶
Machine-readable impact remains complete and schema-valid: a config may contain
at most 10,000 configured components and 10,000 distinct external-consumer
labels repository-wide, and each component name or external label may contain
at most 16,384 characters. validate-config rejects larger graphs before
generation or verification; boundver never emits a partial transitive closure.
Configured component names and internal references to them cannot contain a
comma or leading/trailing whitespace. --components, the GitHub Action, and
the GitLab Catalog all use a comma-separated filter and trim tokens, so allowing
those spellings would create components that no scoped command could address.
Opaque external_consumers labels are not component selectors and retain their
broader string contract.
What each facet needs¶
A facet is available for a component only when its declaration can produce a
digest. Gating a facet a component cannot supply is a configuration error, not
drift — boundver reports UNAVAILABLE FACET and exits 2 rather than
inventing an identity.
| Facet | Available when |
|---|---|
exact |
Always, for any component with tracked files |
behavior |
behavior.paths is declared and non-empty |
boundary |
The provider publishes a boundary — any provider except leaf, and implicit only when it declares paths |
compat |
version_source is declared |
Two consequences are worth internalizing before you write a policy:
- A
leafcomponent never suppliesboundary. That is the point of declaring it a leaf: it consumes a contract without publishing one. It still suppliesexact, and it can supplybehaviorwhenbehavior.pathsis non-empty andcompatwhenversion_sourceis declared. Itsboundary.pathsmust therefore be absent or empty; non-empty paths are a configuration error instead of silently ignored input. - A slice inherits this constraint from its members. A slice in
mode: boundaryneeds a boundary digest from every member. This bites most often withclosure_of, where you do not choose the membership: the resolved downstream closure can pull in exactly the leaf consumers that cannot supply the mode. Useexactfor heterogeneous closures.
validate-config applies these rules by default, so an unsatisfiable policy is
reported before generate runs.
The compatibility identity can come from any one of four declarations:
{"version_source": {"file": "package.json", "field": "version"}}
{"version_source": {"git_tag_prefix": "service-v"}}
{"version_source": {"component": "service-package"}}
{"version_source": {"constant": "1.0.0"}}
component inherits the referenced component's resolved version from the same
selected source. References must name another configured component; self
references and cycles fail validation and generation. This is useful for a
schema directory or generated contract that shares the owning package's
release identity. constant must be a bounded, whitespace-free SemVer string
and is itself part of semantic configuration identity. Use it only when no
tracked manifest or tag owns the version.
For a file source, the selected JSON, TOML, YAML, or YML value must be a string.
Quote numeric-looking versions: a parsed number cannot preserve source spelling
(1.10 becomes 1.1), so Boundver refuses it rather than changing identity.
Version inheritance is not a consumer edge: declare consumers separately for
impact routing. A compat slice uses each member's resolved identity, including
inherited and constant versions, exactly as it uses file- and tag-backed ones.
git_tag_prefix is a literal prefix, not a glob. It is limited to 4,096
characters and must be able to form a valid refs/tags/<prefix><semver> name.
If one component's prefix is a strict prefix of another component's prefix,
the shorter prefix also matches the longer component's tags when the remaining
suffix is valid SemVer. Use non-overlapping prefixes when components must have
independent compatibility identities.
Git-forbidden whitespace and controls, ~, ^, :, ?, *, [, \,
.., @{, empty path components, dot-prefixed components, and completed
components ending in .lock are rejected during config validation. Unicode
and slash-separated namespaces are supported; a final /, ., or .lock
is valid only when appending the version completes a valid tag component.
A valid prefix can still have no reachable tag, especially in a shallow clone. That is a source-history error reported during generation, distinct from an invalid declaration. Fetch the required tags and commit history; do not replace the literal prefix with wildcard syntax.
--allow-partial¶
--allow-partial permits intentional null slice inputs — a boundary slice
that temporarily includes an implicit component during adoption, for example.
It does not suppress failures. Missing declared paths, provider errors, broken version sources, and vendored-copy mismatches remain fatal with or without it.
Generated-artifact freshness¶
Use a top-level derivations declaration when a component boundary is generated
from other tracked files:
{
"derivations": {
"public-api": {
"inputs": ["infrastructure/template.yaml"],
"outputs": ["infrastructure/openapi.generated.yaml"],
"evidence": "infrastructure/openapi.boundver-derivation.json",
"generator": "sam-openapi/v1"
}
}
}
Every input and output selector must match at least one tracked file in the
selected source. Inputs and outputs cannot overlap. Each output must also be
selected by a component boundary and cannot belong to two derivations. The
evidence path is a unique, portable literal ending in
.boundver-derivation.json.
Run the trusted generator yourself, then record what it produced:
python ci/generate_platform_openapi.py
git add boundary.config.json infrastructure/template.yaml \
infrastructure/openapi.generated.yaml
boundver record-derivation public-api --source index
git add infrastructure/openapi.boundver-derivation.json
boundver generate --source index
git add boundary.lock.json
boundver verify --source index
record-derivation is the only mutating derivation command. Its receipt binds
the derivation name, the declared generator identity, and deterministic,
mode-aware digests of the selected input and output file sets. This permits a
new derivation, its files, receipt, and lock to land together without a partial
lock. Use head, index, or working-tree consistently; the receipt is checked
against that same selected source during validation, generation, and
verification.
Freshness hashing has one operation-wide ceiling equivalent to one maximally sized input digest plus one maximally sized output digest: 100,000 selected-file visits and 512 MiB of hashed content. Identical selected sets in the same digest domain are hashed once. This prevents many overlapping derivations from multiplying bounded per-derivation work into an unbounded operation.
The generator value is an identifier, not a command. Boundver never executes
it or any other repository-configured derivation command. The receipt proves
that the declared inputs and outputs have not moved since recording; it is not
a signature, does not attest who ran the generator, and does not prove the
generator is correct. Keep a deterministic generator --check step in trusted
CI when you need an independent reproducibility check.
Upgrading¶
Boundver pins configuration and CLI-output schemas to the release tag. A
persisted lock points to the immutable canonical publication of its structural
lock schema (boundary-lock/v4 uses the v0.16.0 schema URL), so a
digest-neutral package upgrade does not dirty the lock merely to rotate a
schema annotation. A structural lock change must advance the lock schema and
select a new canonical publication. The upgrade procedure is:
python -m pip install --upgrade "boundver[schema,yaml]==0.17.0"
boundver validate-config --source head
boundver verify --source head
Upgrading from 0.16 with an existing supported lock does not require lock regeneration. Do not record unrelated or undeployed checkout changes merely to upgrade the tool. Read the release's upgrade contract first. Only when declarations or selected source inputs intentionally change, review and stage those changes before generating a new snapshot:
# Stage changed config and every changed or newly selected contract input.
git add boundary.config.json services/payment/openapi/new-route.yaml
boundver generate --source index
git add boundary.lock.json
boundver verify --source index
git diff --cached -- boundary.config.json boundary.lock.json
Replace the illustrative source path with your own changed inputs, and omit
boundary.config.json when it did not change. If you prefer a head baseline,
commit the config and source changes first and generate afterwards. Update CI,
local tooling, and automation in the same change.
Hash-bearing locks are never relabelled. boundver migrate-lock rejects
boundary-lock/v1, v2, and v3, directing you to regenerate from repository
content instead. For a current v4 lock, the command only removes supported
legacy metadata or fills supported missing maps. An already-normalized lock is
a true no-op: its representation and file metadata are left untouched.
--dry-run prints prospective normalized JSON only when data would change and
otherwise reports the no-op without rewriting or reformatting the lock.
For what a regeneration diff should look like on each upgrade path — and how to inspect 0.10 selector changes before you commit to one — see migration and ratcheting.
Related¶
- Why boundver? — the model, and what it cannot detect
- Getting started — first configuration and baseline
- Gradual adoption — staged rollout in an existing repo
- CI cookbook — pipeline recipes