Skip to content

docs(AppKit): document Files plugin policy API#71

Merged
atilafassina merged 4 commits into
mainfrom
appkit-files-policy
Jun 3, 2026
Merged

docs(AppKit): document Files plugin policy API#71
atilafassina merged 4 commits into
mainfrom
appkit-files-policy

Conversation

@atilafassina

Copy link
Copy Markdown
Contributor

Summary

  • Updates the Files skill reference for AppKit v0.21.0+ per-volume policy enforcement (databricks/appkit#197)
  • Adds Permission Model + Access Policies sections covering built-ins (publicRead, allowAll, denyAll), combinators (all, any, not), custom FilePolicy shape, exported types, and PolicyDeniedError
  • Fixes a factually wrong HTTP Routes line — routes always run as the service principal; user identity comes from x-forwarded-user and is passed to the policy (not via asUser(req))
  • Reframes the Server-Side API section so asUser(req) is described as switching the policy identity, not the UC credentials
  • Refreshes the troubleshooting table with policy-related rows, including the publicRead() default-write-denial gotcha

Test plan

  • python3 scripts/skills.py validate passes
  • Skim rendered Markdown for the new Permission Model / Access Policies sections
  • Confirm policy snippets compile against @databricks/appkit v0.31.0 types

This pull request and its description were written by Isaac.

@atilafassina atilafassina force-pushed the appkit-files-policy branch from fc1a3fe to 369050a Compare May 22, 2026 07:13
Update the Files skill reference for AppKit v0.21.0+ per-volume
policy enforcement (PR databricks/appkit#197):

- Add Permission Model section explaining the three layers
  (UC grants, execution identity, file policies)
- Add Access Policies section with built-ins, combinators,
  custom policies, and policy-input types
- Fix HTTP Routes intro: routes always run as service principal,
  user identity comes from x-forwarded-user and is passed to
  the policy (not asUser(req))
- Reframe Server-Side API: asUser(req) switches policy identity,
  not UC credentials
- Refresh troubleshooting with policy-related errors and the
  default-publicRead() write-denial gotcha

Co-authored-by: Isaac
Align with the jobs.md/lakebase.md style: keep gotchas and idioms
in-skill, push encyclopedic reference to `npx @databricks/appkit docs`.

- Flatten Access Policies subsections (5 H3s → 0)
- Drop Policy inputs types block (duplicate of upstream `## Types`)
- Drop standalone SP-bypass snippet (mention inline instead)
- Inline Execution defaults table as a single sentence in
  Server-Side API
- Drop full HTTP Routes table; keep the 403/security gotchas
- Add `npx @databricks/appkit docs` pointers from each trimmed
  section (defer-to-docs count: 2 → 5, matching jobs.md)

Net effect: 410 → 346 lines (-15%); the policy concepts and
HTTP-route execution model stay, the redundant tables go.

Co-authored-by: Isaac
@atilafassina atilafassina force-pushed the appkit-files-policy branch from 369050a to 2663a7d Compare May 22, 2026 07:19
The skill described pre-OBO behavior for `asUser(req)` and HTTP routes.
Per the current source (appkit v0.36.0, JSDoc on `VolumeHandle.asUser`
explicitly flags this as a behavior change):

- `asUser(req)` is now a hard override that wraps the call in
  `runInUserContext`; the SDK call runs as the end user, not just the
  policy identity.
- Per-volume `auth: "service-principal" | "on-behalf-of-user"` controls
  execution identity for HTTP routes too — they don't always run as SP.

Updates:
- Permission Model: rewrite layer 2 (execution identity) around the
  `auth` field; clarify UC-grants behavior on SP vs OBO volumes.
- Configuration example: add `auth` per-volume option and resolution
  order.
- Server-Side API: rewrite `asUser(req)` semantics to describe SDK-call
  override; document production-vs-dev fallback.
- HTTP Routes: replace "always run as SP" with the `auth`-based model;
  describe `/raw` attachment-forcing as an allowlist (images, plain
  text, CSV, markdown, JSON, PDF), not a denylist of HTML/JS/SVG.
- `user_api_scopes` Note: required for OBO volumes too, not only
  `.asUser(req)` programmatic calls.
- Typo fixes: `READ_ACTIONS`/`WRITE_ACTIONS` are `ReadonlySet<FileAction>`
  not `Set<FileAction>`; troubleshooting `Unknown volume "X"` (was
  `Unknown volume key "X"`).

Co-authored-by: Isaac
@atilafassina atilafassina marked this pull request as ready for review May 22, 2026 08:21
@atilafassina atilafassina requested a review from a team as a code owner May 22, 2026 08:21
@atilafassina atilafassina requested a review from pkosiec June 2, 2026 13:57

@pkosiec pkosiec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, just one comment

Comment thread skills/databricks-apps/references/appkit/files.md Outdated
Copilot AI review requested due to automatic review settings June 3, 2026 09:58

Copilot AI 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.

Pull request overview

Updates the AppKit Files reference documentation to reflect the current Files plugin policy model and related operational guidance, including new sections describing how access is evaluated and how to configure per-volume policies.

Changes:

  • Adds new Permission Model and Access Policies documentation, including defaults and examples.
  • Updates server-side/API and HTTP route guidance, plus troubleshooting entries related to policy enforcement.
  • Refreshes assorted docs commands, configuration snippets, and formatting for clarity.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread skills/databricks-apps/references/appkit/files.md
Comment thread skills/databricks-apps/references/appkit/files.md
Comment thread skills/databricks-apps/references/appkit/files.md
Comment thread skills/databricks-apps/references/appkit/files.md
Comment thread skills/databricks-apps/references/appkit/files.md
@atilafassina atilafassina merged commit 348d670 into main Jun 3, 2026
2 checks passed
@atilafassina atilafassina deleted the appkit-files-policy branch June 3, 2026 12:14
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.

3 participants