Skip to content

feat(psl): expose inspectable attribute combinators - #30247

Merged
SevInf merged 10 commits into
mainfrom
attribute-autocomplete
Sep 10, 2026
Merged

SevInf merged 10 commits into
mainfrom
attribute-autocomplete

Conversation

@StevenMcClankerton

@StevenMcClankerton StevenMcClankerton commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator

Expose inspectable attribute combinators so tooling can consume the same grammar used by PSL interpretation, without maintaining a second descriptor tree.

Changes

  • Parser API: replace open argument kinds with a closed discriminated union exposing fixed values, collection children, union alternatives, and function signatures. Optional wrappers preserve metadata and output types.
  • Context safety: distinguish local and referenced field arguments and enforce mixed-alternative/nested-wrapper placement constraints through TypeScript parse-context inference only; no runtime context tags or reducers are part of the metadata surface.
  • Family evidence: use actual SQL/Mongo factories to verify dynamic defaults, index signatures, references, and non-completable empty-enum rejection.

Why

The combinators already describe accepted grammar. Exposing that structure directly keeps interpretation and future editor consumers aligned without parsing labels or hardcoding family-specific signatures.

Scope: first of three attribute-autocomplete slices. No language-server completion behavior, accepted PSL syntax, contract emission, or runtime changes.

Verification

  • Parser, SQL PSL, and Mongo PSL tests/typechecks/lint passed during implementation; independent review passed all five slice criteria.
  • Full package testing repeatedly hit known concurrent tarball/prepack skill-sync filesystem flakes. All three affected suites passed individually; the operator accepted this specific exception. The full suite is not reported green.
  • After fetching origin/main: pnpm build (85 tasks), pnpm typecheck (166 tasks), and pnpm lint:deps passed. Parser/SQL/Mongo lint passed; parser lint's 31 informational findings do not fail the command (verified exit 0).
  • The language server reports unresolved internal imports, but package typechecking passes and compiler resolution tracing resolves both parser entrypoints to their built declarations. No source suppressions were added.

Manual QA: N/A for editor behavior: this slice changes inspectable grammar metadata, not user-observable PSL behavior. Actual contribution-consumer metadata is covered by family factory tests.

Summary by CodeRabbit

  • Improvements
    • Improved attribute specification typing and validation for strings, numbers, lists, references, records, JSON, function calls, and unions.
    • Attribute metadata now more accurately reflects configured constraints, defaults, alternatives, reference kinds, and nested structures.
    • List specifications now use clearer empty-list controls while preserving uniqueness and non-empty validation.
    • Enhanced context handling improves validation across model- and field-level specifications.
    • SQL enum exclusions now provide clearer rejecting behavior and diagnostics.
  • Tests
    • Expanded coverage for metadata preservation, parsing contexts, optional values, and database-specific attribute specifications.

Close the attribute-spec combinator type surface into named, inspectable variants while preserving parse behavior and literal output inference.

Add regression tests for combinator metadata, optional/default typing, context-specific refs, and rejecting specs. Update SQL enum-member rejection to use the explicit rejecting variant and document the ADR 231 amendment.

Signed-off-by: Steven McClankerton <[email protected]>
@StevenMcClankerton
StevenMcClankerton requested a review from a team as a code owner September 10, 2026 11:49
@coderabbitai

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Advanced

Run ID: d2146231-85bb-4c36-9779-72e5c9314dc6

📥 Commits

Reviewing files that changed from the base of the PR and between 6fbebf4 and 83392f0.

📒 Files selected for processing (9)
  • packages/1-framework/2-authoring/psl-parser/src/attribute-spec/combinators/list.ts
  • packages/1-framework/2-authoring/psl-parser/src/attribute-spec/optional.ts
  • packages/1-framework/2-authoring/psl-parser/src/attribute-spec/types.ts
  • packages/1-framework/2-authoring/psl-parser/test/attribute-spec-combinators.test-d.ts
  • packages/1-framework/2-authoring/psl-parser/test/attribute-spec-combinators.test.ts
  • packages/2-mongo-family/2-authoring/contract-psl/src/mongo-attribute-specs.ts
  • packages/2-mongo-family/2-authoring/contract-psl/test/mongo-attribute-specs.test.ts
  • packages/2-sql/2-authoring/contract-psl/src/sql-attribute-specs.ts
  • packages/2-sql/2-authoring/contract-psl/test/sql-attribute-specs.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The parser now uses specialized, discriminated argument types. Combinators expose inspectable metadata and preserve output and context information. Parser, SQL, and Mongo tests validate the new type contracts and metadata shapes.

Changes

Attribute specification inspection

