Skip to content

extend architecture enforcement to orchestration code (2.4.5) - #143

Draft
leynos wants to merge 16 commits into
mainfrom
2-4-5-extend-architecture-enforcement-to-orchestration-code
Draft

extend architecture enforcement to orchestration code (2.4.5)#143
leynos wants to merge 16 commits into
mainfrom
2-4-5-extend-architecture-enforcement-to-orchestration-code

Conversation

@leynos

@leynos leynos commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

This pull request completes roadmap item 2.4.5 — Extend architecture
enforcement to orchestration code
.

The branch extends Hecate architecture checks over orchestration-facing code,
splits LangGraph node logic from graph composition, extracts a provider-neutral
worker workload contract, and adds checkpoint payload boundary enforcement.

What changed

  • Split structured generation LangGraph orchestration into ports-only node code
    and an application-tier graph builder behind the existing public facade.
  • Added Hecate groups for orchestration nodes, orchestration builders, Celery
    tasks, and checkpoint payload DTOs.
  • Extracted WorkloadClass into a provider-neutral worker contract so Celery
    tasks can depend on domain/application contracts without importing Kombu.
  • Added checkpoint payload boundary checks, including structural and property
    coverage for the checkpoint serializer allow-list.
  • Added BDD architecture scenarios, normalized Hecate JSON snapshot coverage,
    and a direct Vidai Mock-backed LangGraph plan -> execute -> finish test.
  • Recorded ADR-016 and updated architecture, developer, roadmap, and execution
    plan documentation.

Validation

  • make check-fmt
  • make test (1030 passed, 3 skipped)
  • make typecheck
  • make lint
  • make markdownlint
  • make nixie
  • coderabbit review --agent after M0, M1, M2, M3, and M4; each completed with
    0 findings.

References

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a6cb7bb6-0444-4b0f-9555-8a1640f2ec68

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2-4-5-extend-architecture-enforcement-to-orchestration-code

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

@sourcery-ai sourcery-ai 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.

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

Please try again later or upgrade to continue using Sourcery

@lodyai
lodyai Bot force-pushed the 2-4-5-extend-architecture-enforcement-to-orchestration-code branch from d6ec9f0 to ec44417 Compare June 26, 2026 17:34
@lodyai lodyai Bot changed the title Plan: extend architecture enforcement to orchestration code (2.4.5) extend architecture enforcement to orchestration code (2.4.5) Jun 26, 2026
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.

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.

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.

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

leynos commented Jul 21, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. Ensure that this is validated against the current version of the codegraph.

If further refinement to address this finding would be deleterious, please supply a clear explanatory one to two paragraph markdown message I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced.

Large Method

tests/test_architecture_hecate_config.py: test_fixture_config_writes_expected_toml_shape

What lead to degradation?

test_fixture_config_writes_expected_toml_shape has 85 lines, threshold = 70

Why does this problem occur?

Overly long functions make the code harder to read. The recommended maximum function length for the Python language is 70 lines of code. Severity: Brain Method - Complex Method - Long Method.

How to fix it?

We recommend to be careful here -- just splitting long functions don't necessarily make the code easier to read. Instead, look for natural chunks inside the functions that expresses a specific task or concern. Often, such concerns are indicated by a Code Comment followed by an if-statement. Use the EXTRACT FUNCTION refactoring to encapsulate that concern.

@leynos

leynos commented Jul 21, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. Ensure that this is validated against the current version of the codegraph.

If further refinement to address this finding would be deleterious, please supply a clear explanatory one to two paragraph markdown message I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced.

Complex Method

tests/test_checkpoint_payload_boundaries.py: _is_provider_neutral_origin

What lead to degradation?

_is_provider_neutral_origin has a cyclomatic complexity of 10, threshold = 9

Why does this problem occur?

A Complex Method has a high cyclomatic complexity. The recommended threshold for the Python language is a cyclomatic complexity lower than 9.

How to fix it?

There are many reasons for Complex Method. Sometimes, another design approach is beneficial such as a) modeling state using an explicit state machine rather than conditionals, or b) using table lookup rather than long chains of logic. In other scenarios, the function can be split using EXTRACT FUNCTION. Just make sure you extract natural and cohesive functions. Complex Methods can also be addressed by identifying complex conditional expressions and then using the DECOMPOSE CONDITIONAL refactoring.

Helpful refactoring examples

To get a general understanding of what this code health issue looks like - and how it might be addressed - we have prepared some diffs for illustrative purposes.

SAMPLE

