Skip to content

Compile the Dakar workflow from typed modules (5.)#3

Merged
leynos merged 21 commits into
mainfrom
workflow-compilation
Jul 17, 2026
Merged

Compile the Dakar workflow from typed modules (5.)#3
leynos merged 21 commits into
mainfrom
workflow-compilation

Conversation

@leynos

@leynos leynos commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

This branch compiles Dakar's ODW review workflow from strict, directly tested TypeScript modules so maintainers can change cohesive components without sacrificing the single-file runtime artefact required by ODW. It adds a deterministic, fail-closed compiler and freshness contract, preserves the installed CLI and direct-invocation interfaces, and proves parity through module, artefact, dry-run, CLI, state, and isolated live-review evidence.

Roadmap slice: (5.), completing tasks (5.1.1)–(5.3.2) in the roadmap.

ExecPlan: Compile the Dakar review workflow from typed modules.

The implementation lands all planned work: the accepted architectural decision, exact TypeScript and esbuild development contracts, typed component extraction, generated-artefact validation, synchronized documentation, and end-to-end parity proof. Review follow-up also validates trusted-base instructions and hostile workflow arguments, makes verifier labels collision-safe, exposes bounded Record retries, and property-tests task and candidate bounds. These corrections preserve the public review interface while making the typed trust boundaries explicit. No planned work is deferred.

Review walkthrough

  • Start with the ExecPlan and ADR 001 for the accepted boundary, decisions, discoveries, review dispositions, and completion evidence.
  • Review the workflow compiler for deterministic framing, bidirectional manifest checks, loader-hazard rejection, atomic writes, line-ending portability, and freshness validation.
  • Follow the runtime composition from main.ts into the typed workflow modules. The entry retains phase sequencing and ambient ODW calls; configuration, routing, schemas, planning, candidate handling, shell quoting, and prompts remain pure dependencies.
  • Inspect the CLI and CLI tests for trusted-base AGENTS.md loading, mutable-working-tree exclusion, and fail-closed Git errors.
  • Review the compiler contract tests and generated-workflow orchestration tests for compiler probes, exact phase and agent calls, unique verifier labels, resolved-policy propagation, and Record retry success and exhaustion.
  • Finish with AGENTS.md, the developer guide, component design, system design, and user guide for contributor conventions, internal interfaces, and user-visible retry observability.

Validation

  • git diff --check: passed.
  • make check-fmt: passed.
  • make typecheck: passed, including strict TypeScript checking and an ODW dry run returning ok: true and dryRun: true.
  • make lint: passed with 13 Markdown files reporting zero errors and every Nixie diagram valid.
  • make test: passed with 109 tests, zero failures, and a fresh generated artefact.
  • make workflow-freshness: passed; the generated artefact matches its TypeScript sources exactly.
  • Repeated workflow builds: produced identical SHA-256 4f48e4a2b665a60a3d644e65630e41cdc794d18b4ec182ac32081a5916e9fe31 values at the implementation milestone.
  • Isolated live review: completed two planned tasks, recorded natively without CLI recovery, retained exactly one history entry, and returned skipped: true on the same-head rerun.
  • coderabbit review --agent: completed after each implementation milestone; the final implementation review returned zero findings before the inline follow-up addressed here.
  • PR metadata: checked against the pr-creation and en-gb-oxendict-style skill requirements.

Notes

The generated ODW artefact remains committed and directly runnable. Users and installations do not require TypeScript, esbuild, or a contributor build step.

The generated-file Biome/standard-JS ignore suggestion was not applied because the repository configures neither tool and already excludes the artefact from ordinary node --check; the ODW dry run remains its parser contract. The blanket 80% function-docstring suggestion was also not applied because no such gate exists and mechanical comments conflict with the repository's “comment why” convention; every workflow module now has the required top-level @file documentation instead.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @leynos, your pull request is larger than the review limit of 150000 diff characters

@pandalump
pandalump marked this pull request as ready for review July 14, 2026 08:35
@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d8e56ac8-a354-4eff-8537-6ec2bb1f2cb4

📥 Commits

Reviewing files that changed from the base of the PR and between 79a2a8f and 3557c07.

