Skip to content

feat(primitives): describe tables and file stores - #262

Merged
allisonmahmood merged 2 commits into
mainfrom
portal/249-primitive-descriptions
Sep 16, 2026
Merged

allisonmahmood merged 2 commits into
mainfrom
portal/249-primitive-descriptions

Conversation

@allisonmahmood

Copy link
Copy Markdown
Owner

Agents could see table and file-store names but not what their data represents.

Require nonblank descriptions in config and manifests, persist them in inventory, and return them through the inventory API. Description edits leave schema revisions unchanged; omission and rollback preserve the stored text. Update init, SDK fixtures, project skills and documentation, and reject table/store name collisions with bounded diagnostics naming both.

Stacked on portal/248-lifecycle. This PR targets that branch and contains only the work for #249. Inventory initialization DDL changes in place as specified; existing dev databases must be recreated.

Closes #249.

Verification

  • pnpm typecheck
  • pnpm lint
  • pnpm test --maxWorkers=2: 767 tests passed across 77 files
  • pnpm test:postgres-concurrency: passed
  • pnpm test:packed-cli-e2e: passed, including init, dev, hosted tier 1 and additive publishing
  • Standards and spec reviews completed with no remaining findings

Implemented with openai-codex/gpt-6-astra in Oh My Pi.

@github-actions github-actions Bot added area:server Touches the server area area:cli Touches the cli area area:docs Touches the docs area size:l 501-1,000 changed lines labels Sep 15, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Astra review

Reviewed git diff origin/portal/248-lifecycle...HEAD at 7fa1868 against #249. One pass, no subagents; merge-blocking findings only.

Standards

No merge-blocking method or YAGNI findings. The implementation extends the existing config, schema and inventory paths without adding the deferred CLI reminder or discovery features.

Spec

No merge-blocking intent findings. Descriptions are required at config execution and manifest validation, persist in inventory, and reach the inventory API. Redefinition replaces them; omission and rollback preserve them; description-only changes leave the schema revision unchanged. Config collision diagnostics name both primitives.

Checked the CLI and local inventory mirrors, initialization DDL, starter config and SDK fixtures, project skills, API/CLI documentation, and domain/product documentation.

Verification

92 tests passed across four focused suites: packages/api/src/schemas.test.ts, packages/patchy/src/executeConfig.test.ts, packages/primitives/src/Tables.test.ts, and packages/patches/src/PatchesApi.test.ts. These cover config rejection, Postgres/PGlite provisioning, and API description replacement, omission and rollback.

