Skip to content

feat(lang): spec-level kind tag (metadata classification badge)#99

Merged
rizumita merged 1 commit into
mainfrom
feat/spec-level-kind-tag
Jul 6, 2026
Merged

feat(lang): spec-level kind tag (metadata classification badge)#99
rizumita merged 1 commit into
mainfrom
feat/spec-level-kind-tag

Conversation

@rizumita

@rizumita rizumita commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

What

Adds an optional spec-level tag classifying a whole spec:

spec ReturnUI "ui: return-request screen flow (behavioral slice only)" { … }

Metadata only — desugars to nothing, never verified. Surfaced in three places:

  • fslc explain JSON → skeleton.spec_kind = {id, text}
  • fslc explain --readableKind: … line
  • fslc html → neutral badge next to the spec title

Why

The fsl-ui spike (#9) established that screen flows are expressible in plain FSL. The open question was whether a dedicated UI syntax adds value. Conclusion: no formal-semantics gain (a dialect desugars to the same kernel), but a machine-readable + at-a-glance "this is a UI spec" classification does. This is the cheap Tier-1 purchase of that benefit — spec-unit classification without the lossy expand_ui dialect (screen/navigate line-level vocabulary, deferred until demand; that is where cost jumps discontinuously and the F-UI-2/3/4 expander risk lives). See docs/DESIGN-ui.md.

Design note

The surfaced field is spec_kind, not kind: the enveloped result tree reserves kind for the string diagnostic discriminator that with_faithfulness / trace_type_for scan on every nested dict. A kind dict there crashes the walker (unhashable type: 'dict'); a regression test pins the CLI envelope path.

Verification

  • corpus snapshot: 152 passed — the feature is verdict-neutral (metadata only, no kernel semantics).
  • example return_ui.fsl: still proved + refines.
  • test_explain / test_html_report (3 new) pass; test_v1: 39 pass; LSP tests: 25 pass.
  • LSP + VSCode tmLanguage: no change needed — verified empirically (shared parse_src/build_spec; _TOP_LEVEL_NAME captures the name before the tag; generic string highlighting covers the tag).
  • no absolute paths in the tracked diff.

11 files, +116/−8. bmc/runtime untouched (no concrete semantics); no new files (no SPDX); corpus snapshot not regenerated (unchanged).

🤖 Generated with Claude Code

Add an optional string tag right after the spec name that classifies the
whole spec, e.g. `spec ReturnUI "ui: screen flow" { … }`. Metadata only — it
desugars to nothing and is never verified (corpus snapshot unchanged) —
surfaced by `fslc explain` (`skeleton.spec_kind = {id, text}` + a `Kind:` line
in `--readable`) and by `fslc html` (a neutral badge next to the spec title).
Delivers the machine-readable and at-a-glance "this is a UI spec"
classification the fsl-ui spike (#9) identified, without the expand_ui dialect.

The surfaced field is `spec_kind`, not `kind`, because the enveloped result
tree reserves `kind` for the diagnostic discriminator scanned by
with_faithfulness / trace_type_for on every nested dict.

Files moved together: grammar.py + model.py (feature), explain.py +
html_report.py (surfacing), examples/ui_spike/return_ui.fsl (live example),
docs/LANGUAGE.md + skills/fsl/reference.md + docs/DESIGN-ui.md, CHANGELOG, and
regression tests. LSP + VSCode tmLanguage need no change (verified: shared
parser + generic string highlighting).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rizumita rizumita merged commit 196e92c into main Jul 6, 2026
6 checks passed
@rizumita rizumita deleted the feat/spec-level-kind-tag branch July 6, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant