P0: agent edit-loop trust & teaching (CRLF fix, pre-flight discoverability, prescriptive errors)#38
Closed
lukaisailovic wants to merge 5 commits into
Closed
P0: agent edit-loop trust & teaching (CRLF fix, pre-flight discoverability, prescriptive errors)#38lukaisailovic wants to merge 5 commits into
lukaisailovic wants to merge 5 commits into
Conversation
appendLines joined and separated rows with LF regardless of the target file's existing dialect, so appending to a CRLF file (via an action or a connector) mixed in LF and corrupted it. Detect the dialect from the existing content and use it for the separator, the join, and the trailing newline. Adds a CRLF/LF regression test over the public resolveWriter path.
…es pre-flight
Shift discoverability left so agents stop guessing:
- listIslands lists each island's optional field NAMES (not full schemas —
names only, no keystone bloat), alongside required.
- getOverview returns hints pointing at runSql({dataset}) read-back,
patchManifest's section deep-merge, and runAction/runSync.
- getIslandSchema notes carry copyable examples for the chronically-guessed
shapes (drilldown, gauge.goal goals, content.editor file/dir).
… errors When an agent guesses a nested shape wrong, the validator dropped to generic Zod text that names the rule, not the correct shape. Append a copyable correct-shape example to the four chronically-guessed structures — drilldown, gauge.goal goals, content.editor, and the select page filter — on both the generic Zod path and the semantic checks. Failure-path only; no schema, type, or validation-outcome change.
…tion
runActions([{ action, rows }, ...], { atomic }) runs several action inserts as
one unit. atomic (default true) validates every call's rows first and writes
nothing if any is invalid; a mid-batch write failure rolls back the writes
already applied in reverse order — restoring a snapshot, or removing a
newly-created file. Returns per-call { action, inserted, checkpoint_id } plus
checkpoint_ids.
BREAKING CHANGE: the singular runAction(name, rows) is removed — call
runActions([{ action: name, rows }]) for a single insert. The form.entry schema
description is updated to match.
…templates Replace every runAction reference with runActions in the MCP/data docs, the agent skill (and its synced template copies), and the example/template READMEs. Add two golden-path recipes to start.md and the skill: an atomic parent+children multi-write, and deriving a metric with a SQL transform.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
P0 — Trust & teaching
The MCP edit loop is the product and the agent is its user. Pass-1 research found most "missing features" already exist — the real cost is discoverability and trust: every place an agent guesses wrong burns a guess→fail→retry cycle. This is the P0 slice of
PLAN.md: cheap, hits every session, restores the "actions are safe" promise.Three independent workstreams, one package each:
fix(compiler)— CRLF append corruptionappendLinesjoined and separated rows with LF regardless of the file's existing line-ending dialect, so appending to a CRLF file (via an action or a connector — both route here) mixed in LF and corrupted it. Now it detects the dialect from existing content and uses it for the separator, the join, and the trailing newline. Regression test covers CRLF preservation and LF-stays-LF over the publicresolveWriterpath.feat(mcp-server)— pre-flight discoverability (shift knowledge left)listIslandsnow lists each island's optional field NAMES alongside required — so capabilities likedrilldown/targetare visible before the agent acts. Names only, not full schemas (avoids the prior keystone-bloat incident).getOverviewreturnshintspointing at the under-discovered affordances:runSql({dataset})read-back,patchManifest's section deep-merge (don't resend the whole manifest), andrunAction/runSync.getIslandSchemanotescarry copyable examples for the chronically-guessed shapes (drilldown,gauge.goalgoals,content.editorfile/dir).feat(schema)— prescriptive structural errorsThe validator's diagnosis is good (names page/index/type/field) but its prescription dropped to generic Zod text for nested structures. Now a copyable correct-shape example is appended to the four chronically-guessed structures —
drilldown,gauge.goalgoals,content.editor, and theselectpage filter — on both the generic Zod path and the semantic checks. Failure-path only; no schema, type, or validation-outcome change (a valid manifest stays valid, an invalid one keeps the same{page,index,type,field}). The in-loop example JSON matches thegetIslandSchemanotes byte-for-byte.Verification
pnpm build && pnpm typecheck && pnpm test && pnpm lint— all green.pnpm validate:templates— all 4 templates valid (confirms the validator change is failure-path only). Per-package: schema 171, compiler 154, mcp 148+3 new, runtime 389.Out of scope (deliberately)
P1+ from the plan:
runActions({atomic}), delete/update action modes,previewDatasetalias, richer templates/examples page, connector copy, telemetry. This PR is P0 only.