Skip to content

feat: add edition guard CI and frozen 2026 fixtures - #17

Merged
SammyBytes merged 1 commit into
mainfrom
feat/edition-guard
Nov 17, 2026
Merged

SammyBytes merged 1 commit into
mainfrom
feat/edition-guard

Conversation

@SammyBytes

Copy link
Copy Markdown
Owner

Summary

Adds an edition governance pipeline for @sam-lang/compiler, dogfooding Sam for the advisory audit, plus deterministic frozen-fixture validation for edition "2026".

Deliverables

Frozen fixtures (tests/editions/2026/)

  • basic-agent.sb — no edition header, validating the 2026 default with a provider, schema, agent, and flow main.
  • explicit-edition.sb — explicit edition "2026", strict_schema: true, multiple agents, template interpolation, and !res.ok handling.

Sam audit flow (ci/sam/edition-guard.sb)

  • edition "2026", Groq provider with env() base URL/key and strict_schema: true.
  • EditionAudit schema with introduces_breaking_syntax, affects_edition_2026, risk_level, summary, and recommendation.
  • LanguageArchitect agent on openai/gpt-oss-20b with reasoning_effort: "medium", max_tokens: 1000, timeout: 30, retries: 2, and a prompt that treats the diff as untrusted and checks for keyword collisions, silent default changes, and ungated stricter rules.
  • flow main(compiler_diff: string) returns the error result on !res.ok, otherwise the audit value.

Workflow (.github/workflows/edition-guard.yml)

  • Triggers on pull_request for packages/compiler/**, tests/editions/**, and ci/sam/edition-guard.sb.
  • contents: read, pull-requests: write.
  • Always runs deterministic validation: compiles and parses every fixture and the guard flow with the Sam CLI.
  • Runs only with GROQ_API_KEY: builds git diff origin/<base>...HEAD -- packages/compiler/, truncates to 24,000 bytes, runs the guard flow, validates the JSON with Bun, posts or updates a single marked comment, and fails the job when affects_edition_2026 is true.

Tests and docs

  • packages/compiler/src/editionFixtures.test.ts parses and compiles every frozen fixture and the guard flow, asserting ast.edition === "2026".
  • README documents editions, the fixtures, the guard flow, and the workflow.

Verification

  • bun test: 140 pass, 1 skip, 0 fail
  • bun run typecheck: no errors
  • sam compile and sam ast succeed for tests/editions/2026/*.sb and ci/sam/edition-guard.sb
  • Workflow YAML parses cleanly; Bun schema/render/enforce snippets exercised locally

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Sam PR Review

Verdict: approve · Risk: low

The PR introduces a comprehensive edition guard workflow, documentation, and test fixtures. All added code follows repository conventions, and the tests cover the new functionality. No bugs or security issues were identified.

Advisory review generated by Sam with Groq. It does not approve or block the pull request; ci.yml remains the required check.

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Sam Edition Guard

Risk: low · Affects edition 2026: false

The added test file does not modify the compiler, parser, lexer, or codegen logic and therefore introduces no new syntax or breaking changes for edition 2026 programs.

Recommendation: No action required; the change is backward compatible.

Generated by Sam with Groq from the compiler diff. Deterministic fixture compilation always runs; this audit is advisory unless it reports an edition 2026 impact.

- add tests/editions/2026 fixtures: a default-edition basic agent and an
  explicit edition "2026" program with strict_schema, multiple agents,
  template interpolation, and !res.ok handling
- add ci/sam/edition-guard.sb, a Sam flow that audits compiler diffs for
  edition 2026 compatibility and returns an EditionAudit schema
- add .github/workflows/edition-guard.yml: deterministic fixture
  compilation on every matching PR, plus a Groq-backed audit when the
  secret is available that comments on the PR and fails on edition impact
- add package-level fixture tests so bun test parses and compiles every
  frozen fixture and the guard flow as edition 2026
- document editions and the guard in the README
@SammyBytes

Copy link
Copy Markdown
Owner Author

Checked the finding. gh does not need to be installed: GitHub-hosted ubuntu-latest runners ship it preinstalled, and GH_TOKEN is already defined at job level from ${{ github.token }}. The previous run proves it end to end — the Post or update comment step succeeded and logged Created edition guard comment (run 44018716012).

To make the dependency explicit rather than implicit, f857634 adds a Verify GitHub CLI step that runs gh --version and asserts GH_TOKEN is non-empty before any audit work. The new run passes, including that step and Post or update comment (run 44018938145).

A unit test for locating a workflow-only binary is not applicable here; the workflow run is the deterministic check for it.

@SammyBytes
SammyBytes merged commit ee84f58 into main Nov 17, 2026
9 checks passed
@SammyBytes
SammyBytes deleted the feat/edition-guard branch November 17, 2026 04:42
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