Skip to content

extras: extract the xff_extras_api base module (RegexBackend seam) - #326

Merged
helly25 merged 1 commit into
mainfrom
feat/extras-api-base-module
Jul 10, 2026
Merged

extras: extract the xff_extras_api base module (RegexBackend seam)#326
helly25 merged 1 commit into
mainfrom
feat/extras-api-base-module

Conversation

@helly25

@helly25 helly25 commented Jul 10, 2026

Copy link
Copy Markdown
Owner

b1 of the true-module extras refactor (#123).

The RegexBackend plugin interface + PCRE2 registration slot (backend.h) move out of //xff/regex into a new standalone local Bazel module, xff_extras_api, that both the xff core and every removable extra depend on. This breaks the cycle that blocked a real extra module: an extra (extra_modules/pcre2) can now depend on @xff_extras_api for the interface instead of reaching back into the core.

Changes

  • extra_modules/xff_extras_api/ (new local module): MODULE.bazel + backend.{h,cc}. Holds RegexBackend, the Pcre2Factory/RegisterPcre2Backend/Pcre2Registrar API, Pcre2Available(), and a new MakePcre2Backend() that owns the factory slot + the "not built in" Unimplemented. The header keeps its xff/regex/backend.h include path (via include_prefix) and xff::regex namespace, so no consumer include or call site changes.
  • //xff/regex: regex.h re-includes backend.h; regex.cc's Compile(kPcre2) calls MakePcre2Backend instead of the local slot; regex_cc deps @xff_extras_api.
  • extra_modules/pcre2: the backend gets the interface from @xff_extras_api, not //xff/regex.
  • MODULE.bazel: bazel_dep + local_path_override for xff_extras_api; align rules_cc to the resolved 0.2.21 (silences the direct-dep skew the fresh resolution surfaced).

Verified

No behavior change. regex_test (lean not-built-in path via MakePcre2Backend) and pcre2_backend_test (full PCRE2 compile via the relocated slot) both pass; lean //... (74/74) and --config=xff_full (incl. the manual pcre2_backend_test + full_binary_test) both green.

Next (this series)

  • b2: move the license-notice registry into xff_extras_api too.
  • b3: make extra_modules/pcre2 a real standalone module (own MODULE.bazel + local_path_override), retiring the include() segment.

Part of #123.

First step of the true-module extras refactor (#123). The RegexBackend plugin
interface + PCRE2 registration slot (backend.h) move out of //xff/regex into a new
standalone local Bazel module, xff_extras_api, that both the core and every removable
extra depend on - so an extra can become a real module without depending back into the
core (which would be a cycle).

- extra_modules/xff_extras_api/: MODULE.bazel + backend.{h,cc}. Holds RegexBackend,
  the Pcre2Factory/RegisterPcre2Backend/Pcre2Registrar API, Pcre2Available(), and a new
  MakePcre2Backend() that owns the slot + the "not built in" Unimplemented. Header keeps
  its xff/regex/backend.h include path (include_prefix) and xff::regex namespace, so no
  consumer include or call changes.
- //xff/regex: regex.h re-includes backend.h; regex.cc's Compile(kPcre2) calls
  MakePcre2Backend instead of the local slot; regex_cc deps @xff_extras_api.
- extra_modules/pcre2: the backend now gets the interface from @xff_extras_api, not
  //xff/regex - a step toward pcre2 being a standalone module (b3).
- MODULE.bazel: bazel_dep + local_path_override for xff_extras_api; align rules_cc to the
  resolved 0.2.21 (silences the direct-dep skew the fresh resolution surfaced).

No behavior change: regex_test (lean not-built-in) and pcre2_backend_test (full PCRE2 via
the relocated slot) both pass; lean //... and --config=xff_full both green.
@helly25
helly25 enabled auto-merge (squash) July 10, 2026 22:15
@helly25
helly25 merged commit 266bf96 into main Jul 10, 2026
9 checks passed
@helly25
helly25 deleted the feat/extras-api-base-module branch July 10, 2026 22:23
helly25 added a commit that referenced this pull request Jul 11, 2026
…l; minimal-archive CI (#328)

* extras: make pcre2 a standalone module; relocate xff_extras_api to top level

Final step of the true-module extras refactor (#123). extra_modules/pcre2 becomes its
own Bazel module (xff_pcre2), and the shared base module moves out of extra_modules/ so
that directory holds ONLY removable extras.

- xff_extras_api relocated extra_modules/xff_extras_api -> top-level xff_extras_api/. It
  is core-required (RegexBackend + license-notice seams), so it must NOT live under
  extra_modules/; now `rm -rf extra_modules/` (+ dropping the extras' bazel_deps) yields a
  minimal core archive. (Fixes the location introduced in #326/#327.)
- extra_modules/pcre2: new MODULE.bazel (module xff_pcre2, bazel_dep pcre2 +
  xff_extras_api); root swaps the include() segment for bazel_dep + local_path_override
  (the override is root-global, so xff_pcre2's bazel_dep(xff_extras_api) resolves). The old
  pcre2.MODULE.bazel segment + its exports_files are gone. pcre2_backend is //visibility:public.
- pcre2_backend_test rewritten to drive the backend through the base seam (MakePcre2Backend
  / RegexBackend), dropping its //xff/regex dep so it is module-local; the Matcher routing
  stays covered by //xff/cli:full_binary_test.
- xff_full select + CI full cell: //extra_modules/pcre2:... -> @xff_pcre2//:...

Verified: lean //... (74/74) has zero extra_modules/@pcre2 deps (cquery); --config=xff_full
full_binary_test + @xff_pcre2//:pcre2_backend_test green; --help=notice still lists PCRE2
(full) via the standalone module's license seam.

* ci: add a minimal-core-archive cell (drop all of extra_modules/)

Guards the full-separation property (#123): strip the whole extra_modules/ directory
plus the extras' bazel_dep + local_path_override lines, then build the lean core
(//xff/cli:xff). It passes only because xff_extras_api is top-level core infrastructure
(not under extra_modules/) and nothing in the core reaches into an extra - so a future
core->extra dependency, or a regression that pulls an extra into a lean target, fails
here. One cell on the single most-default target (ubuntu default); wired into the done gate.

Verified locally: rm -rf extra_modules + the sed strip -> bazel build --nobuild //...
re-resolves and loads all targets cleanly (xff_full's @xff_pcre2 select is lazy/manual).
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