From 679f6bae94a75a85d16321b6b581b7ee635ad213 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Wed, 25 Feb 2026 17:16:52 +0300 Subject: [PATCH] fix(meta-compile): handle dict-format attributes in tabular sections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Python list(dict) returns only keys, losing values. Added _as_list() helper to convert dict {"K":"V"} → ["K:V"] before passing to parse_attribute_shorthand(). Fixes TS attribute generation for all dict-format inputs (attributes, accountingFlags, etc.). Co-Authored-By: Claude Opus 4.6 --- .../meta-compile/scripts/meta-compile.py | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.claude/skills/meta-compile/scripts/meta-compile.py b/.claude/skills/meta-compile/scripts/meta-compile.py index 3002c39e..762de880 100644 --- a/.claude/skills/meta-compile/scripts/meta-compile.py +++ b/.claude/skills/meta-compile/scripts/meta-compile.py @@ -2077,9 +2077,17 @@ types_with_attr_ts = [ ] if obj_type in types_with_attr_ts: + def _as_list(val): + """Normalize attributes: dict {"K":"V"} → ["K:V"], list/other → list.""" + if val is None: + return [] + if isinstance(val, dict): + return [f"{k}:{v}" for k, v in val.items()] + return list(val) + attrs = [] if defn.get('attributes'): - for a in defn['attributes']: + for a in _as_list(defn['attributes']): attrs.append(parse_attribute_shorthand(a)) ts_sections = {} ts_order = [] @@ -2088,25 +2096,25 @@ if obj_type in types_with_attr_ts: if isinstance(ts_data, list): for ts in ts_data: ts_name = ts['name'] - ts_cols = list(ts.get('attributes', [])) + ts_cols = _as_list(ts.get('attributes', [])) ts_sections[ts_name] = ts_cols ts_order.append(ts_name) else: for k, v in ts_data.items(): - ts_sections[k] = list(v) if isinstance(v, list) else [v] + ts_sections[k] = _as_list(v) ts_order.append(k) # ChartOfAccounts: AccountingFlags + ExtDimensionAccountingFlags acct_flags = [] ext_dim_flags = [] if obj_type == 'ChartOfAccounts': if defn.get('accountingFlags'): - acct_flags = list(defn['accountingFlags']) + acct_flags = _as_list(defn['accountingFlags']) if defn.get('extDimensionAccountingFlags'): - ext_dim_flags = list(defn['extDimensionAccountingFlags']) + ext_dim_flags = _as_list(defn['extDimensionAccountingFlags']) # Task: AddressingAttributes addr_attrs = [] if obj_type == 'Task' and defn.get('addressingAttributes'): - addr_attrs = list(defn['addressingAttributes']) + addr_attrs = _as_list(defn['addressingAttributes']) child_count = len(attrs) + len(ts_sections) + len(acct_flags) + len(ext_dim_flags) + len(addr_attrs) if child_count > 0: has_children = True