📒 Files selected for processing (10)
  • docs/dakar-review-design.md
  • docs/design/initial-workflow.md
  • docs/developers-guide.md
  • docs/execplans/compile-dakar-review-workflow.md
  • docs/users-guide.md
  • scripts/check-docstrings.mjs
  • src/workflows/dakar-review/main.ts
  • tests/docstrings.test.mjs
  • tests/workflow-orchestration.test.mjs
  • workflows/dakar-review.js

Summary

  • Compiles Dakar’s ODW review workflow from typed, directly tested TypeScript modules into the committed workflows/dakar-review.js artefact, with deterministic, fail-closed builds, manifest validation, atomic writes, and freshness checks.
  • Adds typed workflow components for configuration, task planning, prompts, schemas, model routing, candidate normalisation, verification, synthesis, and recording while preserving the existing CLI and runtime contracts.
  • Hardens trust boundaries by loading AGENTS.md from immutable Git commits and deriving recovery state paths from trusted CLI locations; recording is idempotent and retries are bounded.
  • Adds comprehensive unit, property-based, compiler, artefact, CLI, dry-run, and orchestration coverage, including adversarial inputs and malformed acknowledgements.
  • Adds documentation coverage auditing and updates repository guidance, user/developer documentation, design records, and the completed ExecPlan.
  • Documents the accepted source-to-artefact boundary in ADR-001 and wires build, freshness, documentation, type-checking, and workflow validation into make check.

Validation

Formatting, linting, strict type checking, documentation auditing, workflow freshness, deterministic repeated builds, ODW dry-run execution, 115 tests, and isolated live-review parity all pass.

Walkthrough

Changes

Workflow compilation and review runtime

Layer / File(s) Summary
Architecture and contributor contracts
AGENTS.md, docs/..., package.json, tsconfig.json, .gitignore
Document the TypeScript source boundary, generated ODW artefact, compiler invariants, validation plan, contributor commands, and toolchain configuration.
Fail-closed workflow compiler
Makefile, scripts/build-workflow.mjs, scripts/check-docstrings.mjs, tests/compile-time-contract.test.mjs, tests/workflow-build.test.mjs
Add workflow build, freshness, docstring, and type-check gates; bundle and validate the workflow; support atomic writes and stale-output checks; and test compiler diagnostics and loader compatibility.
Typed workflow contracts and pure modules
src/workflows/dakar-review/*, tests/workflow-config.test.mjs, tests/workflow-model-routing.test.mjs, tests/workflow-candidate-paths.test.mjs, tests/workflow-task-graph.test.mjs, tests/workflow-prompts.test.mjs
Add typed contracts, schemas, configuration and model routing, prompt construction, task planning, candidate filtering, verdict processing, shell quoting, and direct module tests.
Workflow orchestration and generated artefact
src/workflows/dakar-review/main.ts, src/workflows/dakar-review/meta.js, workflows/dakar-review.js, tests/workflow-orchestration.test.mjs, tests/workflow-dry-run.test.mjs
Implement the phased workflow, strict review and verification handling, synthesis and recording retries, deterministic output, and the generated ODW runtime bundle.
Trusted inputs and review idempotence
bin/dakar-review.mjs, scripts/review-state.mjs, tests/cli.test.mjs, tests/review-state.test.mjs
Read repository instructions from the selected base revision, derive trusted recovery destinations, and prevent duplicate review records for the same head commit.

Possibly related PRs

Poem

Typed branches bloom where Dakar once ran,
Bundled by esbuild, shaped to a plan.
Candidates gather, verdicts align,
Freshness guards the output line.
One head, one record, no echoes remain.

🚥 Pre-merge checks | ✅ 19 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (19 passed)
Check name Status Explanation
Title check ✅ Passed Keep this title: it matches the roadmap slice (5.) and the main workflow compilation change.
Description check ✅ Passed Keep this description: it stays on-topic and tracks the typed-module workflow compilation work.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Testing (Overall) ✅ Passed PASS: The new suites exercise real workflow, CLI, compiler, state, prompt, config, and docstring behaviour with negative and property-based cases, so plausible regressions would fail.
User-Facing Documentation ✅ Passed docs/users-guide.md covers the changed CLI, direct ODW use, state-root, recordAttempts, skip/error behaviour, and generated artefact guidance; no README exists.
Developer Documentation ✅ Passed Developer guide, ADRs, design docs, roadmap checkboxes, and the living ExecPlan all reflect the new compiler/boundary work and completion status.
Module-Level Documentation ✅ Passed PASS: all 32 tracked JS/TS modules start with a top-level /** ... */ docstring; no offenders were found in the repository scan.
Testing (Unit And Behavioural) ✅ Passed PASS: It adds invariant-focused unit tests and real boundary/e2e tests for the CLI, build, dry-run, docstrings and generated-workflow orchestration.
Testing (Property / Proof) ✅ Passed PASS: The PR adds fast-check properties for config bounds, candidate filtering/caps, task-graph coverage, and review-state ancestry/slug invariants.
Testing (Compile-Time / Ui) ✅ Passed PASS: tests/compile-time-contract.test.mjs gives a TypeScript-specific tsc regression for erasable syntax, and the text-output tests stay focused with semantic assertions.
Unit Architecture ✅ Passed PASS: Typed workflow modules are pure; I/O and process work stay in CLI/scripts with explicit errors, and tests exercise the seams directly.
Domain Architecture ✅ Passed PASS: Pure workflow modules stay dependency-free, while CLI, git, fs, env, and retry concerns are confined to bin/ and scripts/ adapters.
Observability ✅ Passed PASS: stage-tagged failures, phase logs, retry logging, and persisted metrics/recordAttempts expose review and record recovery states; CLI emits structured ODW error JSON.
Security And Privacy ✅ Passed Confirm trusted-base AGENTS loading, shell-quoted prompt commands, and derived state paths; no secrets, auth gaps, or unsafe logging are introduced.
Performance And Resource Use ✅ Passed PASS: New loops are bounded (3 record retries, 100 lock attempts, task-slot loop), I/O is one-shot, and candidate/task growth is capped by workflow limits.
Concurrency And State ✅ Passed PASS: appendReview is serialized by withStateLock, buildWorkflow uses temp-file rename, and tests cover concurrent writes, stale/fresh locks, retries, and duplicate record ids.
Architectural Complexity And Maintainability ✅ Passed PASS: The new modules are domain-scoped, explicit, and acyclic; docs define the source-of-truth boundary and reuse path, and no hidden hooks or speculative layers appear.
Rust Compiler Lint Integrity ✅ Passed No .rs files changed in this PR, so no Rust lint suppressions or clone regressions were introduced.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch workflow-compilation

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Biome (2.5.3)
workflows/dakar-review.js

