Skip to content

⚡ Bolt: [O(N^2) list deduplication performance] - #1140

Closed
seonghobae wants to merge 1 commit into
developfrom
jules-9512803248755467289-ea3c326a
Closed

⚡ Bolt: [O(N^2) list deduplication performance]#1140
seonghobae wants to merge 1 commit into
developfrom
jules-9512803248755467289-ea3c326a

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

💡 What: Optimized list deduplication loops by replacing O(N) list lookups with O(1) dictionary key lookups.
🎯 Why: Using if item not in lst: lst.append(item) inside loops results in O(N^2) complexity, degrading performance for large section counts.
📊 Impact: Reduces deduplication complexity from O(N^2) to O(N) while preserving insertion order (guaranteed by Python 3.7+ dictionaries).
🔬 Measurement: Python unit tests via uv run pytest ensure outputs remain identical.


PR created automatically by Jules for task 9512803248755467289 started by @seonghobae


Devin Review

@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 16 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 80a29f27-d28f-4aba-a7fe-a8950a7384c4

📥 Commits

Reviewing files that changed from the base of the PR and between 749511c and 5b15eac.

📒 Files selected for processing (2)
  • .jules/bolt.md
  • services/analysis-engine/src/bandscope_analysis/exports/chart.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Comment on lines +127 to +128
if name is not None:
names[name] = None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Malformed strings crash chart exports

An unhashable string subclass in a role name, cue, or active role ID makes dictionary deduplication raise TypeError. Both export builders then violate their safe-failure contract.

Prompt for agents
Restore safe failure for all three new dictionary-based deduplication paths in services/analysis-engine/src/bandscope_analysis/exports/chart.py: _active_role_ids, _active_role_names, and _section_cue. Values can pass isinstance(value, str) while remaining unhashable, such as a str subclass with __hash__ = None; the previous list membership logic accepted these values. Preserve insertion order and linear behavior for normal strings, while skipping malformed unhashable values rather than allowing TypeError to escape. Add tests covering malformed unhashable role IDs, display names, and cue values through both public export builders.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Collaborator Author

Closing as a proven duplicate of canonical chart-export writer #1076 after exact-head semantic comparison.

Current #1140 head 5b15eacc3941645b831b059e07b5aa1e396a5e81 changes only .jules/bolt.md and services/analysis-engine/src/bandscope_analysis/exports/chart.py. Its production delta is the same insertion-ordered-dictionary de-duplication for active role ids, role display names, cue values, and priority lines already owned by #1076.

#1076 current head 5677582ba1abcad0a1dd373475f4a814aa9994cd preserves that behavior and adds executable regressions for first-occurrence ordering, duplicate role/display/cue/priority values, duplicate role identities/graph positions, plus fail-closed handling of malformed unhashable or truthiness-overriding string-like values. #1140 contains no additional production behavior or test contract to transfer; its .jules/bolt.md note is non-runtime agent history, not a unique product requirement.

No #1140 checks, reviews, approvals, or predecessor evidence transfer to #1076.

@seonghobae seonghobae closed this Sep 2, 2026
@google-labs-jules

Copy link
Copy Markdown

Closing as a proven duplicate of canonical chart-export writer #1076 after exact-head semantic comparison.

Current #1140 head 5b15eacc3941645b831b059e07b5aa1e396a5e81 changes only .jules/bolt.md and services/analysis-engine/src/bandscope_analysis/exports/chart.py. Its production delta is the same insertion-ordered-dictionary de-duplication for active role ids, role display names, cue values, and priority lines already owned by #1076.

#1076 current head 5677582ba1abcad0a1dd373475f4a814aa9994cd preserves that behavior and adds executable regressions for first-occurrence ordering, duplicate role/display/cue/priority values, duplicate role identities/graph positions, plus fail-closed handling of malformed unhashable or truthiness-overriding string-like values. #1140 contains no additional production behavior or test contract to transfer; its .jules/bolt.md note is non-runtime agent history, not a unique product requirement.

No #1140 checks, reviews, approvals, or predecessor evidence transfer to #1076.

Understood. Acknowledging that this work is now obsolete as it's a proven duplicate of canonical chart-export writer #1076, and stopping work on this task.

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.

1 participant