Skip to content

Commit 5f33524

Browse files
os-zhuangclaude
andauthored
docs(skills): teach the real feature-flags surface, not a fake defineStack key (#3311)
The Feature Flags example in skills/objectstack-platform/SKILL.md authored `defineStack({ featureFlags: [...] })` — a key that does not exist on ObjectStackDefinitionSchema (strict parsing silently strips it; consumers copying it hit TS2353), and `environment: ['production']` is the wrong shape (scalar enum) and an out-of-enum value ('prod' is correct). Rewritten against the surface that actually exists: - `FeatureFlag.create()` from `@objectstack/spec/kernel` for compile-checked flag values; - the flags' one protocol home, the runtime capabilities descriptor (`ObjectStackCapabilities.system.features`); - an explicit warning that this is NOT a defineStack key; - pointers to the live toggle surfaces readers may actually want (the `feature_flags` settings manifest and `requiresFeature` auth gates). Re-tagged the block with `<!-- os:check -->` so check:skill-examples covers it going forward (gate passes: 20 marked examples). Closes #3248 Claude-Session: https://claude.ai/code/session_011omKdw59exYDNh3GekqFZq Co-authored-by: Claude <noreply@anthropic.com>
1 parent 616e839 commit 5f33524

1 file changed

Lines changed: 38 additions & 20 deletions

File tree

skills/objectstack-platform/SKILL.md

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,32 +1033,50 @@ const metrics = kernel.getPluginMetrics();
10331033

10341034
## Feature Flags
10351035

1036-
```typescript
1037-
import { defineStack } from '@objectstack/spec';
1036+
Feature flags are a **protocol shape, not a config key**. `FeatureFlagSchema` (from
1037+
`@objectstack/spec/kernel`) defines the flag document; in the protocol it appears only on
1038+
the runtime capabilities descriptor (`ObjectStackCapabilities.system.features`) that a
1039+
platform serves for introspection. There is **no `featureFlags:` / `features:` key on
1040+
`defineStack`** — strict parsing silently strips unknown keys, so such config would be a
1041+
no-op.
10381042

1039-
export default defineStack({
1040-
featureFlags: [
1041-
{
1042-
name: 'experimental_ai_copilot',
1043-
label: 'AI Copilot',
1044-
enabled: true,
1045-
strategy: 'percentage',
1046-
conditions: { percentage: 25 }, // 25% of users
1047-
environment: ['production'],
1048-
},
1049-
{
1050-
name: 'beta_kanban_view',
1051-
label: 'Kanban View',
1052-
enabled: true,
1053-
strategy: 'group',
1054-
conditions: { groups: ['beta_testers'] },
1055-
},
1056-
],
1043+
<!-- os:check -->
1044+
```typescript
1045+
import { FeatureFlag } from '@objectstack/spec/kernel';
1046+
import type { ObjectStackCapabilities } from '@objectstack/spec';
1047+
1048+
// FeatureFlag.create() gives you a compile-checked flag value:
1049+
const aiCopilot = FeatureFlag.create({
1050+
name: 'experimental_ai_copilot',
1051+
label: 'AI Copilot',
1052+
enabled: true,
1053+
strategy: 'percentage',
1054+
conditions: { percentage: 25 }, // 25% of users
1055+
environment: 'prod', // 'dev' | 'staging' | 'prod' | 'all' (default 'all')
10571056
});
1057+
1058+
// Where flags live in the protocol — the runtime capabilities descriptor:
1059+
type SystemFeatures = NonNullable<ObjectStackCapabilities['system']['features']>;
1060+
const features: SystemFeatures = [
1061+
aiCopilot,
1062+
{
1063+
name: 'beta_kanban_view',
1064+
label: 'Kanban View',
1065+
enabled: true,
1066+
strategy: 'group',
1067+
conditions: { groups: ['beta_testers'] },
1068+
environment: 'all',
1069+
},
1070+
];
10581071
```
10591072

10601073
Strategies: `boolean` | `percentage` | `user_list` | `group` | `custom`
10611074

1075+
Looking for live, resolvable toggles today? Those are different surfaces, not
1076+
`FeatureFlagSchema`: the `feature_flags` settings manifest
1077+
(`@objectstack/service-settings`, env-overridable via `OS_FEATURE_FLAGS_*`) and auth
1078+
capability gates (`requiresFeature``PUBLIC_AUTH_FEATURES`).
1079+
10621080
---
10631081
---
10641082

0 commit comments

Comments
 (0)