Layer / File(s) Summary
Typed argument contract
packages/1-framework/2-authoring/psl-parser/src/attribute-spec/types.ts, packages/1-framework/2-authoring/psl-parser/src/exports/index.ts
Defines specialized argument kinds, output inference, context metadata, collection shapes, optional markers, rejecting arguments, and exported function-call types.
Combinator metadata and context propagation
packages/1-framework/2-authoring/psl-parser/src/attribute-spec/combinators/*, packages/1-framework/2-authoring/psl-parser/src/attribute-spec/optional.ts
Updates combinators to return specialized types and expose metadata for references, lists, records, alternatives, function calls, optional values, fixed values, and constraints.
Parser type and behavior validation
packages/1-framework/2-authoring/psl-parser/test/attribute-spec-block.test-d.ts, packages/1-framework/2-authoring/psl-parser/test/attribute-spec-combinators.test-d.ts, packages/1-framework/2-authoring/psl-parser/test/attribute-spec-combinators.test.ts, packages/1-framework/2-authoring/psl-parser/test/attribute-spec.test-d.ts
Adds type-level and runtime coverage for output inference, context propagation, metadata narrowing, wrapper behavior, fixed values, references, optional defaults, and valid argument kinds.
SQL and Mongo metadata contracts
packages/2-mongo-family/2-authoring/contract-psl/*, packages/2-sql/2-authoring/contract-psl/*
Validates typed metadata for Mongo indexes and defaults, SQL registry specifications, list constraints, and rejecting enum members.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested reviewers: sevinf

Merge Risk: ⚪ Minimal · up to 83392

This change adds inspectable, typed attribute metadata without changing accepted PSL syntax or runtime behavior. The covered checks pass, so no merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.76% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 34 functions across 24 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: exposing inspectable PSL attribute combinators.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch attribute-autocomplete

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

@pkg-pr-new

pkg-pr-new Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@prisma/orm-extension-arktype-json

npm i https://pkg.pr.new/@prisma/orm-extension-arktype-json@30247

@prisma/orm-extension-middleware-cache

npm i https://pkg.pr.new/@prisma/orm-extension-middleware-cache@30247

@prisma/orm-extension-paradedb

npm i https://pkg.pr.new/@prisma/orm-extension-paradedb@30247

@prisma/orm-extension-pgvector

npm i https://pkg.pr.new/@prisma/orm-extension-pgvector@30247

@prisma/orm-extension-postgis

npm i https://pkg.pr.new/@prisma/orm-extension-postgis@30247

@prisma/orm-extension-supabase

npm i https://pkg.pr.new/@prisma/orm-extension-supabase@30247

@prisma/orm-family-mongo

npm i https://pkg.pr.new/@prisma/orm-family-mongo@30247

@prisma/orm-family-sql

npm i https://pkg.pr.new/@prisma/orm-family-sql@30247

@prisma/orm-framework

npm i https://pkg.pr.new/@prisma/orm-framework@30247

@prisma/orm-mongo

npm i https://pkg.pr.new/@prisma/orm-mongo@30247

@prisma/orm-postgres

npm i https://pkg.pr.new/@prisma/orm-postgres@30247

@prisma/orm-sqlite

npm i https://pkg.pr.new/@prisma/orm-sqlite@30247

@prisma/orm-target-mongo

npm i https://pkg.pr.new/@prisma/orm-target-mongo@30247

@prisma/orm-target-postgres

npm i https://pkg.pr.new/@prisma/orm-target-postgres@30247

@prisma/orm-target-sqlite

npm i https://pkg.pr.new/@prisma/orm-target-sqlite@30247

@prisma/orm-toolchain

npm i https://pkg.pr.new/@prisma/orm-toolchain@30247

commit: e7e4c93

Signed-off-by: Steven McClankerton <[email protected]>
@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
postgres / no-emit 181.5 KB (+0.06% 🔺)
postgres / emit 154.59 KB (+0.02% 🔺)
mongo / no-emit 107.36 KB (+0.08% 🔺)
mongo / emit 91.81 KB (0%)
cf-worker / no-emit 205.94 KB (+0.05% 🔺)
cf-worker / emit 176.09 KB (+0.01% 🔺)

@SevInf
SevInf enabled auto-merge September 10, 2026 15:43
@SevInf
SevInf disabled auto-merge September 10, 2026 15:45
@SevInf
SevInf added this pull request to the merge queue Sep 10, 2026
Merged via the queue into main with commit b8f7456 Sep 10, 2026
26 checks passed
@SevInf
SevInf deleted the attribute-autocomplete branch September 10, 2026 15:56
github-merge-queue Bot pushed a commit that referenced this pull request Sep 15, 2026
## Linked issue

n/a — small project closeout; Linear prefix explicitly waived. Delivery
merged in [#30247](#30247),
[#30249](#30249), and
[#30266](#30266).

## Summary

Remove the completed project's two tracked QA artifacts and retain one
final-retro lesson in `drive/retro/README.md`: editor acceptance must
verify applied edits, caret placement, and visible follow-up suggestions
in the rendered editor, separately from invocation and transport checks.

The approved classification marked all 39 project files transient (two
tracked, 37 local/ignored), with zero long-lived migrations. The project
directory is absent and the tracked external-reference scan returns zero
matches. The final retro was completed before cleanup.

## Testing performed

- Project DoD audit: all three delivery PRs merged; each final head
passed 25 CI checks, with no unresolved review threads.
- Documentation lint and normal commit hooks passed during closeout
preparation; independent review confirmed DCO sign-off and `git diff
--check`.
- Documentation-only change: no feature builds or tests rerun. Existing
cached local diagnostics concern unchanged parser/Mongo files, not this
diff.

## Skill update

n/a — internal only. The durable editor-acceptance lesson lives in the
existing Drive retro context.

## Checklist

- [x] All commits are signed off (`git commit -s`) per the DCO.
- [x] I read CONTRIBUTING.md and the change is scoped to one logical
concern.
- [x] Tests: n/a — documentation-only, with no behavioural delta.
- [ ] Linear-prefixed title: explicitly waived for this closeout.
- [x] The Skill update section is filled in.

## Notes for the reviewer

Only the retro entry and two tracked deletions are included. No source
or ADR changes, archive, or restored README narration; the one-line
language-server README remains unchanged. Unrelated playground README
and calibration edits remain local and excluded. This PR proposes the
cleanup; the cleanup itself is not yet merged.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Documentation**
- Added the first entry to the recurring-pattern catalogue, documenting
acceptance checks for editor projects.
- Clarified that validation should cover the rendered editor, applied
edits, caret position, visible follow-up suggestions, and required
client opt-ins.
  - Separated invocation checks from acceptance verification.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Steven McClankerton <[email protected]>
Co-authored-by: Steven McClankerton <[email protected]>
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.

2 participants