Skip to content

Document which dependency kinds participate in cycle detection (4.4.2) - #806

Draft
leynos wants to merge 7 commits into
mainfrom
4-4-2-document-cycle-detection-scope
Draft

leynos wants to merge 7 commits into
mainfrom
4-4-2-document-cycle-detection-scope

Conversation

@leynos

@leynos leynos commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Align whole-manifest cycle detection with the build graph. The detector follows
explicit sources, implicit deps, and order_only_deps, and resolves
explicit and implicit output aliases to their producing edge. Human diagnostics
show the localized cycle path; tracing records only a fixed error category. The
JSON diagnostic envelope is unchanged.

Contract and compatibility

  • ADR-0060
    records why every prerequisite kind participates in whole-manifest cycle
    detection; dependency_order: serial remains a scheduling policy that adds
    no dependency arc.
  • This is a breaking behaviour change: an order-only cycle is rejected even
    when its targets are not requested. The v0.1.0 migration guide explains how
    to remove the back edge.
  • Unit, property, BDD, end-to-end, and Kani coverage exercise order-only
    cycles, implicit-output aliases, missing paths, serial ordering, and the
    human and JSON diagnostics.
  • Proposed follow-up D7: add the dependency kind that closes the cycle to the
    diagnostic. No issue is filed without maintainer agreement.

Validation

  • make check-fmt, make lint, make typecheck, and make doc-coverage
    passed; doc coverage is 98.19%.
  • make test passed 4,742 tests with 7 skipped; doctests passed.
  • make markdownlint passed for 202 files with zero issues; make nixie,
    make test-documentation-contracts (15 passed), and
    make test-workflow-contracts (1,351 passed, 3 skipped, plus 27 script
    tests) passed.
  • The capped make kani-ir run passed all 17 harnesses.

References

@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@sourcery-ai

sourcery-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Adds a plan-only ExecPlan for documenting and implementing cycle-detection semantics: order-only dependencies will become cycle-detection edges, implicit outputs will be explicitly documented and tested, serial ordering will remain outside the dependency graph, and the behavior will be covered by implementation, verification, documentation, and migration work.

Sequence diagram for order-only cycle rejection

sequenceDiagram
    participant User
    participant Netsuke
    participant IR as IR validation
    participant Ninja
    User->>Netsuke: generate or build manifest
    Netsuke->>IR: BuildGraph.detect_cycles()
    IR->>IR: visit_known_edge()
    IR->>IR: visit_dependencies(order_only_deps)
    alt cycle detected
        IR-->>Netsuke: CircularDependency
        Netsuke-->>User: localized diagnostic / JSON error
        Netsuke-->>Ninja: no Ninja invocation
    else no cycle
        IR-->>Netsuke: validated graph
        Netsuke->>Ninja: generate or run build
    end
Loading

Flow diagram for dependency-kind participation

flowchart TD
    Start[Dependency graph validation] --> Kinds{Dependency kind}
    Kinds -->|sources| Traverse[Traverse dependency edge]
    Kinds -->|deps| Traverse
    Kinds -->|order_only_deps| Traverse
    Traverse --> Cycle{Back edge found?}
    Cycle -->|yes| Reject[Reject with CircularDependency]
    Cycle -->|no| Continue[Continue graph validation]
    Alias[Explicit or implicit output alias] --> Resolve[Resolve producing edge]
    Resolve --> Traverse
    Serial[dependency_order: serial] -. adds no edge .-> Continue
Loading

File-Level Changes

Change Details Files
Adds a detailed execution plan for aligning Netsuke's cycle-detection scope with Ninja semantics.
  • Decides that order_only_deps participate in whole-manifest cycle detection and records the breaking compatibility impact.
  • Specifies characterization coverage for implicit-output aliases and confirms dependency_order: serial contributes no graph edges.
  • Defines the implementation change to traverse order-only dependencies and the associated unit, property, Kani, BDD, and end-to-end tests.
  • Plans consistent updates to the users' guide, ADR-041, design and verification documents, developer documentation, changelog, migration guide, roadmap, and contents index.
  • Defines staged milestones, acceptance criteria, mutation evidence, quality gates, risks, constraints, and rollback/recovery procedures.
docs/execplans/4-4-2-document-cycle-detection-scope.md

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.

@leynos leynos changed the title Plan: Document which dependency kinds participate in cycle detection (4.4.2) Document which dependency kinds participate in cycle detection (4.4.2) Oct 23, 2026
leynos and others added 6 commits October 26, 2026 08:33
Plan roadmap item 4.4.2: decide which dependency kinds take part in
IR cycle detection, document the rule in the users' guide, and align
the implementation and tests with it.

Planning evidence shows Ninja 1.11.1 rejects cycles closed by
order-only dependencies and by implicit outputs, while Netsuke's IR
check skips order-only dependencies, so `netsuke generate` can emit a
Ninja file Ninja refuses. The draft proposes that every dependency kind
participates (ADR-041), pins the existing implicit-output alias
behaviour, and records that serial dependency ordering adds no arcs.

The plan is DRAFT and awaits expert review and approval; no
implementation is included.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Fold in the conditions from the expert-panel design review, which
returned "proceed with conditions":

- Keep new Kani harnesses in `cycle_verification.rs`, moving its
  canonicalization helpers to a harness-free support file, so harness
  paths match the mutation-evidence contract's module derivation.
- Add a typed cycle slot to the BDD world so scenarios assert the cycle
  path, not bare failure (a YAML 1.1 Boolean name would otherwise pass).
- Gate the serial end-to-end build on real Ninja, pin locale and
  filters for the JSON snapshot, and prove Ninja is never started.
- Rebuild the oracle strategy on a DAG base with one optional back arc
  per dependency kind, and add an obligation for missing order-only
  dependencies.
- Correct the breaking-change risk: Ninja ignores cycles it is not
  asked to build, so affected manifests could have built before. The
  three release-admission canaries contain no `order_only_deps`.
- Record the tiered-rollout and reachable-subgraph alternatives,
  recalibrate tolerances, and make the stale-rule search multiline and
  live.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Record explicit user approval for D1 before rebasing or starting
implementation.
Update source paths and ADR allocation to match the rebased tree.
Record exact rebase evidence and the current documentation contract
gates before implementation proceeds.
Update the plan for the merged Terms of Reference and current user guide
headings. Correct Rust module path attributes and record that the Kani
baseline timed out before harness enumeration, leaving the post-change proof
run as a required gate.
Traverse explicit inputs, implicit dependencies, and order-only dependencies
when checking the whole manifest, and resolve output aliases to their
producing edge.

Expose the localized cycle path in human diagnostics while preserving the
JSON envelope. Record the breaking behaviour change in ADR-0060 and the user,
design, developer, and migration documentation, with unit, property, BDD,
end-to-end, and Kani coverage.
@leynos
leynos force-pushed the 4-4-2-document-cycle-detection-scope branch from 6d5d1cf to d388bf2 Compare October 26, 2026 08:20
codescene-access[bot]

This comment was marked as outdated.

Refine the independent property oracle and Kani fixtures to address
CodeScene findings. Keep assumptions and assertions in the Kani proof
harnesses, where the pinned verifier handles them.

Keep manifest-derived cycle paths in human diagnostics, and log only the
fixed circular-dependency category. Add a regression test and document the
logging boundary in ADR-0060.

Validation: make check-fmt, lint, typecheck, doc-coverage, test,
markdownlint, nixie, and capped kani-ir (17 harnesses) pass.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants