Files
pad/internal/server
xarmian 8da0473e4e refactor(bootstrap): slim Collections projection — drop id/timestamps/settings, parse schema inline (TASK-1412) (#535)
Introduces BootstrapCollection — a purpose-built projection for the
bootstrap response that replaces []models.Collection on
AgentBootstrap.Collections. Drops fields the /pad skill never reads:

  - id, workspace_id           — agent addresses collections by slug
  - created_at, updated_at,     — irrelevant at context-load time
    deleted_at
  - settings                    — quick_actions + view defaults are
                                  web-UI chat-prompt config

The remaining schema string is delivered as a nested JSON object
(json.RawMessage) rather than a JSON-encoded string, killing the
backslash-escape overhead so the agent sees real {}/[] structure
instead of double-encoded quotes. json.Valid() gates the emission
so a future migration leaving non-JSON in the column can't break
agent-side json.Unmarshal — invalid/empty schemas are simply
omitted (omitempty).

Measured against the bootstrapSizeBudget fixture (TASK-1411):

                   before        after        delta
  collections      8,848 b       3,979 b      -4,869 b (-55%)
  total bootstrap  13,861 b      8,992 b      -4,869 b (-35%)

Budget tightened from 16 KiB to 11 KiB to lock in the win. Later
PLAN-1410 PRs (TASK-1413's dedup + dashboard caps, TASK-1417's
final measurement) tighten further.

Wire-shape change details:

  - BuildAgentBootstrap holds collections as []models.Collection
    through the visibility-restricted role+count recompute (which
    keys lookups by Collection.ID), then projects to []BootstrapCollection
    at the end of that section. ID-keyed recompute logic is preserved
    verbatim — only the final wire shape changes.
  - printBootstrapMarkdown was already reading {slug, name, prefix}
    via its own anonymous struct; those three are preserved.
  - No web-UI consumers exist for /agent/bootstrap (grep confirms),
    so no client-side churn.

Out of scope (handled by later PLAN-1410 PRs):

  - Dedup'ing top-level recent_activity, dropping convention slug,
    capping dashboard.attention/recent_activity (TASK-1413).
  - ToolSurfaceVersion bump 0.3 → 0.4 (TASK-1418, after all shape
    changes land).

Parent: PLAN-1410.
2026-05-13 12:18:07 -04:00
..