File contains syntax errors that prevent linting: Line 954: Illegal return statement outside of a function


Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the Roadmap label Jul 14, 2026
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@leynos

leynos commented Jul 14, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Have the following now been resolved?

tests/workflow-candidate-paths.test.mjs (1)

20-50: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Give the fake ReviewTask a maxFindings so the per-task cap is actually tested.
TASK_GRAPH[0] and taskResult() never set maxFindings; task.maxFindings is undefined for every case in this file, so normalizeCandidates's acceptedForTask >= task.maxFindings break condition (undefined comparison always evaluates false) is never exercised. Add the field and a case that exceeds it.

🧪 Proposed fixture fix
const TASK_GRAPH = [
   {
     taskId: 'source-1',
     kind: 'source',
     assignedModel: 'gpt-5.5/high',
     files: [],
+    maxFindings: 30,
     verificationPolicy: 'verify-all',
   },
 ]
🤖 Detailed instructions

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @tests/workflow-candidate-paths.test.mjs around lines 20 - 50, Update the
fake ReviewTask fixture in TASK_GRAPH to define a finite maxFindings value, and
add or adjust a test case using taskResult() with more candidates than that
limit. Ensure the assertions verify normalizeCandidates stops accepting
candidates once the per-task cap is reached.

@leynos

leynos commented Jul 14, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Have the following failed checks now been resolved?

If further work is required, please provide an AI agent prompt for the remaining work to be done to address these failures.

Do not treat warnings as optional or aspirational. Where a change is out of scope for this PR, propose a GitHub issue unless one exists already. (Treat documentation and validation coverage as in scope).

❌ Failed checks (3 errors, 3 warnings)

