Skip to content

Refactor suffix/label handling and add SupportEntityScreen model - #274

Merged
OCopping merged 2 commits into
mainfrom
refactor-label-gen
Oct 1, 2026
Merged

OCopping merged 2 commits into
mainfrom
refactor-label-gen

Conversation

@OCopping

Copy link
Copy Markdown
Collaborator

Changes

generate.py — Suffix and label improvements

  • suffix_key now falls back to None instead of component_name, preventing creation of bogus macro keys
  • Label fallback from screen_macros now prefers explicit "label" or "suffix" keys over dict order
  • Switched screen_mapping["key"] → screen_mapping.key for the new model type

models.py — New SupportEntityScreen BaseModel

  • Added SupportEntityScreen(file, type, screen_macros) replacing list[dict[...]] with proper typed fields
  • Added json_schema_extra on screen_macros for YAML editor validation

Tests — Updated fixtures and attribute access to match the new model type.

Benefits

  • Missing file or type in a screen entry is a clear Pydantic error instead of a KeyError
  • IDEs can validate screen_macros key-value pairs at edit time
  • No more silent creation of invalid macro keys

@codecov

codecov Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.85714% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.23%. Comparing base (2dd3dc6) to head (836efc5).

Files with missing lines Patch % Lines
src/techui_builder/generate.py 91.30% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #274      +/-   ##
==========================================
- Coverage   96.55%   96.23%   -0.33%     
==========================================
  Files          17       17              
  Lines        1075     1088      +13     
==========================================
+ Hits         1038     1047       +9     
- Misses         37       41       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…eModel for the screen dict in techui-support yaml entities
@OCopping

OCopping commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator Author

Built against the newest techui-support, it works and I am now getting this for i19's QBPM screen:
image

Comment thread src/techui_builder/generate.py
@adedamola-sode

Copy link
Copy Markdown
Collaborator

I don't know if we want to optimise for coverage or not, if not, we should probably remove it completely, otherwise that would need resolution. Looks great, thanks!

@OCopping

OCopping commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator Author

I don't know if we want to optimise for coverage or not, if not, we should probably remove it completely, otherwise that would need resolution. Looks great, thanks!

I think as long as the coverage is above 95% it doesn't really matter too much, but we should try and at least make the patch coverage be green in future. It's just annoying when the cause is odd lines.

@OCopping
OCopping merged commit 4966f69 into main Oct 1, 2026
7 of 9 checks passed
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.

2 participants