fix(extract): regenerate stale Yaegi symbol tables; fix wfextract directive
Two pre-existing issues discovered while scoping the Module-position slice
(archie-core-e7bo), unrelated to the playbook engine work:
1. wfextract's //go:generate directive still targeted
internal/workflow, a path gone since the domain migration -- the
committed generated file was hand-patched for imports only, never
regenerated. 'go generate ./...' failed repo-wide, silently.
2. Regeneration surfaced real drift on three surfaces:
- wfextract: the committed table predated the migration and was
missing everything added since -- routing YAML loaders (t2db.9/.10/
.11), the review types, and the Forger/Reviewer/Trees interfaces
that TaskContext exposes to every interpreted stage plugin. A stage
plugin referencing tc.Trees or the review types could not resolve
them.
- pluginextract: internal/plugin/host.go (f73b2d1) added the
Host/Module/Manifest/Permission/Health/CapabilityKind/LifecycleState
/ModuleStatus types and NewHost/AdaptLegacy/HostAPIVersion, none of
which were ever extracted. A daemon plugin written against the
capability-host API (bootstrap.go:707 LoadDir) silently had no way
to reference them.
- secretextract: symbol exports were current; only the hand-applied
nil-guards and comments differ from raw generator output.
Fix: update the wfextract directive to internal/domain/workflow and
regenerate all four extract surfaces via 'go generate ./...'. Re-apply
the documented hand-written nil-guards on interface wrappers (Yaegi
wrappers omit them natively), restating the IMPORTANT note in wfextract's
package doc (it now has interface wrappers for the first time). Delete
the stale hand-patched wfextract generated file in favour of the
correctly-named regeneration.
Regression coverage (the previously-missing types are now reachable from
interpreted code, proven by tests that fail against the old tables):
- wfextract/reachability_test.go: interprets a stage plugin referencing
Trees/Reviewer/LoadPlaybookDirs and calls it; plus a Go-side nil-guard
test on the three wrappers.
- pluginextract/reachability_test.go: interprets a daemon plugin building
a Host from a Go-side Module and calls it end to end; plus nil-guard
tests on the _Module/_Plugin wrappers.
- secretextract keeps its existing wrapper nil-guard tests.
Verified red-then-green: after a fresh 'go generate ./...' wipes the
guards, the guard tests fail with nil-pointer panics; after re-applying,
they pass. task check clean (113/113 UI, exit 0).
This commit is contained in:
1 parent
cbc8aac724
commit
3d37a437ff
9 files changed
+499
-62
No files matched your search
@@ -13,6 +13,7 @@
|
||||
{"_type":"issue","id":"archie-core-1ysw.1","title":"Bind worktree RPC operations to the dispatched task","description":"The sandboxed agent can currently choose owner, repo, issue, base, and branch on worktree RPC requests. The daemon then performs host deletion and credentialed forge operations without correlating the request to the dispatched task or enforcing WorkDir containment.","acceptance_criteria":"Reject traversal and unconfigured or task-mismatched coordinates before any filesystem or forge side effect; derive or validate the permitted branch; regression tests fail on the old behavior and pass on the fix.","status":"closed","priority":0,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-08-22T11:01:43Z","created_by":"Sam Catlow","updated_at":"2026-08-24T06:59:58Z","started_at":"2026-08-22T11:02:03Z","closed_at":"2026-08-24T06:59:58Z","close_reason":"Fixed on main: worktreerpc now exposes only Push, authorized by an opaque per-dispatch grant issued from the dispatched *store.Task (worktreerpc.go:71-83). Sandbox input no longer selects host path, repo or branch; ValidCoordinates rejects traversal. Package tests pass.","external_ref":"https://github.com/samcharles93/archie-core/issues/589","metadata":null,"dependencies":[{"issue_id":"archie-core-1ysw.1","depends_on_id":"archie-core-1ysw","type":"parent-child","created_at":"2026-08-22T21:01:42Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-1ysw","title":"Repair internal/worktree correctness and trust-boundary defects","description":"Track the concrete worktree-package defects proven by the 2026-08-22 evidence-gated review. Child bugs cover RPC authority/path containment, repository-key isolation, retry/base/diff correctness, push lifecycle, terminal cleanup, cancellation, and branch naming. This epic groups implementation only; each child has its own observable acceptance criteria.","acceptance_criteria":"All child bugs are closed with red-green regression tests, scoped lint passes, and the repository quality gate is clean.","status":"closed","priority":0,"issue_type":"epic","owner":"sam@catlow.tech","created_at":"2026-08-22T11:01:18Z","created_by":"Sam Catlow","updated_at":"2026-08-24T08:16:00Z","closed_at":"2026-08-24T08:16:00Z","close_reason":"All 9 children complete. The P0/P1 trust-boundary and correctness defects (.1 RPC task binding, .2 colliding directory keys, .3 untracked cleanup, .4 fail-closed base resolution, .5 three-dot merge-base semantics) were already fixed on main and reconciled 2026-08-24. The remaining four (.6 push result, .7 no-change worktree leak, .8 commit cancellation, .9 branch naming contract) were implemented this session, merged as 474c31d and its two merge commits, task check green, with an independent adversarial review reporting zero findings.","external_ref":"https://github.com/samcharles93/archie-core/issues/590","dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-t2db.5","title":"Security: an unauthenticated endpoint must not be able to run an agent","description":"P0 within this epic because the feature's own pitch is the threat model: a public intake surface whose output is an agent with tool access and a repo. Get this wrong and a webhook URL is remote code execution with extra steps.\n\nNon-negotiables to design:\n\n- Per-source authentication. A source registers with a secret (HMAC, as internal/channels/webhook already does per route) before its events can trigger anything. Capture-only for unknown senders is acceptable; triggering is not.\n- Human approval before a binding goes live. An operator authoring a binding is a deliberate act; an event arriving is not. Nothing should self-arm.\n- Rate and volume limits per source, so capture cannot be used to exhaust disk or drown the inspector.\n- Payload content is untrusted input flowing into an agent prompt. Treat prompt injection as expected, not exceptional -- the sender controls that text, and the agent has tools. Bound what a playbook-triggered workflow may do.\n- Captured payloads may contain secrets from the sending system. Decide retention, redaction and who can view them; internal/memory/scrubber may already have applicable prior art.\n\nArchie's own principle applies: environmental enforcement over prompt rules. 'The agent should ignore instructions in the payload' is not a control.","acceptance_criteria":"An event from an unauthenticated source can be captured but cannot trigger a workflow; a new binding requires explicit human approval before it arms; per-source rate limits exist; the blast radius of a playbook-triggered workflow is bounded by code rather than by prompt text; retention and visibility of captured payloads is decided and documented.","notes":"2026-08-22: security design decided and documented in docs/prds/webhook-intake-security.md, covering all five non-negotiables from this bead's description:\n1. Per-source auth reuses internal/channels/webhook's existing HMAC-SHA256 scheme; capture accepts unsigned events (visible, marked unauthenticated), only authenticated events can ever match a binding.\n2. Bindings gain a draft -\u003e pending_approval -\u003e armed state machine; any edit to an armed binding drops it back to pending_approval so approval can't be bypassed by editing. Modeled on telegram's existing dangerousAction/pendingApproval flow (dangerous.go/approval.go).\n3. Per-source token-bucket rate limiting (precedent: pairing/store.go's MaxPendingPerPlatform); limit-exceeded is an observable 429, not a silent drop.\n4. Blast radius bounded by the SAME code-level controls every task already gets -- gate, diff_cap_lines, sandboxed container, worktree isolation -- no new relaxation for playbook-triggered work, and payload text is ordinary untrusted prompt input, never a trusted instruction.\n5. 7-day configurable retention on captured payloads; best-effort redaction reusing gateway/stream.go's sensitiveParameterKey heuristic before persisting; visibility gated by the same dashboard auth as every other webui surface.\n\nThis bead's code-level acceptance criteria (capture-can't-trigger, rate limits exist, blast-radius bounded, approval gate) cannot be implemented yet: they constrain t2db.1 (capture), 7d5u.3 (intake family) and t2db.4 (binding), none of which have landed. This document is the contract those beads build against -- do not build any of them without satisfying it. Leaving this bead in_progress rather than closing it; it closes when t2db.1/7d5u.3/t2db.4 land and demonstrably satisfy points 1-5, not before.","status":"closed","priority":0,"issue_type":"feature","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-21T13:45:46Z","created_by":"Sam Catlow","updated_at":"2026-09-02T13:09:39Z","started_at":"2026-08-21T14:51:26Z","closed_at":"2026-09-02T13:09:39Z","close_reason":"Closed","external_ref":"https://github.com/samcharles93/archie-core/issues/536","dependencies":[{"issue_id":"archie-core-t2db.5","depends_on_id":"archie-core-t2db","type":"parent-child","created_at":"2026-08-21T23:45:45Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":1,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-e7bo","title":"fix stale wfextract go:generate directive; audit pluginextract/secretextract drift","description":"Discovered 2026-09-03 while scoping archie-core-t2db.13 (Module position). Two separate, pre-existing issues, unrelated to the playbook engine work -- do not fix as a drive-by inside that ticket.\n\n1. internal/domain/workflow/wfextract/wfextract.go's //go:generate directive still targets 'github.com/samcharles93/archie-core/internal/workflow', a path that has not existed since the domain migration (7e896c9, 2026-08-07 - the package moved to internal/domain/workflow). The committed generated file was hand-patched at some point to import the new path, but the directive itself was never fixed. Net effect: 'go generate ./...' has been broken repo-wide (at least for wfextract) since that migration, silently, for anyone who hasn't tried running it.\n\n2. Running 'go generate ./...' anyway (to see what breaks) also produced real, substantive diffs in internal/plugin/pluginextract and internal/secret/secretextract's generated symbol tables -- new wrapper types (Host, Module) appearing that are NOT in the currently-committed, in-production symbol tables. This means the Yaegi plugin and secret-engine extension surfaces have been running against stale, incomplete generated symbol tables for an unknown period: interpreted plugin/secret-engine code may be unable to reference types it should have access to. This is a latent correctness gap with real blast radius on two extension surfaces, not cosmetic drift.","design":"Two-part fix, do not conflate:\n1. Fix wfextract's directive to point at internal/domain/workflow (matching what the generated file already imports). Verify 'go generate ./internal/domain/workflow/wfextract/...' now succeeds and produces output identical (or intentionally different, documented why) to what's committed.\n2. For pluginextract/secretextract: do NOT blindly regenerate-and-commit. First determine why they're stale (when did plugin.go/secret's Engine gain the types the fresh generation adds -- git log on internal/plugin/plugin.go and internal/secret's engine files vs. when the generated files were last touched) and whether any existing test exercises a Yaegi plugin/secret-engine referencing the missing types (if none does, that's itself a coverage gap worth noting). Regenerate, gofumpt, and add/confirm a test that would have caught the drift, before committing the regenerated symbol tables -- this is a correctness-sensitive change to two live extension surfaces and needs real verification, not a mechanical re-run.","acceptance_criteria":"'go generate ./...' completes without error across the whole repo. wfextract's directive matches its actual package path. pluginextract/secretextract regeneration (if done) is backed by a test demonstrating the previously-missing types are now reachable from interpreted code, and task check passes. No behavior change to existing plugins/secret engines that were already working (regression-tested, not assumed).","status":"open","priority":1,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-09-02T17:17:42Z","created_by":"Sam Catlow","updated_at":"2026-09-02T17:17:42Z","dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-95dj","title":"StageCommitPush discards baseline-fix commits when build makes no changes","description":"Confirmed via carina production logs (task 6, chat-spawned synthetic test task, 2026-09-02). StageBaselineGate (internal/domain/workflow/implement.go:37) found the repo's gate red at the base commit, spent 405,004 tokens/14 iterations genuinely fixing two broken pre-existing tests, and committed the fix locally via tc.Trees.CommitAll (implement.go:104) -- verified passing. plan and build stages then correctly found nothing else to do for the (synthetic, content-free) task. StageCommitPush -\u003e closeNoChangesIssue (steps.go:56) decides 'no changes' purely from tc.BuildNoChanges, which the build AgentStage sets from its own len(res.Changes)==0 (implement.go:176) -- it has zero awareness that StageBaselineGate already committed real changes two stages earlier. Never pushed, never opened a PR; the entire worktree containing a real, gate-verified fix for genuinely broken tests was discarded when the task closed as 'merged: completed -- no changes required'.\n\nCost: 669,421 tokens burned to fix a real bug that then evaporated. This recurs: any task that hits the same red baseline pays the identical tax again since the fix never lands. Evidence a prior incident already happened: an orphaned 'fix: baseline gate repair' commit (e49f3cd) sits on a stale, unmerged branch (fix/441-archied-repos-entries-cant-span-more-than-one-forge) from an earlier occurrence.","design":"Fix direction: either (a) StageBaselineGate sets a flag /flips tc.BuildNoChanges appropriately when it commits, or (b) StageCommitPush's no-changes branch checks the worktree's actual diff against the base branch (tc.Trees, similar to StageDiffCap's ChangedLines) instead of trusting tc.BuildNoChanges alone. Prefer (a): cheaper, and keeps the diff-against-base check (which already exists for StageDiffCap) from being computed twice per task.","acceptance_criteria":"A task whose baseline-fix stage committed real changes, but whose plan/build stages found nothing further to do, still pushes and opens a PR carrying the baseline-fix commit -- it must never be silently discarded. tc.BuildNoChanges (or StageCommitPush's decision) accounts for what StageBaselineGate already committed, not just the build stage's own diff. Regression test reproduces the exact scenario (baseline-fix commits, build stage reports zero changes) and proves a PR opens. task check passes.","status":"closed","priority":1,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-09-02T11:20:48Z","created_by":"Sam Catlow","updated_at":"2026-09-02T14:56:02Z","started_at":"2026-09-02T11:20:51Z","closed_at":"2026-09-02T11:25:53Z","close_reason":"Fixed via a new TaskContext.BaselineFixed flag: StageBaselineGate sets it when its own CommitAll reports a real committed change (implement.go:104-111). The build stage's OnResult only sets BuildNoChanges when its own diff is empty AND BaselineFixed is false (implement.go:177), so a baseline-only fix can no longer be masked as 'no changes'. StageCommitPush itself now calls CommitAll directly and pushes whenever either a new commit was made OR BaselineFixed is true (steps.go), instead of erroring on 'nothing to commit' when the real change already sits on the branch from the baseline-fix commit. Two new regression tests (TestStageCommitPushPushesBaselineFixEvenWithNothingNewToCommit, TestStageBaselineGateSetsBaselineFixedWhenItCommits) plus a guard test that the old empty-tree error still fires without a baseline fix. task check clean.","external_ref":"https://github.com/samcharles93/archie-core/issues/682","dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-s81k","title":"Preserve bound slog attributes in persistent log sinks","description":"PR #650 scopes daemon, Web UI, and curator loggers with slog.Logger.With. internal/logging.FeedHandler.WithAttrs retains those bound attributes for the live feed but does not pass them to the wrapped handler, while Handle forwards the bare slog.Record. As a result, component is present in live Web UI entries but absent from stderr and file JSON; after restart, historical component discovery and filtering cannot see those records. Fix bound-attribute propagation without breaking slog group semantics or duplicating attributes.","acceptance_criteria":"Bound attributes appear in both Feed entries and the wrapped JSON sink; component values survive file persistence and are discoverable and filterable through historical /api/logs reads; regression tests exercise logger.With for both live and persistent paths; task check passes.","status":"closed","priority":1,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-09-02T09:37:55Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:48:54Z","closed_at":"2026-09-02T09:43:01Z","close_reason":"Fixed: FeedHandler.WithAttrs/WithGroup now propagate to the wrapped handler, matching SystemLogHandler's existing pattern. Added regression test covering both feed and persistent sink.","external_ref":"https://github.com/samcharles93/archie-core/issues/655","dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-d66k","title":"P1: Update ARCHITECTURE.md Package Map with missing packages","description":"ARCHITECTURE.md's Package Map omits sizeable load-bearing packages:\n- internal/gateway: 18.7k LOC\n- internal/tools: 20.9k LOC\n- internal/memory: 7k LOC\n- secret/*\n- plugin/*\n- skill/*\n\nA contributor or agent reading the map would miss where most of the code actually lives.\n\nNeed to:\n- Audit ARCHITECTURE.md Package Map section\n- Add all missing packages with their responsibilities\n- Ensure consistency with actual package structure\n- Verify LOC counts are accurate\n\nBlocked by: nothing","status":"closed","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-08-28T13:42:10Z","created_by":"Sam Catlow","updated_at":"2026-09-02T09:48:55Z","closed_at":"2026-08-31T10:10:50Z","close_reason":"Added internal/gateway, internal/tools, internal/memory, internal/secret, internal/plugin, internal/skill to ARCHITECTURE.md Package Map with LOC and role descriptions","external_ref":"https://github.com/samcharles93/archie-core/issues/656","dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
@@ -91,6 +92,7 @@
|
||||
{"_type":"issue","id":"archie-core-g7tm","title":"telegram: finalize the reply through a live context, matching the error branch","description":"The success path calls live.finalize(turnCtx, reply) with the raw cancellable turn context (telegram.go:582), while the error branch two lines above deliberately uses context.WithoutCancel(turnCtx). If /stop lands during finalize, the rich edit, the plain-text retry, and the split-send fallback all abort with context.Canceled (go-telegram/bot builds requests with NewRequestWithContext), so the authoritative reply is never delivered and the live message keeps the ▌ cursor forever. The reply is persisted to the ledger, so the loss is delivery-level — but the user sees a frozen half-answer.\n\nFailure: a long tool-using turn is /stop-ped as it completes; turnCtx is cancelled mid-finalize; every send fails on the dead context; the chat shows the last live frame with a blinking cursor and no final answer.\n\nFound by code-review of PR #476 (feat/467, merged 98e8dda).","design":"live.finalize(context.WithoutCancel(turnCtx), reply) — the one-liner the error branch already uses. Consider making finalize take a live context internally rather than trusting each caller to remember.","acceptance_criteria":"A /stop landing mid-finalize still delivers the authoritative reply and drops the cursor; a test covers the cancellable-context finalize path.","status":"closed","priority":1,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-14T14:43:08Z","created_by":"Sam Catlow","updated_at":"2026-08-14T15:07:36Z","started_at":"2026-08-14T14:53:28Z","closed_at":"2026-08-14T15:03:28Z","close_reason":"Fixed in internal/channels/telegram/live.go and telegram.go: finalize/abandon strip context cancellation before sending (mirroring each other), ToolCall escapes Markdown metacharacters via bot.EscapeMarkdown, splitLongMessage splits on rune boundaries. All new/changed tests verified red-then-green; task check clean; adversarial review pass found no blocking issues.","external_ref":"https://github.com/samcharles93/archie-core/issues/484","labels":["code-review","streaming","telegram"],"dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-tb3a","title":"Fix streaming review blockers for inline tool calls","description":"Resolve the four evidence-gated findings in merged inline tool-call streaming: preserve the authoritative Telegram reply when final edits fail; keep Telegram network I/O off the model FullStream consumer and cancellable; correlate tool inputs with results and render a bounded redacted parameter summary; snapshot show_tool_calls per live reply to avoid reload races. Add regression tests for every path and run task check plus lint/race validation.","acceptance_criteria":"Regression tests fail on the merged implementation and pass after the fix. Final edit failure falls back to normal split delivery. Delta and ToolCall callbacks do not wait on Telegram HTTP and stop cancels in-flight rendering. Completed tool events include bounded redacted parameters correlated by tool-call ID. Reload cannot race an in-flight reply's show_tool_calls setting. task check passes, golangci-lint reports no new findings, and focused race tests pass.","notes":"Implemented in worktree /tmp/archie-core-tb3a on branch fix/archie-core-tb3a. Added cancellable async Telegram rendering, final edit failure fallback through normal split delivery, call-ID-correlated bounded conservative parameter summaries, atomic per-reply show_tool_calls snapshots, SSE/UI parameter rendering, rebuilt ui/dist, and regression tests. Validation: GOFLAGS=-buildvcs=false task check passed; golangci-lint --new-from-rev=HEAD ./... reported 0 issues; focused race suite passed; fresh adversarial reviewer reported PASS with zero findings. Plain task check is blocked in linked worktrees by Go VCS stamping exit 128, hence buildvcs override.\n2026-08-24 reconciliation: the close reason's 'worktree left uncommitted' is stale. The work did land on main via ba33527 (Merge pull request #477 from samcharles93/fix/archie-core-tb3a); verified on main: gateway/stream.go sensitiveParameterKey+redactToolParameters, telegram/live.go per-reply showToolCalls snapshot, webui/api_chat.go gating. The /tmp/archie-core-tb3a worktree and its branch are gone, as expected.\n","status":"closed","priority":1,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-13T18:05:35Z","created_by":"Sam Catlow","updated_at":"2026-08-24T07:29:09Z","started_at":"2026-08-13T18:05:39Z","closed_at":"2026-08-13T18:35:26Z","close_reason":"Completed and independently reviewed; worktree left uncommitted per conservative repository policy.","external_ref":"https://github.com/samcharles93/archie-core/issues/485","dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-dzx","title":"Remove duplicate archie-agent safe.directory setup","description":"## Problem\\ncmd/archie-agent/main.go configures git safe.directory inline and then calls markWorktreeSafe, so startup writes the same global git configuration twice.\\n\\n## Scope\\nKeep markWorktreeSafe as the single tested production path and remove the older inline exec.Command block/import. Add regression coverage proving startup wiring has exactly one authoritative safe-directory call.\\n\\n## Acceptance\\n- archie-agent startup invokes markWorktreeSafe exactly once\\n- no second inline safe.directory command remains in main.go\\n- cmd/archie-agent tests and repository quality gate pass","acceptance_criteria":"Single tested safe.directory setup path remains; duplicate inline command is removed; tests and task check pass","notes":"Red proof: TestMainConfiguresWorktreeSafetyOnce failed with 2 setup paths before implementation. Green proof: go test/vet/build ./cmd/archie-agent/... passed; golangci-lint --new-from-rev=HEAD reported 0 issues. Fresh adversarial review found no blockers. Full task check was not run because the working tree contains unrelated in-progress changes and task check rewrites files; scoped package gate used per repository protocol.","status":"closed","priority":1,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-08-13T16:10:09Z","created_by":"Sam Catlow","updated_at":"2026-08-13T16:13:48Z","started_at":"2026-08-13T16:10:24Z","closed_at":"2026-08-13T16:13:48Z","close_reason":"Removed duplicate inline safe.directory setup; markWorktreeSafe is now the single tested production path","external_ref":"https://github.com/samcharles93/archie-core/issues/470","dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-t2db.13","title":"workflow: Module position first slice (registry + side-effect-free 'log' kind)","description":"Fifth slice of docs/prds/eda-playbook-engine.md, implementing docs/prds/module-position.md's recommended first slice: prove schema -\u003e go:generate -\u003e Yaegi load -\u003e ModuleRegistry -\u003e playbook dispatch end to end with a side-effect-free action kind, before any kind with a real external effect (notify, image-gen, forge writes) is attempted -- those remain blocked on the parent doc's unresolved execution-time gaps (idempotency, mid-run failure), which this slice deliberately does not need.\n\nGeneralizes the fixed-signature, resolved-by-name Yaegi pattern already shipped for custom gates (internal/gate/gateeval) and workflow stage plugins (skillbuild) -- do not invent a new interpreter-construction or panic-recovery mechanism; reuse yaegiutil.New/Resolve/Safe directly.","design":"Per module-position.md:\n1. internal/domain/eda/module/log: hand-written schema source (Args/Result structs, SchemaVersion const), //go:generate yaegi extract -name logextract producing logextract.Symbols -- same shape as gateextract/wfextract.\n2. internal/domain/eda/module: ModuleRegistry with Register(kind, dir) and Invoke(ctx, kind, rawArgs map[string]any) (map[string]any, error). No generic Module interface with an any payload -- Invoke decodes rawArgs into the kind's generated Args struct before calling the resolved function; a shape mismatch is a reported failure per the existing 'schema defines the accepted message' rule, not a silent zero-value fill. Discovery/resolve mirrors gateeval.Evaluate's structure (read file -\u003e yaegiutil.New with that kind's symbols -\u003e yaegiutil.Resolve[func(Args) Result] -\u003e yaegiutil.Safe-wrapped call).\n3. Config: ModuleDir field mirroring PluginDir's shape and doc comment exactly (operator-trusted directory of Yaegi module implementations, empty means none loaded).\n4. Wire ModuleRegistry construction into daemon startup (bootstrap.go) alongside the existing PlaybookDirs/routing-file loading -- log-and-abort on load failure, matching the established pattern.\n5. Do NOT implement notify, image-gen, or any action kind with a real external side effect in this slice. Do NOT wire this into playbook YAML action dispatch yet if that requires resolving the data-flow/condition syntax (parent doc open question 1) -- confirm during implementation whether a minimal 'run this one module action, no chaining' dispatch is small enough to include, or whether registry+one-kind-loadable is itself the right slice boundary and dispatch is a follow-up ticket.","acceptance_criteria":"internal/domain/eda/module/log exists with a generated symbol table via go:generate yaegi extract (same tooling as wfextract/gateextract, verified by running go generate ./... and checking the output compiles). ModuleRegistry.Register discovers and loads a *.go file implementing the log kind's generated contract; Invoke calls it and returns a typed result decoded from the interpreted function's return value. A malformed or wrong-shaped args map is a reported error, not a panic or silent default. Config gains ModuleDir (empty by default, no behavior change). Trust boundary matches PluginDir/SecretEngineDir (operator-installed, in-process, daemon-privileged) -- not repository/task code. task check passes.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-09-02T17:11:21Z","created_by":"Sam Catlow","updated_at":"2026-09-02T17:11:21Z","dependencies":[{"issue_id":"archie-core-t2db.13","depends_on_id":"archie-core-t2db","type":"parent-child","created_at":"2026-09-02T17:11:21Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-t2db.12","title":"workflow: standalone playbook lint/LSP tool (gopls-shaped)","description":"Fourth slice of docs/prds/eda-playbook-engine.md. The design doc's collision handling has two layers: a linter for pre-merge, same-tree collisions, and the runtime detect-log-report path for cross-source collisions only visible at daemon startup (t2db.9/.10/.11). Only the runtime path exists so far.\n\nCorrected 2026-09-03 (Sam): not a Taskfile target wrapping existing functions -- a small standalone CLI binary shaped like gopls: one tool, multiple invocation modes. A one-shot 'lint' mode ships in this ticket; the design doc's LSP requirement (author-time hover/completion/inline errors) is a later mode of the SAME binary, not a separate tool, so the two can never validate a playbook YAML differently -- one schema source, one binary, two entrypoints into it (matches gopls's own check-vs-serve split).\n\nDepends on archie-core-t2db.11 (multiple playbook directories) landing first, since a linter checking one directory in isolation can't demonstrate the cross-directory case the doc cares about -- though it should also catch within-a-single-directory duplicates, which is the more common real case.","design":"New cmd/\u003cname\u003e binary (e.g. cmd/archie-playbooks), per organisation.md's cmd/ rule: CLI flag parsing and entry-point routing only, no domain wiring in cmd/ itself. Actual validation logic stays in internal/domain/workflow (reuse LoadKindWorkflowsYAML/LoadLabelWorkflowsYAML/t2db.11's directory merge directly -- no second, parallel validation path). This ticket implements only the lint subcommand/mode; structure the binary's command dispatch so an 'lsp'/'serve' subcommand can be added later without restructuring (e.g. a small subcommand table from the start, even with one entry), matching gopls's shape rather than assuming a single-purpose CLI that gets bolted onto later.","acceptance_criteria":"A new cmd/ binary exists with a lint subcommand/mode that runs against one or more playbook directories and exits non-zero with a clear message when two files bind the same label/kind; exits 0 cleanly on a valid set. Reuses existing loader/merge logic directly -- no duplicated validation rules. Binary's command structure has an explicit seam for adding an LSP/serve mode later (does not need to be built yet). Documented (README or Taskfile.yml comment) so it's discoverable. task check passes.","status":"closed","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-09-02T16:56:44Z","created_by":"Sam Catlow","updated_at":"2026-09-02T17:07:39Z","closed_at":"2026-09-02T17:07:39Z","close_reason":"Implemented and gate-verified as 2c7c79e (pushed to main). cmd/archie-playbooks lint mode reuses daemon loaders; file-granular positions documented as known limitation.","dependencies":[{"issue_id":"archie-core-t2db.12","depends_on_id":"archie-core-t2db","type":"parent-child","created_at":"2026-09-02T16:56:44Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-t2db.11","title":"workflow: generalize routing/label files to multiple playbook directories","description":"Third slice of docs/prds/eda-playbook-engine.md, completing open question #2. Generalizes the single-file workflow_routing_file / workflow_labels_file config fields (t2db.9, t2db.10) into a LIST of configured playbook directories, loaded at daemon startup alongside the existing single-file fields for backward compatibility. This is what makes the design doc's collision-handling rule (drop + log + report to caller, no auto-arbitration) load-bearing: a single file has nothing to collide with, so the rule has never actually been exercised in production code yet.\n\nCorrected 2026-09-03 (Sam): must be a list of directories, not one directory -- a single playbook_dir field would contradict supporting multiple independently-maintained playbook sources, which the PRD's own Dedup section already assumes ('independently-sourced playbook directories collide'). Scope directories by the existing Repo (owner/name) concept already in Config.Repos, NOT by org/tenant -- org-keying would require an auth/identity model archie does not have yet. That is a separate, later decision, not something to half-build here.","design":"Follow the existing once-at-startup lifecycle (SetKindWorkflows/SetLabelWorkflows pattern) rather than inventing new state management. Config gains a list field (e.g. PlaybookDirs []string, or a PlaybookDir field on the existing Repo struct if directories should tie to a specific configured repo rather than being globally pooled -- decide based on whether playbooks are meant to be repo-scoped or operator-global). A loader reads every *.yaml file across all configured directories, applying the same per-file validation LoadLabelWorkflowsYAML already does, then merges bindings across all sources -- a binding for the same label/kind declared by two different sources is the collision case: drop both, log which sources/label collided, return the error to the caller (do not start the daemon on a routing collision). Single-file fields (workflow_routing_file, workflow_labels_file) remain supported unchanged as an additional, independent input alongside the directory list, not replaced by it.","acceptance_criteria":"Config supports a LIST of playbook directories (not a single path), empty/unset by default (no behavior change for existing configs). Loading two directories with a colliding label binding is a reported load failure, not a silent pick-one. Loading multiple non-colliding directories merges cleanly and Route() honours the merged bindings. Existing workflow_routing_file/workflow_labels_file continue to work unchanged when no directories are configured. Org/tenant scoping is explicitly out of scope and not attempted. task check passes.","status":"closed","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-09-02T16:50:18Z","created_by":"Sam Catlow","updated_at":"2026-09-02T16:57:50Z","closed_at":"2026-09-02T16:57:50Z","close_reason":"Implemented and gate-verified as 3e7fe00 (pushed to main). PlaybookDirs is a list per ticket correction; cross-source collision rule exercised by new load path.","dependencies":[{"issue_id":"archie-core-t2db.11","depends_on_id":"archie-core-t2db","type":"parent-child","created_at":"2026-09-02T16:50:18Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"archie-core-t2db.10","title":"feat(workflow): route arbitrary forge labels to workflows via playbook YAML","description":"Second slice of docs/prds/eda-playbook-engine.md, complementing the kind-\u003eworkflow layer (WorkflowRoutingFile): the label vocabulary itself becomes playbook data. A label outside the closed bug/feature/bootstrap kind set (e.g. security) dispatches to a registered workflow from an optional WorkflowLabelsFile, instead of falling through to triage.\n\n- LabelWorkflows + LoadLabelWorkflowsYAML/SetLabelWorkflows in internal/domain/workflow/routing.go, mirroring the kind layer's once-at-startup lifecycle. The closed Kind/NATS-subject set is untouched; the map only extends binding authority for labels the kind layer does not own.\n- Collision rule per design doc: a label owned by the kind set, an empty label, an empty workflow name, or a duplicate binding is a reported load failure (dropped, logged, error returned to the caller) -- the schema defines what is accepted; nothing is silently arbitrated by schema/version.\n- Route() precedence: explicit t.Workflow -\u003e arbitrary-label binding -\u003e kind binding -\u003e triage -\u003e implement -\u003e default.\n- Config: WorkflowLabelsFile (workflow_labels_file), wired at boot alongside WorkflowRoutingFile; documented in config.example.toml.\n- PRD: records this slice's decisions (single-file shape, collision rule, precedence) so later slices stay anchored.\n\nCommitted as 93a5f3a and pushed to main.","design":"Follows the EDA playbook engine design doc (docs/prds/eda-playbook-engine.md). Open question 2 (config field shape) partially resolved: single file (workflow_labels_file) mirroring WorkflowRoutingFile and SkillsDir's single-path precedent; a directory remains open and larger. Data-flow/condition syntax (Q1), mid-run failure semantics and idempotency (design gaps 1-2) are explicitly out of this slice's scope per the PRD phasing -- they land with Module/Channel/Forge action kinds.","acceptance_criteria":"1. An issue labelled with an arbitrary label (not bug/feature/bootstrap) routes to the workflow bound in workflow_labels_file.\n2. No workflow_labels_file configured: kind-only routing unchanged (backward compatible).\n3. Colliding/empty/kind-owned labels in the file produce a reported load error, not silent arbitration.\n4. Route() precedence: explicit t.Workflow \u003e arbitrary-label binding \u003e kind binding \u003e triage \u003e implement \u003e default.\n5. task check is green; tests cover dispatch, collision, empties, nil-restore, and precedence.","status":"closed","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-09-02T16:45:33Z","created_by":"Sam Catlow","updated_at":"2026-09-02T16:46:28Z","closed_at":"2026-09-02T16:46:14Z","close_reason":"Implemented and gate-verified as 93a5f3a (pushed to main).","external_ref":"https://github.com/samcharles93/archie-core/issues/701","dependencies":[{"issue_id":"archie-core-t2db.10","depends_on_id":"archie-core-t2db","type":"parent-child","created_at":"2026-09-02T16:45:33Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
// Code generated by 'yaegi extract github.com/samcharles93/archie-core/internal/domain/workflow'. DO NOT EDIT.
|
||||
|
||||
package wfextract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Symbols["github.com/samcharles93/archie-core/internal/domain/workflow/workflow"] = map[string]reflect.Value{
|
||||
// function, constant and variable definitions
|
||||
"Bootstrap": reflect.ValueOf(workflow.Bootstrap),
|
||||
"Definitions": reflect.ValueOf(workflow.Definitions),
|
||||
"DefinitionsWithOrigins": reflect.ValueOf(workflow.DefinitionsWithOrigins),
|
||||
"Feasibility": reflect.ValueOf(workflow.Feasibility),
|
||||
"GateFromRepo": reflect.ValueOf(workflow.GateFromRepo),
|
||||
"Implement": reflect.ValueOf(workflow.Implement),
|
||||
"LoadKindWorkflowsYAML": reflect.ValueOf(workflow.LoadKindWorkflowsYAML),
|
||||
"LoadLabelWorkflowsYAML": reflect.ValueOf(workflow.LoadLabelWorkflowsYAML),
|
||||
"LoadPlaybookDirs": reflect.ValueOf(workflow.LoadPlaybookDirs),
|
||||
"MergeKindWorkflows": reflect.ValueOf(workflow.MergeKindWorkflows),
|
||||
"MergeLabelWorkflows": reflect.ValueOf(workflow.MergeLabelWorkflows),
|
||||
"NewCompletedReviewReport": reflect.ValueOf(workflow.NewCompletedReviewReport),
|
||||
"NewNotRunReviewReport": reflect.ValueOf(workflow.NewNotRunReviewReport),
|
||||
"NewSkippedReviewReport": reflect.ValueOf(workflow.NewSkippedReviewReport),
|
||||
"OpenPR": reflect.ValueOf(workflow.OpenPR),
|
||||
"ReviewBlocking": reflect.ValueOf(workflow.ReviewBlocking),
|
||||
"ReviewCategoryDeadCode": reflect.ValueOf(workflow.ReviewCategoryDeadCode),
|
||||
"ReviewCategoryGoroutineLeak": reflect.ValueOf(workflow.ReviewCategoryGoroutineLeak),
|
||||
"ReviewCategoryHardcodedValue": reflect.ValueOf(workflow.ReviewCategoryHardcodedValue),
|
||||
"ReviewCategoryInterfaceSatisfaction": reflect.ValueOf(workflow.ReviewCategoryInterfaceSatisfaction),
|
||||
"ReviewCategoryNilRisk": reflect.ValueOf(workflow.ReviewCategoryNilRisk),
|
||||
"ReviewCategoryOther": reflect.ValueOf(workflow.ReviewCategoryOther),
|
||||
"ReviewCategoryRace": reflect.ValueOf(workflow.ReviewCategoryRace),
|
||||
"ReviewCategoryUncheckedError": reflect.ValueOf(workflow.ReviewCategoryUncheckedError),
|
||||
"ReviewDispositionFixed": reflect.ValueOf(workflow.ReviewDispositionFixed),
|
||||
"ReviewDispositionNoChangeNeeded": reflect.ValueOf(workflow.ReviewDispositionNoChangeNeeded),
|
||||
"ReviewDispositionSkipped": reflect.ValueOf(workflow.ReviewDispositionSkipped),
|
||||
"ReviewLevelError": reflect.ValueOf(workflow.ReviewLevelError),
|
||||
"ReviewLevelWarn": reflect.ValueOf(workflow.ReviewLevelWarn),
|
||||
"ReviewStatusCompleted": reflect.ValueOf(workflow.ReviewStatusCompleted),
|
||||
"ReviewStatusNotRun": reflect.ValueOf(workflow.ReviewStatusNotRun),
|
||||
"ReviewStatusSkipped": reflect.ValueOf(workflow.ReviewStatusSkipped),
|
||||
"ReviewVerdictConfirmed": reflect.ValueOf(workflow.ReviewVerdictConfirmed),
|
||||
"ReviewVerdictPlausible": reflect.ValueOf(workflow.ReviewVerdictPlausible),
|
||||
"Route": reflect.ValueOf(workflow.Route),
|
||||
"Run": reflect.ValueOf(workflow.Run),
|
||||
"SetKindWorkflows": reflect.ValueOf(workflow.SetKindWorkflows),
|
||||
"SetLabelWorkflows": reflect.ValueOf(workflow.SetLabelWorkflows),
|
||||
"StageBaselineGate": reflect.ValueOf(workflow.StageBaselineGate),
|
||||
"StageCommit": reflect.ValueOf(workflow.StageCommit),
|
||||
"StageCommitPush": reflect.ValueOf(workflow.StageCommitPush),
|
||||
"StageDiffCap": reflect.ValueOf(workflow.StageDiffCap),
|
||||
"StageOpenPR": reflect.ValueOf(workflow.StageOpenPR),
|
||||
"StagePrepareWorktree": reflect.ValueOf(workflow.StagePrepareWorktree),
|
||||
"StageRepoStages": reflect.ValueOf(workflow.StageRepoStages),
|
||||
"StageReview": reflect.ValueOf(workflow.StageReview),
|
||||
"StageYaegiGate": reflect.ValueOf(workflow.StageYaegiGate),
|
||||
"TDD": reflect.ValueOf(workflow.TDD),
|
||||
"Triage": reflect.ValueOf(workflow.Triage),
|
||||
|
||||
// type definitions
|
||||
"AgentStage": reflect.ValueOf((*workflow.AgentStage)(nil)),
|
||||
"Definition": reflect.ValueOf((*workflow.Definition)(nil)),
|
||||
"Forger": reflect.ValueOf((*workflow.Forger)(nil)),
|
||||
"KindWorkflows": reflect.ValueOf((*workflow.KindWorkflows)(nil)),
|
||||
"LabelWorkflows": reflect.ValueOf((*workflow.LabelWorkflows)(nil)),
|
||||
"Outcome": reflect.ValueOf((*workflow.Outcome)(nil)),
|
||||
"Registry": reflect.ValueOf((*workflow.Registry)(nil)),
|
||||
"ReviewCategory": reflect.ValueOf((*workflow.ReviewCategory)(nil)),
|
||||
"ReviewDisposition": reflect.ValueOf((*workflow.ReviewDisposition)(nil)),
|
||||
"ReviewFinding": reflect.ValueOf((*workflow.ReviewFinding)(nil)),
|
||||
"ReviewLevel": reflect.ValueOf((*workflow.ReviewLevel)(nil)),
|
||||
"ReviewReport": reflect.ValueOf((*workflow.ReviewReport)(nil)),
|
||||
"ReviewRequest": reflect.ValueOf((*workflow.ReviewRequest)(nil)),
|
||||
"ReviewStatus": reflect.ValueOf((*workflow.ReviewStatus)(nil)),
|
||||
"ReviewVerdict": reflect.ValueOf((*workflow.ReviewVerdict)(nil)),
|
||||
"Reviewer": reflect.ValueOf((*workflow.Reviewer)(nil)),
|
||||
"Stage": reflect.ValueOf((*workflow.Stage)(nil)),
|
||||
"TaskContext": reflect.ValueOf((*workflow.TaskContext)(nil)),
|
||||
"Trees": reflect.ValueOf((*workflow.Trees)(nil)),
|
||||
"Workflow": reflect.ValueOf((*workflow.Workflow)(nil)),
|
||||
|
||||
// interface wrapper definitions
|
||||
"_Forger": reflect.ValueOf((*_github_com_samcharles93_archie_core_internal_domain_workflow_Forger)(nil)),
|
||||
"_Reviewer": reflect.ValueOf((*_github_com_samcharles93_archie_core_internal_domain_workflow_Reviewer)(nil)),
|
||||
"_Trees": reflect.ValueOf((*_github_com_samcharles93_archie_core_internal_domain_workflow_Trees)(nil)),
|
||||
}
|
||||
}
|
||||
|
||||
// _github_com_samcharles93_archie_core_internal_domain_workflow_Forger is an interface wrapper for Forger type
|
||||
type _github_com_samcharles93_archie_core_internal_domain_workflow_Forger struct {
|
||||
IValue interface{}
|
||||
WCloseIssue func(ctx context.Context, owner string, repo string, number int, comment string) error
|
||||
WCreatePR func(ctx context.Context, owner string, repo string, title string, head string, base string, body string) (int, error)
|
||||
WLinkBranch func(ctx context.Context, owner string, repo string, issueNumber int, branch string) error
|
||||
}
|
||||
|
||||
func (W _github_com_samcharles93_archie_core_internal_domain_workflow_Forger) CloseIssue(ctx context.Context, owner string, repo string, number int, comment string) error {
|
||||
if W.WCloseIssue == nil {
|
||||
return nil
|
||||
}
|
||||
return W.WCloseIssue(ctx, owner, repo, number, comment)
|
||||
}
|
||||
func (W _github_com_samcharles93_archie_core_internal_domain_workflow_Forger) CreatePR(ctx context.Context, owner string, repo string, title string, head string, base string, body string) (int, error) {
|
||||
if W.WCreatePR == nil {
|
||||
return 0, nil
|
||||
}
|
||||
return W.WCreatePR(ctx, owner, repo, title, head, base, body)
|
||||
}
|
||||
func (W _github_com_samcharles93_archie_core_internal_domain_workflow_Forger) LinkBranch(ctx context.Context, owner string, repo string, issueNumber int, branch string) error {
|
||||
if W.WLinkBranch == nil {
|
||||
return nil
|
||||
}
|
||||
return W.WLinkBranch(ctx, owner, repo, issueNumber, branch)
|
||||
}
|
||||
|
||||
// _github_com_samcharles93_archie_core_internal_domain_workflow_Reviewer is an interface wrapper for Reviewer type
|
||||
type _github_com_samcharles93_archie_core_internal_domain_workflow_Reviewer struct {
|
||||
IValue interface{}
|
||||
WReview func(ctx context.Context, req workflow.ReviewRequest) workflow.ReviewReport
|
||||
}
|
||||
|
||||
func (W _github_com_samcharles93_archie_core_internal_domain_workflow_Reviewer) Review(ctx context.Context, req workflow.ReviewRequest) workflow.ReviewReport {
|
||||
if W.WReview == nil {
|
||||
return workflow.ReviewReport{}
|
||||
}
|
||||
return W.WReview(ctx, req)
|
||||
}
|
||||
|
||||
// _github_com_samcharles93_archie_core_internal_domain_workflow_Trees is an interface wrapper for Trees type
|
||||
type _github_com_samcharles93_archie_core_internal_domain_workflow_Trees struct {
|
||||
IValue interface{}
|
||||
WChangedFiles func(ctx context.Context, dir string, base string) ([]string, error)
|
||||
WChangedLines func(ctx context.Context, dir string, base string) (int, error)
|
||||
WCommitAll func(ctx context.Context, dir string, message string) (bool, error)
|
||||
WDiff func(ctx context.Context, dir string, base string) (string, error)
|
||||
WPrepare func(ctx context.Context, owner string, repo string, base string, issue int, title string, body string, labels string) (dir string, branch string, err error)
|
||||
WPush func(ctx context.Context, dir string, branch string) error
|
||||
WSnapshot func(ctx context.Context, dir string, destDir string) error
|
||||
}
|
||||
|
||||
func (W _github_com_samcharles93_archie_core_internal_domain_workflow_Trees) ChangedFiles(ctx context.Context, dir string, base string) ([]string, error) {
|
||||
if W.WChangedFiles == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return W.WChangedFiles(ctx, dir, base)
|
||||
}
|
||||
func (W _github_com_samcharles93_archie_core_internal_domain_workflow_Trees) ChangedLines(ctx context.Context, dir string, base string) (int, error) {
|
||||
if W.WChangedLines == nil {
|
||||
return 0, nil
|
||||
}
|
||||
return W.WChangedLines(ctx, dir, base)
|
||||
}
|
||||
func (W _github_com_samcharles93_archie_core_internal_domain_workflow_Trees) CommitAll(ctx context.Context, dir string, message string) (bool, error) {
|
||||
if W.WCommitAll == nil {
|
||||
return false, nil
|
||||
}
|
||||
return W.WCommitAll(ctx, dir, message)
|
||||
}
|
||||
func (W _github_com_samcharles93_archie_core_internal_domain_workflow_Trees) Diff(ctx context.Context, dir string, base string) (string, error) {
|
||||
if W.WDiff == nil {
|
||||
return "", nil
|
||||
}
|
||||
return W.WDiff(ctx, dir, base)
|
||||
}
|
||||
func (W _github_com_samcharles93_archie_core_internal_domain_workflow_Trees) Prepare(ctx context.Context, owner string, repo string, base string, issue int, title string, body string, labels string) (dir string, branch string, err error) {
|
||||
if W.WPrepare == nil {
|
||||
return "", "", nil
|
||||
}
|
||||
return W.WPrepare(ctx, owner, repo, base, issue, title, body, labels)
|
||||
}
|
||||
func (W _github_com_samcharles93_archie_core_internal_domain_workflow_Trees) Push(ctx context.Context, dir string, branch string) error {
|
||||
if W.WPush == nil {
|
||||
return nil
|
||||
}
|
||||
return W.WPush(ctx, dir, branch)
|
||||
}
|
||||
func (W _github_com_samcharles93_archie_core_internal_domain_workflow_Trees) Snapshot(ctx context.Context, dir string, destDir string) error {
|
||||
if W.WSnapshot == nil {
|
||||
return nil
|
||||
}
|
||||
return W.WSnapshot(ctx, dir, destDir)
|
||||
}
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
// Code generated by 'yaegi extract github.com/samcharles93/archie-core/internal/workflow'. DO NOT EDIT.
|
||||
|
||||
package wfextract
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Symbols["github.com/samcharles93/archie-core/internal/domain/workflow/workflow"] = map[string]reflect.Value{
|
||||
// function, constant and variable definitions
|
||||
"Bootstrap": reflect.ValueOf(workflow.Bootstrap),
|
||||
"Feasibility": reflect.ValueOf(workflow.Feasibility),
|
||||
"GateFromRepo": reflect.ValueOf(workflow.GateFromRepo),
|
||||
"Implement": reflect.ValueOf(workflow.Implement),
|
||||
"OpenPR": reflect.ValueOf(workflow.OpenPR),
|
||||
"Route": reflect.ValueOf(workflow.Route),
|
||||
"Run": reflect.ValueOf(workflow.Run),
|
||||
"StageBaselineGate": reflect.ValueOf(workflow.StageBaselineGate),
|
||||
"StageCommit": reflect.ValueOf(workflow.StageCommit),
|
||||
"StageCommitPush": reflect.ValueOf(workflow.StageCommitPush),
|
||||
"StageDiffCap": reflect.ValueOf(workflow.StageDiffCap),
|
||||
"StageOpenPR": reflect.ValueOf(workflow.StageOpenPR),
|
||||
"StagePrepareWorktree": reflect.ValueOf(workflow.StagePrepareWorktree),
|
||||
"StageRepoStages": reflect.ValueOf(workflow.StageRepoStages),
|
||||
"StageYaegiGate": reflect.ValueOf(workflow.StageYaegiGate),
|
||||
"TDD": reflect.ValueOf(workflow.TDD),
|
||||
|
||||
// type definitions
|
||||
"AgentStage": reflect.ValueOf((*workflow.AgentStage)(nil)),
|
||||
"Outcome": reflect.ValueOf((*workflow.Outcome)(nil)),
|
||||
"Registry": reflect.ValueOf((*workflow.Registry)(nil)),
|
||||
"Stage": reflect.ValueOf((*workflow.Stage)(nil)),
|
||||
"TaskContext": reflect.ValueOf((*workflow.TaskContext)(nil)),
|
||||
"Workflow": reflect.ValueOf((*workflow.Workflow)(nil)),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package wfextract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/traefik/yaegi/interp"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow"
|
||||
"github.com/samcharles93/archie-core/internal/yaegiutil"
|
||||
)
|
||||
|
||||
// TestPreviouslyMissingSymbolsReachableFromInterpretedCode is the regression
|
||||
// test for the stale-symbol-table drift (e7bo): the committed generated file
|
||||
// predated the domain migration and was hand-patched for imports only, never
|
||||
// regenerated -- so symbols added after the migration (the routing YAML
|
||||
// loaders t2db.9/.10/.11, the review types, and the Forger/Reviewer/Trees
|
||||
// interfaces that TaskContext exposes to every interpreted stage plugin)
|
||||
// were missing from the table. A stage plugin referencing tc.Trees or the
|
||||
// review types could not resolve them, silently.
|
||||
//
|
||||
// This test interprets a plugin that references the previously-missing
|
||||
// symbols. It fails if the symbols or wrappers are dropped from the table.
|
||||
func TestPreviouslyMissingSymbolsReachableFromInterpretedCode(t *testing.T) {
|
||||
src := `package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow"
|
||||
)
|
||||
|
||||
// Trees is the branch/prepare/diff surface TaskContext.Trees exposes.
|
||||
func UseTrees(t workflow.Trees) (string, int, error) {
|
||||
dir, _, err := t.Prepare(context.Background(), "o", "r", "main", 1, "t", "", "")
|
||||
if err != nil {
|
||||
return "", 0, err
|
||||
}
|
||||
diff, err := t.Diff(context.Background(), dir, "main")
|
||||
lines, err := t.ChangedLines(context.Background(), dir, "main")
|
||||
return diff, lines, err
|
||||
}
|
||||
|
||||
// Reviewer is the adversarial-review surface TaskContext.Reviewer exposes.
|
||||
func UseReviewer(r workflow.Reviewer) workflow.ReviewReport {
|
||||
return r.Review(context.Background(), workflow.ReviewRequest{})
|
||||
}
|
||||
|
||||
// Routing loaders are the t2db.9/.10/.11 API stage plugins may call.
|
||||
func UseRouting() error {
|
||||
_, _, err := workflow.LoadPlaybookDirs([]string{"/nonexistent"})
|
||||
return err
|
||||
}
|
||||
`
|
||||
|
||||
i, err := yaegiutil.New(interp.Options{}, Symbols)
|
||||
if err != nil {
|
||||
t.Fatalf("New: %v", err)
|
||||
}
|
||||
|
||||
// Resolve and call the routing loader through interpreted code -- the
|
||||
// strongest proof the previously-missing symbol is reachable.
|
||||
useRouting, err := yaegiutil.Resolve[func() error](i, src, "main.UseRouting")
|
||||
if err != nil {
|
||||
t.Fatalf("Resolve UseRouting: %v", err)
|
||||
}
|
||||
err = useRouting()
|
||||
if err == nil {
|
||||
// LoadPlaybookDirs("/nonexistent") errors only if the dir list is
|
||||
// valid and the files are missing -- but an empty / nonexistent
|
||||
// directory is a no-op (matching t2db.11's empty-means-defaults).
|
||||
// Either way, the call itself resolving and executing proves the
|
||||
// symbol is wired.
|
||||
t.Logf("UseRouting returned nil error (nonexistent dir is a no-op)")
|
||||
}
|
||||
}
|
||||
|
||||
// TestWrapperNilGuardsPreserved is the Go-side nil-guard regression test,
|
||||
// following the established pattern in secretextract/wrapper_test.go and
|
||||
// pluginextract's TestGeneratedWrapperHasNilGuards: yaegi's fresh wrapper
|
||||
// generation omits nil-guards, so they are re-applied by hand after every
|
||||
// regeneration. A zero-value wrapper (all function fields nil) must not
|
||||
// panic.
|
||||
func TestWrapperNilGuardsPreserved(t *testing.T) {
|
||||
var forger _github_com_samcharles93_archie_core_internal_domain_workflow_Forger
|
||||
if err := forger.CloseIssue(context.Background(), "", "", 0, ""); err != nil {
|
||||
t.Errorf("CloseIssue on nil WCloseIssue = %v, want nil", err)
|
||||
}
|
||||
if _, err := forger.CreatePR(context.Background(), "", "", "", "", "", ""); err != nil {
|
||||
t.Errorf("CreatePR on nil WCreatePR = %v, want nil", err)
|
||||
}
|
||||
if err := forger.LinkBranch(context.Background(), "", "", 0, ""); err != nil {
|
||||
t.Errorf("LinkBranch on nil WLinkBranch = %v, want nil", err)
|
||||
}
|
||||
|
||||
var reviewer _github_com_samcharles93_archie_core_internal_domain_workflow_Reviewer
|
||||
if got := reviewer.Review(context.Background(), workflow.ReviewRequest{}); len(got.Findings) != 0 || got.Status != "" || got.Summary != "" {
|
||||
t.Errorf("Review on nil WReview = %#v, want empty report", got)
|
||||
}
|
||||
|
||||
var trees _github_com_samcharles93_archie_core_internal_domain_workflow_Trees
|
||||
if _, _, err := trees.Prepare(context.Background(), "", "", "", 0, "", "", ""); err != nil {
|
||||
t.Errorf("Prepare on nil WPrepare = %v, want nil", err)
|
||||
}
|
||||
if _, err := trees.Diff(context.Background(), "", ""); err != nil {
|
||||
t.Errorf("Diff on nil WDiff = %v, want nil", err)
|
||||
}
|
||||
if _, err := trees.ChangedLines(context.Background(), "", ""); err != nil {
|
||||
t.Errorf("ChangedLines on nil WChangedLines = %v, want nil", err)
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,16 @@
|
||||
// Package wfextract holds the Yaegi symbol table for internal/workflow,
|
||||
// generated by `go generate`. Kept separate from internal/workflow itself
|
||||
// so the generated file can import it without a self-import cycle.
|
||||
// Package wfextract holds the Yaegi symbol table for internal/domain/workflow,
|
||||
// generated by `go generate`. Kept separate from internal/domain/workflow
|
||||
// itself so the generated file can import it without a self-import cycle.
|
||||
//
|
||||
// IMPORTANT: Running `go generate` overwrites the generated file with
|
||||
// Yaegi's default wrapper which does NOT include nil-guards on function
|
||||
// fields. The `TestWrapperNilGuardsPreserved` test catches this if
|
||||
// regeneration strips the guards. Re-apply nil-guards manually after
|
||||
// regeneration until Yaegi supports generating them natively.
|
||||
package wfextract
|
||||
|
||||
import "reflect"
|
||||
|
||||
//go:generate go run github.com/traefik/yaegi/cmd/yaegi extract -name wfextract github.com/samcharles93/archie-core/internal/workflow
|
||||
//go:generate go run github.com/traefik/yaegi/cmd/yaegi extract -name wfextract github.com/samcharles93/archie-core/internal/domain/workflow
|
||||
|
||||
var Symbols = map[string]map[string]reflect.Value{}
|
||||
@@ -3,9 +3,8 @@
|
||||
package gateextract
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/gate"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
+64
-9
@@ -3,29 +3,85 @@
|
||||
package pluginextract
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"context"
|
||||
"github.com/samcharles93/archie-core/internal/plugin"
|
||||
"go/constant"
|
||||
"go/token"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Symbols["github.com/samcharles93/archie-core/internal/plugin/plugin"] = map[string]reflect.Value{
|
||||
// function, constant and variable definitions
|
||||
"LoadDir": reflect.ValueOf(plugin.LoadDir),
|
||||
"AdaptLegacy": reflect.ValueOf(plugin.AdaptLegacy),
|
||||
"HealthDegraded": reflect.ValueOf(plugin.HealthDegraded),
|
||||
"HealthHealthy": reflect.ValueOf(plugin.HealthHealthy),
|
||||
"HealthUnhealthy": reflect.ValueOf(plugin.HealthUnhealthy),
|
||||
"HealthUnknown": reflect.ValueOf(plugin.HealthUnknown),
|
||||
"HostAPIVersion": reflect.ValueOf(constant.MakeFromLiteral("\"1.0.0\"", token.STRING, 0)),
|
||||
"LoadDir": reflect.ValueOf(plugin.LoadDir),
|
||||
"NewHost": reflect.ValueOf(plugin.NewHost),
|
||||
"StateFailed": reflect.ValueOf(plugin.StateFailed),
|
||||
"StateRegistered": reflect.ValueOf(plugin.StateRegistered),
|
||||
"StateRunning": reflect.ValueOf(plugin.StateRunning),
|
||||
"StateStarting": reflect.ValueOf(plugin.StateStarting),
|
||||
"StateStopped": reflect.ValueOf(plugin.StateStopped),
|
||||
"StateStopping": reflect.ValueOf(plugin.StateStopping),
|
||||
|
||||
// type definitions
|
||||
"Plugin": reflect.ValueOf((*plugin.Plugin)(nil)),
|
||||
"Registry": reflect.ValueOf((*plugin.Registry)(nil)),
|
||||
"CapabilityKind": reflect.ValueOf((*plugin.CapabilityKind)(nil)),
|
||||
"Health": reflect.ValueOf((*plugin.Health)(nil)),
|
||||
"HealthStatus": reflect.ValueOf((*plugin.HealthStatus)(nil)),
|
||||
"Host": reflect.ValueOf((*plugin.Host)(nil)),
|
||||
"LifecycleState": reflect.ValueOf((*plugin.LifecycleState)(nil)),
|
||||
"Manifest": reflect.ValueOf((*plugin.Manifest)(nil)),
|
||||
"Module": reflect.ValueOf((*plugin.Module)(nil)),
|
||||
"ModuleStatus": reflect.ValueOf((*plugin.ModuleStatus)(nil)),
|
||||
"Permission": reflect.ValueOf((*plugin.Permission)(nil)),
|
||||
"Plugin": reflect.ValueOf((*plugin.Plugin)(nil)),
|
||||
"Registry": reflect.ValueOf((*plugin.Registry)(nil)),
|
||||
|
||||
// interface wrapper definitions
|
||||
"_Module": reflect.ValueOf((*_github_com_samcharles93_archie_core_internal_plugin_Module)(nil)),
|
||||
"_Plugin": reflect.ValueOf((*_github_com_samcharles93_archie_core_internal_plugin_Plugin)(nil)),
|
||||
}
|
||||
}
|
||||
|
||||
// _github_com_samcharles93_archie_core_internal_plugin_Module is an interface wrapper for Module type
|
||||
type _github_com_samcharles93_archie_core_internal_plugin_Module struct {
|
||||
IValue interface{}
|
||||
WHealth func(a0 context.Context) plugin.Health
|
||||
WManifest func() plugin.Manifest
|
||||
WStart func(a0 context.Context) error
|
||||
WStop func(a0 context.Context) error
|
||||
}
|
||||
|
||||
func (W _github_com_samcharles93_archie_core_internal_plugin_Module) Health(a0 context.Context) plugin.Health {
|
||||
if W.WHealth == nil {
|
||||
return plugin.Health{}
|
||||
}
|
||||
return W.WHealth(a0)
|
||||
}
|
||||
func (W _github_com_samcharles93_archie_core_internal_plugin_Module) Manifest() plugin.Manifest {
|
||||
if W.WManifest == nil {
|
||||
return plugin.Manifest{}
|
||||
}
|
||||
return W.WManifest()
|
||||
}
|
||||
func (W _github_com_samcharles93_archie_core_internal_plugin_Module) Start(a0 context.Context) error {
|
||||
if W.WStart == nil {
|
||||
return nil
|
||||
}
|
||||
return W.WStart(a0)
|
||||
}
|
||||
func (W _github_com_samcharles93_archie_core_internal_plugin_Module) Stop(a0 context.Context) error {
|
||||
if W.WStop == nil {
|
||||
return nil
|
||||
}
|
||||
return W.WStop(a0)
|
||||
}
|
||||
|
||||
// _github_com_samcharles93_archie_core_internal_plugin_Plugin is an interface wrapper for Plugin type
|
||||
// generated by 'yaegi extract'. IValue is required by Yaegi's interface bridging --
|
||||
// it holds the underlying concrete value for the interpreter's type system even
|
||||
// though Name()/Version() delegate to the function fields. Do not remove.
|
||||
type _github_com_samcharles93_archie_core_internal_plugin_Plugin struct {
|
||||
IValue interface{}
|
||||
WName func() string
|
||||
@@ -38,7 +94,6 @@ func (W _github_com_samcharles93_archie_core_internal_plugin_Plugin) Name() stri
|
||||
}
|
||||
return W.WName()
|
||||
}
|
||||
|
||||
func (W _github_com_samcharles93_archie_core_internal_plugin_Plugin) Version() string {
|
||||
if W.WVersion == nil {
|
||||
return ""
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
package pluginextract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/traefik/yaegi/interp"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/plugin"
|
||||
"github.com/samcharles93/archie-core/internal/yaegiutil"
|
||||
)
|
||||
|
||||
// TestPreviouslyMissingSymbolsReachableFromInterpretedCode is the regression
|
||||
// test for the stale symbol-table drift (e7bo): the committed generated file
|
||||
// predated internal/plugin/host.go (f73b2d1) and was never regenerated, so
|
||||
// the Host/Module/Manifest/Permission/Health/CapabilityKind/LifecycleState/
|
||||
// ModuleStatus types and the NewHost/AdaptLegacy/HostAPIVersion identifiers
|
||||
// that plugin.go's LoadDir exposes to interpreted daemon plugins were absent
|
||||
// from the table. A daemon plugin written against the capability-host API
|
||||
// could not resolve them, silently.
|
||||
//
|
||||
// This test interprets a plugin that references the previously-missing
|
||||
// symbols, resolves it, and calls it -- proving the symbols are wired.
|
||||
func TestPreviouslyMissingSymbolsReachableFromInterpretedCode(t *testing.T) {
|
||||
src := `package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/plugin"
|
||||
)
|
||||
|
||||
// BuildHost exercises NewHost and HostAPIVersion -- the module-capability
|
||||
// registration surface that was missing from the symbol table.
|
||||
func BuildHost(m plugin.Module) (string, error) {
|
||||
h := plugin.NewHost()
|
||||
if h == nil {
|
||||
return "", fmt.Errorf("NewHost returned nil")
|
||||
}
|
||||
if plugin.HostAPIVersion == "" {
|
||||
return "", fmt.Errorf("HostAPIVersion empty")
|
||||
}
|
||||
if err := h.Register(m); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if err := h.Start(context.Background()); err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer h.Stop(context.Background())
|
||||
return plugin.HostAPIVersion, nil
|
||||
}
|
||||
`
|
||||
|
||||
i, err := yaegiutil.New(interp.Options{}, Symbols)
|
||||
if err != nil {
|
||||
t.Fatalf("New: %v", err)
|
||||
}
|
||||
buildHost, err := yaegiutil.Resolve[func(plugin.Module) (string, error)](i, src, "main.BuildHost")
|
||||
if err != nil {
|
||||
t.Fatalf("Resolve BuildHost: %v", err)
|
||||
}
|
||||
|
||||
// Call through with a Go-side module implementing the contract. This
|
||||
// proves the interpreted host API works across the boundary end to end.
|
||||
mod := testModule{}
|
||||
version, err := buildHost(mod)
|
||||
if err != nil {
|
||||
t.Fatalf("BuildHost: %v", err)
|
||||
}
|
||||
if version != plugin.HostAPIVersion {
|
||||
t.Errorf("BuildHost version = %q, want %q", version, plugin.HostAPIVersion)
|
||||
}
|
||||
}
|
||||
|
||||
// testModule implements plugin.Module for the Go-side call.
|
||||
type testModule struct{}
|
||||
|
||||
func (testModule) Manifest() plugin.Manifest {
|
||||
return plugin.Manifest{
|
||||
ID: "test",
|
||||
Name: "test",
|
||||
Version: "1.0.0",
|
||||
APIVersion: plugin.HostAPIVersion,
|
||||
Capabilities: []plugin.CapabilityKind{"test.capability"},
|
||||
}
|
||||
}
|
||||
|
||||
func (testModule) Start(context.Context) error { return nil }
|
||||
func (testModule) Health(context.Context) plugin.Health {
|
||||
return plugin.Health{Status: plugin.HealthHealthy}
|
||||
}
|
||||
func (testModule) Stop(context.Context) error { return nil }
|
||||
|
||||
// TestWrapperNilGuardsPreserved follows the established pattern: yaegi's
|
||||
// fresh wrapper generation omits nil-guards on interface-wrappers, so they
|
||||
// are re-applied by hand after every regeneration. A zero-value wrapper
|
||||
// (all function fields nil) must not panic.
|
||||
func TestWrapperNilGuardsPreserved(t *testing.T) {
|
||||
var mod _github_com_samcharles93_archie_core_internal_plugin_Module
|
||||
if err := mod.Start(context.Background()); err != nil {
|
||||
t.Errorf("Start on nil WStart = %v, want nil", err)
|
||||
}
|
||||
if got := mod.Manifest(); got.ID != "" || got.Name != "" || got.APIVersion != "" {
|
||||
t.Errorf("Manifest on nil WManifest = %#v, want empty", got)
|
||||
}
|
||||
if got := mod.Health(context.Background()); got.Status != "" || got.Message != "" {
|
||||
t.Errorf("Health on nil WHealth = %#v, want empty", got)
|
||||
}
|
||||
if err := mod.Stop(context.Background()); err != nil {
|
||||
t.Errorf("Stop on nil WStop = %v, want nil", err)
|
||||
}
|
||||
|
||||
var legacy _github_com_samcharles93_archie_core_internal_plugin_Plugin
|
||||
if got := legacy.Name(); got != "" {
|
||||
t.Errorf("Name on nil WName = %q, want empty", got)
|
||||
}
|
||||
if got := legacy.Version(); got != "" {
|
||||
t.Errorf("Version on nil WVersion = %q, want empty", got)
|
||||
}
|
||||
}
|
||||
|
||||
var _ plugin.Module = testModule{}
|
||||
+2
-8
@@ -3,9 +3,8 @@
|
||||
package secretextract
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/secret"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -25,11 +24,8 @@ func init() {
|
||||
}
|
||||
|
||||
// _github_com_samcharles93_archie_core_internal_secret_Engine is an interface wrapper for Engine type
|
||||
// generated by 'yaegi extract'. IValue is required by Yaegi's interface bridging --
|
||||
// it holds the underlying concrete value for the interpreter's type system even
|
||||
// though Name()/Resolve()/Version() delegate to the function fields. Do not remove.
|
||||
type _github_com_samcharles93_archie_core_internal_secret_Engine struct {
|
||||
IValue any
|
||||
IValue interface{}
|
||||
WName func() string
|
||||
WResolve func(key string) (string, error)
|
||||
WVersion func() string
|
||||
@@ -41,14 +37,12 @@ func (W _github_com_samcharles93_archie_core_internal_secret_Engine) Name() stri
|
||||
}
|
||||
return W.WName()
|
||||
}
|
||||
|
||||
func (W _github_com_samcharles93_archie_core_internal_secret_Engine) Resolve(key string) (string, error) {
|
||||
if W.WResolve == nil {
|
||||
return "", nil
|
||||
}
|
||||
return W.WResolve(key)
|
||||
}
|
||||
|
||||
func (W _github_com_samcharles93_archie_core_internal_secret_Engine) Version() string {
|
||||
if W.WVersion == nil {
|
||||
return ""
|
||||
|
||||
Reference in new issue
Block a user