Check name Status Explanation Resolution
Testing (Overall) ❌ Error The AGENTS.md CLI test is vacuous: it commits the file but leaves an identical working-tree copy, so a regression to repoRoot/AGENTS.md still passes; no invalid-base test exists. Delete or alter the working-tree AGENTS.md after commit, keep --base HEAD, and add a test that invalid base refs fail closed rather than falling back.
Module-Level Documentation ❌ Error Several new modules start with imports or declarations, not a top-of-file docstring, e.g. src/workflows/dakar-review/config.ts, main.ts, model-routing.ts, shell.ts and task-graph.ts. Add a clear module docstring to every JS/TS file, especially the dakar-review source modules, stating each file’s purpose and how it relates to the surrounding workflow.
Unit Architecture ❌ Error FAIL: readAgentInstructions() returns null for every git show failure, so invalid bases/permissions are hidden and the CLI silently drops trusted instructions. Return a structured error for non-ENOENT git failures, only treat missing AGENTS.md as null, and add tests for invalid base/permission failures.
Docstring Coverage ⚠️ Warning Docstring coverage is 7.41% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Testing (Property / Proof) ⚠️ Warning New range-based invariants are only covered by example tests; the PR does not recommend property-based or proof-style checks for them. Add fast-check property tests for config/task/candidate invariants, or justify bounded examples; make any proof-like claim rigorous with an exhaustive check.
Observability ⚠️ Warning Record retries and AGENTS git failures are hidden: no retry metric/log is emitted, and readAgentInstructions() returns null for any git error. Emit a bounded retry metric or log for record attempts, and distinguish missing AGENTS.md from bad git refs with an explicit error or warning.

@leynos

leynos commented Jul 14, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

1 similar comment
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
sed -n '1,80p' tests/workflow-candidate-paths.test.mjs

Length of output: 2782


Confirmed. Line 20-50 area now defines TASK_GRAPH[0].maxFindings = 2, and a dedicated test — normalizeCandidates enforces the per-task finding cap before the global cap — exercises the cap with three candidates against a cap of two, plus a property test proving the cap holds for arbitrary sizes. The concern is resolved.

@coderabbitai

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

leynos added 12 commits July 15, 2026 22:38
Define the ODW-specific TypeScript compilation boundary, module ownership,
freshness checks, and behaviour-preserving validation sequence.

Record the architectural decision, update component and contributor
documentation, and align the roadmap with the reviewed ExecPlan.
Record explicit implementation approval and move the living ExecPlan into progress with baseline gate evidence.
Pin the contributor TypeScript and esbuild toolchain, declare the ambient ODW surface, and test both configured-project and erasable-syntax constraints.
Add the fail-closed esbuild compiler, strict runtime manifest, atomic freshness checks, typed workflow entry, and trust-boundary regressions while preserving the canonical ODW artefact.
Read repository AGENTS.md content from the base Git object so reviewed working-tree changes cannot inject workflow instructions.
Split configuration, routing, task planning, candidates, and prompts into directly tested TypeScript modules while retaining orchestration in the generated workflow entry.
Synchronize the architecture, contributor practices, user runtime contract, roadmap, and living execution plan with the implemented TypeScript source split.
Close the execution plan and roadmap slice with deterministic-build, isolated live-recording, same-head skip, and final review evidence.
Validate trusted instructions and external workflow arguments, enforce
bounded task and retry behaviour, and keep generated artefact checks
portable across line endings.

Add focused examples and properties for every corrected boundary, document
record retry observability, and align contributor guidance with the compiled
ODW source contract.
Align the two remaining section references with the existing British-English
`Artefacts and notes` heading.
Add concise JSDoc contracts for the workflow entry, exported functions,
constants, interfaces, and type aliases without changing generated runtime
behaviour.
Resolve trusted instruction reads through an immutable commit and derive
review-history destinations from trusted repository and state-root inputs.

Apply deterministic source ordering before candidate caps, reject fractional
chunk sizes, and omit misleading unscoped diff commands for empty tasks.
Document the resulting contracts and add regression coverage for each review
finding.
@leynos

This comment was marked as resolved.

@leynos

leynos commented Jul 16, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

Parse metadata banners structurally, detect assignment aliases, and reject
conflicting model reasoning before workflow execution.

Validate complete Record acknowledgements and SHA-1 or SHA-256 review heads,
with focused regressions for each fail-closed boundary. Document the authored
JSDoc coverage convention and updated validation evidence.
@leynos

leynos commented Jul 16, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot]

This comment was marked as resolved.

Preserve Unicode candidate identity, reject mismatched or duplicate verifier
responses, and reconcile accepted overflow before applying report limits.

