Skip to content

Add a link field type: a title and URL pair for schema fields #3541

Closed

Description

@malibio

Overview

Schema fields can be text, number, boolean, date, datetime, enum, array or object. There is no way to declare a field that holds a web link, so a project cannot record its repository and a task cannot record the pull request or commits that delivered it. This issue adds a link field type: a title and a URL.

Problem Statement

A link stored as plain text loses its title and cannot be validated or rendered as something to open. A link stored as an object field has no fixed shape, so nothing checks it and every surface would have to guess. ADR-092 needs a typed link for project.repository, task.pull_request and task.commits, and users need the same type for their own schemas.

Proposed Solution

Add Link to SchemaFieldType. A link value is an object with exactly two keys, title and url, both strings; url must be an absolute URL. An Array field may use link as its item type. The type is available to user-defined schemas like any other field type.

This issue adds the type only. The core fields that use it (project.repository, task.pull_request, task.commits) are added with the core model.

Documentation

  • ADR-092 §4 - the link field type: its shape, validation, and use as an array item type
  • ADR-086 - one wire definition in nodespace-types, generated TypeScript, closed schemas, nested stored values with snake_case keys and unknown keys refused
  • Naming conventions - field names, stored keys, SchemaField metadata
  • Data layer - how field values are stored and validated
  • Updates: architecture/data-layer.md and components/creating-node-types.md (the list of field types and the link value's shape), packages/skill/references/cli.md (how a link is written and printed)

Architecture Impact

Implements ADR-092 §4. It extends the set of schema field types and changes no existing decision.

Acceptance Criteria

  • SchemaFieldType has a Link variant, defined once in nodespace-types, listed in SchemaFieldType::ALL, with TypeScript regenerated (bun run gen:types) and committed
  • A link value is stored as { "title": ..., "url": ... }; a write with a missing key, an extra key, a non-string value or a url that is not an absolute URL is refused with a message naming the field and the problem
  • An Array field with item type link accepts a list of link values and validates each one
  • create_schema and update_schema accept link as a field type and as an array item type, for user-defined schemas
  • A link field cannot be marked unique or used as a kanban grouping field, and the schema write that tries is refused
  • A Play condition can read a link's parts (node.<field>.url, node.<field>.title), and has(node.<field>) is false when the field is unset
  • The CLI sets a link with --property and clears it, prints it in human output as its title and URL, and returns the object in --json; nodespace schema get shows the field as type link
  • The built-in agent's write tools accept a link value for a link field and reject a bare string with the validation message
  • Markdown export renders a link field as a Markdown link
  • In the app, the schema form offers Link as a field type; a node's property editor shows a link as its title, opens the URL in the system browser, and edits title and URL; a list of links can be added to and removed from; table and kanban cells show the title
  • The URL is opened only for http and https; any other scheme is shown as text
  • references/cli.md documents writing and reading a link, and bun run skill:check passes
  • Docs updated as listed under Documentation
  • Code passes bun run quality:fix
  • Tests pass (bun run test:changed)

Technical Specifications

Reference Files

  • packages/nodespace-types/src/schema.rs - SchemaFieldType and ALL
  • packages/nodespace-types/src/bin/gen_ts.rs - TypeScript generation
  • packages/core/src/schema/mod.rs, packages/core/src/schema/extends_chain.rs - schema create and update, field validation
  • packages/core/src/behaviors/mod.rs, packages/core/src/services/node_service/crud.rs - property validation on write
  • packages/core/src/playbook/cel.rs - how a node's fields become CEL values
  • packages/core/src/utils/markdown.rs - field rendering in Markdown export
  • packages/core/src/ops/context_ops.rs, packages/core/src/ops/entity_types_block.rs - schema descriptors shown to agents
  • packages/cli/src/output.rs, packages/cli/src/commands/node.rs - property input and output
  • packages/desktop-app/src/lib/types/schema-node.ts - hand-written helpers around the generated field types
  • packages/desktop-app/src/lib/components/schema/schema-field-leaf.svelte - the schema form's field editor
  • packages/desktop-app/src/lib/components/query/table-row.svelte, packages/desktop-app/src/lib/components/query/kanban-grouping.ts - field rendering in views

Implementation Details

  • The stored value is a nested value: snake_case keys, no rename_all, and unknown fields denied.
  • "Absolute URL" means it parses with a scheme and a host. Do not restrict the scheme at validation; restrict it where the app opens a link.
  • Every match on SchemaFieldType is exhaustive, so the compiler lists the places to handle. Do not add a catch-all arm.
  • Open a URL through the Tauri opener the app already uses, not a new mechanism.
  • Changing the field type set needs no migration: reset the database.

Related Issues

Non-Goals

  • The project.repository, task.pull_request and task.commits fields
  • Fetching a link's title from the web, previews, or unfurling

Activity

  1. malibio commented on Oct 5, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 317 test files passed, 5733 tests passed

  2. self-assigned this
    on Oct 5, 2026
  3. malibio commented on Oct 5, 2026

    @malibio
    CollaboratorAuthor

    Query paths into a link field (from #3554, merged as #3578)

    A property filter and a sort can now name a field inside a structured value with a dotted path (repository.url), checked against the schema. The check walks object fields' declared fields only, because the link type did not exist when it landed. PR #3579 does not touch it, so on a link field today:

    • {"property": "repository.url", ...} is refused with "'repository' is a link field ... with no declared fields inside it".

    What is needed, in resolve_property (packages/core/src/ops/query_ops.rs): where a segment's field is a link, accept its parts (title, url) as the next and last segment. The stored value is a JSON object, so the SQL side (json_extract(properties, '$.project.repository.url')) and the app's matcher already read it; only the schema check stops it.

    ADR-094's "the project for a checkout is found by an ordinary query" depends on this. A test beside a_filter_and_a_sort_reach_into_an_object_field would cover it. It fits in #3579 if that is still open for changes; main also needs merging into that branch first, since #3578 changed the same area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions