Skip to content

fix: close agnosticism guard compound, SDK and symlink gaps - #422

Closed
apotema wants to merge 2 commits into
developmentfrom
fix/419-agnostic-guard
Closed

apotema wants to merge 2 commits into
developmentfrom
fix/419-agnostic-guard

Conversation

@apotema

@apotema apotema commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

The agnosticism guard missed compound/package identities such as Steamworks and libsdl2-dev, provider tools/SDKs, and source-shaped symlinks. This change closes those gaps in src/agnostic_guard_test.zig only.

  • Add explicit steamworks, libsdl/libsdl2, butler, uikit, steamcmd, xcodebuild, adb, and emcc identities. Known compounds may span CamelCase boundaries (UIKitGlue), including numeric suffixes (UIKit2Glue). ASCII benign controls protect host tools, ordinary library names, and longer unrelated words.
  • Reject .zig, .c, and .h symlinks before reading or allowlisting them. Self-tests cover forbidden link names, neutral names hiding forbidden contents, dangling/cyclic targets, allowlisted paths, and the root sentinel. Regular source and non-source fixture controls remain covered.
  • Revalidate the existing 53-entry migration allowlist: no additions or stale entries. Newly recognized legacy uses are already covered by the SDL, mobile SDK, and emsdk migration files.

Validation with Zig 0.16.0:

  • Windows: zig build test-guard --summary all — 16 passed, 1 skipped. The real symlink fixture skips because Windows denies symlink creation; the direct entry-policy test passes.
  • Linux: cross-compiled the same guard test with zig test src/agnostic_guard_test.zig -target x86_64-linux --test-no-exec, then ran it under the already installed Ubuntu WSL — all 17 passed, including real symlink creation and rejection.
  • zig fmt --check src/agnostic_guard_test.zig and git diff --check passed.
  • Added a regression assertion for versioned compound SDK identifiers, observed it fail before the fix, then pass on both hosts.

Based on current origin/development (26d93c7). The diff is guard-only; no packaging, provider runtime, target, or service extraction changes.

Closes #419.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@coderabbitai

coderabbitai Bot commented Sep 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 736c22b2-8576-4801-b860-77c3aa63ecbf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-26T15:31:12.586063Z 9e287bb PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e287bb3e8

ℹ️ 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".

// A listed name can itself span acronym boundaries (UI|Kit).
// Match only complete prefixes ending at a CamelCase boundary,
// never a substring such as UIKit in UIKitten or UIKithelper.
var end = start + 1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Detect UIKit after one-letter lowercase prefixes

When the newly forbidden compound follows a one-letter lowercase prefix, such as aUIKitGlue or kUIKit2Version, splitsBefore suppresses the initial lower-to-upper boundary under its lowercase-leading-acronym rule. The fallback consequently consumes aUI/kUI as the first piece, so this prefix search never begins at U and the tokenizer emits no finding, allowing UIKit-specific identifiers to bypass the guard.

Useful? React with 👍 / 👎.

/// Return whether to read an entry. Never follow source-shaped links:
/// rejection applies before the allowlist and does not trust the target.
fn sourceEntry(self: *Scan, path: []const u8, kind: std.Io.File.Kind) !bool {
if (!isSource(path)) return false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject symlinked source directories before filtering extensions

When a tracked path such as src/cli/platform is a symlink to a directory containing imported .zig files, the walker reports the alias itself as .sym_link and does not descend into it. Because this extension check returns before examining the entry kind, the directory link is neither rejected nor scanned, so sources compiled through @import("platform/file.zig") can still contain forbidden provider identities without failing the guard.

Useful? React with 👍 / 👎.

@apotema

apotema commented Sep 26, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded: #419 was fixed by #425 (merged into development as a83db12). This PR's handling of CamelCase-spanning compounds (UIKitGlue, UIKit2Glue) is something #425 lacks (UIKitView is documented there as a gap); that rule is being ported in a small follow-up.

https://claude.ai/code/session_01R2K5sJDL5Msn1uRTkybiDP

@apotema apotema closed this Sep 26, 2026
apotema added a commit that referenced this pull request Sep 26, 2026
)

The CamelCase splitter breaks `UIKitView` into `UI|Kit|View`, so no single
piece is `uikit` and the guard missed it (gap documented in #425). At each
piece the tokenizer now tries joins of up to 3 adjacent pieces of the same
run, longest first, before the piece alone. `UIKitView`, `UIKitGlue`,
`UIKit2Glue` and `XCodeProject` flag; `UIntKind`, `GuiKit`, `UiKitchen`,
`UIKeyboard` and `UIKitten` stay clean. Ports the spanning-compound rule of
the closed #422. Allowlist recomputed: no file newly dirty, still 54.

Claude-Session: https://claude.ai/code/session_01R2K5sJDL5Msn1uRTkybiDP
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