Keep synthesis metrics out of persisted workflow telemetry, retry incomplete
Record acknowledgements, emit a leading generated module docstring, and align
the completed ADR and ExecPlan wording.
@leynos

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

Add a repository validation command with an explicit authored-source scope
and enforce the 80 percent threshold through `make check`.

Document the remaining internal workflow helpers and reconcile the completed
ExecPlan with its approval history and final validation record.
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '=== Target file outlines ==='
ast-grep outline src/workflows/dakar-review/candidates.ts --items all
ast-grep outline src/workflows/dakar-review/main.ts --items all
ast-grep outline src/workflows/dakar-review/schemas.ts --items all
ast-grep outline scripts/build-workflow.mjs --items all
ast-grep outline tests/workflow-candidate-paths.test.mjs --items all
ast-grep outline tests/workflow-orchestration.test.mjs --items all

echo '=== Candidate identity and verdict reduction ==='
rg -n -C 10 'candidateKey|normalizeCandidates|acceptedFromVerdicts|discardedFromVerdicts|candidateId' \
  src/workflows/dakar-review/candidates.ts

echo '=== Verification, synthesis metrics, record predicate and retry ==='
rg -n -C 12 'scheduledCandidate|candidateId|synthesis|metrics|recordInput|isCompleteRecord|recordAttempts|sleep\(' \
  src/workflows/dakar-review/main.ts

echo '=== Synthesis schema metrics ==='
rg -n -C 8 'SYNTHESIS_SCHEMA|metrics|additionalProperties' src/workflows/dakar-review/schemas.ts

echo '=== Generated artefact and meta source headers ==='
head -n 12 workflows/dakar-review.js
head -n 12 src/workflows/dakar-review/meta.js

echo '=== Targeted test evidence ==='
rg -n -i -C 5 'unicode|non.latin|chinese|cyrillic|candidateId|duplicate|mismatch|synthesis.*metric|metric.*synthesis|malformed|recordAttempts|three attempts|sleepDelays' \
  tests/workflow-candidate-paths.test.mjs tests/workflow-orchestration.test.mjs tests/review-state.test.mjs

echo '=== Documentation headers and documented declarations ==='
for f in src/workflows/dakar-review/*.{ts,d.ts,js} bin/dakar-review.mjs scripts/build-workflow.mjs; do
  test -f "$f" || continue
  echo "--- $f ---"
  sed -n '1,8p' "$f"
  rg -n '^\s*/\*\*|^export (async )?function|^export (interface|type|const)|^(async )?function workflowMain' "$f" || true
done

echo '=== Documentation coverage tooling and ExecPlan wording ==='
rg -n -i -C 3 'docstring|documentation.coverage|coverage' package.json Makefile tests scripts docs AGENTS.md || true
rg -n -i -C 3 'status:|approval|approve|implementation|complete|115 tests' \
  docs/execplans/compile-dakar-review-workflow.md

Length of output: 94885


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '=== Documentation audit implementation ==='
cat -n scripts/check-docstrings.mjs

echo '=== Audited source inventory ==='
fd -t f -e ts -e js . src/workflows/dakar-review bin | sort

echo '=== Functions, classes, exported types/interfaces/constants selected by source syntax ==='
for f in bin/dakar-review.mjs src/workflows/dakar-review/*.{ts,d.ts,js}; do
  test -f "$f" || continue
  echo "--- $f ---"
  rg -n '^(export\s+)?(async\s+)?function\s+[A-Za-z_$][A-Za-z0-9_$]*|^export\s+(class|interface|type|const)\s+[A-Za-z_$][A-Za-z0-9_$]*' "$f" || true
done

echo '=== JSDoc immediately preceding declarations, including single-line forms ==='
for f in bin/dakar-review.mjs src/workflows/dakar-review/*.{ts,d.ts,js}; do
  test -f "$f" || continue
  echo "--- $f ---"
  rg -n -U '/\*\*[\s\S]*?\*/\s*\n\s*(export\s+)?(async\s+)?function|/\*\*[\s\S]*?\*/\s*\n\s*export\s+(class|interface|type|const)' "$f" || true
done

echo '=== Approval-transition language in the completed ExecPlan ==='
sed -n '1,36p;145,185p;468,485p;995,1018p' docs/execplans/compile-dakar-review-workflow.md

Length of output: 49152


