Skip to content

✨ workflow models P1: lifecycle schema, compiler, hive-default generator, DeriveFromModel (#17620) - #17639

Closed
clubanderson wants to merge 2 commits into
workflowmodel/phase1-ingestfrom
workflowmodel/p1-compiler
Closed

clubanderson wants to merge 2 commits into
workflowmodel/phase1-ingestfrom
workflowmodel/p1-compiler

Conversation

@clubanderson

Copy link
Copy Markdown
Member

RFC #17620, phase 1 of 7. Stacked on #17630 (retarget to v6 after it merges).

What this adds

  • Schema (lifecycle half) — workflow.hivecommons.dev/v1alpha1 gains columns, derivation, events, gates, roles, agents, checks, bookkeeping, labels, meta, and per-state lifecycle {column, number, kinds, waiting, replies, confidence, citations}. Existing fields and goldens untouched.
  • Compiler — workflowmodel.Compile(m) (*Profile, []Diagnostic, error). Refuses with coded diagnostics: state-no-exit, gate-no-owner, agent-no-human-gate, duplicate-event-fact, state-no-column / unknown-column, duplicate-stage-number, unknown-fact / bad-op, no-rules, no-version, plus unknown state/role/gate/event references. confidence: inferred elements compile with a warning.
  • hive-default is generated, not hand-written — pkg/workflowmodel/hivedefault.Generate() builds it from stagelabels.Table + stageengine.DiagramEdges() + the monitor's column anchors (Open · Actionable · Claimed · PR in progress · CI / Review · Merge queue · Merged). 23 states, ~70 transitions, compiles clean.
  • stageengine.DeriveFromModel(profile, kind) — the third Deriver. hive-default declares derivation: builtin and delegates to the existing derivers, checking only coverage. Custom models declare derivation: rules: ordered first-match predicates over the fact vocabulary (workflowmodel.Facts); unmatched → Abstain workflow: not covered. Options.Workflow *Profile selects it.
  • workflow.enabled config flag, default false. No wiring effect yet (P2 binds repos).

Design decision

hive-default derivation stays in Go. That is what makes the P1 bar — goldens byte-for-byte — hold without a second state machine. Documented in src/docs/design/workflow-models.md.

Tests

  • TestDeriveFromModelHiveDefaultParity: every PR stage golden + an issue sweep derive to identical Decisions under built-in and under hive-default.
  • TestCompileRefusals: 24-case table, one per refusal code, on the hand-written testdata/models/techdocs.json (cncf/techdocs engagement model, derivation: rules).
  • TestDeriveFromModelRules walks a TechDocs engagement through the rules evaluator; TestRulesFactVocabularyIsComplete proves every fact in the vocabulary evaluates.
  • hivedefault: every Table stage has a state/number/column, columns match tracker-row-anchor.js, edges mirror the engine, JSON round-trip keeps the hash.

Coverage: workflowmodel 91.4%, hivedefault 95.4%, stageengine 90.2%. golangci-lint clean.

v5/v6 impact

None for any hive: flag off, no repo bound, built-in derivers untouched. pkg/config golden regenerated for the new workflow key.

…DeriveFromModel (#17620 P1)

Extends the v1alpha1 schema with columns, derivation, events, gates,
roles, agents, checks, bookkeeping, labels and meta; adds Compile with
coded refusals; generates hive-default from the stage table and the
engine's expected edges; adds stageengine.DeriveFromModel (builtin
delegation + rules evaluator) and Options.Workflow; adds the
workflow.enabled flag (default false, no wiring effect yet).

The PR stage-golden corpus derives identically under hive-default.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 11, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kellyaa for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: workflowmodel/phase1-ingest

Conflicts are checked with every PR merged onto the current tip of workflowmodel/phase1-ingest, so a PR that only needs a rebase is not reported as conflicting with its siblings.

No conflicting open PRs or same-file overlaps were found.

@kubestellar-prow
kubestellar-prow Bot deleted the branch workflowmodel/phase1-ingest November 11, 2026 04:24
@kubestellar-prow kubestellar-prow Bot closed this Nov 11, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

Merge-state is dirty (GitHub reports mergeable: false) against the stacked base workflowmodel/phase1-ingest: this branch needs a rebase before it can merge. Not pushing since the branch is not hive-authored; deferring until the author rebases.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

@clubanderson

Copy link
Copy Markdown
Member Author

Superseded by #17648 (same commit, rebased onto v6 after the stacked base was deleted on #17630's merge).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant