Skip to content

test(core): add regression coverage for multi-tag operation dedup (#873) - #3377

Merged
melloware merged 1 commit into
orval-labs:masterfrom
wadakatu:test/issue-873-multi-tag-dedup
May 18, 2026
Merged

test(core): add regression coverage for multi-tag operation dedup (#873)#3377
melloware merged 1 commit into
orval-labs:masterfrom
wadakatu:test/issue-873-multi-tag-dedup

Conversation

@wadakatu

@wadakatu wadakatu commented May 18, 2026

Copy link
Copy Markdown
Contributor

What this PR does

Adds a focused regression test for #873.

#873 reports that an operation declaring multiple tags (e.g. tags: [cats, dogs]) was generated and exposed once per tag in tags / tags-split mode, which duplicated the operation across tag files and made the workspace index.ts re-export the same symbol twice and fail to compile.

This behaviour is already fixed on master: generateTargetForTags buckets each operation by its first tag only (packages/core/src/writers/target-tags.ts). The existing tests/specifications/multiple-tags.yaml fixture (listPets has tags: [cats, dogs]) already exercises this path, but it is only covered by the broad file snapshots, so a regression would surface as an opaque snapshot diff rather than a clear signal.

This PR pins the behaviour explicitly, matching the existing focused-test pattern in tests/api-generation.spec.ts (see the #708 / #826 / #3103 tests): the test asserts that listPets is emitted under its first tag (cats) and is not duplicated into a later tag (dogs), for both tags and tags-split modes.

Why

The duplication bug is fixed but had no targeted coverage. If the first-tag dedup logic regresses, this test fails with a clear message (listPets must not be duplicated into a later tag) instead of a full-file snapshot diff.

Verification

  • New test passes on master.
  • Temporarily reverting the dedup (emitting each operation once per tag) makes the new test fail with the targeted message — confirming it actually guards the behaviour.
  • No production code and no generated snapshots change; only tests/api-generation.spec.ts is touched.
  • format:check, typecheck, lint, test, test:snapshots, and the generated-client typecheck (--filter orval-tests build) all pass.

Summary by CodeRabbit

  • Tests
    • Added a regression test to verify correct behavior of multi-tag API generation scenarios.

Review Change Stack

Copilot AI review requested due to automatic review settings May 18, 2026 12:28
@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

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: 77c2df35-5483-421b-b5f2-fcf9a3f89c44

📥 Commits

Reviewing files that changed from the base of the PR and between 103a570 and dae6178.

📒 Files selected for processing (1)
  • tests/api-generation.spec.ts

📝 Walkthrough

Walkthrough

Adds a regression test for issue #873 that verifies multi-tag API generation deduplicates operations to the first tag's output file, not replicated across later tag files. The test iterates multi-tag modes, reads generated endpoint files, and asserts the expected marker placement.

Changes

Multi-tag Operation Regression Test

Layer / File(s) Summary
Issue #873 multi-tag deduplication test
tests/api-generation.spec.ts
New regression test iterates multi-tag generation modes, loads endpoint files for first vs. later tags, and asserts listPets export appears only in first-tag output.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related PRs

  • orval-labs/orval#3249: Implements the multi-tag operation deduplication fix (scoping Angular httpResource header generation by tag), which this test verifies at the generated code level.

Suggested labels

enhancement

Suggested reviewers

  • melloware

Poem

🐰 A test to guard the double play,
Multi-tags that stray no way,
Issue 873 we defend,
One export, never split again! ✓

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a regression test for multi-tag operation deduplication (issue #873), which aligns perfectly with the changeset's addition of a focused test case.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

@melloware melloware added this to the 8.12.0 milestone May 18, 2026
@melloware
melloware merged commit 8fda223 into orval-labs:master May 18, 2026
5 checks passed
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.

Bug: endpoints with multiple tags get generated and exposed multiple times

2 participants