@leynos, mark all nine checks resolved. No further implementation work or follow-up issue is required.

Check Status Verified evidence
Testing (Overall) ✅ Resolved Preserve Unicode candidate identity with NFKC normalization and Unicode letter/number classes in candidateKey(). Test Chinese and Cyrillic titles as distinct keys. Reject mismatched and duplicate verifier IDs in tests/workflow-orchestration.test.mjs. Reject model-controlled synthesis metrics from returned and persisted workflow metrics.
Module-Level Documentation ✅ Resolved Start workflows/dakar-review.js with its generated-artifact /** @file ... */ header on Line 1.
Unit Architecture ✅ Resolved Carry { scheduledCandidate, verdict } throughout Verify. Reject unknown, mismatched, duplicate, incomplete, and invalid downgrade verdicts before reduction. Build recordInput.metrics only from workflow-controlled values; do not spread synthesis.metrics.
Security And Privacy ✅ Resolved Do not copy synthesis.metrics into metrics, recordInput, or the returned trusted metrics. appendReview() therefore cannot persist model-provided arbitrary metrics through this route.
Docstring Coverage ✅ Resolved Use the new deterministic audit: scripts/check-docstrings.mjs audits module headers, named functions, exported interfaces/types, and exported constants across the authored CLI and workflow source. The ExecPlan records 103/103 documented symbols (100.00%), exceeding the 80% threshold.
Developer Documentation ✅ Resolved Keep Status: COMPLETE, completed WI-0 wording, the completed 115-test outcome, and the revision note consistent. The former future-tense approval instruction has been converted to historical completion language.
Domain Architecture ✅ Resolved Retain Unicode-safe candidate identity. Do not move record retry/sleep orchestration out of main.ts: it is intentionally the ODW composition root and the sole caller of injected primitives. The retry loop now uses injected sleep(), while pure modules remain free of ODW runtime dependencies.
Observability ✅ Resolved Keep bounded, workflow-derived metrics only: task and finding counts, discard reasons, model assignments, diff stat, warnings, and retry attempts. Do not persist arbitrary synthesis metadata.
Concurrency And State ✅ Resolved Continue retries until isCompleteRecord() verifies all three conditions: ok === true, a non-blank stateFile, and a headCommit exactly matching the prepared head. The regression suite proves that malformed successful acknowledgements consume all three attempts.

No AI-agent prompt is needed because no reported item remains open.

@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot]

This comment was marked as resolved.

Reject audits that discover no symbols and cover the command boundary with
empty, documented, and below-threshold fixtures.

Recognize bind-wrapped injected primitive calls in the workflow source guard.
@leynos

leynos commented Jul 17, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

@leynos

leynos commented Jul 17, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Have the following now been resolved?

tests/workflow-build.test.mjs (1)

290-298: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Detect .bind()-wrapped primitive invocations.
Handle bind alongside call and apply; otherwise phase.bind(null)('Review') bypasses the enforced main.ts-only primitive boundary. Add that form to the unsafe regression fixture.

