Skip to content

Remove the import cycles between _internal and the public modules - #511

Merged
winding-lines merged 2 commits into
mainfrom
fix-498
Nov 16, 2026
Merged

winding-lines merged 2 commits into
mainfrom
fix-498

Conversation

@winding-lines

Copy link
Copy Markdown
Contributor

Closes #498

customs already reports 0 cycles between modules on main: the cycles in #498 are between packages. _internal imported three public modules that import _internal back:

  • _internal/cli.mojo → morca.pipeline
  • _internal/lakehost.mojo → morca.ctx
  • _internal/rust_ffi.mojo → morca.ctx

(_internal/maintain.mojo → morca.maintain, and the morca/morca.command imports in _internal/handover.mojo and _internal/command.mojo, are only in docstrings.)

Fix: the three modules move, unchanged, out of _internal to sit beside the public modules that use them: morca._cli (re-exported by morca and morca.cli as before), morca._lakehost (used by morca.tables) and morca._rust_ffi (used by morca.rust_step). Imports and docstring references are updated. Ctx, Pipeline and every other public type keep their module paths, so step linkage names and registry hashes don't change: describe output of examples/toy, daily and fanout is byte-identical between main and this branch (toy 0xa3bcc571ad7c6939, daily 0x81ead348d0a21c1f, fanout 0x1f0ebf1f2a93d993).

Check: scripts/check_layers.py (no dependencies) checks the package layers that customs doesn't: _common imports only _common; _lake only _lake and _common; _internal only _internal, _lake, _common and public modules that import no _internal module, directly or through others (morca.civil, morca.day, …). It runs as a step of the existing customs job. On main it reports the three imports above; on this branch none. AGENTS.md's layer rule says so.

_internal still imports leaf public modules (civil, day, hour, month, name, key, cron, schedule, tz, tasks): they are key and schedule types in step signatures, so they stay where they are; none of them imports _internal, so there's no cycle.

🤖 Generated with Claude Code

https://claude.ai/code/session_017TycszSbyw92Efu4ZeCYL6

winding-lines and others added 2 commits November 15, 2026 21:22
`_internal/cli.mojo` imported `morca.pipeline`, and `_internal/lakehost.mojo`
and `_internal/rust_ffi.mojo` imported `morca.ctx`, all of which import
`_internal`: cycles between the packages. They move, unchanged, beside the
public modules that use them (`morca._cli`, `morca._lakehost`,
`morca._rust_ffi`); `Ctx` and `Pipeline` keep their module paths, so
registry hashes don't change. `scripts/check_layers.py` checks the layers
in the customs job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017TycszSbyw92Efu4ZeCYL6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017TycszSbyw92Efu4ZeCYL6
@winding-lines
winding-lines merged commit 11ad3ce into main Nov 16, 2026
34 checks passed
@winding-lines
winding-lines deleted the fix-498 branch November 16, 2026 06:21
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.

Imports: remove the cycles between _internal and public modules (morca.ctx, morca.maintain)

1 participant