8000 feat(automations): set a field, move to a collection, write a note by adeelahmad · Pull Request #444 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(automations): set a field, move to a collection, write a note - #444

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-mwk71t
Oct 15, 2026
Merged

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

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Description

Before: automations could message people, use the model, call a web address and run Lens work. They couldn't change an asset or write anything down.

After: the last group of workflow studio M7 actions.

  • set_field (effect lens)
    • Sets one of an asset's custom fields, named by id or label, to value. An empty value clears it.
    • Choice fields are checked.
    • The change goes in the asset's metadata history as by "automation: ", so it can be reverted. The audit log notes who it was done for.
    • Output: {asset, field, label, value, changed}.
  • add_to_collection (effect lens)
    • Moves an asset into a collection in its own namespace.
    • Moving an asset into a collection also shows it to anyone given a role on that collection. When that would let someone see it who can't now, the action doesn't do it on its own: it fails and names them, and moves it only once the person approved it.
    • Output: {asset, collection, name, moved, newly_see}.
  • write_note
    • On a page (the default), it writes a notebook page as the automation. The page goes in the namespace of what it is about, else the one named, else the automation's only namespace. A thing has one page, so a second note about it goes at that page's end.
    • With on: asset, it writes a note on the asset as the person. A private note is effect self, so it runs at once; a shared note is effect lens.
    • Output: {on, page or note, added, url}.

The asset actions default asset to the event's object. On that asset, inside the automation's namespaces, they are routine; on any other asset, they ask first. They check the person's role now: edit, or read for a private note.

Calendar writes are left out. Lens signs in to Google Calendar read-only, and writing needs a new consent, which would change existing installs. This is written down as refine-later in the docs.

Motivation and Context

Workflow studio, module M7 (plan: /mnt/project-files/workflow-studio/plan.md §5 M7), PR 5 of 5. Earlier PRs: #433 (notify), #438 (AI), #439 (web) and #441 (run). This completes the brief's action list.

Choices taken (reversible):

  • A move that widens access fails rather than asks. resolve_risk has no database access to tell when a move would widen access. A risk that reads the database is in refine-later.
  • Notes on an asset belong to the person, so they can see and delete them like their own. Pages are written by the automation and marked as by the assistant.

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 (ruff, ruff format, mypy clean locally).
  • I added or updated tests. tests/api/test_actions_lens.py covers:
    • Risk and effect for each action.
    • set_field: history and audit entries, choice checks, an unknown field, and permissions.
    • add_to_collection: a move that widens access is refused, then done once approved; another namespace and an unknown collection are refused.
    • write_note: a page, appending to a thing's own page, private and shared asset notes, a viewer's limits, and namespaces.
  • My change requires documentation updates, and I have updated docs/ accordingly (docs/automations.md "Changing assets and writing notes", Actions rows, refine later).
  • Users need more than the title: n/a, people reach these actions once the engine (M6) runs automations.

Done questions (AGENTS.md)

  • Goal: the last group of M7. Every action in the brief is built except calendar writes, which are refine-later. Merged on green CI.
  • Agents: these actions are in actions.catalog(), which M6 serves to the API, MCP and the assistant.
  • Zero setup: they use the fields, collections and notebook already there.
  • Fewest clicks: asset defaults to the event's object, a page's title defaults to the first line, and the namespace defaults to the automation's.
  • Configurable: n/a, no new setting.
  • Light: no new dependency.
  • Private and secure: the person's role is checked now, only inside the automation's namespaces. Nothing is shown to new people without their approval, and changes are audited and revertible. No new outside surface.
  • Cost: no model call.
  • User decides: anything beyond the event's own asset, or that widens who sees it, waits for the person.
  • Upgrades: no change to stored data.
  • Honest: docs label it built and calendar writes as refine-later.
  • Tests and docs updated. No API change, so no OpenAPI regeneration.
  • Open: notes stay Markdown.
  • Refine later is written in docs/automations.md:
    • A database-aware risk for moves.
    • Fields on collections and files.
    • Tags.
    • Collection roles counting for edit.
    • Calendar writes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CyjR2zEfmTXBewKAx9Taw5


Generated by Claude Code

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CyjR2zEfmTXBewKAx9Taw5
@adeelahmad
adeelahmad merged commit 43db432 into main Oct 15, 2026
10 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-mwk71t branch October 15, 2026 23:44
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