Skip to content

Extract is_auto_eligible predicate; document instrumentation flags gotcha - #107

Merged
lukstafi merged 1 commit into
mainfrom
ludics/task-d3ede2d6-s5/root
Apr 15, 2026
Merged

Extract is_auto_eligible predicate; document instrumentation flags gotcha#107
lukstafi merged 1 commit into
mainfrom
ludics/task-d3ede2d6-s5/root

Conversation

@lukstafi

Copy link
Copy Markdown
Owner

Summary

  • Extract a single is_auto_eligible predicate in ppx_minidebug.ml to replace three identical 4-conjunct eligibility checks (in needs_runtime_injection, any_eligible, and the List.map filter)
  • Add "Dune Instrumentation Backend" section to README documenting that --auto must be passed on the consumer side via (instrumentation (backend ppx_minidebug --auto)), since dune-project's (instrumentation.backend ...) stanza does not support a flags field

Test plan

  • dune runtest passes with no diffs — pure refactor, no behavior change
  • Verify is_auto_eligible is used in all three original locations

🤖 Generated with Claude Code

…gs gotcha

Deduplicate the 4-conjunct auto-instrumentation eligibility check
from needs_runtime_injection, any_eligible, and the List.map filter
into a single is_auto_eligible function. Add a "Dune Instrumentation
Backend" section to README documenting that --auto must be passed on
the consumer side since dune-project's instrumentation.backend stanza
does not support a flags field.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lukstafi

Copy link
Copy Markdown
Owner Author

@codex review Focus on bugs, correctness issues, and edge cases. Do not check adherence to a spec or plan.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lukstafi
lukstafi merged commit 53e4a4d into main Apr 15, 2026
0 of 6 checks passed
@lukstafi

Copy link
Copy Markdown
Owner Author

Coder Retrospective — task-d3ede2d6

What went well

  • Clean, single-commit refactor with no test regressions.
  • All three duplication sites were truly identical — no hidden divergence to reconcile.
  • README section placed logically and covers the key gotcha clearly.

What I'd do differently next time

  1. Verify dune-project stanza syntax against dune docs before documenting. The README example uses (instrumentation.backend (ppx ppx_minidebug)) — this matches the proposal, but I didn't independently verify it against current dune documentation. For documentation-focused changes, a quick WebFetch of the relevant dune docs page would add confidence.
  2. Consider adding an inline test for is_auto_eligible. The predicate is pure and testable — a small expect test exercising it against a few synthetic value_binding AST nodes would guard against future regressions if the eligibility criteria evolve. This wasn't in scope but would be cheap insurance.
  3. Check for other near-duplicates while in the area. When extracting a predicate from 3 sites, it's worth a quick grep for subsets of the conjuncts (e.g., is_function_expr + is_unit_pattern together) to see if there are 4th or 5th partial duplications that could also benefit from is_auto_eligible.

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