Skip to content

Roadmap 3.11.4: complete OrthoConfig precedence-ladder regression tests (#385) - #582

Merged
leynos merged 9 commits into
mainfrom
issue-385-roadmap-3-11-4-complete-orthoconfig-precedence-ladder-regression-tests
Aug 23, 2026
Merged

Roadmap 3.11.4: complete OrthoConfig precedence-ladder regression tests (#385)#582
leynos merged 9 commits into
mainfrom
issue-385-roadmap-3-11-4-complete-orthoconfig-precedence-ladder-regression-tests

Conversation

@leynos

@leynos leynos commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Closes #385

Summary

Completes roadmap item 3.11.4 (issue #385) with exhaustive regression coverage of the Netsuke config precedence ladder, following the two-selector framing recorded in ADR-004 (--config > NETSUKE_CONFIG > automatic discovery). No second environment selector is introduced, asserted, or assumed anywhere.

Task 1 — Full-ladder scalar precedence regression tests

  • tests/cli_tests/merge_probe.rs: hermetic system-scope config helper via the closed discovery env set (isolated system-configuration directory), reusing the fabricated HOME/XDG_CONFIG_HOME isolation; no parent-process env mutation; no second selector.
  • tests/cli_tests/config_discovery_scopes.rs: rstest cases proving system-scope discovery, user-over-system precedence, and system-only merge-through for manifest path, emoji policy, locale, and jobs.
  • tests/cli_tests/config_precedence_ladder.rs (new): unified end-to-end ladder test — CLI > environment > project > user > system > default, with per-rung #[case] seeding; deferred profile-rung marker for roadmap 5.3.1; closed-selector NETSUKE_CONFIG_PATH guard asserting the legacy variable has no effect.

Task 2 — Property-based merge-ordering and list-append tests

  • tests/cli_tests/merge_targets_proptests.rs (new): hand-written proptest strategies (no derive(Arbitrary)) verifying merge ordering (defaults > file > environment > CLI) and default_targets append-in-discovery-order semantics, plus the documented explicit-build <targets...> replace-over-append asymmetry.

Task 3 — Display-policy resolution coverage across the enum domain

  • tests/cli_tests/display_policy_domain.rs (new): deterministic exhaustive sweep of every EmojiPolicy x ProgressPolicy x AccessibilityPolicy x ColourPolicy x OutputMode x json combination (-x NO_COLOR toggle) against a hand-written truth model, an output-mode/TERM sweep, and a proptest — verifying theme/output-prefs precedence (explicit theme preference > emoji policy > NO_COLOR > output mode) without adding conflict rules. src/theme.rs and src/output_prefs.rs untouched.

Task 4 — Dependency-boundary docs + roadmap alignment

  • docs/roadmap.md item 3.11.4 ticked for precedence expectations and CLI-override layers now covered; profile-selection deferred to 5.3.1; OrthoConfig 5.2.3 documented as an upstream roadmap identifier (not a crate version) and left blocked on upstream — Cargo.toml unchanged (stays at ortho_config = 0.9.0).

Guard files src/cli/config_path_precedence_tests.rs and src/cli/discovery_tracing_tests.rs::legacy_config_path_variable_is_not_a_selector remain unmodified and passing.

Verification

  • Workspace cargo fmt --check and cargo clippy --workspace --all-targets --all-features -- -D warnings: clean.
  • cargo nextest run --workspace: 2315 tests passed, 0 failures (3 environment-dependent skips).
  • CodeRabbit --agent review: 0 findings across 3 passes (7 files).

Commits: 8faa7102 (Task 1), 87eb5ea7 (Task 2), 7423836a (Task 3), 70f70155 (Task 4).

References

Summary by Sourcery

Complete roadmap item 3.11.4 by formalizing Netsuke’s configuration precedence and display-policy behavior through comprehensive regression and property-based tests.

Enhancements:

  • Add exhaustive regression coverage for configuration discovery and precedence across system, user, project, environment, CLI, and default layers, while documenting the deferred profile layer and closed selector model.
  • Add property-based coverage for scalar merge ordering and default-target append semantics.
  • Add exhaustive and property-based validation of display-policy resolution across policy enums, JSON, NO_COLOR, TERM, and output modes.

Documentation:

  • Document the new configuration-precedence and display-policy regression suites and align roadmap item 3.11.4 with the completed coverage and upstream dependency boundary.

Tests:

  • Cover system-scope discovery, user and project precedence, legacy selector rejection, full scalar precedence, target-list merging, and the consolidated display-policy domain.

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Warning

Your free Security trial is over. An organization admin can activate billing to continue.

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Summary

  • Add regression coverage for ADR-004 configuration precedence: --config > NETSUKE_CONFIG > automatic discovery.
  • Test scalar precedence across default, system, user, project, environment, and CLI layers.
  • Verify hermetic system-scope discovery and confirm NETSUKE_CONFIG_PATH is not a selector.
  • Add property-based tests for scalar merging and ordered default_targets appending.
  • Add exhaustive display-policy coverage across output modes, JSON, NO_COLOR, TERM, accessibility, colour, progress, and emoji settings.
  • Document the isolated test environment and Unix-only system-scope scenarios.
  • Update the roadmap to record completed coverage and defer profile precedence to task 5.3.1.
  • Keep ortho_config at 0.9.0; track OrthoConfig 5.2.3 as an upstream roadmap dependency.

Relates to ADR-004 and issue #385.

Walkthrough

Changes

Configuration regression coverage

Layer / File(s) Summary
Configuration scope discovery
tests/cli_tests/config_discovery_scopes.rs, tests/cli_tests/merge_probe.rs
Add isolated system, user, and project scope tests. Verify discovery and precedence behaviour.
Precedence ladder verification
tests/cli_tests/config_precedence_ladder.rs, tests/cli_tests/mod.rs, docs/roadmap.md
Cover defaults through CLI precedence, selector behaviour, deferred profiles, and roadmap status.
Merge semantics properties
tests/cli_tests/merge_targets_proptests.rs
Verify scalar precedence and discovery-order target concatenation with generated configuration layers.
Display-policy domain validation
tests/cli_tests/display_policy_domain.rs
Validate display-policy combinations with exhaustive, property-based, and parameterised tests.
Regression coverage documentation
docs/developers-guide.md, docs/roadmap.md
Document the regression-test modules, isolated execution model, roadmap identifiers, and exclusive automatic discovery.

Suggested labels: Roadmap, Issue

Poem

Poem

Scopes resolve in ordered flight,
CLI values take precedence right.
Targets join in discovery’s stream,
Policies match the tested scheme.
Every rule now has a test in sight.

🚥 Pre-merge checks | ✅ 19 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR covers implemented layers but does not satisfy the linked issue's profile-precedence requirement or OrthoConfig 5.2.3 dependency guidance. Complete profile-layer precedence coverage and provide the required OrthoConfig 5.2.3 consumer-boundary guidance, or defer these requirements explicitly in the issue.
✅ Passed checks (19 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed All changes are limited to regression tests and documentation that directly support issue #385 and roadmap item 3.11.4.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Testing (Overall) ✅ Passed Registered tests add real child-process discovery and merge assertions, handwritten property oracles for scalar/list precedence, and exhaustive display-policy sweeps across policy and environment c...
User-Facing Documentation ✅ Passed Pass: the complete PR diff changes only tests and developer/roadmap documentation; it changes no production source, manifests, or users-guide content, so it introduces no user-facing behaviour requ...
Developer Documentation ✅ Passed The PR changes only tests and documentation. The developer's guide documents the new test modules, merge_probe environment seam, child-process isolation, and Unix constraints; the roadmap records c...
Module-Level Documentation ✅ Passed Mark PASS: every PR-touched Rust module has a module-level //! docstring, with purpose, test utility, and component relationships described where needed.
Testing (Unit And Behavioural) ✅ Passed The added suites register correctly, exercise real parser/config merging in isolated child processes, and cover precedence, edge cases, and generated invariants; policy tests use public resolution...
Testing (Property / Proof) ✅ Passed Accept this check: the PR adds substantive proptest coverage for generated layer order, scalar precedence, list appends, and display-policy states, plus a finite truth-model sweep; no proof assumpt...
Testing (Compile-Time / Ui) ✅ Passed The PR changes no production or compile-time behaviour. New display tests assert stable policy decisions, while existing snapshots cover rendered prefixes and status text.
Unit Architecture ✅ Passed Pass the architecture check: the PR changes only tests and docs; filesystem, child-process, and environment effects stay in explicit test helpers with Result handling and no process-wide mutation.
Domain Architecture ✅ Passed Pass: the PR changes only tests and documentation; the diff has no src/ or Cargo.toml changes, and environment/filesystem access stays in the test-only merge_probe adapter.
Observability ✅ Passed The verified PR range changes only tests and documentation; no production source, manifest, logging, metrics, or tracing behaviour changes, so observability additions are not required.
Security And Privacy ✅ Passed Pass: confirm the aggregate diff contains only tests and documentation; fixtures use fake values, child arguments use JSON/argv, and no secrets, auth changes, shell sinks, or production permission...
Performance And Resource Use ✅ Passed Accept: the diff adds only tests and documentation; the 324-case sweep and proptest vectors have finite bounds, with no production or dependency changes.
Concurrency And State ✅ Passed Keep the current design: the PR changes only tests/docs; probes use per-test TempDirs and child-process env_clear/env, with no new async tasks, locks, globals, or process-wide mutation.
Architectural Complexity And Maintainability ✅ Passed Accept the change: the PR adds only focused test helpers and test models, reuses existing dependencies, documents their contracts, and changes no production code or manifest.
Rust Compiler Lint Integrity ✅ Passed Keep the current lint integrity: the full topic diff adds no broad lint suppressions or artificial anchors; all added helpers have real references and clones retain generated inputs for expected-va...
Title check ✅ Passed Accept the title because it identifies roadmap item 3.11.4, references issue #385, and accurately describes the regression-test changes.
Description check ✅ Passed Accept the description because it directly matches the changes and objectives, including precedence tests, display-policy coverage, documentation, and deferred work.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-385-roadmap-3-11-4-complete-orthoconfig-precedence-ladder-regression-tests

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai

sourcery-ai Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Adds exhaustive regression tests around Netsuke configuration precedence (discovery scopes and full ladder), property-based tests for target merging and scalar merge ordering, and exhaustive display-policy resolution tests, plus roadmap documentation updates to reflect the new coverage and deferred profile handling.

Flow diagram for Netsuke configuration precedence and discovery

flowchart TD
    A["--config selector"] --> B["NETSUKE_CONFIG selector"]
    B --> C["Automatic discovery"]
    C --> D["Project configuration"]
    D --> E["User configuration"]
    E --> F["System configuration"]
    F --> G["Default values"]
    A -. overrides .-> H["Resolved scalar settings"]
    B -. overrides .-> H
    C -. contributes .-> H
    D -. merges .-> H
    E -. merges .-> H
    F -. merges .-> H
    G -. fallback .-> H
Loading

Flow diagram for display-policy resolution precedence

flowchart TD
    A["Explicit theme preference"] --> E["Resolved display policy"]
    B["Emoji policy"] --> E
    C["NO_COLOR"] --> E
    D["Output mode"] --> E
    A -. highest precedence .-> E
    B -. next precedence .-> E
    C -. next precedence .-> E
    D -. fallback context .-> E
Loading

File-Level Changes

Change Details Files
Extend config discovery tests to cover system-scope discovery and user/project precedence using an isolated system config directory and shared environment helper.
  • Introduce SYSTEM_CONFIG_CONTENT and helper assertion to validate system-scope config application for manifest path, emoji, color, jobs, and locale.
  • Add run_system_scope_scenario and ScopeLayers to seed system, optional user, and optional project config files in an isolated temp directory hierarchy, reusing the merge_probe environment helper.
  • Add Unix and Windows rstest cases covering pure system discovery, user-over-system exclusivity, and project-over-system precedence with system-only fields merging through.
tests/cli_tests/config_discovery_scopes.rs
tests/cli_tests/merge_probe.rs
Add end-to-end precedence-ladder tests that seed each config rung (system, user, project, env, CLI) and assert winners plus NETSUKE_CONFIG_PATH behavior and deferred profile rung.
  • Introduce Layer and LadderExpectation types and ladder_environment/run_ladder_scenario helpers to seed system/user/project configs and NETSUKE_* env into isolated tempdirs.
  • Add rstest matrix that enables different layer subsets and CLI flags to assert merged Cli values follow CLI > env > project > user > system > defaults for scalar fields.
  • Add tests ensuring a single enabled rung wins, NETSUKE_CONFIG_PATH does not act as a selector, and profile behavior is explicitly deferred but its future position in the ladder is documented.
tests/cli_tests/config_precedence_ladder.rs
tests/cli_tests/merge_probe.rs
tests/cli_tests/mod.rs
Introduce property-based tests for default_targets append semantics and scalar merge ordering via OrthoConfig MergeComposer.
  • Define LayerValues struct and strategies for targets, locales, policy enums, and jobs without using derive(Arbitrary).
  • Implement build_target_layer and merge_generated helpers that construct JSON layers and merge them through MergeComposer into CliConfig.
  • Add proptests asserting default_targets strictly appends file/env/CLI lists in order and that locale, emoji, color, and jobs follow defaults → file → env → CLI scalar precedence.
tests/cli_tests/merge_targets_proptests.rs
tests/cli_tests/mod.rs
Add exhaustive display-policy resolution tests over EmojiPolicy, ColourPolicy, ProgressPolicy, AccessibilityPolicy, OutputMode, json, and NO_COLOR/TERM environment.
  • Define DomainCase and ExpectedDisplay truth model with helper functions encoding expected theme preference, accessibility override, progress enabled, output mode, and emoji allowance.
  • Write proptests and rstests that compare Cli theme/accessibility/progress projections, output_mode::resolve_with, theme::resolve_theme, and output_prefs::resolve_from_theme_with against the truth model over random and exhaustive policy combinations.
  • Validate that precedence across explicit theme preference, emoji policy, NO_COLOR, and output mode holds without modifying src/theme.rs or src/output_prefs.rs.
tests/cli_tests/display_policy_domain.rs
tests/cli_tests/mod.rs
Update roadmap documentation to reflect completed precedence coverage, clarify OrthoConfig roadmap identifier, and defer profile-related work.
  • Clarify that OrthoConfig 5.2.3 is an upstream roadmap identifier rather than a crate version and that Netsuke remains pinned to ortho_config 0.9.0 pending upstream guidance.
  • Mark precedence and CLI-override regression coverage for scalar fields (manifest path, display policies, locale, jobs) as complete under issue Roadmap 3.11.4: complete OrthoConfig precedence-ladder regression tests #385, while explicitly deferring profile selection and profile-layer override checks to roadmap 5.3.1.
docs/roadmap.md

Assessment against linked issues

Issue Objective Addressed Explanation
#385 Depend on OrthoConfig 5.2.3 and provide the corresponding consumer-boundary guidance. The PR only documents OrthoConfig 5.2.3 as an upstream roadmap identifier, leaves the dependency at ortho_config = 0.9.0, and explicitly marks this work as blocked.
#385 Preserve Netsuke-specific precedence behavior and verify CLI precedence over environment, profile, project, user, system, and default layers, while retaining the closed two-selector environment model. The PR adds substantial coverage for scalar precedence through environment, project, user, system, and default layers and preserves the NETSUKE_CONFIG-only selector constraint. However, profile-layer precedence and profile selection are explicitly deferred to roadmap item 5.3.1, so the full objective is not complete.
#385 Add property-based regression coverage for merge ordering and target-list appending, plus cross-field validation across the relevant policy combinations. The PR implements property-based scalar merge-ordering and default-target append tests and adds broad display-policy domain coverage. However, it does not verify the required cross-field validation rules for theme/no_emoji, spinner_mode/progress, and output_format restrictions; the display-policy tests explicitly avoid conflict-rule assertions.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

leynos added 5 commits August 22, 2026 06:31
Cover the complete implemented precedence ladder for scalar fields
(manifest path, display policies, locale, jobs) from the lowest to the
highest layer:

- CLI flags > environment > project scope > discovered (system/user)
  > defaults.

Add a hermetic system-scope harness (XDG_CONFIG_DIRS seam) to
merge_probe, system-scope discovery cases to config_discovery_scopes,
and a unified ladder module with one rstest case per rung plus a
closed-selector guard proving NETSUKE_CONFIG_PATH is not a selector.
The profile rung is explicitly deferred to roadmap 5.3.1 and never
asserted. Progress is tracked in roadmap item 3.11.4.
Hand-written proptest strategies (no derive(Arbitrary)) verify the
OrthoConfig layer invariants over generated inputs:

- default_targets appends in discovery order (file -> environment ->
  CLI) whatever the generated layer lengths.
- Scalar merge ordering (defaults -> file -> environment -> CLI) holds
  for generated locale, jobs, and display-policy values.

The explicit-CLI build <targets...> replacement asymmetry is asserted
by the existing merge.rs command-layer tests, which exercise a parsed
command that a pure MergeComposer composition cannot observe. All
strategies stay free of any second environment selector.
…num domain

Verifies the consolidated theme/output_prefs display-policy resolution over
the full domain of EmojiPolicy, ProgressPolicy, AccessibilityPolicy,
ColourPolicy, OutputMode and json combinations, using a deterministic
domain sweep against a hand-written truth model, output-mode/TERM sweep,
and a probabilistic proptest. Coverage-only; no production logic changes.

Part of issue #385 (roadmap 3.11.4).
Tick the precedence-expectation and CLI-override sub-items for the layers
now covered by the regression tests in issue #385. Keep profile-selection
portions deferred to 5.3.1 (--profile flag) and the OrthoConfig 5.2.3
sub-item blocked on upstream guidance (5.2.3 is an upstream roadmap
identifier, not a crate version; Cargo.toml stays at 0.9.0).

Part of issue #385.
Route fixture file I/O through test_support::fs instead of std::fs to satisfy
the Whitaker capability policy, flatten nested conditional clusters in
ladder_environment and expected_emoji_allowed, and trim modules to the
400-line ceiling. Also fix spelling (handwritten) so the prose gate passes.

Part of #385.
@leynos
leynos force-pushed the issue-385-roadmap-3-11-4-complete-orthoconfig-precedence-ladder-regression-tests branch from 72d7cdf to dc61559 Compare August 22, 2026 04:40
codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

@leynos

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

@leynos

leynos commented Aug 22, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai based on the current codegraph, is this PR a correct and complete implementation of the associated issue (see below)? If further work is required, please provide an AI agent prompt for the remaining work to be done to address these failures.

Context

Roadmap item 3.11.4 (Add OrthoConfig precedence-ladder regression tests) has three sub-items that remain open after PR #327 (closes #291) delivered exhaustive rstest and proptest coverage of the explicit config-path selector precedence (--config > NETSUKE_CONFIG).

The following sub-items are still unaddressed:

  • Depend on OrthoConfig 5.2.3 for consumer boundary guidance.
  • Preserve Netsuke-specific precedence expectations for manifest path, display policies, locale, and profile selection.
  • Verify that CLI flags override environment, profile, project, user, system, and default configuration layers.

Required constraint for any PR closing this issue

[!IMPORTANT]
The environment selector set is closed at one variable. Any regression tests added here must not introduce, assert, or assume NETSUKE_CONFIG_PATH or any second environment selector.

  • Precedence tests assert the two-selector ladder only: --config > NETSUKE_CONFIG > automatic discovery.
  • No test sets NETSUKE_CONFIG_PATH expecting it to select a configuration file.
  • The existing legacy_config_path_variable_is_not_a_selector test (in src/cli/config_path_precedence_tests.rs) still passes unmodified.

Rationale: ADR-004 (Accepted 2026-05-31) records NETSUKE_CONFIG as the only environment selector, and the legacy NETSUKE_CONFIG_PATH alias was removed in #427. Reintroducing it would require superseding ADR-004 and updating docs/users-guide.md, docs/developers-guide.md, and docs/netsuke-design.md together — that is a separate, deliberate decision, not something to add incidentally while writing regression tests.

Out of scope for PR #327

These items require changes beyond the explicit config-path selector subset and are tracked here for a future PR.

Note: selector ladder narrowed (2026-07-30)

This issue was originally filed describing a three-selector ladder, --config > NETSUKE_CONFIG > NETSUKE_CONFIG_PATH. That is no longer accurate. The current ladder is:

--config             (CLI flag)
NETSUKE_CONFIG       (env var)
automatic discovery  (fallback)

The three open sub-items above are unaffected — none of them depend on the legacy alias — so this issue remains valid work. Only the precedence framing needed correcting.

References

/cc @leynos

Aggregation (2026-08-12)

This issue now also absorbs #317 (closed), whose property-based scope substantially overlapped the sub-items above — both demand invariant coverage of the same merge pipeline, and keeping them separate risked two people writing the same tests. Additional sub-items carried over from #317:

  • Generate arbitrary CliConfig layer values with proptest strategies and verify merge ordering is consistently respected (a CLI value always beats a file value for the same field; defaults → file → environment → CLI).
  • Verify list-appending semantics (cmds.build.targets appended in discovery order) under arbitrary target lists.
  • Verify cross-field validation rules (theme/no_emoji, spinner_mode/progress, output_format restriction) fire correctly across the full domain of enum combinations.

The closed-selector constraint above applies to these carried-over items equally: no property strategy may introduce or assume a second environment selector. The stale June draft PR #368 (filed against #317) predates the env-seam series and should be treated as reference material only.

Constraint added 2026-08-01: no in-process environment mutation.

AGENTS.md now forbids in-process environment mutation in tests and disqualifies process-wide locks as a fallback.

This issue's remaining sub-item — "verify that CLI flags override environment, profile, project, user, system, and default configuration layers" — requires controlling NETSUKE_CONFIG. There is no injection point today: src/cli/discovery.rs:111 reads it via std::env::var_os, which is why the existing suites (tests/cli_tests/config_selection.rs, config_discovery.rs, config_discovery_scopes.rs, config_discovery_overrides.rs) all serialize behind EnvLock.

This issue is blocked on #483, which threads &impl mockable::Env through the discovery functions.

The closed-selector constraint recorded in this issue is unaffected and still binds: the ladder remains --config > NETSUKE_CONFIG > automatic discovery, per ADR-004, and legacy_config_path_variable_is_not_a_selector must still pass unmodified. Injecting an Env changes how the selector is read, not which selectors exist.

Aggregation

This issue now absorbs #317 (closed) — its proptest scope over the merge pipeline substantially overlapped the open sub-items here, so the property-based items are carried over as an explicit checklist (see the aggregation section appended to the description). ADR-004's closed-selector constraint applies to them equally.

@coderabbitai

This comment was marked as resolved.

display_policy_domain.rs: replace the five-level nested loop in
exhaustive_domain_sweep_matches_truth_model with a flat Cartesian-product
iterator (itertools::iproduct over the finite policy domain), preserving
deterministic coverage of all 3x3x3x3x2 - 162 cases and the single
assert_consolidated assertion path per case.

config_discovery_scopes.rs: merge the byte-identical Unix and Windows
system_scope_config_discovered_when_no_user_or_project_config bodies into one
platform-neutral test. Both bodies used only platform-neutral helpers
(run_system_scope_scenario + assert_system_config_applied), so platform
coverage is preserved.

Part of #385.
codescene-access[bot]

This comment was marked as outdated.

The Whitaker 0.2.7 suite enforces module-max-lines at 400. Condense the module
doc (drop the stale output_mode_inference_matches_truth_model reference; the
TERM/output-mode dimension is covered by the proptest) and tighten the
all_domain_cases helper doc so the module fits under 400 lines without changing
coverage or behaviour.

Part of #385.
codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

@leynos
leynos marked this pull request as ready for review August 22, 2026 22:35

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @leynos, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

chatgpt-codex-connector[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

Resolve the CodeScene review findings on the issue-385 regression tests
without suppressing rules or changing production behaviour:

- roadmap: replace the 'full merge ladder' phrasing with the exclusive
  user-over-system discovery semantics (a user-scope win drops system-only
  fields to defaults) and add the required type:docstyle triage note.
- config_precedence_ladder: point NETSUKE_CONFIG_PATH at a real existing
  legacy config carrying distinct values, so the guard also rejects
  implementations that would open an existing legacy path.
- display_policy_domain: extend DomainCase with the json field, thread it
  through the fixtures, and assert cli.json per case; exhaustive sweep is
  now 3x3x3x3x2x2 = 324 cases.
- Gate XDG-only ladder/system-scope harness and tests to Unix (Windows
  discovers config through APPDATA/LOCALAPPDATA, not XDG).
- developers-guide: document the config-precedence test modules.

Part of issue #385 (roadmap 3.11.4).
codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

@leynos

This comment was marked as resolved.

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== Pull request check state =='
gh pr view 582 --repo leynos/netsuke \
  --json state,updatedAt,statusCheckRollup,files \
  --jq '{
    state,
    updatedAt,
    checks: [.statusCheckRollup[] | {
      name,
      status,
      conclusion,
      detailsUrl,
      workflowName
    }],
    files: [.files[].path]
  }'

echo
echo '== Developer-guide change in PR =='
gh pr diff 582 --repo leynos/netsuke --patch -- docs/developers-guide.md || true

echo
echo '== Relevant developer-guide sections =='
if [ -f docs/developers-guide.md ]; then
  rg -n -i -C 5 \
    '(test strategy|cli test|configuration|precedence|system.scope|display.policy|property|proptest|environment|EnvProvider|environment_with_system_scope|child.process)' \
    docs/developers-guide.md || true
fi

echo
echo '== Current changed test and helper outlines =='
for file in \
  tests/cli_tests/config_precedence_ladder.rs \
  tests/cli_tests/config_discovery_scopes.rs \
  tests/cli_tests/display_policy_domain.rs \
  tests/cli_tests/merge_targets_proptests.rs \
  tests/cli_tests/merge_probe.rs; do
  if [ -f "$file" ]; then
    echo "-- $file"
    ast-grep outline "$file" --items all
  fi
done

echo
echo '== Documentation references to the added modules and helper =='
rg -n -C 2 \
  '(config_precedence_ladder|config_discovery_scopes|display_policy_domain|merge_targets_proptests|environment_with_system_scope)' \
  docs tests/cli_tests || true

Length of output: 116610


@leynos

Treat the Developer Documentation warning as resolved.

docs/developers-guide.md now documents the configuration-precedence test strategy in the new Configuration-precedence regression tests section.

It documents:

  • config_precedence_ladder.rs, including the closed selector ladder and scalar precedence.
  • display_policy_domain.rs, including the exhaustive display-policy domain sweep.
  • merge_targets_proptests.rs, including scalar merge ordering and default_targets append order.
  • merge_probe child-process execution and its isolated environment.
  • System-scope configuration setup through redirectable XDG_CONFIG_DIRS.
  • The prohibition on parent-process environment mutation.

All completed checks now pass. This includes CodeScene Code Health Review (main) and CodeScene Code Coverage (main). The remaining skipped checks are not failures.

Do not create a follow-up issue. Do not perform further work for this warning.

You are interacting with an AI system.

@buzzybee-df12

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot]

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

Review findings on the issue-385 regression tests:

- roadmap: drop the literal [type:docstyle] marker and internal triage
  framing from the 3.11.4 note, keeping the exclusive-discovery
  explanation as normal prose.
- display_policy_domain: vary term_dumb alongside no_color and json in
  the flat iproduct! matrix, mapping the generated value into DomainCase
  instead of hardcoding false, and bump the documented case count from
  324 to 648. Construct DomainCase fields in struct-definition order to
  satisfy clippy::inconsistent-struct-constructor, and tighten doc
  comments so the file stays under the module-max-lines ceiling.

Part of issue #385 (roadmap 3.11.4).
codescene-access[bot]

This comment was marked as outdated.

@codescene-access codescene-access Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No quality gates enabled for this code.

@coderabbitai

This comment was marked as resolved.

@leynos
leynos merged commit aa93ef8 into main Aug 23, 2026
24 of 26 checks passed
@leynos
leynos deleted the issue-385-roadmap-3-11-4-complete-orthoconfig-precedence-ladder-regression-tests branch August 23, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Roadmap 3.11.4: complete OrthoConfig precedence-ladder regression tests

2 participants