Proposed fix
-      if (ts.isPropertyAccessExpression(expression) && ['call', 'apply'].includes(expression.name.text)) {
+      if (ts.isPropertyAccessExpression(expression) && ['call', 'apply', 'bind'].includes(expression.name.text)) {

As per coding guidelines, add a regression test for each bug fix.

🤖 Detailed instructions

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @tests/workflow-build.test.mjs around lines 290 - 298, Extend the
property-access check in the primitive invocation analysis to recognize bind
alongside call and apply, preserving the existing receiver and symbol validation
before recording the primitive call. Update the unsafe regression fixture to
include a bind-wrapped invocation such as phase.bind(null)('Review') and verify
it is rejected outside main.ts.

Source: Coding guidelines

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

ast-grep outline tests/workflow-build.test.mjs --items all

echo "=== primitive-call analysis near the reported range ==="
sed -n '260,325p' tests/workflow-build.test.mjs

echo "=== primitive-boundary regression fixture and assertion ==="
rg -n -C 18 'unsafe|primitive|\.call|\.apply|\.bind|main\.ts' tests/workflow-build.test.mjs

Length of output: 13976


@leynos, mark this resolved.

tests/workflow-build.test.mjs now recognizes .bind() alongside .call() and .apply() at Line 290, while preserving the existing receiver unwrapping and primitive-symbol validation.

The unsafe fixture at Line 313 includes:

phase.bind(null)("Bound")

The expected detected-call list at Line 317 includes the corresponding phase entry. Removing bind from the analyzer would make that regression fail, so the bypass is covered.

coderabbitai[bot]

This comment was marked as resolved.

Return phase-specific failures when configuration, preparation, or synthesis
agent calls reject instead of allowing those errors to escape the workflow.

Exclude ambient declarations from runtime docstring coverage and pin the
default audit scope with a regression fixture.
@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@leynos

leynos commented Jul 17, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Have the following now been resolved?

src/workflows/dakar-review/main.ts (1)

97-107: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Convert direct agent rejections into stage-tagged failures.
The test agent can reject, but these three calls sit outside parallel, pipeline, and the Record try block. Catch each rejection and return { ok: false, stage: 'config' | 'prepare' | 'synthesize', error } instead of rejecting workflowMain().

  • src/workflows/dakar-review/main.ts#L97-L107: catch Resolve Config invocation failures.
  • src/workflows/dakar-review/main.ts#L124-L134: catch Prepare invocation failures.
  • src/workflows/dakar-review/main.ts#L327-L337: catch Synthesize invocation failures.
  • workflows/dakar-review.js#L637-L647: regenerate this Resolve Config block.
  • workflows/dakar-review.js#L657-L667: regenerate this Prepare block.
  • workflows/dakar-review.js#L819-L829: regenerate this Synthesize block.
  • tests/workflow-orchestration.test.mjs#L9-L58: add one fail-closed regression for each direct phase.
    As per coding guidelines, “Add a regression test for each bug fix” and do not edit the generated artefact directly.
🤖 Detailed instructions

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @src/workflows/dakar-review/main.ts around lines 97 - 107, Wrap the direct
agent invocations in workflowMain with rejection handling so Resolve Config,
Prepare, and Synthesize return stage-tagged failures ({ ok: false, stage:
'config' | 'prepare' | 'synthesize', error }) instead of rejecting. Update
src/workflows/dakar-review/main.ts:97-107, 124-134, and 327-337, then regenerate
the corresponding blocks in workflows/dakar-review.js:637-647, 657-667, and
819-829 rather than editing the generated artifact directly. Add one fail-closed
regression for each direct phase in tests/workflow-orchestration.test.mjs:9-58.

Sources: Coding guidelines, Learnings

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '=== main workflow outline ==='
ast-grep outline src/workflows/dakar-review/main.ts --items all

echo '=== direct phase calls and error handling in TypeScript source ==='
rg -n -C 14 'config-resolve|state-prepare|synthesis|stage: .(config|prepare|synthesize).|agent\(' \
  src/workflows/dakar-review/main.ts

echo '=== generated workflow counterparts ==='
rg -n -C 12 'config-resolve|state-prepare|synthesis|stage: .(config|prepare|synthesize).|agent\(' \
  workflows/dakar-review.js

echo '=== orchestration harness and direct-phase failure tests ==='
ast-grep outline tests/workflow-orchestration.test.mjs --items all
rg -n -i -C 10 'failedLabel|config-resolve|state-prepare|synthesis|stage|reject|throw|failure' \
  tests/workflow-orchestration.test.mjs

echo '=== build/freshness configuration references ==='
rg -n -C 3 'workflow:build|workflow:freshness|workflow-build|workflow-freshness' \
  package.json Makefile

Length of output: 38299


@leynos, mark this resolved.

  • Catch rejected config-resolve calls in src/workflows/dakar-review/main.ts Lines 99–112 and return { ok: false, stage: 'config', error }.
  • Catch rejected state-prepare calls in Lines 131–144 and return { ok: false, stage: 'prepare', error }.
  • Catch rejected synthesis calls in Lines 339–352 and return { ok: false, stage: 'synthesize', error }.
  • Preserve original Error.message values and stringify non-Error rejections.
  • Regenerate workflows/dakar-review.js; it contains the matching handlers in its Resolve Config, Prepare, and Synthesize blocks.
  • Cover every fix in tests/workflow-orchestration.test.mjs Lines 98–109. The parameterized regression injects a rejected agent for each of config-resolve, state-prepare, and synthesis, then asserts the exact stage-tagged result:
{ ok: false, stage, error: 'fixture failure' }

No remaining work is required for this finding.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants