Skip to content

Commit e2100c7

Browse files
authored
Merge pull request #332 from knockout/docs/agent-context
AGENTS.md: agent context + testing framed as additive coverage
2 parents 94413fe + 1d53977 commit e2100c7

1 file changed

Lines changed: 32 additions & 2 deletions

File tree

AGENTS.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ Repository: https://github.com/knockout/tko
88
Docs: https://tko.io
99
License: MIT
1010

11+
## Context for every agent
12+
13+
Two things shape the coverage/safety bar here more than any specific rule:
14+
15+
- **Low-level framework with an unknown audience.** Observables, computeds, binding engine — infrastructure, not an app. Published to npm and used in apps the maintainers will never see, including high-stakes ones. A regression hits every downstream consumer.
16+
- **Dark-factory thesis.** Small teams plus AI agents maintaining what once took a big team. Tests carry the load human review used to.
17+
18+
Together: coverage and signal are expensive to lose and cheap to keep. When a change trades either away, say so explicitly and justify the delta.
19+
1120
## Project Structure
1221

1322
Monorepo with Bun workspaces.
@@ -59,8 +68,9 @@ Individual packages can be built from their directory with `bun run build`.
5968
- **Test files**: `packages/*/spec/**/*.ts`, `builds/*/spec/**/*.js`
6069
- **Run**: `bunx vitest run` (all tests) or `bunx vitest run <path>` (single file)
6170

62-
Tests run in a real browser via Playwright — not jsdom. This is required
63-
because TKO does low-level DOM manipulation, MutationObserver, and event handling.
71+
Today the suite runs in a real-browser matrix (chromium, firefox, webkit) — authoritative because the binding layer is exercised against real DOM behavior. Additional environments (happy-dom, node, bun, TUI shims, …) should **add** coverage for runtimes TKO should work in; they are not a substitute for the authoritative matrix. If a PR replaces a runner, environment, or matrix target, say so explicitly in the PR and justify the coverage delta. A test failing in a new environment is usually signal (missing polyfill, env-scoped behavior worth documenting, or a test that assumed too much) — investigate before excluding.
72+
73+
Fast local iteration: scope the run (`bunx vitest run packages/observable`, ~1s warm).
6474

6575
## Code Style
6676

@@ -183,6 +193,26 @@ When a feedback loop fails, fix the loop — not just the symptom. Examples: `bu
183193

184194
Avoid scope creep. If an improvement would balloon the PR, file a follow-up issue or spawn a separate task instead.
185195

196+
## Review Your Own Change Adversarially
197+
198+
Before declaring a change done, steelman the case against it. Ask what could go wrong, what assumption could be false, what future goal it quietly forecloses, what coverage or signal it weakens, who it surprises. Get an independent second pass (a colleague, a subagent where available) on changes that touch framework internals, test coverage, public APIs, or docs the whole team relies on.
199+
200+
This is the ceiling on "Always Improve": that section pushes toward *more* in a PR; this one pushes toward *scrutiny* of what's in it. Use both — improve in scope, audit the scope itself here.
201+
202+
Failure modes specific to a published low-level framework, worth probing every time:
203+
- Backwards-compat breaks in `@tko/build.knockout` (the legacy surface consumers rely on)
204+
- Subscription / computed / DOM-listener disposal leaks
205+
- Perf regressions in hot paths (observable read, dependency tracking, binding apply)
206+
- Public `@tko/*` API changes shipped without a changeset
207+
- Import-time side effects that poison the module graph
208+
- Trading coverage or signal for speed/convenience
209+
- Locking in the current shape of the project with presumptive rules
210+
- Patching the symptom, not the root cause
211+
- Unrelated refactors or opportunistic redesigns that balloon the PR (the "Always Improve" bar is *small, low-risk, in-scope* fixes — anything larger belongs in its own PR)
212+
- Silent assumptions about environment, timing, or ordering
213+
214+
If the change doesn't survive a ten-minute attempt to poke holes in it, it's not ready.
215+
186216
## Important Guidelines
187217

188218
- Do not modify `tools/build.ts` or `vitest.config.ts` without understanding

0 commit comments

Comments
 (0)