Summary: Standards 0 blockers; Spec 0 blockers. No blocking issue in either axis.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Code review (PR 262 / #249)

Reviewed 7fa1868 against portal/248-lifecycle (94cf67fe...HEAD), not main. Spec is #249 (primitive descriptions from #247 §6). The CLI change reminder, patchy list, and patch-description sync stay on #253.

Six parallel reviews: Standards, Spec, Effect conventions, #249 intent, method/YAGNI, and hit-every-surface.

Intent (#249)

Agents could see table and store names and still not know what a row or file is. Descriptions are config-owned metadata, first argument of table / files, required and nonblank so they cannot be skipped. Mutation mirrors columns: a publish that defines the primitive replaces the text, omission and rollback preserve it, and a description-only publish does not bump schema revision. A table and a file store cannot share a name, so a later list <patch> <name> path is unambiguous.

The PR implements that, not a nearby ticket. Skills teach what one row or object is (keys, units), not a label. docs/product.md moves primitive descriptions from decided to built and leaves the reminder and list as later work.

Method and YAGNI

This is the smallest correct path. Description is one required field on the existing config, Manifest, inventory row, and inventory GET shapes. There is no second schema, mapper, or plan type.

Tables.diff never reads description, so revision stays a count of schema/sharing/store additions. provision still gates DDL on schemaChanged; the trailing putTable / putStore loops are define-replaces / omit-skips on the same inventory row that already owned shared. Rollback never re-provisions, so it cannot rewrite the text.

Name collision lives on Manifest / GenerationManifest. The CLI PrimitiveNameCollision unwrap exists so invalid_manifest names both definitions without leaking a schema dump. That is the ticket's diagnostic, not a new API.

configFailure is new: unknown config exceptions stay in cause, and only collision (and existing stale_generated) become public text. That matches the PR's bounded-diagnostics note.


Standards

(a) Documented standards

  1. packages/company-database/src/Inventory.ts (initialize / upgrade) — judgement, with a real operator gap. The ticket said change init DDL in place and recreate dev databases; there is no new platform migration id, which matches feat(primitives): descriptions on tables and file stores in the config, manifest and inventory #249. CREATE TABLE IF NOT EXISTS will not add "description" to an already-ready company database. upgrade still only adds ref_table. docs/DEVELOPMENT.md tells operators to pnpm dev reset for 0006_runtime_baseline and does not mention this inventory rewrite. Existing local company DBs will fail inventory reads/writes until recreated. Do not add an ALTER backfill unless we reverse the ticket; do mention the recreate next to the existing reset note.

  2. Wire tests — packages/api/src/schemas.test.ts — judgement. packages/api is the wire source. "Rejecting malformed definitions" still has no Manifest decode failure for missing/blank description or table/store name collision. HTTP coverage is in PatchesApi.test.ts ("", " \t\n" → 422 invalid_manifest). A couple of schema-level cases would match how other Manifest rules are tested.

  3. Effect services — packages/patchy/src/executeConfig.ts:128–136 — judgement. configFailure copies cause.message for PrimitiveNameCollision. The tagged error already derives that sentence from definitionName. Construct LocalError from definitionName and keep the tagged error as cause. The StaleGenerated branch is the same file's existing Error shape, not a new service defect.

(b) Baseline smells (always judgement)

  • Duplicated Code (executeConfig.ts): collision is already distinctPrimitiveNames on Manifest. The catch re-walks keys to produce the CLI sentence. Acceptable if we keep schema errors off the CLI wire; otherwise attach the check to configSchema and drop the parallel type.
  • Shotgun Surgery across ~45 files is expected here (wire, CLI README, ADR-0004 init note, project skills, CONTEXT, product). Global skills/patchy/SKILL.md correctly unchanged.

No hard Effect-service layout, import, or runtime-boundary violations in Tables / Inventory.


Spec

(a) Missing or partial. None of #249 / §6 primitive-description requirements are missing.

  • Config: table(description, columns, options?) and files(description); first arg; NonEmptyString plus runtime nonblank. Init starter and both project skill examples use the new shape.
  • Collision: invalid_manifest naming both (Table "notes" and file store "notes" must have different names.), asserted on publish and refresh.
  • Manifest: PrimitiveDescription required and nonblank; server refuses "" and whitespace as invalid_manifest.
  • Inventory: description on patchy.tables and patchy.stores; init DDL in place. Define replaces, omit preserves, rollback does not re-provision, description-only leaves schemaRevision alone. GET /api/patches/:patchId/inventory returns the stored text (PatchesApi.test.ts, provisioningContract.ts).
  • Skills: what one row/object is, identifying keys, units; counterexample to a mere label.
  • Surfaces named by the ticket: Manifest + docs/API.md, packages/patchy/README.md, ADR-0004 init tree note, packages/sdk/skills, Primitives Definition, docs/product.md § Primitives (decided → built), ADR-0009 inventory paragraph. Packed SDK fixture config and init starter gained descriptions.

(b) Scope creep. No extra product behavior. Collision is also on the Manifest wire (a crafted publish is refused too); #249 named config, but it is the same invalid_manifest check. Reminder and patchy list were not added.

(c) Implemented but wrong. No mismatches found.


Standards: 3 findings (all judgement). Worst: existing local company databases will miss description until recreate, and DEVELOPMENT.md does not say so. Spec: 0 findings.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Reviewed both conversation reports against #249 and the implementation. The Reviews tab and inline-review endpoint contain no additional feedback.

Fixed

  • Dev database reset guidance: committed and pushed as 4b3b9e3. docs/DEVELOPMENT.md now explains that existing local cloud databases need pnpm dev reset, and existing patch-repo PGlite data needs pnpm patchy dev reset followed by a fresh start. It names the missing inventory description columns and warns about deleted local data. No databases were reset during this work.

Kept as is

  • In-place inventory DDL, without a backfill: feat(primitives): descriptions on tables and file stores in the config, manifest and inventory #249 explicitly says nothing is deployed and dev databases are recreated. An upgrade/backfill would contradict that decision; the missing operator guidance is now fixed.
  • Existing wire-test organization: config execution, publish HTTP, and CLI tests already defend description rejection and collision diagnostics at their consumer boundaries. I did not add another set of overlapping permanent cases. I also directly exercised both Manifest and GenerationManifest: valid descriptions pass; missing, empty and whitespace-only descriptions and table/store collisions fail.
  • configFailure using the known collision getter: PrimitiveNameCollision.message is defined in the same module and derives only from the DefinitionName-validated name. Unknown config exceptions receive a static public diagnostic and remain in cause. Reconstructing the same sentence in the mapper would duplicate that diagnostic without fixing an observed leak. CLI collision and private-diagnostic tests pass.
  • Failure-only name scan and collision error: the schema remains the admission check; the catch-path scan translates its refusal into a bounded CLI message naming both definitions, without exposing a schema dump.
  • Cross-package updates and unchanged global skill: the mirrored files are explicitly required by feat(primitives): descriptions on tables and file stores in the config, manifest and inventory #249. The global skill, deferred change reminder and discovery commands remain untouched.

Verification

  • 92 tests passed across the API schema, config execution, Postgres/PGlite provisioning and publish API suites.
  • Four focused CLI tests passed for collision diagnostics and private-error redaction.
  • Direct schema smoke and documentation formatting check passed.
  • CI run 34926290082 completed successfully on the latest head, 4b3b9e3dd4537caa3e969e679bdd48e3c9acfa5c.
  • All eight reported checks passed: test (22), test (24), postgres-concurrency, clerk-live, lint, cli-smoke, dependency-review, and label.

GitHub reports no configured required checks for this stacked target, so I waited for every reported check. The PR is MERGEABLE with merge state CLEAN against portal/248-lifecycle. No unresolved blockers; not merged.

@allisonmahmood
allisonmahmood deleted the branch main September 16, 2026 15:52
@allisonmahmood
allisonmahmood changed the base branch from portal/248-lifecycle to main September 16, 2026 15:59
@github-actions github-actions Bot added the area:ci CI, shared testing infrastructure, development scripts and tooling label Sep 16, 2026
Require nonblank descriptions in config and manifests, persist them in cumulative inventory without schema revision changes, and preserve them on omission and rollback. Update starter configs, SDK fixtures, project skills and documentation. Keep config error diagnostics bounded while naming table/store collisions.

Closes #249
@allisonmahmood
allisonmahmood force-pushed the portal/249-primitive-descriptions branch from 4b3b9e3 to 2e93f4d Compare September 16, 2026 16:00
@github-actions github-actions Bot removed the area:ci CI, shared testing infrastructure, development scripts and tooling label Sep 16, 2026
@allisonmahmood
allisonmahmood merged commit 3714611 into main Sep 16, 2026
8 checks passed
@allisonmahmood
allisonmahmood deleted the portal/249-primitive-descriptions branch September 16, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:cli Touches the cli area area:docs Touches the docs area area:server Touches the server area size:l 501-1,000 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(primitives): descriptions on tables and file stores in the config, manifest and inventory

1 participant