Skip to content
Back to skills

1601 2026 02 05 Ui Messaging Layer Facade 388ad5c7

ASecurity

Fixed a dependency-layer violation where the UI imported `tunacode.utils.messaging` directly by routing message token estimation through the `tunacode.core.ui_api.messaging` facade.

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
code-qualityapi

Works with

  • api

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 1601-2026-02-05-ui-messaging-layer-facade_388ad5c7 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 1601 2026 02 05 Ui Messaging Layer Facade 388ad5c7?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 1601 2026 02 05 Ui Messaging Layer Facade 388ad5c7
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-1601-2026-02-05-ui-messaging-layer-facade-388ad5c7/badge)](https://www.skillsdirectory.com/skills/tools-only-1601-2026-02-05-ui-messaging-layer-facade-388ad5c7)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
title: UI token estimation routed through core messaging facade
type: delta
link: ui-messaging-layer-facade
path: src/tunacode/ui/app.py
depth: 0
seams: [A, M]
ontological_relations:
  - relates_to: [[dependency-layers]]
  - affects: [[ui]]
  - affects: [[core-ui-api]]
  - fixes: [[ui-imports-utils-layer-violation]]
tags:
  - architecture
  - ui
  - dependencies
  - messaging
created_at: 2026-02-05T15:56:00-06:00
updated_at: 2026-02-05T15:56:00-06:00
uuid: 9f8848d1-f855-4567-99a8-fa37a8f104de
---

# UI token estimation routed through core messaging facade

## Summary

Fixed a dependency-layer violation where the UI imported `tunacode.utils.messaging` directly by routing message token estimation through the `tunacode.core.ui_api.messaging` facade.

## Context

`tests/test_dependency_layers.py::test_no_new_layer_violations` flagged:

- `tunacode.ui.app -> tunacode.utils.messaging` (ui -> utils)

## Root Cause

The UI layer is only allowed to depend on `core` (per the dependency layer rules), but `TextualReplApp._update_resource_bar()` imported `estimate_messages_tokens` from `utils`.

## Changes

- `src/tunacode/core/ui_api/messaging.py`
  - Re-exported `estimate_messages_tokens()` from `tunacode.utils.messaging`.
- `src/tunacode/ui/app.py`
  - Switched import to `from tunacode.core.ui_api.messaging import estimate_messages_tokens`.
  - Reordered imports to satisfy first-party import-order tests.

## Behavioral Impact

No user-visible behavior change; token estimation remains the same. The UI now respects the enforced dependency direction.

## Related Cards

- [[dependency-layers]]

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.