Skip to content

refactor: isolate runtime imports while preserving the public API - #124

Draft
byte271 wants to merge 2 commits into
mainfrom
refactor/runtime-import-boundaries
Draft

byte271 wants to merge 2 commits into
mainfrom
refactor/runtime-import-boundaries

Conversation

@byte271

@byte271 byte271 commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Scope

First foundation change for the LLM text-watermark project. This is a bounded import-boundary refactor, not a new watermark-removal algorithm and not a pivot to a detector product.

  • Resolve the public APIs of fuckmark, fuckmark.product, and fuckmark.transforms on demand instead of eagerly importing their implementation graph.
  • Preserve 239 / 74 / 156 explicitly re-exported targets and the original wildcard export order, including the two transforms symbols historically accessible outside __all__.
  • Return and cache the original objects; propagate import failures; expose declared API names through dir(); clear export caches on reload.
  • Add 29 cold-process tests for import boundaries, compatibility, real object identity, and wildcard imports.
  • Keep the staged extraction, packaging, evaluation, and removal plan in docs/runtime-refactor.md.

Deliberately unchanged

No watermark algorithm, Unicode layer, detector threshold, frozen evidence, research module, dependency, workflow, or release version changes. No historical code is deleted. This does not yet shrink the wheel or fully extract the runtime core. Avoid relying on incidental eager-import side effects; explicit submodule imports remain supported.

Verified local results for c3ee8de

The sandbox could not clone GitHub directly. Instead, the exact baseline and initial PR source distributions were retrieved from GitHub Actions artifacts, and both artifact SHA-256 digests were checked. The final four Python file blobs were then matched against the pushed commit.

  • 29/29 added tests passed against real implementations, including all export identities and wildcard imports. No implementation-dependent tests were skipped in this run.
  • 38/38 deterministic input cases matched the baseline, comparing complete serialized ProcessResult values or exception type/message. Cases include multilingual text, emoji, combining marks, protected code/URLs, existing carriers, limits, lone surrogates, and invalid input types. This is a regression sample, not proof over every input.
  • All four changed Python files pass the existing no-comment/no-docstring source rule.

Fresh-process loaded FuckMark module counts, Python 3.13.5:

Import Baseline Refactor
import fuckmark 107 1
import fuckmark.cli 133 68
import fuckmark.product.domain 107 3
import fuckmark.transforms.schema 107 3

These are module-load counts, not speedup or watermark-efficacy measurements.

CI status and limitation

The first commit passed Linux/Windows CLI I/O, frozen calibration-readiness, WASM/native-binding, and artifact build/install checks. Its release-readiness job caught newly added Python comments/docstrings, which the existing repository hygiene policy forbids. Commit c3ee8de removes those comments/docstrings without changing runtime logic or test assertions; explanations remain in Markdown. The original hygiene test was not weakened.

The latest commit's full repository and platform workflows have been triggered but are not yet confirmed complete. The source distribution omits repository evidence/spec files, so local targeted tests are not a substitute for the full checkout CI. Keep this PR draft and unmerged until the latest-head checks have been reviewed.

Resource issue discovered

An import-only PR automatically triggers 14 workflows, including model-generation/confirmation jobs such as Cycle8 Carrier Detector. That workflow currently has a pull_request trigger on fuckmark/product/** and installs Torch/Transformers before regenerating model samples. Future cleanup should separate inexpensive regression checks from explicitly authorized research reruns; frozen confirmation corpora should not be treated as an ordinary change-by-change tuning loop. No workflow triggers are modified in this PR, and no extra manual model runs were requested.

Provenance

Baseline: 09c8cbf184e37e2e934e133b74a5db9af67b4f97.

Final changed Python blob identities:

  • root: 5ae028d35af6d719cc10ccabdcb23ffd98587d77
  • product: 1be8ecbd0cf55ac4dbf36040921d749644a1839a
  • transforms: a044d734d5bb59fde66f55fcdfed9466b9097a02
  • tests: c31db5348d514a1517148d03a795cae530cf38db

Behavior-comparison serialized result SHA-256: f7d90b7650f9c64d5e93ca6ed507954ed7c43415565952122f1da8a279bdd915.

Preserve the baseline public export targets and wildcard order for the root,
product, and transforms namespaces. Add cold-process compatibility and
import-boundary tests plus a staged runtime extraction plan.

No watermark algorithms, frozen evidence, thresholds, dependencies, or
release versions are changed.
@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown

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

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Keep explanations in docs/runtime-refactor.md and remove comments/docstrings
from Python files to satisfy the existing repository hygiene contract.
No runtime logic or test assertions change.
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