Skip to content

Concurrency conformance: eager, shareable themes and configuration; canary + audit + probes #42

Closed

Description

@mhenrixon

Child of EPIC_REF (concurrency conformance across the zoolutions gems). Depends on conformance-kit (Phase 0 of the epic).

Problem / Goal

phlex-forms keeps its component maps and configuration in lazy class ivars — Theme.@daisy ||= / @plain ||= (lib/phlex_forms/theme.rb:56,74), PhlexForms.@configuration ||= (lib/phlex_forms.rb:42-56), Configuration lazies incl. an icon_renderer lambda (configuration.rb:50,58,68) — idempotent races today, unreadable from a non-main Ractor. Goal: Tier 1–2 gates green; PhlexForms.finalize! builds both themes and the configuration eagerly and Ractor.make_shareables them (the icon_renderer default becomes a method object / Ractor.shareable_lambda on 4.0, a capture-free lambda below); the kit's canary runs field inference (Forms::Field option resolution from a literal model-like Struct) inside a non-main Ractor on Ruby 4.0; rendering stays pending on yippee-fun/phlex#1055 (per-Ractor attribute cache; tag() registries are a further follow-up); audit passes; probes report-only. Floor 3.4 (store_if_absent available; still reach it through the kit shim for uniformity). Add a 4.0 lane (matrix is ["3.4"]).

Context

  • lib/phlex_forms.rb:42-56,65-95 (configuration memo, reset_configuration!, manual Zeitwerk loader, require "phlex/reactive" rescue), lib/phlex_forms/theme.rb:56,74 + reactive_roles (defined?(Phlex::Reactive) probe), lib/phlex_forms/configuration.rb:50,58,68, lib/forms/base.rb:24-40 (form_options class ivars, class-body time), lib/phlex_forms/inline_icons.rb:14-16 (frozen SVG constants — already shareable), lib/phlex_forms/engine.rb:31.
  • Labels: core, theme, devops.

Decision

Finalize-at-boot (engine after_initialize, or end of configure when Rails is absent); themes become frozen, shareable Hashes of classes; configuration frozen; reset_configuration! stays for tests. The daisyui/phlex-reactive defined? probes are evaluated once at finalize.

Steps (TDD)

  1. Kit dev dep + rubocop inherit. 2. spec/phlex_forms/finalize_spec.rb ("a boot-finalized configuration" over Theme.daisy, Theme.plain, every Configuration reader) RED → GREEN. 3. spec/phlex_forms/contention_spec.rb (thread + Async examples over Theme.component_for). 4. spec/phlex_forms/ractor_canary_spec.rb (:ractor; pending render canary with the Phlex reason). 5. .conformance.yml (Forms::Base class-body ivars → main_only). 6. CI callers + 4.0 lane; CHANGELOG.

Gates

bundle exec rspec green (3.4/4.0; --tag ractor on 4.0); rubocop clean; conformance-audit --strict 0; probes artifact.

Out of scope

Rendering in a Ractor (Phlex upstream); the validation→Stimulus client bridge.

Execution

/lfg <this issue> after the kit exists.

Update 2026-10-14: conformance-kit 0.1.0 is on RubyGems; the Gemfile reference (gem "conformance-kit", "~> 0.1", require: false, plus require "conformance_kit/rspec" where RSpec is used) is in #43 (open until the branch ruleset's CodeQL requirement is sorted). Start from the remaining steps.

Update 2026-10-14 (conformance-kit 0.2.0, zoolutions/conformance-kit#6): this supersedes the CI step above ("call the kit's ractor.yml + probes.yml" / "CI callers"). 0.2 removed those workflows: one zoolutions org ruleset now requires the kit's conformance.yml on every repo whose conformance property is enforced, and this repo is flipped once this issue closes clean. Instead:

  • Write .conformance.yml 0.2: audit.require (must eager-load the gem), audit.namespace, audit.strict_autoloads: true, ractor.test_command, probes.gem_name.
  • Bump to gem "conformance-kit", "~> 0.2" (plus gem "rubocop-thread_safety", ">= 0.8", and inherit_gem: { conformance-kit: config/rubocop.yml } in .rubocop.yml; conformance-kit doctor checks all three).
  • bundle exec conformance-kit check green on Ruby 4.0.
  • Do not add caller jobs.

Update 2026-10-15 (supersedes the 2026-10-14 conformance-kit 0.2.0 note above; zoolutions/conformance-kit#10): there will be no org ruleset. Each repo calls the kit's workflow itself, so this replaces "Do not add caller jobs". Once conformance-kit v0.3.0 is released:

  • Add .github/workflows/conformance.yml with the caller from the kit README's Enforcement section: uses: zoolutions/conformance-kit/.github/workflows/conformance.yml@v0.3.0 on pull_request + merge_group, permissions: contents: read.
  • Bump to gem "conformance-kit", "~> 0.3". The workflow's version check fails while the lockfile resolves anything older than the caller's tag.
  • Add .github/dependabot.yml with the github-actions and bundler ecosystems, as in the kit README's "Staying current", so both pins keep moving.
  • Once bundle exec conformance-kit check is green on Ruby 4.0, add conformance / Conformance settings and conformance / Conformance (Ruby 4.0) to this repo's branch ruleset as required status checks.
  • The rest of the 0.2 note still applies: the .conformance.yml 0.2 keys, rubocop-thread_safety >= 0.8, inherit_gem, and the repo-specific line.

Activity

  1. added
    enhancementNew feature or request
    devopsCI, the release kit, Docker, deploys and infrastructure
    themeThemes and the Plain (unstyled) components
    coreConfiguration, the Rails engine and soft-dependency wiring
    planHas a /flow:plan body with Context, Decision, Steps and Gates; ready for /flow:lfg
    on Oct 12, 2026
  2. mhenrixon commented on Oct 16, 2026

    @mhenrixon
    CollaboratorAuthor

    Done in #45, released in v0.5.0 (conformance-kit 0.4).

    • bundle exec conformance-kit check passes on Ruby 4.0 and in CI.
    • conformance / Conformance settings and conformance / Conformance (Ruby 4.0) are now required checks on main.
    • Configuration finalizes automatically at boot.

    Left upstream: rendering inside a non-main Ractor waits on yippee-fun/phlex#1055 (tracked in zoolutions/phlex-reactive#363).

    https://claude.ai/code/session_01Pu6VAMxKeUE1gfNwDrbPZ4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreConfiguration, the Rails engine and soft-dependency wiringdevopsCI, the release kit, Docker, deploys and infrastructureenhancementNew feature or requestplanHas a /flow:plan body with Context, Decision, Steps and Gates; ready for /flow:lfgthemeThemes and the Plain (unstyled) components

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions