8000 feat(access): let a grant end on a date by adeelahmad · Pull Request #676 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(access): let a grant end on a date - #676

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-xfmkzn
Oct 19, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-xfmkzn

Conversation

@adeelahmad
@adeelahmad adeelahmad commented Oct 19, 2026 •
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: access given to someone (a role in a namespace, a role on a collection, permission on an asset) lasted until an owner remembered to take it away.

After: each of those grants takes an optional end date: an "Until" day in the asset's Access dialog, a collection's People and a namespace's members, expires_at in the API, and until on the assistant's change_person. After that day the grant opens nothing anywhere access is checked, and lists show it as expired until it's given again or taken away. The field starts empty, so grants without an end work as before.

How: access.py, roles.py and hierarchy.py skip grants whose expires_at has passed; the routes, schemas and assistant tool take the date; the web app adds an Until field to the three places grants are given.

tests/api/test_scaling_agents.py now sets ai.context_tokens to 64000. The admin's 80 tools take about 11,000 tokens of the default 16,000-token window, and the new until field pushed the scaling read past what fit, so it was cut and the test's json.loads failed. The product gap is filed as #677.

Motivation and Context

Item from the personal feature plan sheet ("share with someone for a week").

Screenshots (if appropriate):

n/a

Steps to reproduce (if appropriate):

Share an asset with someone with Until set to yesterday: they can't open it, and the Access dialog shows the grant as expired.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests (tests/api/test_grant_ends.py, tests/api/test_setup_assistant.py, __tests__/access-until.test.ts).
  • My change requires documentation updates, and I have updated docs/ accordingly (docs/access.md, Grants that end; docs/api.md).
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md. Written as changelog.d/grant-expiry.md, per build(release): changelog fragments in changelog.d/ instead of one Unreleased section #581.

Done questions (AGENTS.md)

  • Goal: delivers what the user wanted, merged on green CI.
  • Agents: usable through the API, MCP or an assistant tool. expires_at in the API and until on change_person.
  • Zero setup: no new prerequisite, .env edit or manual step.
  • Fewest clicks and keystrokes. One optional date field beside the role picker, empty by default.
  • Configurable: new settings in the web app with defaults; wizard asks only what is required. n/a: no settings.
  • Light: default install still runs on a Raspberry Pi with cloud models.
  • Private and secure: data local and encrypted, passkeys, threat model updated. Access narrows; the threat model row for grants notes the end date.
  • Cost: cheapest path, model calls in the activity ledger, budgets respected. n/a: no model calls.
  • User decides: consequential or new actions wait for the user; defaults unchanged. Grants without a date work as before.
  • Upgrades: existing installs upgrade safely (upgrade step for stored-data changes). expires_at is a new optional field; existing grants have none and never end.
  • Honest: sources cited; labelled built, in progress or planned.
  • Tests, docs and generated files updated (make openapi).
  • Open standards; dependencies keep Lens MIT. n/a: no dependencies.
  • Result reported with evidence; "refine later" items written down (Admin assistant toolbox leaves almost no room in the default 16k context window #677).
  • Reuse: existing Lens code and permissive libraries reused, nothing reinvented.

Local CI (ci/local-ci.sh): FastAPI embedded, Next.js, pre-commit and PR title passed. The server-mode job timed out on SurrealDB handshakes in this container; GitHub CI on this head passed it. test_scaling_agents.py passes locally after the fix (5 passed).

🤖 Generated with Claude Code

https://claude.ai/code/session_01QFUNzy1QZy5HhKAyJxTAYJ

@adeelahmad adeelahmad self-assigned this Oct 19, 2026
A role in a namespace, a role on a collection and permission on an asset
take an optional expires_at, set when giving them (an "Until" day in the
web app, expires_at in the API, until on the assistant's change_person)
and changed by giving them again or PATCH /resources/{rid}/permissions/
{account}. The three lookups every check reads grants through leave out
ended ones, so an ended grant opens nothing anywhere; lists mark it
expired.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QFUNzy1QZy5HhKAyJxTAYJ
@adeelahmad
adeelahmad force-pushed the claude/project-thread-xfmkzn branch from 335e9e8 to 1610b32 Compare October 19, 2026 06:03
@adeelahmad
adeelahmad merged commit 4df3db3 into main Oct 19, 2026
12 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-xfmkzn branch October 19, 2026 06:19
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

0