Repository navigation
feat(gen): membership-scope access for AppSpec entities - #53
Conversation
A custom entity's access can now be { "scope": "<scope>" }: each row belongs to one entity of that membership scope, and only its members see it. "org" puts a row in an organization (the active workspace); an entity type's scope needs a key to its table, or to a table with the same access, which the row's entity is copied from. The desktop validates specs against this schema and provisions the policies; gen doesn't read a table's access.
…er-filled links as junctions manage_entity_types names an entity type's table with the prefix plus "s" (propertys), and the API inflects it to another plural (properties). The spec names the SQL table, so applySpec now matches `_meta`'s tableName too; before, the table's label, nav and panels were dropped as a gap. A link to a scoped row carries the entity its trigger copies from a side. The API takes no value for that column on create, so it no longer makes the link an entity of its own: it stays a junction, with the link editor on both sides.
|
Review complete. 🟡 1 medium 📍 Findings outside the diff (1) — 🟡 1 medium — defects on lines GitHub can't attach comments to🟡 Medium — Scoped // shared/gen/app-spec.ts
121 for (const entity of entities) {
122 const ir = findResource(entity.name);
123 if (!ir) {
124 gap(entitiesPath, entity.name, `AppSpec entity "${entity.name}" is not in _meta.`);
125 continue;
126 }
127 if (entity.label) ir.label = entity.label;
128 const path = `${entitiesPath}.${entity.name}`;
129 refineTable(ir, entity.fields, entity.belongsTo ?? [], { fields: `${path}.fields`, belongsTo: `${path}.belongsTo` });
130 }The schema and 🧹 Nitpicks (1) — 🟢 1 low
This PR extends the generated app-spec schema and types so
Reviewed commit: 96c6f08 |
Lets a custom entity's rows belong to a membership scope, and fixes two gen gaps that scoped apps hit. Desktop provisions the policies (constructive-io/constructive-desktop#287); gen only renders.
accesstakes"shared","private"or{ "scope": "<scope>" }(SpecAccessinapp-spec.types.ts, aoneOfinapp-spec.schema.json). Desktop syncs both files and validates specs against them.manage_entity_typesnames the table with the prefix plus "s" (propertys), and the API inflects it asproperties.applySpecnow also matches_meta'stableName, so the table's label, nav and panels apply instead of becoming a gap.isWritableOnCreate: false), so it no longer turns the link into an entity of its own. The link stays a junction, with the link editor on both sides.🤖 Generated with Claude Code
https://claude.ai/code/session_017WbsGACCtSUb8SqXaydeYJ