Skip to content

refactor(skill): move generic functional style ownership out of streams#52

Open
martinfrancois wants to merge 2 commits into
mainfrom
refactor/use-java-functional-style
Open

refactor(skill): move generic functional style ownership out of streams#52
martinfrancois wants to merge 2 commits into
mainfrom
refactor/use-java-functional-style

Conversation

@martinfrancois

Copy link
Copy Markdown
Owner

Summary

  • Problem: java-streams was carrying generic Java lambda and functional-interface style guidance alongside stream and collector semantics.
  • Why it matters: the stream skill should stay focused on stream behavior while java-functional-style owns cross-cutting callback readability, identity functions, and no-op functional stages.
  • What changed: slimmed stream runtime guidance to semantic ownership, added companion-boundary docs, and kept only the stream-specific bridge text needed for composition.
  • What did not change: existing stream eval criteria were not weakened before the composition proof; stream and collector semantic guidance remains in this repo.

Change Type

  • Skill behavior
  • Evals or scoring
  • Documentation
  • CI, release, or dependency automation
  • Repository metadata or contribution process
  • Other maintenance

Linked Issue

User-Visible Behavior

java-streams now presents itself as the owner of stream and collector semantics: terminal operation choice, collector choice, duplicate-key and null behavior, encounter order, primitive streams, Java-version compatibility, parallel streams, gatherers, and stream-specific behavior preservation.

Generic lambda and functional-interface cleanup is delegated to martinfrancois/java-functional-style, which should be installed with this package when stream cleanup also involves non-trivial callbacks, identity functions, no-op functional stages, supplier laziness, or callback side effects.

Bug Fix Details

  • Root cause: generic functional-style guidance was previously canonical in the stream skill, which blurred ownership and made composition with other Java domain skills harder.
  • Test, eval, or guardrail added: composed stream + functional-style context was validated against all existing stream main, reference, and regression evals after the final runtime-context change.
  • If no test or eval was added, why not: no eval criteria were changed in this PR; the gate intentionally used the existing stream evals unchanged.

Ownership Boundary

Moved out of streams: canonical guidance for method references, identity functions, no-op functional stages, multi-line/block callback extraction, supplier laziness as general callback style, and generic callback side-effect readability.

Kept in streams: terminal operation choice, collector semantics, duplicate keys, null keys/values, encounter order, primitive streams, findFirst versus findAny, parallelStream, Gatherers.mapConcurrent, stream Java-version compatibility, and stream behavior preservation.

Issue #44 status: Function.identity() is canonical java-functional-style guidance. Streams keeps collector-shaped composition coverage and semantic warnings for merge functions, map suppliers, ordering expectations, key/value mappers, and Java baseline compatibility.

Composition Gate

No PR was opened before the stream composition quality gate passed.

Criterion-level requirement: current java-streams behavior <= slimmed java-streams + java-functional-style behavior on the existing stream evals.

Final composed eval results after the last stream runtime-context change:

main:       4/4 scenarios at 100, run 019f11b9-01a4-753d-b95a-b60541477283
reference:  6/6 scenarios at 100, run 019f11c4-7244-7233-b28d-2038693a8854
regression: 19/19 scenarios at 100, run 019f11b4-86f8-71cc-b4c6-c45ecaaa1014

Because every retained scenario reached 100% under the composed setup, the composed result is equal or better than the baseline at criterion level, including the PR #37 affected lambda scenarios.

Validation

Checks most contributors can run:

  • python3 scripts/validate_skill.py skills/java-streams -> passed
  • python3 scripts/validate_eval_criteria.py evals evals-reference evals-regression -> passed, Validated 29 scenario(s): 11 natural, 18 explicit.
  • python3 -m py_compile scripts/*.py -> passed
  • bash -n scripts/*.sh -> passed
  • python3 scripts/validate_json_files.py -> passed
  • python3 scripts/validate_openai_agent_yaml.py -> passed
  • tessl plugin lint . -> passed
  • Manual rendered-doc or example review, if docs or examples changed

Tessl-authenticated checks:

  • tessl review run --workspace martinfrancois --threshold 100 skills/java-streams/SKILL.md -> 100, run 019f11af-6549-7278-98b9-770a69d3578c
  • Full composed regression eval suite -> 19/19 at 100, run 019f11b4-86f8-71cc-b4c6-c45ecaaa1014
  • Full composed main eval suite -> 4/4 at 100, run 019f11b9-01a4-753d-b95a-b60541477283
  • Full composed reference eval suite -> 6/6 at 100, run 019f11c4-7244-7233-b28d-2038693a8854
  • Every retained eval scenario reached 100% with context after the final runtime-context change.

Details:

The unchanged existing stream evals were used for the composition proof. No stream eval criteria were weakened, deleted, or moved before the gate passed.

Human Verification

Reviewed the stream skill, hard-stop references, examples, README, and ownership-boundary docs to confirm generic functional-style ownership moved to the companion package while stream-specific semantic guidance remained in this package.

Review Checklist

  • The change is scoped to the sections, skill files, evals, or workflows described above.
  • Validation that applies to this change is checked above, or any unavailable check is explained.
  • If Java stream guidance changed, Java baseline compatibility plus ordering, null handling, and parallelism were considered.
  • If evals or benchmark claims changed, the eval scenarios remain fair and do not leak answer keys, run IDs, or fixed score claims into runtime references.
  • If runtime skill text or references changed, hosted checks were widened from targeted affected scenarios to main/reference/regression as described in docs/agents/workflow.md, or any Tessl blocker is documented.
  • If a runtime skill/reference change was released, the final report includes the published main eval run plus post-change reference and regression run IDs, or a blocker issue for missing broad suites.
  • Main and reference evals were run with both variants when hosted evals were needed; regression evals were run with context only unless reclassification back to reference was being checked.
  • New or moved eval scenarios follow the classifier recommendation, or the PR explains the maintainer-approved override.
  • Every retained eval scenario has a 100% with-context result, or any below-100 result is documented as blocking follow-up rather than classified/reportable coverage.
  • PR title or squash title uses Conventional Commits.
  • Redaction checked: no tokens, private links, private eval artifacts, local host paths, or proprietary Java source.

AI Assistance (if used)

  • AI-assisted PR
  • I confirm I understand and reviewed the change
AI prompts / session logs (optional)
AI assistance was used to draft and edit the skill/docs and to run local and hosted validation. The submitted diff and validation results were reviewed before opening this PR.

martinfrancois and others added 2 commits June 28, 2026 20:28
Keep java-streams focused on stream and collector semantics while documenting java-functional-style as the owner for generic lambda, identity-function, supplier-laziness, no-op callback stage, and callback readability guidance.

Existing stream eval criteria are left unchanged so the composed setup can be compared against the frozen baseline before any eval cleanup.

Co-Authored-By: marvinbuff <marvinbuff@hotmail.com>

Co-Authored-By: PReimers <preimers@pm.me>
Tighten stream-specific review guidance for ordered findFirst replacements and external-mutation performance claims, and add a narrow bridge for applying the companion callback rules inside stream pipelines.

This keeps stream semantics in java-streams while allowing composed java-streams plus java-functional-style runs to satisfy existing focused callback-shape coverage without restoring generic functional-style ownership to streams.

Co-Authored-By: marvinbuff <marvinbuff@hotmail.com>

Co-Authored-By: PReimers <preimers@pm.me>
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.

feat: Improve readability by avoiding multi-line lambdas

1 participant