Skip to content

fortinet: repair query() mangled by a bad merge (syntax error on main) - #290

Merged
uforia merged 1 commit into
mainfrom
fix/fortinet-merge-duplication
Jul 26, 2026
Merged

fortinet: repair query() mangled by a bad merge (syntax error on main)#290
uforia merged 1 commit into
mainfrom
fix/fortinet-merge-duplication

Conversation

@spierenburg

Copy link
Copy Markdown
Collaborator

Problem

modules/fortinet/feed.py does not parse on main — a try: at line 95 has no matching except/finally:

File ".../modules/fortinet/feed.py", line 95
    try:
SyntaxError: expected 'except' or 'finally' block

Merge c89c607 ("Merge branch 'main' into fix/268-fortinet-unfiltered-content") stacked three overlapping copies of the query() loop body on top of each other. The file has not parsed since, so test_feed_contracts, test_module_contracts and every test importing the module fail — the stdlib unittest check is red on every PR against main, not just one.

Fix

Reconstructed from the last revision that parsed (c76c439) by re-applying only the intended FeedResult error-contract changes, matching the sibling multi-source modules migrated in c7acb1a:

  • import feedutils; collect per-source errors in errors
  • wrap each URL in try/excepterrors.append((URL, str(e))); continue
  • content = None guard so an entry that fails the CVSS filter is skipped, not posted with the previous entry's content
  • break (not return) on IndexError, so the remaining URLs are still processed
  • return feedutils.result(items, errors)

The diff against c76c439 is exactly those changes and nothing else.

Testing

python -m unittest tests.test_feed_contracts tests.test_module_contracts tests.test_import_path_safety21/21 pass (were erroring on the parse failure). File byte-compiles.

Merge c89c607 ("Merge branch 'main' into fix/268-fortinet-unfiltered-content")
stacked three overlapping copies of the query() loop body on top of each other,
leaving a `try:` with no matching `except`/`finally` at line 95. modules/fortinet/
feed.py has not parsed on main since -- test_feed_contracts, test_module_contracts
and everything importing the module fail, so the stdlib-unittest check is red on
every PR against main.

Reconstructed from the last parsing revision (c76c439) by applying only the
intended FeedResult error-contract changes, matching the sibling multi-source
modules migrated in c7acb1a:
- import feedutils; collect per-source errors in `errors`
- wrap each URL in try/except -> errors.append((URL, str(e))); continue
- content=None guard so an entry that fails the CVSS filter is skipped, not
  posted with the previous entry's content
- break (not return) on IndexError so remaining URLs are still processed
- return feedutils.result(items, errors)
@spierenburg

Copy link
Copy Markdown
Collaborator Author

Merge order — please merge this first.

This repairs a syntax error in modules/fortinet/feed.py that is currently red on main's CI, so it fails the stdlib unittest check on every open PR against main.

It unblocks #289, whose CI is failing only because of this same pre-existing break (not because of anything in #289). Once this lands on main, #289 will be rebased on top and its CI will go green.

Merge path: #290 → main, then rebase #289.

@uforia
uforia merged commit 1db202d into main Jul 26, 2026
4 of 5 checks passed
@spierenburg
spierenburg deleted the fix/fortinet-merge-duplication branch August 4, 2026 21:08
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