Skip to content

feat(examples): golden teaching example — L1 synthesis (#216 T2) - #219

Merged
lex00 merged 1 commit into
mainfrom
feat/216-golden-example-l1
Jun 6, 2026
Merged

lex00 merged 1 commit into
mainfrom
feat/216-golden-example-l1

Conversation

@lex00

@lex00 lex00 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Implements #216 T2 — scaffold the golden teaching example at examples/getting-started/ with L1 (the synthesis core).

What this is

One example that teaches chant from the core up, in levels, each adding one capability over the same declarations. This PR lands L1 and the structure; L2–L5 are follow-ups.

Level Adds Status
L1 — synthesis typed resources → chant build → spec-native output, chant lint, chant graph; no executor this PR
L2 — Ops, local wrap the declarations in an Op, run in-process follow-up
L3 — gate + Temporal a human-approval gate follow-up
L4 — lifecycle dial observe → reconcile → apply follow-up
L5 — capstone the alert-triage app (#74) follow-up

L1 contents

A Lambda that lists an S3 bucket, declared as typed TypeScript. Each file maps to one concept:

  • src/main.ts — typed resources, a composite, intrinsics (Sub/Ref/AWS.StackName)
  • src/params.ts — a deploy-time input (CloudFormation Parameter)
  • src/outputs.ts — a cross-resource reference resolved at synthesis
  • src/tags.ts — a reused const (static config)

Wired into the example harness via describeExample, so L1 lints and builds in CI (with a check asserting the CloudFormation output contains the function, the bucket, and the DocsBucketArn output).

Quickstart consolidation decision (T2 AC)

local-op-quickstart stays in place — the chant CI job's regression guard runs chant run hello against examples/local-op-quickstart, so moving it would break that step. The golden example references it as the standalone zero-dependency Op demo. The golden example's own L2 (an Op over L1's declarations) is authored fresh in a later PR rather than by relocating quickstart.

Validation

Local: the example builds (template.json, spec-native CloudFormation) and chant lint src reports no problems. The full root example suite passes (107 tests), and eslint packages/ is clean. The three required chant checks are unaffected by the new example beyond the test job, which now also exercises L1.

Part of #216.

🤖 Generated with Claude Code

Scaffold the golden teaching example at examples/getting-started/. It teaches
chant from the core up in levels, each adding one capability over the same
declarations. L1 is the synthesis core — typed resources to spec-native
CloudFormation, plus lint and graph, with no executor and no cloud.

L1 contents (a Lambda that lists an S3 bucket):
- src/main.ts    — typed resources, a composite, intrinsics (Sub/Ref/StackName)
- src/params.ts  — a deploy-time input (CloudFormation Parameter)
- src/outputs.ts — a cross-resource reference resolved at synthesis
- src/tags.ts    — a reused const (static config)

README lays out the L1–L5 plan (L2 Ops-local, L3 gate+Temporal, L4 the
lifecycle dial, L5 the alert-triage capstone #74) and marks L2+ as follow-ups.

Wired into the example harness (describeExample) so L1 lints and builds in CI.

Quickstart consolidation decision: local-op-quickstart stays in place — the
chant CI regression guard runs `chant run hello` against that path — and is
referenced from the golden example as the standalone zero-dependency Op demo,
rather than being moved (which would break that CI step). The golden example's
own L2 (an Op over L1's declarations) is authored fresh in a later PR.

Part of #216.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lex00
lex00 merged commit 7375d40 into main Jun 6, 2026
5 checks passed
@lex00
lex00 deleted the feat/216-golden-example-l1 branch June 6, 2026 22:59
lex00 added a commit that referenced this pull request Jun 6, 2026
The golden teaching example's lexicon arc is Kubernetes end to end, so every
level runs on a laptop (L2 kubectl-applies to local k3d, L5 reaches k8s +
temporal). L1 was AWS (#219) — a fine pure-synthesis intro, but AWS does not
run locally, so the arc would change lexicon between L1 and L2. Redo L1 on k8s
for one coherent arc.

L1 (a web Deployment + Service via the WebApp composite):
- src/config.ts — static const data (app name, pinned image), reused
- src/web.ts    — typed resources via WebApp; expands to Deployment + Service
                  + PodDisruptionBudget, with resources and a security context

Lint is clean (the harness gate asserts zero warnings); `chant build` still
prints non-failing post-synth advisories (imagePullPolicy, readOnlyRootFilesystem),
which the README frames as guidance, not failures. Uses the WebApp composite
because raw resources trip the core COR001/COR004 style rules — which is why the
other raw k8s examples skipLint; the golden example must not skip lint.

Updated the harness block to the k8s serializer (Deployment/Service/PDB +
managed-by label checks), package scripts (build → k8s.yaml, list instead of the
Op-only graph), chant.config to k8s, and the README to the k8s arc.

Part of #216.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
lex00 added a commit that referenced this pull request Jun 7, 2026
The root examples/examples.test.ts was Bun-era (`import.meta.dir`, undefined
under vitest/Node), so vitest's `include` deliberately scoped to packages/** and
lexicons/** — meaning the whole file never ran in CI. That included the
golden-example L1 `getting-started` block added in #219/#221, the
k8s-eks/gke/aks microservice suites, gitlab-cells, ray-kuberay, and the
gitlab-aws-alb describeExamples.

- Port `import.meta.dir` → `import.meta.dirname` (9 sites).
- Add `examples/examples.test.ts` to the vitest include (explicitly, not a
  wholesale examples/** glob — the fargate docker e2e/volume suites need Docker
  and aren't CI unit tests).
- Quarantine k8s-aks-microservice (`describe.skip`) — it's broken by an Azure
  lexicon regression (Microsoft.Authorization/roleAssignments no longer
  generated), tracked in #223. Un-skip when #223 lands.

Result: the golden example L1 and 5 other example suites now run in CI
(149 passed, aks skipped). This is the real fix behind the golden-example
testing, prerequisite to L2 (#216) getting a running test.

Part of #216. Refs #223.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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