Commit Graph

4 Commits

Author SHA1 Message Date
freemo e0336379f5 fix(robot): correct dedent logic for try...except...finally in indentation_library
CI / lint (pull_request) Successful in 29s
CI / typecheck (pull_request) Successful in 48s
CI / quality (pull_request) Successful in 33s
CI / security (pull_request) Successful in 1m2s
CI / build (pull_request) Successful in 23s
CI / helm (pull_request) Successful in 23s
CI / unit_tests (pull_request) Successful in 6m48s
CI / e2e_tests (pull_request) Successful in 19m4s
CI / integration_tests (pull_request) Successful in 22m6s
CI / coverage (pull_request) Successful in 10m59s
CI / docker (pull_request) Successful in 22s
CI / status-check (pull_request) Successful in 2s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 57m5s
Rewrites the block_stack management in fix_python_indentation to correctly
handle try...except...finally blocks in all configurations:

- Single except clause
- Multiple except clauses for the same try
- try...except...finally
- Nested try blocks with outer except
- Nested try with inner finally followed by outer except (critical regression)

Root cause: The original implementation stored only keyword strings in
block_stack (e.g. 'try', 'class', 'other'). Two bugs existed:

1. When 'finally:' was encountered, the code popped the 'try' from the
   stack. This meant subsequent 'except:' clauses for an outer try could
   not find their matching try, producing syntactically invalid Python.

2. The dedent calculation for 'except'/'finally' counted all stack entries
   up to the first 'try', but did not account for nested try blocks where
   the inner try's except/finally had already been processed.

Fix: Replace the flat string stack with a tuple stack of
(keyword, base_indent, has_seen_except_finally). The new logic:

- 'finally:' always belongs to the innermost try. Pop non-try entries,
  set indent to that try's base_indent, then pop the try itself (finally
  closes the block). The outer try remains on the stack.

- 'except:' belongs to the innermost try. If the innermost try has already
  seen an except/finally AND there is an outer try, the inner try is done:
  pop it and use the outer try instead. Otherwise use the innermost try
  and mark it as having seen an except/finally clause.

Adds a Behave BDD feature (tdd_indentation_library_try_except.feature)
with 6 scenarios covering all acceptance criteria from issue #2845.

ISSUES CLOSED: #2845
2026-04-05 07:39:57 +00:00
brent.edwards 51bfee28a9 style(robot/-and-typings/numpy): fix style problems found by ruff check
CI / lint (pull_request) Successful in 15s
CI / typecheck (pull_request) Successful in 25s
CI / security (pull_request) Successful in 18s
CI / quality (pull_request) Failing after 15s
CI / behave (3.11) (pull_request) Failing after 11s
CI / behave (3.12) (pull_request) Failing after 11s
CI / behave (3.13) (pull_request) Failing after 13s
CI / docker (pull_request) Has been skipped
CI / helm (pull_request) Has been skipped
CI / build (pull_request) Failing after 14s
CI / coverage (pull_request) Failing after 15s
2026-02-12 02:47:08 +00:00
freemo 958c29b18a Feat: Moved to langchain based providers 2025-11-18 00:10:29 -05:00
freemo 8c662e9a1b Chore: removed test_utils.py from the core code base 2025-11-16 21:45:09 -05:00