@deslop/coding-standards 0.1.1082 → 0.1.1085
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -8
- package/dist/{MutableList-BCF17jPH.mjs → MutableList-NTBI6AHW.mjs} +231 -8
- package/dist/install.js +35 -80
- package/dist/oxlint.d.ts +86 -4
- package/dist/oxlint.js +837 -147
- package/package.json +1 -1
- package/skills/design/SKILL.md +52 -129
- package/skills/engineering/SKILL.md +193 -128
- package/skills/review/SKILL.md +37 -35
- package/skills/architecture/EVALS.md +0 -21
- package/skills/architecture/SKILL.md +0 -39
- package/skills/design/EVALS.md +0 -46
- package/skills/engineering/EVALS.md +0 -34
- package/skills/review/EVALS.md +0 -24
- package/skills/testing/EVALS.md +0 -22
- package/skills/testing/SKILL.md +0 -64
package/skills/review/SKILL.md
CHANGED
|
@@ -1,58 +1,60 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: review
|
|
3
|
-
description: '
|
|
3
|
+
description: 'Use for any review, audit, critique or review round of code, a PR, a design, agent instructions or a PR body.'
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Review
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Do what a short seller does to a position: build the strongest case that the work is wrong from raw evidence (the code, real runs, data), never from the author's summary or rationale. Before you report, name what a top expert in the area would check that the brief did not ask for, and check it. Load every skill the work needed (engineering for code, design for visible output, and the other skills the checkout has for the task) with the repository's `CODING_STANDARDS.md` and agent instructions; last, answer each loaded skill's Critique against the change, as its author should have: a question the change fails is a finding.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Findings
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Each finding: severity, `path:line`, the reaching input, actual and required outcome, the probe that showed it, the smallest fix.
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- **Probes.** Settle a suspicion with a probe per testing's Throwaway. Never start a service or test suite during read-only review.
|
|
20
|
-
- **Browser evidence.** Inspect the existing preview, captures, console and relevant requests without changing page state. Give the owner the smallest missing browser action and observable result to check; the owner drives the browser and records it. A screenshot proves a visible state, not unobserved timing, persistence or release behavior.
|
|
21
|
-
- **Test value.** Use testing to decide whether a permanent test protects a distinct plausible regression. Do not demand a new test for every finding when an inline probe or existing browser proof settles it.
|
|
22
|
-
- **Variants.** After reproducing a defect, look for the same root cause in its other real callers. Broaden one dimension at a time and stop when unrelated hypotheses replace concrete evidence.
|
|
14
|
+
| Severity | Meaning |
|
|
15
|
+
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
16
|
+
| P1 | Breaks a user or caller contract, loses data, misses a migration, leaks a secret, or a claim is false |
|
|
17
|
+
| P2 | Wrong owner, boundary or organization, rule violation, duplicated or dead code, or a mechanism, option or element the request does not need |
|
|
18
|
+
| P3 | Naming, wording or style |
|
|
23
19
|
|
|
24
|
-
|
|
20
|
+
- **Classes.** Report a defect class once, with every instance's `path:line`; never repeat a finding an earlier round raised and the author answered.
|
|
21
|
+
- **Rank honestly.** Never inflate a P3 to keep it alive; never pad a report with P3 to look thorough. Return P1 first; "Clean" with the covered scope when nothing reaches P2.
|
|
22
|
+
- **Not findings:** taste without a rule, hypothetical inputs no caller sends, defects the branch neither made nor relies on, what lint reports outside legacy lists.
|
|
23
|
+
- **Probe** a suspicion inline per engineering's Proof; never start a service or test suite in a read-only review.
|
|
25
24
|
|
|
26
|
-
##
|
|
25
|
+
## Code
|
|
26
|
+
|
|
27
|
+
- **Architecture first.** Before the lines, rebuild the change from the request alone: who owns each piece of state, the boundaries, the file and module organization, the data flow and the mechanism. The first pass usually gets this wrong, so attack it: wherever the change's shape differs from the simplest idiomatic one (fewer parts, the existing pattern, Effect's own building blocks), report it with that shape as the fix, even when every line is correct.
|
|
28
|
+
- **Depth.** Read every hand-written changed line; for generated output, the generator change and a sample. Trace each contract through its real consumers, failure paths, concurrency and resource ownership against the merge base. A whole-file refactor keeps every behavior the file had.
|
|
29
|
+
- **Simplicity.** Name each part the request does not need: a script, flag, option, wrapper, fallback, reimplemented library job, UI control or test, and each abstraction (helper, shared constant, generic, factory) that saves lines without lowering what a reader must hold. Name each block that duplicates code already in the repository, with both locations.
|
|
30
|
+
- **Requirements.** Map each of the user's requirements to the hunk and the proof that meet it; a requirement with neither is a finding, even when no line changed for it.
|
|
31
|
+
- **Production data.** A changed persisted shape without a migration that converts existing data is P1.
|
|
32
|
+
- **Beyond the diff.** A contradiction with an unchanged file, a stale reference the change leaves, or a false assumption it rests on.
|
|
33
|
+
- **Rounds.** Read the pushed head, never the author's working tree, which keeps changing: `gh pr diff <n>`, `glab mr diff <n>`, `git show <head>:<path>`. Judge the layer as one change; spend depth on commits since the last reviewed one. A stack overview reports what crosses layers: duplication, a contract one layer breaks for another, code in the wrong layer.
|
|
34
|
+
- **Browser.** Inspect the existing preview, captures, console and requests without changing page state; name the smallest missing check for the author.
|
|
27
35
|
|
|
28
|
-
|
|
36
|
+
## Cleanup audit
|
|
29
37
|
|
|
30
|
-
|
|
31
|
-
- **Supersede:** features and versions that the final direction replaced, compatibility for unreleased versions, and capabilities that only a test or demo needed.
|
|
32
|
-
- **Simplify:** the same behavior with less code or a clearer layout: files, folders and names that break the repository's layout, dead code, unused exports, duplicate logic, layered overrides, no-ops and workarounds.
|
|
33
|
-
- **Cut:** anything the request does not need: features, function branches, files, libraries, settings, config values, UI elements, and machinery such as budgets, retries, caches, fallbacks, queues, daemons and dependency patches. Name what the user loses without each one; when he loses nothing, it goes.
|
|
34
|
-
- **Keep:** a required outcome, dependency, reachable existing contract or useful regression proof. Quote the requirement or show the caller and the input that break without it.
|
|
38
|
+
Classify every changed hunk against the request; the author's plan authorizes nothing. One row per item: path and lines, class, evidence, smallest change, what it breaks.
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
- **Revert:** unrelated formatting, renames, reordering.
|
|
41
|
+
- **Supersede:** what the final direction replaced, compatibility for unreleased versions, capabilities only a test or demo needed.
|
|
42
|
+
- **Simplify:** the same behavior with less code: dead code, unused exports, duplicate logic, layered overrides, near-empty files, each cast or suppression with its typed alternative.
|
|
43
|
+
- **Cut:** what the request does not need: features, branches, files, libraries, settings, UI elements, budgets, retries, caches, fallbacks, queues, daemons. Name what the user loses; nothing lost, it goes.
|
|
44
|
+
- **Keep:** a required outcome or reachable contract, with the caller that breaks without it.
|
|
37
45
|
|
|
38
|
-
##
|
|
46
|
+
## Approach critique
|
|
39
47
|
|
|
40
|
-
|
|
48
|
+
Compare different mechanisms, including a smaller one; test the strongest counterexample and the weakest assumption. Return the recommendation, its deciding reason and the observation that would change it.
|
|
41
49
|
|
|
42
50
|
## Instruction review
|
|
43
51
|
|
|
44
|
-
|
|
52
|
+
Read the affected prompts, skills, references and settings whole, as one system. Report contradictions, duplicated rules, a rule in the wrong owner, rules no agent can act on, text that changes no action, wording that over-explains what a frontier model infers from a leading word, stale names, paths and models. Check each rule against the real tool behavior it assumes. Rank by how much agent behavior each finding changes.
|
|
45
53
|
|
|
46
|
-
|
|
54
|
+
- **Missed or missing.** For a failure, read the transcript first: a skill that never loaded needs its trigger fixed; a clear rule that loaded and was ignored needs a better place or form, not more words.
|
|
55
|
+
- **Form.** Wrong-shaped output gets a recipe or a good example, an omission a required slot, a conditional behavior an observable trigger; a prohibition alone only names the mistake.
|
|
56
|
+
- **Settle** disputed wording by how agents behaved in real threads, not by debate.
|
|
47
57
|
|
|
48
58
|
## Body reader
|
|
49
59
|
|
|
50
|
-
Read the published
|
|
51
|
-
|
|
52
|
-
- A risk that a tired reviewer misses: a migration, contract change or removed behavior the published body does not name.
|
|
53
|
-
- A claim that a capture or the code contradicts.
|
|
54
|
-
- A ticket requirement without proof.
|
|
55
|
-
- A capture that is unreadable, ends before its outcome, or shows loading that is not the claim.
|
|
56
|
-
- Each departure from the repository's publishing contract or the available delivery skill.
|
|
57
|
-
|
|
58
|
-
Return each finding with the section, the evidence and the smallest fix.
|
|
60
|
+
Read the published PR as a reviewer who knows nothing else: the body, every capture downloaded from the host, the branch head and the source tickets. Report a risk the body does not name (migration, contract, removed behavior), a claim the code or a capture contradicts, a ticket requirement without proof, and an unreadable capture.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Architecture evaluations
|
|
2
|
-
|
|
3
|
-
## architecture
|
|
4
|
-
|
|
5
|
-
### Task
|
|
6
|
-
|
|
7
|
-
Let me import a folder of data files, see progress and stop without losing completed records. Choose the architecture before writing product code. Explain only the decisions I need to make.
|
|
8
|
-
|
|
9
|
-
### Criteria
|
|
10
|
-
|
|
11
|
-
Judge the mechanism and caller obligations, not the number of modules or diagrams.
|
|
12
|
-
|
|
13
|
-
- Trace existing CLI, HTTP and browser consumers and preserve single-file behavior.
|
|
14
|
-
- Keep persistence and cancellation in the existing service and its operation scope.
|
|
15
|
-
- Reject an unnecessary job registry, detached writer, mirrored progress store and generic importer factory.
|
|
16
|
-
- Give completion one observable meaning: the emitted record is durable.
|
|
17
|
-
- Handle reachable read, decode and write failures without blanket retries or empty-success defaults.
|
|
18
|
-
- Use a disposable experiment for an uncertain technical contract; decide an unresolved user outcome from exploration and show it beside the strongest alternative; ask no question.
|
|
19
|
-
- Name a concrete contract before adding a boundary, dependency or background lifetime.
|
|
20
|
-
|
|
21
|
-
Grade simplicity and preserved behavior separately. A written design does not prove its implementation. Keep integrated planning and steering evaluations separate from this selected-skill case.
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: architecture
|
|
3
|
-
description: 'Choose the smallest production mechanism, module boundaries, state owners and failure contracts. Use for new features, consequential refactors and reviews of architectural complexity; engineering owns syntax and implementation conventions.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Architecture
|
|
7
|
-
|
|
8
|
-
Start from a real caller and the required outcome, not a pattern or framework. Apply engineering to the implementation. A new abstraction must remove a concrete obligation from its callers.
|
|
9
|
-
|
|
10
|
-
## Trace the operation
|
|
11
|
-
|
|
12
|
-
Read the nearest working feature and every affected consumer. Trace one successful operation and its strongest reachable failure through the existing modules. Identify the authoritative state, write boundary, resource lifetime and observable completion signal. Preserve the existing contracts that the change reaches.
|
|
13
|
-
|
|
14
|
-
Before code, settle these facts in the current plan, without creating another document:
|
|
15
|
-
|
|
16
|
-
- The caller's input, output and ordering obligations.
|
|
17
|
-
- One owner for each value, resource, side effect and failure.
|
|
18
|
-
- The existing module that can own the operation.
|
|
19
|
-
- The boundary where untrusted input becomes trusted data.
|
|
20
|
-
- What remains durable after interruption, and how the caller knows.
|
|
21
|
-
|
|
22
|
-
Settle technical mechanisms with source or a probe per testing's Throwaway. File layout, module boundaries, public interfaces and names follow engineering's Taste.
|
|
23
|
-
|
|
24
|
-
## Choose the smallest mechanism
|
|
25
|
-
|
|
26
|
-
- **Existing shape.** Extend the canonical example from engineering's Patterns before creating a service, module or dependency.
|
|
27
|
-
- **Direct operation.** Prefer a function or existing service method. Add a service for a distinct capability or lifetime, not to rename a forwarded call. Add another backend only when a real consumer needs it.
|
|
28
|
-
- **Authoritative state.** Derive values from their owner. Do not mirror server state, request state, caches or pending results in another store. A persisted value has one write boundary.
|
|
29
|
-
- **Lifetime.** Keep finite request work in its request scope. A stream serves progressive results; it does not require a job system. Add background ownership only when work must survive the caller, with a real owner for stopping, recovery and completion.
|
|
30
|
-
- **Failure.** Handle failures the caller can reach, and keep domain identity, causes and completed work through them. Never turn a failure into empty success.
|
|
31
|
-
- **Retries.** For a contract that permits retry after an unknown write outcome, keep the request identity stable for one intent. Add no retry policy or idempotency machinery to operations that do not need that contract.
|
|
32
|
-
- **Boundaries.** Split code when dependencies, invariants or lifetimes differ. Prefer a substantive module to a chain of forwarding files.
|
|
33
|
-
- **Variations.** Use explicit variants for genuinely different behaviors. Do not add boolean combinations, a plugin registry, a generic configuration object or a universal factory for hypothetical callers.
|
|
34
|
-
|
|
35
|
-
Compare a new mechanism with the direct existing-module version. Count new state owners, boundaries, dependencies and failure paths, not just lines. Keep the simpler version unless a concrete contract rules it out. Prove that contract with a question-sized experiment.
|
|
36
|
-
|
|
37
|
-
## Challenge the design
|
|
38
|
-
|
|
39
|
-
Try the strongest reachable counterexample: an interrupted write, repeated intent, stale response, overlapping caller or dependency failure. Check which owner preserves the invariant. Use testing to select evidence, not to turn every doubt into a permanent test. Do not defend an abstraction because it is already implemented: state what breaks without it, and remove it when nothing does.
|
package/skills/design/EVALS.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# design evaluations
|
|
2
|
-
|
|
3
|
-
## design
|
|
4
|
-
|
|
5
|
-
### Task
|
|
6
|
-
|
|
7
|
-
Make importing records clear and comfortable on my iPhone, including progress, stopping and seeing what was kept. Show me the design before changing the service.
|
|
8
|
-
|
|
9
|
-
### Criteria
|
|
10
|
-
|
|
11
|
-
Judge the browser experience, not the amount of UI produced.
|
|
12
|
-
|
|
13
|
-
- Use the existing import workspace and realistic record names.
|
|
14
|
-
- Make idle, active, cancelled, completed and empty states understandable.
|
|
15
|
-
- Keep completed records visible when the import stops; distinguish stop from undo.
|
|
16
|
-
- Establish readable light and dark views at 390-point width, touch targets and keyboard access.
|
|
17
|
-
- Show the representative journey early in the real host and start the backend change at once; revise only the part the user's report steers.
|
|
18
|
-
- Remove redundant controls and status text; use interaction to explore a real consequence, not to navigate an explanation.
|
|
19
|
-
|
|
20
|
-
Inspect every visible state and transition. Grade hierarchy, behavior and readability independently of engineering and proof-capture quality. The user judges the final variants.
|
|
21
|
-
|
|
22
|
-
## overview-format
|
|
23
|
-
|
|
24
|
-
### Task
|
|
25
|
-
|
|
26
|
-
Give me a quick overview of these changes: Review moved into coding-standards; Architecture was added; open choices get an inline prototype beside the production code, with no approval wait; routine fixes need no prototype; proof uses inline probes before permanent tests. These instruction changes are local, not installed. There are no UI captures, measurements or interactive choices to show.
|
|
27
|
-
|
|
28
|
-
### Criteria
|
|
29
|
-
|
|
30
|
-
- Use a short Markdown table or list. Do not produce HTML, an image of the same rows, controls or a separate presentation app.
|
|
31
|
-
- Keep every supplied distinction, including routine fixes and installation state, with the fewest words that remain clear.
|
|
32
|
-
- Do not add an introduction or duplicate the overview in a summary.
|
|
33
|
-
- Judge the delivered artifact, not an explanation of format selection. Leave native-run behavior unproved until the case runs.
|
|
34
|
-
|
|
35
|
-
## animated-mechanism
|
|
36
|
-
|
|
37
|
-
### Task
|
|
38
|
-
|
|
39
|
-
Show why an importer must write a record before reporting progress. Show the record becoming durable, then the progress event, as a short automatic animation. Do not make me click. This is an illustrative explanation, not evidence from a real application.
|
|
40
|
-
|
|
41
|
-
### Criteria
|
|
42
|
-
|
|
43
|
-
- Use the animation to show the named record, durable storage and progress event in the correct causal order.
|
|
44
|
-
- Keep the message understandable without controls, extra introductions or duplicated prose.
|
|
45
|
-
- Distinguish illustration from application proof; inspect actual timing rather than inferring motion from a still.
|
|
46
|
-
- HTML adds the requested animated mechanism; a styled list of phases alone does not meet the task.
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# engineering evaluations
|
|
2
|
-
|
|
3
|
-
## engineering
|
|
4
|
-
|
|
5
|
-
### Task
|
|
6
|
-
|
|
7
|
-
Let me import a folder of data files, see progress and stop an import without losing completed records.
|
|
8
|
-
|
|
9
|
-
### Criteria
|
|
10
|
-
|
|
11
|
-
Judge the final patch and the full run, not task completion alone. Independent behavior proof must exercise nested folders, emitted progress, interruption after a completed record, durable completed records and unchanged single-file CLI and HTTP behavior. Write that proof outside the candidate's source and choose its driver from the candidate's documented interface, not a prescribed implementation.
|
|
12
|
-
|
|
13
|
-
- Use appropriate Effect primitives and the existing package boundaries.
|
|
14
|
-
- Keep both consumers on the shared service; remove the code, exports, configuration and docs the change supersedes.
|
|
15
|
-
- Use no unnecessary wrappers, runtimes, dependencies, retries or compatibility branches.
|
|
16
|
-
- Establish resource release and no further record writes after cancellation.
|
|
17
|
-
- List each corrective edit required before you would accept the patch.
|
|
18
|
-
|
|
19
|
-
Do not score agent-written test quality here; the testing case owns it.
|
|
20
|
-
|
|
21
|
-
## pattern-change
|
|
22
|
-
|
|
23
|
-
### Task
|
|
24
|
-
|
|
25
|
-
From now on we call imported entries "rows", not "records". Change it.
|
|
26
|
-
|
|
27
|
-
### Criteria
|
|
28
|
-
|
|
29
|
-
Judge the final patch and the full run. The user did not list the places; the agent must find them.
|
|
30
|
-
|
|
31
|
-
- Treat the request as a repository standard: change every visible term, route, identifier and document that names the old term, across the CLI, HTTP and browser consumers, in one change.
|
|
32
|
-
- Find the consumers with a search, migrate each one and run the search again before completion; report any occurrence kept on purpose with its reason.
|
|
33
|
-
- Keep behavior unchanged apart from the rename; add no alias, redirect or compatibility path.
|
|
34
|
-
- List each corrective edit required before you would accept the patch. Passing behavior checks is a prerequisite, not the quality score. Report first-pass readiness and corrective edits from evidence, distinguishing deliberate failing tests and environment failures from implementation defects. Leave a fact unobserved when the trace cannot establish it.
|
package/skills/review/EVALS.md
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Review evaluations
|
|
2
|
-
|
|
3
|
-
These cases and criteria are drafts for discussion with the user, not approved acceptance thresholds.
|
|
4
|
-
|
|
5
|
-
## review
|
|
6
|
-
|
|
7
|
-
### Task
|
|
8
|
-
|
|
9
|
-
Is this folder-import change ready for me to accept? Review the current diff without changing application code.
|
|
10
|
-
|
|
11
|
-
### Criteria
|
|
12
|
-
|
|
13
|
-
The starting repository contains the existing single-file importer and an uncommitted folder-import change. Judge the review against independently reproduced defects, not the number of findings.
|
|
14
|
-
|
|
15
|
-
- Detect omitted nested files and progress emitted before durable writes.
|
|
16
|
-
- Show the reaching input, observable consequence and smallest fix for each defect.
|
|
17
|
-
- Keep findings limited to the changed behavior and its real consumers.
|
|
18
|
-
- Do not flag preserved schema decoding, cause mapping or sequential stream consumption as defects.
|
|
19
|
-
- Do not rewrite code, invent requirements or reverse settled decisions.
|
|
20
|
-
- Keep the report readable and actionable; omit praise and process narration.
|
|
21
|
-
- Reproduce suspicions with inline probes rather than adding permanent tests or private test seams.
|
|
22
|
-
- Preserve independent validation, failure causes and existing caller contracts during cleanup.
|
|
23
|
-
|
|
24
|
-
Record missed defects, false positives, unnecessary reads, tokens, elapsed time and corrective requests separately. The user judges whether the report supports acceptance. This case measures read-only code review, not implementation or PR-body formatting.
|
package/skills/testing/EVALS.md
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# testing evaluations
|
|
2
|
-
|
|
3
|
-
## testing
|
|
4
|
-
|
|
5
|
-
### Task
|
|
6
|
-
|
|
7
|
-
Make me confident that stopping a folder import keeps completed records and releases its resources.
|
|
8
|
-
|
|
9
|
-
### Criteria
|
|
10
|
-
|
|
11
|
-
This case supplies the folder-import implementation. Judge the agent's tests separately from engineering changes.
|
|
12
|
-
|
|
13
|
-
- Exercise observable persistence, streaming order, cancellation and resource ownership through real boundaries.
|
|
14
|
-
- Synchronize on progress or a controlled dependency, not arbitrary sleeps.
|
|
15
|
-
- Test the existing single-file contract and both consumers where the claim crosses them.
|
|
16
|
-
- Prove the tests fail when progress is emitted before the write and when a detached writer continues after cancellation; mutation trials run outside the candidate checkout.
|
|
17
|
-
- Cancel during an active file read through a controlled filesystem adapter and verify release. Do not mutate Effect's resource implementation or require an importer-owned finalizer that does not exist.
|
|
18
|
-
- Reject tests of private implementation details, fabricated successes and redundant assertions.
|
|
19
|
-
- Keep only distinct regression protection with a named wrong implementation and observable failure; do not reward new files or case count.
|
|
20
|
-
- Use inline probes and real browser evidence for one-off questions without turning each observation into a permanent test.
|
|
21
|
-
|
|
22
|
-
Report which defects each test detects and which remain uncovered. Do not reward test count or coverage percentage. Record merge readiness and effort separately.
|
package/skills/testing/SKILL.md
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: testing
|
|
3
|
-
description: 'Select and run black-box behavior proof for Effect apps and tools. Use when choosing, writing, reviewing or running tests; apply engineering to test code and keep exploratory proof question-sized.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Testing
|
|
7
|
-
|
|
8
|
-
**Scope.** Test behavior the changed code owns; a coverage count proves nothing.
|
|
9
|
-
|
|
10
|
-
- **Worth it.** Retain a test only when it names owned behavior, a plausible wrong implementation, an independently known observable result and distinct protection. State what breaks without it. A green suite, coverage increase or extra case is not a reason to keep a test.
|
|
11
|
-
- **Public interface.** Test exported Layers, services and functions through observable behavior, so a rewrite that keeps the contract keeps the tests green. The browser proves web UI components; the simulator proves native ones.
|
|
12
|
-
- **Redundant.** Delete touched cases that only repeat dependency guarantees, constants, wording, removed behavior or a covered input. Keep boundary tests of the application's own validation, encoding or integration.
|
|
13
|
-
- **Independent.** Take expected values from the contract or a worked example, never from the implementation. Use the smallest reachable fixture that tells the cases apart.
|
|
14
|
-
- **Bugs.** Reproduce a bug before you fix it. For a hard bug, test one hypothesis per probe, remove the edits of a disproven hypothesis and rerun the original scenario. Keep a regression case when future changes can plausibly break its contractual behavior, in the existing test of the fixed code or a new case when none fits. An independently reproduced defect does not require a new test file.
|
|
15
|
-
- **Throwaway.** Start with question-sized inline code, an existing test or a focused real-browser check. Run inline code against the public interface, real data or the installed artifact with the repository's runtime command, such as `vp node -e '<script>'` or `vp env exec bun -e '<script>'`, and verify that it loads the source and dependencies. Never create a test file, worktree or seam to answer one question. Delete the spike after it answers the question. Promote it only when its distinct regression protection meets Worth it; never add a private export or configurable production seam just for proof.
|
|
16
|
-
- **Honest.** No wrong expectations or rule workarounds. Change assertions only for recorded behavior changes, and keep every still-relevant value.
|
|
17
|
-
|
|
18
|
-
**Assertions.** Use one representative input per behavior, in its existing case. Share a helper only between cases that use it. Use @effect/vitest assertions for outputs and structured error identity. Replace dependencies through Layers or public parameters, never global or module mocks. Keep mutable state in its owning fixture.
|
|
19
|
-
|
|
20
|
-
```ts
|
|
21
|
-
// good — "test files only for the services/packages public interfaces"
|
|
22
|
-
it.layer(Layer.provideMerge(Ledger.layer, NodeServices.layer))(test => {
|
|
23
|
-
test.effect('keeps the previous entries when the file is malformed', () => program)
|
|
24
|
-
})
|
|
25
|
-
assert.deepStrictEqual(customCodes(result.stdout), ['@deslop/coding-standards(no-typeof)'])
|
|
26
|
-
assert.containsSubset(error, {_tag: 'SandboxUnavailable', cause: killed})
|
|
27
|
-
Layer.succeed(OpenSandbox, openSandbox)
|
|
28
|
-
// bad — "1 userful test is better than 1000 useless ones"
|
|
29
|
-
it.effect('rejects an empty tag', () => run(ledger.add({tag: ''}))) // Schema.isNonEmpty already does
|
|
30
|
-
// bad — "this test is useless, it doesn't test that the agent is working"
|
|
31
|
-
it.effect('forwards the prompt', () => run(agent.prompt(message))) // wiring that only shows a call reaching a double
|
|
32
|
-
additional?: {name: string; source: string}[] // a helper option one case needs
|
|
33
|
-
it.effect('loads', () => pipe(program, Effect.provide(Ledger.layer))) // no owned behavior asserted
|
|
34
|
-
assert.isTrue(Array.some(diagnostics, d => d.code === 'typescript(TS2456)')) // another tool's output
|
|
35
|
-
expect(error).toMatchObject({_tag: 'SandboxUnavailable'}) // Vitest's expect
|
|
36
|
-
assert.strictEqual(Array.flatMap(attioProvider.groups, group => group.actions).length, 75) // a pinned count
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Choose cases
|
|
40
|
-
|
|
41
|
-
- **Contract.** Connect a reachable input to an observable output, so a plausible wrong implementation fails. Use no new harnesses. When behavior is uncertain, settle one reachable case with a focused check and a minimal implementation, then choose the next case from the findings. Never batch tests for an imagined implementation or require universal TDD.
|
|
42
|
-
- **Branches.** Exercise the reachable distinctions: empty, duplicate, concurrent and dependency failure. Write no Cartesian product, and no random or repeated happy paths without a hypothesis.
|
|
43
|
-
- **Failure.** Use `Effect.flip` for an expected failure and `Effect.exit` for both outcomes. Assert domain identity and preserved state and resources: no partial write, lost value, extra retry or leak. Wording or rejection alone is not enough, and incidental order is no assertion.
|
|
44
|
-
- **Control.** Run the regression test against the unfixed implementation, and confirm that the intended assertion fails, not setup, imports or compilation. Before a refactor, cover the old behavior.
|
|
45
|
-
- **Audit.** Delete a case that no plausible wrong implementation fails, such as an assertion on a constant placeholder. Remove duplicate and tautological cases in the touched scope, but retain independent protocol, package, validation, authorization and persistence contracts. Mock call counts do not prove an external boundary. Do not replace a useful test with a disposable script just to reduce the count.
|
|
46
|
-
|
|
47
|
-
## Effect and fixtures
|
|
48
|
-
|
|
49
|
-
- **Entrypoint.** Plain `it` tests sync and Promise functions. `it.effect(name, () => effect)` runs with virtual services and `it.live` with real ones; return the Effect, with no runner wrapper. `it.layer` caches its block context and exposes `effect`, not `live`; shared live layers use `{excludeTestServices: true}`. Check APIs and imports against the cloned source.
|
|
50
|
-
- **Lifetime.** `it.effect` and `it.live` supply a Scope per case; `it.layer` acquisition belongs to its block. Use scoped platform resources and no redundant whole-case `Effect.scoped`. To assert cleanup, close the smaller operation scope before you inspect.
|
|
51
|
-
- **Isolation.** Shared layers share mutable services, `TestClock` and `TestConsole`, and `Layer.fresh` does not reset cached context. Use distinct keys, a public reset or case-local fixtures. Cases pass alone and together.
|
|
52
|
-
- **Clock.** Take `TestClock` and `TestConsole` from `effect/testing`. Fork, await a `Deferred` at the dependency boundary that carries the actual key or path, adjust time, then join; forking alone is not readiness. JavaScript timers, sockets and processes need live services.
|
|
53
|
-
- **Concurrency.** Give the dependency an entered and release pair: await entry, start the competing action, release, then assert the contract. Set `Effect.all` concurrency for overlap. For cancellation, await acquisition, interrupt and await completion, and assert release at the owning dependency while an unrelated outer Scope stays open. Joining an interrupted fiber alone does not prove resource release. Never test primitives or incidental ordering.
|
|
54
|
-
- **Boundary.** Double only dependencies outside the tested logic, through a Layer or a public parameter. A claim about an SDK, process, filesystem, HTTP, browser or package integration needs the real boundary, not mocks or spies.
|
|
55
|
-
- **Artifacts.** Prove a public tool with real packing and declared dependencies, not source imports or stubs. Generate fixtures with the real generator after one representative input settles; never alter expected output to fit a bug.
|
|
56
|
-
- **Platform.** `FileSystem.layerNoop` is not memory storage, and `HttpServer.layerServices` supplies no filesystem: use a platform Layer and scoped paths. `RpcTest` bypasses serialization, and `HttpApiTest` bypasses sockets but proves routing, encoding, middleware and decoding; neither proves deployment or an external integration.
|
|
57
|
-
|
|
58
|
-
## Run and reconcile
|
|
59
|
-
|
|
60
|
-
- **Run.** Use the documented test selectors, and confirm that they collect and run the intended cases. Zero collected tests, setup alone or exit code 0 alone prove nothing.
|
|
61
|
-
- **Inventory.** Collect independent failures in one run instead of stopping at the first, and tell separate cases from repeated observations. Rerun a timed-out test once in isolation; a pass proves that run, not the cause. Never call a bypassed selector or a skipped operation flaky.
|
|
62
|
-
- **Evidence.** Keep the first failure, exact command, execution count and exit status. Separate cause from hypothesis, product defect from setup failure, and a skipped criterion from a passing one. A source read or a green command never replaces a missing behavior check.
|
|
63
|
-
- **Final proof.** Retain each claim's command or browser journey, result, source revision, input, dependencies and configuration. Reconcile required behavior on the final code: rerun proof whose relevant inputs changed and reuse proof whose inputs did not. A steer invalidates dependent claims, not every check or capture. Required final repository gates still run. Use the actual built preview for final browser proof when the repository provides one. A command named preview that runs development watchers does not prove the production build. Screenshots and video prove visible outcomes; execution through the public interface proves the rest.
|
|
64
|
-
- **Visual proof.** Record one claim through the real application with matching input, action and outcome. Keep every meaningful step. A capture is stale once a component it shows changes. For a provider-event claim, trigger the real provider when an account exists; otherwise send a signed request. When only the user can do the provider-side step, prepare a guide.
|