def aggregate_by_key(records):
    result = {}
    for row in records:
        if 'key' not in row or 'value' not in row:
            continue
        key = row['key']
        value = row['value']
        if not isinstance(value, (int, float)) or isinstance(value, bool):
            continue
        result[key] = result.get(key, 0) + value
    return dict(sorted(result.items()))
