Skip to content

fix memogen context skip and scope auto-push to upstream - #7419

Merged
Mzack9999 merged 1 commit into
devfrom
fix-memogen
May 20, 2026
Merged

fix memogen context skip and scope auto-push to upstream#7419
Mzack9999 merged 1 commit into
devfrom
fix-memogen

Conversation

@Mzack9999

@Mzack9999 Mzack9999 commented May 20, 2026

Copy link
Copy Markdown
Member

Summary

  • The memo template skipped context.Context from the hash key via a stale AST-string sentinel (&{context Context}). After an upstream memoize bump, param types are now rendered as context.Context, so the skip stopped matching and fmt.Sprint(ctx) ended up in every hash, effectively killing memoization on the JS libs (redis, mysql, mssql, postgres, etc.). Updates the sentinel.
  • The Memoize Functions workflow runs on any push to a branch named dev, including contributor forks where Actions are enabled by default. That had it auto-commit regenerated memo files into external PRs whose head branch happens to be dev. Adds a github.repository == 'projectdiscovery/nuclei' guard.

Test plan

  • make memogen after the template fix produces zero diff against the committed pkg/js/libs/**/memo.*.go files on dev
  • go build ./... clean
  • go vet ./... clean
  • go test ./cmd/memogen/... ./pkg/js/libs/... passes

Summary by CodeRabbit

  • Bug Fixes
    • Fixed memoization cache key generation to properly exclude context.Context parameters from the caching mechanism.

Review Change Stack

@auto-assign
auto-assign Bot requested a review from dwisiswant0 May 20, 2026 19:17
@coderabbitai

coderabbitai Bot commented May 20, 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: bb51f531-147c-47f5-9540-bad9b6b1d037

📥 Commits

Reviewing files that changed from the base of the PR and between 9330f01 and fe70a10.

⛔ Files ignored due to path filters (1)
  • .github/workflows/memogen.yaml is excluded by !**/*.yaml
📒 Files selected for processing (1)
  • cmd/memogen/function.tpl

Walkthrough

The memoization code generator template corrects its context parameter filtering logic to properly exclude context.Context arguments from the generated memoization cache key hash by fixing the type comparison condition.

Changes

Memoization Context Parameter Fix

Layer / File(s) Summary
Memoization key template fix
cmd/memogen/function.tpl
The hash-key parameter filtering condition is corrected to skip parameters when their type equals context.Context, ensuring context arguments are excluded from the memoization hash.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A rabbit hops through code so fine,
One line fixed, context won't shine
In memoization's golden hash,
No more context in the cache! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title partially addresses the changeset but is misleading about the scope. The raw_summary shows only changes to cmd/memogen/function.tpl (the context skip fix), while the PR objectives reveal a second, substantial fix to GitHub Actions workflow scope that is not mentioned in the title. Update the title to reflect the primary change accurately, either focusing solely on 'fix memogen context skip' or restructuring to represent both fixes more proportionally to their actual scope in the changeset.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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
  • Commit unit tests in branch fix-memogen

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.

@Mzack9999
Mzack9999 merged commit 7ee7cca into dev May 20, 2026
3 checks passed
@Mzack9999
Mzack9999 deleted the fix-memogen branch May 20, 2026 19:19
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