requirements.configuration.feature_sections
Requirements index · View definition
Requirement
Each configurable feature MUST define the name and typed data structure of its user section and any supported project section, citing these common configuration requirements. The feature MUST specify its supported keys, value types, defaults, validation rules, and the precedence or combination rules for user settings, project settings, and invocation options. It MUST specify the behavior of an absent section and which operations require that section.
Feature-specific fields MUST stay within the feature’s section. A feature MUST NOT reinterpret another feature’s settings or change the shared file locations or schema version. A feature MAY define a provider-owned options map, but MUST document that boundary and how those options are validated.
Rationale
Scope. requirements.configuration.feature_sections is mostly a documentation and structure obligation on each feature. It is refined by the authoring, evidence, coverage and workspace-structure requirements, which carry {impl} references to it. Their detailed keys, defaults, validation, precedence and which-operation-requires-the-section rules belong to those requirements’ own reviews. The subject’s own tests only need to cover the cross-feature obligations. They are the two tests marked {test}: tests/configuration.rs#fn[feature_sections_are_scoped_and_absent_sections_use_defaults] and tests/configuration.rs#fn[invalid_schema_and_feature_values_report_the_configuration_path].
Obligations mapped to tests.
- Feature fields stay in the feature’s section, with no reinterpretation of other features’ settings.
feature_sections_are_scoped_and_absent_sections_use_defaultsfeedsWorkspaceConfig::parsetop-levelallow,defaultandreauthorings. It also feeds[authoring] allow,[evidence] defaultand[coverage] allow. All are rejected.- It rejects
[evidence]and[coverage]in the user file, so[coverage]has no user-file counterpart. - It rejects an
allowkey inside an authoring config in both the user and workspace files. - A workspace file with an invalid
[authoring]section (default = 'missing',unknown = 1) still loads its[evidence]policy throughload_workspace_evidence. So evidence loading neither reinterprets nor validates authoring settings.
- Provider-owned options map has a documented, validated boundary. The same test rejects
options.model = 'x'in both file types.invalid_schema_and_feature_values_report_the_configuration_pathalso rejects it, along withnanoption values, unknown keys, bad backends and badapi_key_env. Each error is asserted to name the config file path. - Absent section behavior.
version = 1alone yieldsauthoring,evidenceandcoverageasNone. An absent[evidence]table, or an empty one, gives empty allow and disallow lists.- An absent user
[authoring]section givesNone. configs = {}is a valid empty authoring section.- Which operations require the
[authoring]section is delegated torequirements.authoring.configuration, which refines this requirement.
- Typed structure, value types and validation rules.
reauthorings = 5parses, andreauthorings = 0is rejected with an error namingcoverage.reauthorings.- The invalid-values test covers wrong types (
version = '1'), a bad config name, an empty model, a relative project key, and an unsupported backend.
- Does not change the schema version. Every feature section is paired with
version = 2and rejected with an error mentioningversion. A missing version andversion = '1'are also rejected. The shared file locations are not changed by feature loading, and no test sets up an alternative location.
Gaps. The detailed per-feature specifications (defaults, precedence, which operations require a section) are checked under the refining requirements’ own tests. The assertions here check the expected outcomes, not just execution. I found no plausible violating behavior that these tests would accept.
Inputs
Implementation
Input 2: requirements selection requirements.authoring.configuration
requirements.authoring.configuration:md/requirements/authoring.md:1579–1595
:::{req} configuration
Authoring MUST use the `[authoring]` sections of the shared user configuration
and the selected workspace's `habeas.toml`, refining
{impl}`requirements.configuration.feature_sections` for the authoring feature.
{cite}`requirements.configuration.user_location`
{cite}`requirements.configuration.structure`
Assessing a subject with `habeas author`, singly or in a batch that needs at
least one assessment, MUST require an `[authoring]` section in at least one of
these files; either section MAY be absent. No other operation requires the
section, including a batch with no assessments needed and the operations in
{cite}`requirements.authoring.deterministic_validation`.
It MUST support named configurations, workspace defaults, and a user-local
selection for each project. Credential-source references SHOULD be used;
explicit credentials MUST be supported under {cite}`requirements.authoring.credentials`.
{cite}`requirements.configuration.workspace_location`
{cite}`requirements.configuration.workspace_structure`
:::
Input 3: requirements selection requirements.authoring.configuration_structure
requirements.authoring.configuration_structure:md/requirements/authoring.md:1602–1676
:::{req} configuration_structure
{impl}`requirements.configuration.feature_sections`
Habeas MUST define its authoring configuration using these data structures:
```text
UserAuthoringConfig {
default: Optional<ConfigName>,
configs: Map<ConfigName, AuthoringConfig>,
projects: Map<CanonicalProjectRoot, ProjectSelection>,
}
WorkspaceAuthoringConfig {
default: Optional<ConfigName>,
configs: Map<ConfigName, AuthoringConfig>, // omitted means empty
}
ProjectSelection {
config: ConfigName,
}
AuthoringConfig {
backend: BackendConfig, // tagged union, flattened in TOML
concurrency: Optional<PositiveInteger>, // simultaneous assessments
policy: Optional<AssessmentPolicy>, // default: Once for OpenAI; Confirm otherwise
}
AssessmentPolicy = Confirm | Once // TOML: "confirm" or "once"
BackendConfig = Bedrock(BedrockConfig) | Ollama(OllamaConfig) | Openai(OpenAiConfig)
BedrockConfig {
model: ModelId, // model ID or inference-profile ID/ARN
aws_profile: Optional<String>,
region: Optional<String>,
credentials: Optional<BedrockCredentials>,
options: Map<String, OptionValue>,
}
BedrockCredentials {
access_key_id: SecretString,
secret_access_key: SecretString,
session_token: Optional<SecretString>,
}
OllamaConfig {
model: ModelId, // exact identifier, including tag
endpoint: Optional<String>, // default: http://localhost:11434
api_key_env: Optional<EnvironmentVariableName>,
api_key: Optional<SecretString>,
options: Map<String, OptionValue>,
}
OpenAiConfig {
model: Optional<ModelId>, // default: gpt-6.1-sol
endpoint: Optional<String>, // default: https://api.openai.com/v1
api_key_env: Optional<EnvironmentVariableName>, // default: OPENAI_API_KEY
api_key: Optional<SecretString>,
options: Map<String, OptionValue>,
}
OptionValue = String | Boolean | Integer | FiniteFloat
| Array<OptionValue> | Map<String, OptionValue>
SecretString = String // serialized normally; redacted in Debug
ModelRef {
backend: BackendKind, // Bedrock, Ollama, or Openai
model: ModelId,
}
```
`ModelRef` MUST be derived from the selected backend configuration and MUST
preserve the exact model identifier. It MUST identify the model without replacing
connection settings such as AWS profile, region, or Ollama endpoint.
:::
Input 4: requirements selection requirements.authoring.configuration_serialization
requirements.authoring.configuration_serialization:md/requirements/authoring.md:1678–1691
:::{req} configuration_serialization
{impl}`requirements.configuration.feature_sections`
The user `[authoring]` table MUST serialize UserAuthoringConfig, and the workspace
table MUST serialize WorkspaceAuthoringConfig. Each
`[authoring.configs.<name>]` table MUST serialize one AuthoringConfig, with
`backend = "bedrock"`, `backend = "ollama"`, or `backend = "openai"` and that variant's fields in the same
table. Backend-specific inference options MUST appear in its `options` subtable.
Within a present user authoring section, `configs` MUST be present but MAY be empty;
workspace `configs` MAY be omitted, allowing a workspace default to select a
named user configuration.
omitted `projects` and `options` tables MUST deserialize as empty maps.
Serialization MUST follow the common rules in
{cite}`requirements.configuration.serialization`.
:::
Input 5: requirements selection requirements.authoring.openai_defaults
requirements.authoring.openai_defaults:md/requirements/authoring.md:1693–1703
:::{req} openai_defaults
{impl}`requirements.configuration.feature_sections`
An OpenAI configuration MAY omit `model`; the effective model MUST then be
`gpt-6.1-sol`. When `options.reasoning.effort` is omitted, the request MUST use
`low` effort, preserving other reasoning options. When `options.max_output_tokens`
is omitted, the request MUST use an output-token limit of 16,384. These option
defaults MUST apply even when the model is overridden. An explicit model,
reasoning effort, or output-token limit MUST override its corresponding default.
Defaults MUST NOT be written into omitted configuration fields on serialization.
An explicitly empty model MUST still be rejected.
:::
Input 6: requirements selection requirements.authoring.configuration_storage
requirements.authoring.configuration_storage:md/requirements/authoring.md:1761–1773
:::{req} configuration_storage
{impl}`requirements.configuration.feature_sections`
Configuration names MUST match `[A-Za-z0-9][A-Za-z0-9_-]*` and be case-sensitive.
Project-selection keys MUST be canonical absolute project-root paths. Model IDs
MUST be nonempty opaque strings, preserving tags and ARNs. `api_key_env` MUST
name a nonempty environment variable without `=` or NUL.
Authoring MUST validate its fields under {cite}`requirements.configuration.loading`.
The `options` map MUST accept backend-defined inference settings rather than a
closed Habeas list; the adapter MUST pass them through Rig's provider parameter
mechanism and report rejection by Rig or the provider. These options MUST NOT
replace the selected model, the assessment prompt, or tool definitions.
:::
Input 7: requirements selection requirements.authoring.configuration_precedence
requirements.authoring.configuration_precedence:md/requirements/authoring.md:1775–1793
:::{req} configuration_precedence
{impl}`requirements.configuration.feature_sections`
`--config <name>` MUST select a configuration for that invocation. Otherwise,
authoring MUST use the user's selection for the canonical project root, then the
workspace default, then the user's default. Named workspace configurations MUST
override same-named user configurations as complete records. Backend, model,
connection settings, and options MUST come from the selected record as a unit;
fields MUST NOT be merged between records. Workspace-only authoring MUST work
without a user configuration file. Missing configuration or an unknown selection
MUST identify the relevant configuration file and point to documented examples.
An explicit Bedrock AWS profile or region MUST override the corresponding SDK
default; omitted values MUST use standard AWS SDK resolution. Ollama MUST use
its configured endpoint or `http://localhost:11434`. If `api_key_env` is set, its
named variable MUST supply the credential; a missing or empty value MUST produce
an error before a model request. OpenAI MUST use its configured endpoint or
`https://api.openai.com/v1`, and MUST resolve `OPENAI_API_KEY` when neither
`api_key` nor `api_key_env` is supplied.
:::
Input 8: requirements selection requirements.configuration.workspace_structure
requirements.configuration.workspace_structure:md/requirements/configuration.md:110–124
:::{req} workspace_structure
{impl}`requirements.configuration.feature_sections`
`habeas.toml` MUST serialize WorkspaceConfig as UTF-8 TOML with `version = 1`.
Its supported feature tables are `[authoring]`, `[coverage]`, and
`[evidence]`; each MAY be absent. `[coverage]` has one optional key,
`reauthorings`, under {cite}`requirements.references.coverage.history`; it has
no user-file counterpart or invocation option, and no operation requires it. Unknown keys, unsupported versions, and invalid field types MUST produce
a diagnostic identifying the file and setting. Invalid TOML, including content
that is not UTF-8, MUST produce a diagnostic identifying the file, with the line
and column of a syntax error.
Features MUST define their own data structures and loading rules under
{cite}`requirements.configuration.feature_sections`. A file containing only
`version = 1` MUST be valid. Habeas settings MUST NOT require a `[habeas]` table
inside `book.toml`.
:::
Input 9: requirements selection requirements.configuration.evidence_paths
requirements.configuration.evidence_paths:md/requirements/configuration.md:126–150
:::{req} evidence_paths
The workspace `[evidence]` table MUST serialize EvidenceConfig. `allow` and
`disallow` MUST be arrays of nonempty literal paths, each naming a file or a
directory subtree. Relative paths MUST resolve from the selected `habeas.toml`
directory; absolute paths MUST be supported. These paths are not glob patterns.
An omitted `allow` or `disallow` MUST mean an empty array, and an absent
`[evidence]` table MUST mean both are empty, so only the default source-access
rules apply. No operation requires the section. The table has no user-file
counterpart, and these rules have no invocation options. This section refines
{impl}`requirements.configuration.feature_sections` for the evidence feature.
For authoring reads, a matching disallow MUST reject the path; otherwise a
matching allow MUST permit it; otherwise the default source-access rules MUST
apply. Explicit allow MUST override every default, including Git tracking,
project containment, generated-evidence exclusion, and automatic generated-output
rules. Disallow MUST win even when an allow or generated-output rule also matches.
Both the requested path and its resolved symlink target MUST be checked for
disallow, so an allowed alias cannot expose a disallowed target.
The same explicit disallow rules and external-path exceptions MUST apply when
resolving recorded evidence inputs, including ordinary validation. Validation MUST
remain independent of Git index membership: it
checks the recorded inputs' existence and contents. Loading path policy MUST NOT
resolve credentials or validate unused authoring settings.
:::
Input 10: requirements selection requirements.references.coverage.history
requirements.references.coverage.history:md/requirements/references.md:245–260
:::{req} coverage.history
{impl}`requirements.configuration.feature_sections`
An item has recent coverage when it has a reference that covers it under
{cite}`requirements.references.rust_item_coverage`, or when its outline node, or
an outline node containing it, is named by file and selector in the inputs of
any version of an existing evidence record, citation review, or site review in
its coverage window. A file's coverage window MUST be its current contents on
disk, committed or not, together with its contents in each of the last N
commits in its Git history that changed it, read through a Git library rather
than by running `git`. A recorded hash MUST NOT matter here: an earlier version
names the node, whatever its code was then. N MUST be the workspace
`[coverage]` setting `reauthorings`, a positive integer, and 3 when it is not
set. When the history is unavailable, such as outside Git or in a shallow clone
missing those commits, the window MUST be the commits that are available, and
`habeas status --coverage` MUST say that coverage history is incomplete.
:::
Tests
Input 11: outline tests/configuration.rs fn[invalid_schema_and_feature_values_report_the_configuration_path]
- File:
tests/configuration.rs - Selector:
fn[invalid_schema_and_feature_values_report_the_configuration_path] - Kind:
fn tests/configuration.rs:358–386
// {test}`requirements.configuration.structure`
// {test}`requirements.configuration.loading`
// {test}`requirements.authoring.configuration_serialization`
// {test}`requirements.authoring.configuration_storage`
// {test}`requirements.configuration.feature_sections`
#[test]
fn invalid_schema_and_feature_values_report_the_configuration_path() {
let path = Path::new("/settings/habeas/config.toml");
for source in [
"version = 2",
"version = '1'",
"",
"version = 1\nunknown = true",
"version = 1\n[authoring]",
"version = 1\n[authoring]\nconfigs = {}\ndefault = '_bad'",
"version = 1\n[authoring.configs.local]\nbackend = 'ollama'\nmodel = ''",
"version = 1\n[authoring.configs.local]\nbackend = 'ollama'\nmodel = 'm'\nunknown = true",
"version = 1\n[authoring.configs.local]\nbackend = 'unsupported'\nmodel = 'm'",
"version = 1\n[authoring.configs.local]\nbackend = 'ollama'\nmodel = 'm'\napi_key_env = 'BAD=KEY'",
"version = 1\n[authoring.configs.local]\nbackend = 'ollama'\nmodel = 'm'\n[authoring.configs.local.options]\nvalue = nan",
"version = 1\n[authoring.configs.local]\nbackend = 'ollama'\nmodel = 'm'\n[authoring.configs.local.options]\nmodel = 'override'",
"version = 1\n[authoring]\nconfigs = {}\n[authoring.projects.relative]\nconfig = 'local'",
] {
let error = UserConfig::parse(source, path).unwrap_err().to_string();
assert!(error.contains("/settings/habeas/config.toml"), "{error}");
}
let valid = UserConfig::parse("version = 1\n[authoring]\nconfigs = {}", path).unwrap();
assert!(valid.authoring.unwrap().configs.is_empty());
}
Input 12: outline tests/configuration.rs fn[feature_sections_are_scoped_and_absent_sections_use_defaults]
- File:
tests/configuration.rs - Selector:
fn[feature_sections_are_scoped_and_absent_sections_use_defaults] - Kind:
fn tests/configuration.rs:1203–1271
// {test}`requirements.configuration.feature_sections`
// {test}`requirements.configuration.evidence_paths`
// {test}`requirements.configuration.structure`
// {test}`requirements.configuration.workspace_structure`
#[test]
fn feature_sections_are_scoped_and_absent_sections_use_defaults() {
let temp = tempfile::tempdir().unwrap();
let path = temp.path().join("habeas.toml");
// An absent `[evidence]` table, or omitted arrays, mean empty lists.
for source in ["version = 1\n", "version = 1\n[evidence]\n"] {
fs::write(&path, source).unwrap();
let policy = load_workspace_evidence(temp.path()).unwrap().unwrap();
assert!(policy.evidence.allow.is_empty() && policy.evidence.disallow.is_empty());
}
let config = WorkspaceConfig::parse("version = 1\n", &path).unwrap();
assert!(config.authoring.is_none() && config.evidence.is_none() && config.coverage.is_none());
let config =
WorkspaceConfig::parse("version = 1\n[coverage]\nreauthorings = 5\n", &path).unwrap();
assert_eq!(config.coverage.unwrap().reauthorings, Some(5));
// The one positivity rule applies to the whole-file parse too.
let error = WorkspaceConfig::parse("version = 1\n[coverage]\nreauthorings = 0\n", &path)
.unwrap_err()
.to_string();
assert!(error.contains("coverage.reauthorings"), "{error}");
// Feature settings must stay within their sections.
for source in [
"version = 1\nallow = ['generated']\n",
"version = 1\ndefault = 'cloud'\n",
"version = 1\n[authoring]\nallow = ['generated']\n",
"version = 1\n[evidence]\ndefault = 'cloud'\n",
"version = 1\nreauthorings = 3\n",
"version = 1\n[coverage]\nallow = ['generated']\n",
] {
assert!(WorkspaceConfig::parse(source, &path).is_err(), "{source}");
}
assert!(UserConfig::parse("version = 1\n[evidence]\nallow = []\n", &path).is_err());
// `[coverage]` has no user-file counterpart.
assert!(UserConfig::parse("version = 1\n[coverage]\nreauthorings = 3\n", &path).is_err());
// The evidence feature does not reinterpret or validate authoring settings.
fs::write(
&path,
"version = 1\n[authoring]\ndefault = 'missing'\nunknown = 1\n[evidence]\nallow = ['generated']\n",
)
.unwrap();
let policy = load_workspace_evidence(temp.path()).unwrap().unwrap();
assert_eq!(policy.evidence.allow, vec![Path::new("generated")]);
// Authoring settings stay in `[authoring]`; its provider-owned options
// cannot replace harness settings.
for source in [
"version = 1\n[authoring.configs.c]\nbackend = 'ollama'\nmodel = 'm'\nallow = []\n",
"version = 1\n[authoring.configs.c]\nbackend = 'ollama'\nmodel = 'm'\n[authoring.configs.c.options]\nmodel = 'x'\n",
] {
assert!(UserConfig::parse(source, &path).is_err(), "{source}");
assert!(WorkspaceConfig::parse(source, &path).is_err(), "{source}");
}
// An absent authoring section configures nothing.
let user = UserConfig::parse("version = 1\n", &path).unwrap();
assert!(user.authoring.is_none());
for feature in [
"[authoring]\nconfigs = {}",
"[evidence]\nallow = []",
"[coverage]\nreauthorings = 3",
] {
let error = WorkspaceConfig::parse(&format!("version = 2\n{feature}\n"), &path)
.unwrap_err()
.to_string();
assert!(error.contains("version"), "{error}");
}
}
Other sources
Input 1: requirements selection requirements.configuration.feature_sections
requirements.configuration.feature_sections:md/requirements/configuration.md:185–197
:::{req} feature_sections
Each configurable feature MUST define the name and typed data structure of its
user section and any supported project section, citing these common configuration
requirements. The feature MUST specify its supported keys, value types, defaults,
validation rules, and the precedence or combination rules for user settings,
project settings, and invocation options. It MUST specify the behavior of an
absent section and which operations require that section.
Feature-specific fields MUST stay within the feature's section. A feature MUST
NOT reinterpret another feature's settings or change the shared file locations
or schema version. A feature MAY define a provider-owned options map, but MUST
document that boundary and how those options are validated.
:::