Skip to content

fix: warn on interval_modifier typo#754

Merged
DjamilaBaroudi merged 1 commit into
mainfrom
djamilabaroudi/bru-3764-interval-modifier-typo
May 22, 2026
Merged

fix: warn on interval_modifier typo#754
DjamilaBaroudi merged 1 commit into
mainfrom
djamilabaroudi/bru-3764-interval-modifier-typo

Conversation

@DjamilaBaroudi
Copy link
Copy Markdown
Collaborator

Summary

  • The validator only matched the exact key interval_modifiers:, so common typos like the singular interval_modifier: were silently dropped by the CLI with no diagnostic.
  • Added a typo-detection branch in materializationValidator.ts that flags interval_modifier, intervalmodifier(s), and interval-modifier(s) with a warning suggesting the correct key.

Closes BRU-3764.

Test plan

  • Open a pipeline.yml with interval_modifier: (singular) at top level — expect a yellow squiggle with "Unknown key 'interval_modifier'. Did you mean 'interval_modifiers'?"
  • Open a SQL/Python asset with interval_modifier: inside a @bruin block — same warning appears.
  • Correct spelling interval_modifiers: produces no false positive.
  • Existing placement/format checks still fire for the canonical key.

🤖 Generated with Claude Code

The validator only matched the exact plural form, so common typos like
"interval_modifier" (singular) were silently dropped by the CLI with no
diagnostic. Emit a warning suggesting the correct key.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 21, 2026

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
src/language-server/providers/materializationValidator.ts:142-143
Dead guard — `typoMatch[2]` can never equal `'interval_modifiers'` because that string is not an alternative in the regex. The first branch is `interval_modifier` (no trailing `s`), so the `!== 'interval_modifiers'` check is always `true` and never filters anything. If the intent was to also match the singular and then skip the exact correct form, the first alternative should have been `interval_modifiers?` (with `?` making the `s` optional), paired with the existing guard to suppress warnings for the correct spelling.

```suggestion
            const typoMatch = line.match(/^(\s*)(interval_modifiers?|intervalmodifiers?|interval-modifiers?)\s*:/i);
            if (typoMatch && typoMatch[2].toLowerCase() !== 'interval_modifiers') {
```

Reviews (1): Last reviewed commit: "flag misspellings of interval_modifiers ..." | Re-trigger Greptile

Comment on lines +142 to +143
const typoMatch = line.match(/^(\s*)(interval_modifier|intervalmodifiers?|interval-modifiers?)\s*:/i);
if (typoMatch && typoMatch[2] !== 'interval_modifiers') {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Dead guard — typoMatch[2] can never equal 'interval_modifiers' because that string is not an alternative in the regex. The first branch is interval_modifier (no trailing s), so the !== 'interval_modifiers' check is always true and never filters anything. If the intent was to also match the singular and then skip the exact correct form, the first alternative should have been interval_modifiers? (with ? making the s optional), paired with the existing guard to suppress warnings for the correct spelling.

Suggested change
const typoMatch = line.match(/^(\s*)(interval_modifier|intervalmodifiers?|interval-modifiers?)\s*:/i);
if (typoMatch && typoMatch[2] !== 'interval_modifiers') {
const typoMatch = line.match(/^(\s*)(interval_modifiers?|intervalmodifiers?|interval-modifiers?)\s*:/i);
if (typoMatch && typoMatch[2].toLowerCase() !== 'interval_modifiers') {
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/language-server/providers/materializationValidator.ts
Line: 142-143

Comment:
Dead guard — `typoMatch[2]` can never equal `'interval_modifiers'` because that string is not an alternative in the regex. The first branch is `interval_modifier` (no trailing `s`), so the `!== 'interval_modifiers'` check is always `true` and never filters anything. If the intent was to also match the singular and then skip the exact correct form, the first alternative should have been `interval_modifiers?` (with `?` making the `s` optional), paired with the existing guard to suppress warnings for the correct spelling.

```suggestion
            const typoMatch = line.match(/^(\s*)(interval_modifiers?|intervalmodifiers?|interval-modifiers?)\s*:/i);
            if (typoMatch && typoMatch[2].toLowerCase() !== 'interval_modifiers') {
```

How can I resolve this? If you propose a fix, please make it concise.

@DjamilaBaroudi DjamilaBaroudi merged commit a423a91 into main May 22, 2026
6 of 7 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.

2 participants