amber-lsp library rule packs: Grant tenancy detected from source (v2) - #39
Draft
crimson-knight wants to merge 3 commits into
Draft
crimson-knight wants to merge 3 commits into
crimson-knight wants to merge 3 commits into
Conversation
crimson-knight
marked this pull request as draft
September 23, 2026 23:00
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Library rule packs for amber-lsp, v2 (reworked after owner review).
What changed from v1
grant: tenancy: rowin shard.yml; shard.yml is a package manifest, so that is removed. The tenancy mode is now detected from the app's own Crystal source with the Crystal parser: row mode = a model'smultitenant :colmacro (the column is captured per model, never assumed to betenant_id); schema mode =Grant::SchemaTenant.with/schema_tenant_excluded.lib/<shard>/.amber-lsp/packs/*.yml(was.claude/rules/, which belongs to Claude Code). Harness-neutral: the same diagnostics reach Claude Code and Codex.NoTenantError,ScopedRawSqlError, andTenantMismatchError, so those checks are gone.Grant tenancy pack (ships in Grant, branch
luna/tenancy-pack-v2)Two errors (block agent edits through the fleet gate):
grant/chained-unscoped-in-request-code: chainableModel.unscoped(no block) returns an unguarded builder; in controllers/channels/sockets/pipes.grant/chained-unscoped-bulk-write:Model.unscoped...update_all/delete_alloutside spec/ and db/ (silently writes every tenant's rows).Eight warnings: chainable unscoped elsewhere, block
unscopedin request code,spawninside a tenant block (fiber loses the tenant), a tenant column withoutmultitenant, raw connection SQL naming a tenant table,Tenant.clearin app code, schema-mode queries outsideSchemaTenant.within non-request code, both modes present.Verification
crystal-alpha spec spec/amber_lsp: 233 examples, 0 failures; full suite 436, 0 failures.crystal-alpha build --no-codegen src/amber_lsp.cr: GREEN.tool format --check: clean.amber-lsp+amber-lsp-checkon a probe app withmultitenant :account_id—Invoice.unscoped.delete_allin a controller produced both errors (exit 1);spawnin a tenant block produced the warning.Draft until the Grant tenancy branch lands (the pack describes Grant as of
luna/final).