# complex_method.js
 function postItem(item) {
   if (!item.id) {
-    if (item.x != null && item.y != null) {
-      post(item);
-    } else {
-      throw Error("Item must have x and y");
-    }
+    // extract a separate function for creating new item
+    postNew(item);
   } else {
-    if (item.x < 10 && item.y > 25) {
-      put(item);
-    } else {
-      throw Error("Item must have an x and y value between 10 and 25");
-    }
+    // and one for updating existing items
+    updateItem(item);
   }
 }
+
+function postNew(item) {
+  validateNew(item);
+  post(item);
+}
+
+function updateItem(item) {
+  validateUpdate(item);
+  put(item);
+}
+

@coderabbitai

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

@lodyai
lodyai Bot force-pushed the 2-4-5-extend-architecture-enforcement-to-orchestration-code branch from 589a65e to bd7312d Compare July 21, 2026 22:02
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.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

leynos and others added 3 commits July 29, 2026 00:15
Draft the ExecPlan for roadmap item 2.4.5, which extends Hecate
architecture enforcement to LangGraph orchestration code, Celery tasks,
and checkpoint payloads.

The plan reconciles the roadmap's "ports only" wording with the system
design's "domain services and ports only", and proposes three new
first-match Hecate groups (orchestration, orchestration_tasks,
orchestration_checkpoint) plus two boundary fixes surfaced during
research: extracting WorkloadClass out of the kombu-coupled worker
topology module, and decoupling checkpoint DTOs from the
application-tier generation DTO barrel. It also resolves the existing
400-line limit breach in langgraph.py via a node/builder split.

Enforcement is validated through synthetic architecture fixtures
(positive and negative), a structural reflection test and a Hypothesis
property test for checkpoint payloads, a syrupy snapshot of Hecate
output, a pytest-bdd feature, and a vidai-mock-backed behavioural test
of the generation graph.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mark the 2.4.5 ExecPlan as in progress and record the clean rebase,
post-rebase validation, PR title update, and active Lody session
reference.
Extend the synthetic Hecate fixture config with orchestration node,
task, and checkpoint groups so upcoming production rules have red
harness coverage before the real `pyproject.toml` policy changes.

Add positive and negative fixture packages for LangGraph nodes, Celery
tasks, checkpoint payloads, and grouped adapter guard cases. Record M0
completion and validation evidence in the ExecPlan.
leynos and others added 13 commits July 29, 2026 00:15
Update the 2.4.5 ExecPlan with the CodeRabbit result for the M0
fixture-harness milestone so the plan remains resumable.
Move LangGraph node functions and graph assembly into focused modules
so architecture enforcement can target graph orchestration separately.
Note the zero-finding CodeRabbit review for the orchestration graph split milestone.
Move WorkloadClass into a provider-neutral worker module so task
architecture enforcement no longer depends on the Kombu topology module.
Note the zero-finding CodeRabbit review for the worker workload contract milestone.
Add a provider-neutral orchestration payload DTO core and retarget checkpoint serialization away from the application-coupled DTO barrel.

Group checkpoint payload modules under Hecate, add JSON-shape and structural payload boundary tests, and record the M3 decisions in the ExecPlan.
Record the clean CodeRabbit review result for the checkpoint payload boundary milestone before starting the final behavioural and documentation work.
Add behavioural and snapshot coverage for orchestration architecture
boundaries, including Vidai Mock coverage for the direct LangGraph path.

Record ADR-016, update maintainer documentation, and mark roadmap item
`2.4.5` complete.
Update the orchestration enforcement execplan with the clean CodeRabbit
review result after the M4 documentation and test coverage milestone.
Reconstruct the first-match architecture group ordering after the rebase silently duplicated the outbound adapter table. Preserve main’s updated LLM adapter prefix while restoring the branch’s orchestration, checkpoint, and worker task boundaries.
Apply the Oxford spelling forms required by the new repository spelling gate, regenerate the typos configuration, and remove a duplicated ingestion workflow block exposed by Markdown lint.
Replace conditional generic-origin validation with a validator dispatch table while preserving recursive payload-boundary semantics.

Add direct parametrized coverage for every supported origin category and unsupported generics.
Separate base architecture expectations from orchestration-specific group expectations while keeping the fixture config test as the orchestration point.
@lodyai
lodyai Bot force-pushed the 2-4-5-extend-architecture-enforcement-to-orchestration-code branch from 5cb6ed4 to 145a65f Compare July 28, 2026 22:19
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.

@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.

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.

1 participant