Skip to content

Test/bruno find containing intervals#29525

Open
BGrangeiro wants to merge 10 commits into
calcom:mainfrom
jj-viana:test/Bruno-findContainingIntervals
Open

Test/bruno find containing intervals#29525
BGrangeiro wants to merge 10 commits into
calcom:mainfrom
jj-viana:test/Bruno-findContainingIntervals

Conversation

@BGrangeiro

Copy link
Copy Markdown

Summary

Adds unit tests for findContainingIntervals from ContainmentSearchAlgorithm.

The tests cover equivalence partitioning, boundary value analysis, MC/DC for the containment decision, and the tree search pruning branches.

No new dependencies are required.

  • Fixes: N/A (academic testing activity without a related GitHub issue)

Visual Demo (For contributors especially)

N/A. This PR only adds unit tests and does not change the user interface.

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs if this PR makes changes that would require a documentation change. N/A: no documentation changes are required.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

No environment variables or external test data are required.

Run:

corepack yarn vitest run packages/lib/intervalTree.test.ts

Expected result:

  • 16 tests pass.

To verify coverage:

corepack yarn vitest run packages/lib/intervalTree.test.ts \
  --coverage.enabled \
  --coverage.include="packages/lib/intervalTree.ts" \
  --coverage.reporter=text

Expected coverage for intervalTree.ts:

  • 100% statements
  • 100% branches
  • 100% functions
  • 100% lines

Checklist

  • I have read the contributing guide.
  • My code follows the style guidelines of this project.
  • I have checked that my changes generate no new warnings.
  • This PR is small and focused.

jj-viana and others added 6 commits May 19, 2026 09:15
Adds the team-wide master plan and one working document per member, plus
the assignment brief and report template. Updates the method-selection doc
after a coverage audit that swapped four already-100%-covered functions for
untested pure functions (extractHostTimezone, isEqual, findContainingIntervals,
isPasswordValid) and kept parseTimeString and subtract for their dead-code
findings.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Welcome to Cal.diy, @BGrangeiro! Thanks for opening this pull request.

A few things to keep in mind:

  • This is Cal.diy, not Cal.com. Cal.diy is a community-driven, fully open-source fork of Cal.com licensed under MIT. Your changes here will be part of Cal.diy — they will not be deployed to the Cal.com production app.
  • Please review our Contributing Guidelines if you haven't already.
  • Make sure your PR title follows the Conventional Commits format.

A maintainer will review your PR soon. Thanks for contributing!

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "Test/bruno find containing intervals". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 50071c4e-09aa-4182-9891-7bc35fc98e82

📥 Commits

Reviewing files that changed from the base of the PR and between dcbac1f and ade732c.

📒 Files selected for processing (1)
  • .gitignore
✅ Files skipped from review due to trivial changes (1)
  • .gitignore

📝 Walkthrough

Walkthrough

This PR refactors test coverage for getLuckyUser priority ranking by splitting a complex test case into multiple focused test cases with centralized setup, adds a comprehensive new test suite for interval tree containment search including equivalence partitioning and white-box pruning analysis, and updates the project gitignore to exclude build artifacts and local team working files. The changes improve test clarity and add systematic coverage for a core data structure algorithm without modifying any production code.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Test/bruno find containing intervals' directly relates to the main change: adding tests for findContainingIntervals from ContainmentSearchAlgorithm, as confirmed by the PR description and file summaries.
Description check ✅ Passed The description comprehensively explains the PR's purpose: adding unit tests for findContainingIntervals, covering equivalence partitioning, boundary value analysis, MC/DC, and tree pruning, with testing instructions and expected coverage metrics.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ptoss-2-funcao-joaquim-isPasswordValid.md`:
- Line 78: The markdown decision table row containing D1 (`password.length >= 7
&& (!strict || password.length > 14)`) has more cells than the header and breaks
the table layout; update that row in ptoss-2-funcao-joaquim-isPasswordValid.md
so it matches the header column count (normalize/remove or merge extra
pipe-separated cells for `A=...`, `B=...`, `C=...`, `min = true/false` to the
same number of columns as the table header) so the decision matrix renders
correctly.

In `@ptoss-2-test-method-selection.md`:
- Line 150: Update the section that still references outdated functions
(`getPrefetchMonthCount`, `getAvailabilityFromSchedule`, `intersect`,
`computeEffectiveStateAcrossTeams`) and the ambiguous TDD guidance so it matches
the current decision to focus on a single TDD track: `isPasswordValid`; remove
or replace all instructions that point to the old functions with tasks relevant
to `isPasswordValid` (e.g., propose unit tests, edge cases, and MC/DC candidate
conditions for `isPasswordValid`) and explicitly state that TDD will use
`isPasswordValid` as the single track; apply the same replacements to the other
mentioned ranges so no stale function names or undefined TDD guidance remain.
- Line 39: The markdown table row containing "Técnica caixa-branca usada |
Cobertura de branches de cada `if` e das decisões de 2 condições `value == null
|| other == null` e `Array.isArray(value) && Array.isArray(other)`" is producing
an extra column because of unescaped pipe characters inside the cell; update
that row to keep the table 2-column consistent by escaping any pipe characters
or wrapping the entire cell contents in a code span or HTML entity (e.g.,
replace internal | with \| or use `inline code`/&`#124`;) so the table has exactly
two cells: the left column "Técnica caixa-branca usada" and the right column
with the decision text. Ensure the edited row still contains the original
decision text (including the `value == null || other == null` and
`Array.isArray(value) && Array.isArray(other)`) but with pipes escaped.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c5b868f7-31b2-44e1-800b-ef8942288253

📥 Commits

Reviewing files that changed from the base of the PR and between 75c5eb8 and dcbac1f.

⛔ Files ignored due to path filters (2)
  • 26-1-PTOSS-2-template_relatorio.docx is excluded by !**/*.docx
  • 26-1-PTOSS-2.pdf is excluded by !**/*.pdf
📒 Files selected for processing (10)
  • packages/features/bookings/lib/getLuckyUser.test.ts
  • packages/lib/intervalTree.test.ts
  • ptoss-2-funcao-anderson-parseTimeString.md
  • ptoss-2-funcao-bruno-findContainingIntervals.md
  • ptoss-2-funcao-eduardo-isEqual.md
  • ptoss-2-funcao-joaquim-isPasswordValid.md
  • ptoss-2-funcao-john-subtract.md
  • ptoss-2-funcao-rodrigo-extractHostTimezone.md
  • ptoss-2-plano-geral.md
  • ptoss-2-test-method-selection.md

Comment thread ptoss-2-funcao-joaquim-isPasswordValid.md Outdated
Comment thread ptoss-2-test-method-selection.md Outdated
Comment thread ptoss-2-test-method-selection.md Outdated
Comment thread .gitignore
# pagefind
_pagefind/

# PTOSS-2 working files (mantidos localmente, fora do versionamento)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why these changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants