Skip to content

ci: adopt trunk (clang-tidy + markdownlint/prettier/yamllint/buildifier) - #123

Merged
helly25 merged 1 commit into
mainfrom
adopt/trunk
Jun 24, 2026
Merged

ci: adopt trunk (clang-tidy + markdownlint/prettier/yamllint/buildifier)#123
helly25 merged 1 commit into
mainfrom
adopt/trunk

Conversation

@helly25

@helly25 helly25 commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Adopts helly25/mbo's trunk setup - the second "CI element" (after pre-commit in #122). Completes the lint/CI adoption; the clang-tidy apply sweep follows.

What

  • .trunk/ - trunk.yaml + configs/{.yamllint,.markdownlint}.yaml + .gitignore, from mbo. Linters: buildifier, clang-tidy (local only; run_when: [cli, monitor] so CI skips it without a compile DB), markdownlint, prettier, yamllint, checkov, trivy, trufflehog, git-diff-check.
  • main.yml - new trunk job (trunk-io/trunk-action@v1), wired into done. Gave on: pull_request a non-empty branches: ["**"] (yamllint empty-values; same behavior = all PRs).
  • .markdownlint.yaml - disabled MD036 (emphasis-as-heading) and MD040 (fenced-code-language): xff design docs use bold lead-ins as inline labels + a few language-less ASCII/output fences; relaxing beats churning authored prose.
  • trunk fmt applied: prettier normalized docs (also gives automatic markdown-table alignment - the thing the aligner-skill task wanted), buildifier normalized 5 BUILD files. No semantic changes.

Validation

  • trunk check (buildifier/markdownlint/prettier/yamllint/checkov/trivy/trufflehog/git-diff-check): clean, 102 files.
  • pre-commit run -a: all green (trunk + pre-commit coexist; no overlap).
  • bazel test //...: green in both default and clang+asan (buildifier reformat is non-semantic).

Next

Apply clang-tidy through trunk (trunk check --filter=clang-tidy) and fix real findings with judgment (per-file false positives like the public Lookup need a human).

Adopt helly25/mbo's trunk (https://trunk.io) setup, the second CI element.

- .trunk/trunk.yaml + configs (.yamllint.yaml, .markdownlint.yaml) + .gitignore,
  from mbo. Enables buildifier, clang-tidy (local only; CI-skipped without a
  compile DB), markdownlint, prettier, yamllint, checkov, trivy, trufflehog,
  git-diff-check.
- main.yml: new `trunk` job (trunk-io/trunk-action@v1), wired into the `done`
  gate. Gave `on: pull_request` a non-empty `branches: ["**"]` value to satisfy
  yamllint empty-values; behavior unchanged (all PRs).
- .markdownlint.yaml: disable MD036 (emphasis-as-heading) and MD040
  (fenced-code-language); xff design docs use bold lead-ins as inline labels and
  a few language-less ASCII/output fences.
- trunk fmt applied: prettier normalized the docs (this also delivers the
  markdown-table alignment we wanted, automatically), buildifier normalized the
  BUILD files. No semantic changes.

Validated locally: `trunk check` clean (102 files), `pre-commit run -a` clean,
`bazel test //...` green in both default and clang+asan.

Next: apply clang-tidy via trunk (the run + fix sweep).
@helly25
helly25 enabled auto-merge (squash) June 24, 2026 23:31
@helly25
helly25 merged commit d1a72db into main Jun 24, 2026
7 checks passed
@helly25
helly25 deleted the adopt/trunk branch June 24, 2026 23:39
helly25 added a commit that referenced this pull request Jul 10, 2026
…es (#123) (#319)

Capture the post-#317 review design (317/1-6): fully separate optional extras
from the core so the core never names an extra and a minimal xff source package
can ship with the optional parts deleted. Rename third_party/ -> extra_modules/;
each extra a local Bazel module (own MODULE.bazel declaring its external dep,
pulled by root via local_path_override); a normal build builds both xff and
xff_full (drop the separate full CI cell); each extra carries its own
LICENSE/NOTICE + self-registers the notice, root NOTICE gets an extras
disclaimer. SPIKE first: the auto-enable module extension (module_ctx.modules is
participants-only, so extras must self-register via a shared-base extension;
verify "patch root only / delete dir -> xff_full lean, @pcre2 never fetched").
helly25 added a commit that referenced this pull request Jul 10, 2026
The directory holds the extras' glue/wrapper code, not the vendored libraries,
so `third_party/` was a misnomer. Rename it to `extra_modules/` (which also
generalizes to modules/libs/features). Pure move + label/comment updates; the
architecture is unchanged (root bazel_dep pcre2, //xff:xff_pcre select, the full
CI cell) - the local-module + normal-build-both + notices steps follow.

`git mv third_party extra_modules`, and update //third_party/pcre2 ->
//extra_modules/pcre2, //third_party:__subpackages__ -> //extra_modules:... (the
regex + license visibility grants), the CI full cell, and the doc/comment refs.
helly25 added a commit that referenced this pull request Jul 10, 2026
)

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 added a commit that referenced this pull request Jul 10, 2026
Second step of the true-module extras refactor (#123). The license-notice registration
seam (Notice + Register + Registrar + Notices + the process-wide registry) moves out of
//xff/license into a second xff_extras_api target, license_notice - mirroring b1's
regex_backend. So an extra self-registers its notice via @xff_extras_api, not the core.

- extra_modules/xff_extras_api: split into two targets, regex_backend (backend.{h,cc},
  include_prefix xff/regex) and license_notice (notice.{h,cc}, include_prefix
  xff/license). notice.h keeps the xff/license/notice.h include path + xff::license
  namespace, so consumers are unchanged.
- //xff/license: license.h re-includes notice.h; license.cc keeps the core registrars
  (kAbseil/kRe2/kMbo) + NoticeText() + the generated LicenseText(), drops the moved
  registry; license_cc deps @xff_extras_api//:license_notice.
- extra_modules/pcre2: the backend now includes xff/license/notice.h and deps
  @xff_extras_api//:{regex_backend,license_notice} + @pcre2 - NO root-package deps left,
  which unblocks making pcre2 a standalone module (b3).

No behavior change: --help=notice still lists PCRE2 (full) / omits it (lean) via the base
seam; lean //... (74/74, incl license_test) and --config=xff_full both green.
helly25 added a commit that referenced this pull request Jul 11, 2026
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).
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