Skip to content

feat(bazel): standalone building block authority#1

Merged
Jess Sullivan (Jesssullivan) merged 2 commits into
mainfrom
jess/building-block-authority
Apr 27, 2026
Merged

feat(bazel): standalone building block authority#1
Jess Sullivan (Jesssullivan) merged 2 commits into
mainfrom
jess/building-block-authority

Conversation

@Jesssullivan

Copy link
Copy Markdown
Contributor

Sync to 0.2.2, standalone authority. Part of TIN-652. tc:✓ bld:✓ pl:✓

@greptile-apps

greptile-apps Bot commented Apr 27, 2026

Copy link
Copy Markdown

Greptile Summary

This PR graduates @tummycrypt/tinyland-user-resolution from a monorepo package to a fully standalone Bazel module (v0.2.2), adding a configure()/getConfig() inversion-of-control pattern, a per-handle profile cache with a 60 s TTL, RESERVED_ROUTES/isReservedRoute helpers, and a comprehensive test suite. The infra changes (.bazelrc, MODULE.bazel, flake.nix, CI/publish workflows) look correct; the only two P2 items are a mutable exported RESERVED_ROUTES array and a case-sensitive 'admin' check in the noauth branch that is inconsistent with the case-insensitive isReservedRoute helper.

Confidence Score: 5/5

Safe to merge; only P2 style suggestions remain after accounting for the previously flagged provenance removal.

No P0 or P1 findings. The two new inline comments are P2 quality suggestions (immutable export, noauth case-sensitivity). The provenance removal was already flagged in a prior review comment and is a pre-existing concern.

src/resolution.ts — two minor P2 items worth addressing before wide adoption of the library.

Important Files Changed

Filename Overview
src/resolution.ts Core resolution logic; introduces per-handle profile cache with TTL. Two P2 findings: mutable RESERVED_ROUTES export and case-sensitive noauth handle check vs case-insensitive isReservedRoute.
.github/workflows/publish.yml Publish workflow newly added; dry_run logic is correct for release vs workflow_dispatch. id-token:write present. npm provenance removed from publishConfig (flagged in previous review).
MODULE.bazel Upgraded to standalone Bazel module v0.2.2; adds node toolchain, pnpm extension, npm translation, and rules_ts TypeScript extension. Removes monorepo dependency on //packages:tsconfig_base.
package.json Bumped to 0.2.2, repo URL updated to standalone, publint added, prepublishOnly enhanced. provenance:true removed (previously flagged).
tests/user-resolution.test.ts Comprehensive new test suite covering configure/getConfig, resolveUser (directory, profile, noauth), caching with TTL, userExists, getAllUserHandles, RESERVED_ROUTES, and isReservedRoute.
BUILD.bazel Removes monorepo tsconfig_base dep, disables source maps, bumps npm_package version to 0.2.2.
src/types.ts Unchanged interface definitions; AdminUser, Profile, and ResolvedUser types look correct and consistent with the resolution logic.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A([resolveUser\nhandle]) --> B{findUserByHandle\nthrows?}
    B -- No --> C{dbUser\nfound?}
    B -- Yes, warn --> D[resolveUserFromProfile]
    C -- Yes --> E([return ResolvedUser\nsource: directory])
    C -- No --> D
    D --> F{profileCache\nvalid & has handle?}
    F -- Yes --> G([return cached\nResolvedUser or null])
    F -- No, expired --> H[reset cache map\nreset cacheTime]
    F -- No, miss --> I[loadProfiles\nfilter: handle]
    H --> I
    I --> J{profiles\nreturned?}
    J -- Yes --> K[build ResolvedUser\ncache result]
    J -- No --> L[cache null]
    K --> M([return ResolvedUser\nsource: profile])
    L --> N{handle === 'admin'\n&& isNoAuthMode?}
    N -- Yes --> O([return noauth\nResolvedUser])
    N -- No --> P([return null])
    I -- throws --> Q[cache null\nlog error]
    Q --> N
Loading

Reviews (2): Last reviewed commit: "fix(bazel): align source map outputs wit..." | Re-trigger Greptile

@Jesssullivan Jess Sullivan (Jesssullivan) merged commit 1fb92d2 into main Apr 27, 2026
3 checks passed
@Jesssullivan Jess Sullivan (Jesssullivan) deleted the jess/building-block-authority branch April 27, 2026 16:06
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