feat: use YAML for harness project configuration - #2297
aidandaly24 wants to merge 8 commits into
Conversation
Keep YAML configuration failures user-classified, validate project prompt references before literal-domain validation, and reject FIFO sources without blocking. Build the generated CDK app before tests to prevent missing or stale executable output.
|
Claude Security Review: no high-confidence findings. (run) |
There was a problem hiding this comment.
AgentCore Harness Review
Verdict: Looks good
Nice migration from harness.json to harness.yaml. The design is careful and the test coverage is thorough — I especially appreciated:
- The FIFO / symlink-race hardening in
readPrompt(nonblockingO_RDONLY+ post-openstat), and the subprocess-bounded test. - The YAML alias / shared-node test in
harnessConfig.test.ts("does not read misplaced prompt keys or overwrite shared YAML aliases") — the shallow-clone-on-descent in the reader threads that needle correctly. - The obsolete-JSON diagnostic in both readers, and the migration guidance in
README.mdcovering the copiedagentcore/cdkapp. - Running the same reader test suite against both the CLI copy (
src/io/harnessConfig.ts) and the vended CDK copy (src/assets/cdk/io/harnessConfig.ts), which mitigates drift between the near-duplicate files. - The
HarnessAuthoringSchemasplit that keepsfile://references out ofHarnessSpecSchemawhile still surfacing empty-file://errors before any files are written. test("reports schema errors with the YAML path before creating export output", ...)asserts export output isn't created on failure.
Nothing worth blocking on. A couple of small non-blocking notes for future consideration:
- The CLI and CDK reader files are nearly line-for-line duplicates (only the error-wrapping differs). The shared cross-runner test loop makes drift detectable, but a longer-term refactor to share source (e.g., via
@aws/agentcore-cdk) would be nicer. readFile(configPath, "utf8")has no size guard on the YAML itself (only the referenced prompt files are capped at 1 MiB). Low risk for author-controlled input, but a cheapstatguard would be consistent with the prompt-file policy.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor #2297 +/- ##
============================================
+ Coverage 97.09% 97.11% +0.02%
============================================
Files 578 581 +3
Lines 39639 39880 +241
============================================
+ Hits 38486 38729 +243
+ Misses 1153 1151 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Claude Security Review: no high-confidence findings. (run) |
|
Claude Security Review: no high-confidence findings. (run) |
TextDecoder removes the leading BOM by default. Set ignoreBOM alongside fatal in both readers to preserve prompt contents without weakening UTF-8 validation. Cover main, summary, and conventional prompts plus BOM-only rejection through the shared reader suite.
|
Claude Security Review: no high-confidence findings. (run) |
|
Claude Security Review: no high-confidence findings. (run) |
|
Claude Security Review: no high-confidence findings. (run) |
|
Claude Security Review: no high-confidence findings. (run) |
Summary
harness.jsonfiles with commentedharness.yamlconfiguration.file://prompt references and enable managed memory for newly scaffolded harnesses.Generated harness.yaml
Breaking change: Project harness configuration now uses
harness.yaml;harness.jsonis no longer supported.Testing
Observed service limitation: AWS runtime creation rejected a summary prompt with a trailing newline. The successful smoke run used a single-line summary; the CLI does not trim prompt contents.