Skip to content

refactor(jit): silence Ionic CCQE probe logs and clean up caching - #347

Merged
jhchouuu merged 2 commits into
mainfrom
refactor/jit-core-logging
Jun 1, 2026
Merged

refactor(jit): silence Ionic CCQE probe logs and clean up caching#347
jhchouuu merged 2 commits into
mainfrom
refactor/jit-core-logging

Conversation

@jhchouuu

@jhchouuu jhchouuu commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Migrate Ionic CCQE detection messages from unconditional print to the logging module. They were printing on every import mori and cluttering CI / user output. JIT compilation progress lines ([mori-jit] Compiling ..., [mori-jit] Cached: ...) are intentionally kept as print and remain visible by default.
  • Replace the _ccqe_enabled module-global + None-sentinel cache in is_ccqe_enabled() with @functools.cache. This gives us thread-safe single-execution semantics for free, removes the global statement, and exposes is_ccqe_enabled.cache_clear() for tests.
  • Make MORI_DISABLE_IONIC_CCQE parsing case-insensitive and accept 1 / true / on / yes, matching the conventions used by ENABLE_PROFILER and MORI_DEBUG_INFO elsewhere in mori python (and IsEnvVarEnabled on the C++ side).

Behavior change

Default behavior for end users:

Log line Before After
Ionic _ccqe_enabled: ... lib_support ... nic_support: ... always printed silent (visible at INFO level)
ionic ver: <N> always printed silent (visible at DEBUG level)
[mori-jit] Compiling ... / Cached: ... printed unchanged, still printed

To re-enable the Ionic diagnostic line, an application can do:

import logging
logging.getLogger("mori").setLevel(logging.INFO)
logging.basicConfig()

Test plan

  • import mori no longer emits the Ionic _ccqe_enabled: ... line
  • MORI_PRECOMPILE=1 python -c 'import mori' still shows [mori-jit] Compiling ... / Cached: ... lines
  • MORI_DISABLE_IONIC_CCQE=true / =on / =yes / =1 all disable CCQE
  • Existing CI green

jhchouuu added 2 commits June 1, 2026 15:01
- Route Ionic CCQE detection messages through the standard logging
  module (logger.info / logger.debug) so they no longer print
  unconditionally on every mori import. JIT compilation progress
  ([mori-jit] Compiling/Cached) is intentionally left as print and
  stays visible by default.
- Replace the hand-rolled module-global + None-sentinel cache for
  is_ccqe_enabled with @functools.cache, giving us thread-safe
  single-execution semantics and a cache_clear() hook for tests.
- Accept 1/true/on/yes (case-insensitive) for MORI_DISABLE_IONIC_CCQE,
  matching the conventions already used by ENABLE_PROFILER and
  MORI_DEBUG_INFO elsewhere in mori python.

Copilot AI 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.

Pull request overview

This PR reduces noisy stdout output during import mori by moving Ionic CCQE probing messages to the Python logging framework, while keeping intentional JIT progress output as print. It also simplifies CCQE enablement caching by switching from a module-global sentinel to functools.cache.

Changes:

  • Replace unconditional print diagnostics for Ionic CCQE probing with logger.info / logger.debug.
  • Refactor is_ccqe_enabled() caching to use @functools.cache instead of a module-global None sentinel.
  • Make MORI_DISABLE_IONIC_CCQE parsing case-insensitive and accept multiple truthy values (1/true/on/yes).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jhchouuu
jhchouuu merged commit 0be5eaa into main Jun 1, 2026
12 checks passed
@jhchouuu
jhchouuu deleted the refactor/jit-core-logging branch June 1, 2026 09:27
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.

3 participants