From fd3fe0df4dd19ebb26689d6086624329622d23bb Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Wed, 28 Oct 2026 16:09:45 -0700 Subject: [PATCH 1/3] try to clarify the composite creation timing rules --- docs/adrs/0003-composite-services.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/adrs/0003-composite-services.md b/docs/adrs/0003-composite-services.md index aca924d4..62845d39 100644 --- a/docs/adrs/0003-composite-services.md +++ b/docs/adrs/0003-composite-services.md @@ -6,12 +6,9 @@ Status: accepted If there is more than one implementation of a service, logic for which one to use and/or how to combine their results is to be done in a Composite service. -There are **never** to be exactly two implementations of an interface (exception: decorators). -Either there is a single implementation (wired directly in the container), or there are multiple implementations and a composite to dispatch the logic. -A composite is not added proactively when there is a single implementation. - -A composite is the **only** place outside of implementations that holds switching or combining logic. -It is the only place outside of the DI container that directly names concrete implementations, and **must** do so in its constructor. +A composite is the **only** place outside of implementations that holds switching or combining logic of which implemention to apply. +It is the **only** place outside of the DI container that directly names concrete implementations, **must** do so in its constructor, and **must** name all of the concrete implementations directly. +There MUST be more than one concrete implementation named by the composite, therefore a composite **must not** be created until multiple implementations exist. It is permissible to apply the decorator pattern to any implementation inclduing a composite; this should also be done in the container. From 6f87f084cc2d9f3d2acc37c153daf0ad2e7ecaf3 Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Wed, 28 Oct 2026 16:38:01 -0700 Subject: [PATCH 2/3] revamp the known defects process --- docs/adrs/0008-known-defects-are-tests.md | 36 +++++++++++++++++++++++ docs/adrs/0009-temporary-known-defects.md | 23 +++++++++++++++ docs/adrs/000x-known-defects-are-tests.md | 25 ---------------- 3 files changed, 59 insertions(+), 25 deletions(-) create mode 100644 docs/adrs/0008-known-defects-are-tests.md create mode 100644 docs/adrs/0009-temporary-known-defects.md delete mode 100644 docs/adrs/000x-known-defects-are-tests.md diff --git a/docs/adrs/0008-known-defects-are-tests.md b/docs/adrs/0008-known-defects-are-tests.md new file mode 100644 index 00000000..c4ecb2c2 --- /dev/null +++ b/docs/adrs/0008-known-defects-are-tests.md @@ -0,0 +1,36 @@ +# 8: Known Defects are Added as Tests + +Status: accepted. + +## Decision + +When a reproducible defect is discovered and a fix is out-of-scope for the work being performed, the reproduction script is tracked as a known-defect case. +This addition MAY be included in the original change where it was discovered, or can be given its own PR. + +Known-defect cases are end-to-end tests that live in `tests/EndToEnd/defects/`, written with the intended behavior of the program. +When the defect is resolved, the script moves to the standard home for end-to-end tests: `tests/EndToEnd/scripts`. + +Known-defect cases have a runner that inverts the pass/fail logic: while it lives in `defects` it _must_ fail; a defect case that's passing will cause the suite to fail. + +A defect script is named for its issue when one exists. +The author may use their own discretion as to whether it should be renamed or keep the issue number upon being fixed and moving into the standard suite. + +## Context + +It's common to discover bugs unrelated to the task at hand. +Trying to fix them mid-change often leads to scope creep. + +Capturing them solely as an issue can cause details to get lost. +Further, if a change inadvertently fixes a known issue, the issue remains open until someone discovers it was fixed. +With the inverted pass/fail logic on the defect suite, an unintended fix is actively highlighted when running the test suite and in CI. + +Functionally, this serves as something akin to PHPStan's baseline, but for end-to-end tests. +It also serves as a sort of inverted-TDD: a fix for a known defect will turn that suite red, and moving it into the normal suite brings it green again. + +### Alternatives considered + +- Creating tests and marking as skipped proactively. + This does not have a way to proactively check if any skipped tests are now passing. +- Issues only. + Tried countless times; details get lost and issues go stale. + diff --git a/docs/adrs/0009-temporary-known-defects.md b/docs/adrs/0009-temporary-known-defects.md new file mode 100644 index 00000000..e77f0062 --- /dev/null +++ b/docs/adrs/0009-temporary-known-defects.md @@ -0,0 +1,23 @@ +# 9: Temporary Known Defects + +Status: accepted + +## Decision + +It is acceptable to move a passing end-to-end test temporarily into the known-defects suite (ADR 8) if it simplifies the process of executing a multi-stage refactor or other large project. + +Authors must justify the temporary regression in the pull request making the change, and explain why it should be temporary. +Reviewers must exercise their judgment as to whether this is an acceptable change. + +These temporary regressions should not be added into a tagged release. +The release manager should include a check for this as part of the release process. + +## Context + +The project has kept to very high test coverage standards. +However, trying to meet the letter of the standards sometimes gets in the way of making bigger changes. +Sometimes it's _way_ easier, simpler, or smaller to take a small break during a refactor and fast-follow fix it. + +By moving the test into a known-failing location, no information is lost. +The test remains intact, and retains all the benefits of ADR 8's rationale. +Disabled tests get forgotten, and deleted tests will likely never return. diff --git a/docs/adrs/000x-known-defects-are-tests.md b/docs/adrs/000x-known-defects-are-tests.md deleted file mode 100644 index bc304b94..00000000 --- a/docs/adrs/000x-known-defects-are-tests.md +++ /dev/null @@ -1,25 +0,0 @@ -# 000x: Known Defects Are Tests - -Status: accepted. - -## Decision - -A defect reproduced through the end-to-end tier is kept as a script in `tests/EndToEnd/defects/`, written as the behavior it should have. -The suite requires each defect script to fail at a step, by a wrong answer or no answer. -A defect script that passes fails the suite until it moves to `tests/EndToEnd/scripts/`, where it binds like any other script, or is deleted if a script there already covers it. -A defect script that fails any other way, such as a missing marker or output on stderr once its steps pass, is an error. - -Cases move one at a time, so a partial fix promotes only what it fixes. -A defect script is named for its issue when one exists. - -## Context - -A defect found while working on something else used to leave behind a reproduction in prose, in an issue. -The prose went stale as the code moved, and whoever picked the issue up rebuilt the reproduction from scratch. - -A reproduction kept as a test is checked on every run. -It cannot go stale silently: it either still fails, passes and must be promoted, or breaks and must be fixed. -Its promotion is the failing test of the fix that resolves it. -A fix that resolves a defect by accident is noticed, because the suite fails until the defect is promoted. - -The end-to-end tier is the one place for this because its scripts are data: a reproduction is the same script before and after its fix, and only its directory changes. From cee155c385b682f8353f10649c7aaeb7f22d1906 Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Wed, 28 Oct 2026 16:39:35 -0700 Subject: [PATCH 3/3] drop leading zeroes --- docs/adrs/0001-one-route-per-fact.md | 2 +- docs/adrs/0002-services-interfaces.md | 6 +++--- docs/adrs/0003-composite-services.md | 2 +- docs/adrs/0004-php-parser-document-ast.md | 4 ++-- docs/adrs/0005-document-recovery.md | 6 +++--- docs/adrs/0006-domain-holds-facts.md | 4 ++-- docs/adrs/0007-syntax-produces-facts.md | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/adrs/0001-one-route-per-fact.md b/docs/adrs/0001-one-route-per-fact.md index 93596adc..4baed4c7 100644 --- a/docs/adrs/0001-one-route-per-fact.md +++ b/docs/adrs/0001-one-route-per-fact.md @@ -1,4 +1,4 @@ -# 0001: One Route Per Fact +# 1: One Route Per Fact Status: accepted diff --git a/docs/adrs/0002-services-interfaces.md b/docs/adrs/0002-services-interfaces.md index 2181dbdd..ee56c362 100644 --- a/docs/adrs/0002-services-interfaces.md +++ b/docs/adrs/0002-services-interfaces.md @@ -1,12 +1,12 @@ -# 0002: Services Defined by Interfaces and Provided via DI +# 2: Services Defined by Interfaces and Provided via DI -Status: accepted, supplemented by 0003. +Status: accepted ## Decision A service must be backed by an interface, and reached only through that interface via dependency injection. Service construction (outside of tests) is to be done only in the project's DI container. -The DI container is the only place that does interface-to-implementation mapping (semi-exception: composites may name concrete classes; see ADR 0003). +The DI container is the only place that does interface-to-implementation mapping (semi-exception: composites may name concrete classes; see ADR 3). ## Context diff --git a/docs/adrs/0003-composite-services.md b/docs/adrs/0003-composite-services.md index 62845d39..f0106784 100644 --- a/docs/adrs/0003-composite-services.md +++ b/docs/adrs/0003-composite-services.md @@ -1,4 +1,4 @@ -# 0003: Composite Services +# 3: Composite Services Status: accepted diff --git a/docs/adrs/0004-php-parser-document-ast.md b/docs/adrs/0004-php-parser-document-ast.md index 527ea02a..dee35803 100644 --- a/docs/adrs/0004-php-parser-document-ast.md +++ b/docs/adrs/0004-php-parser-document-ast.md @@ -1,4 +1,4 @@ -# 0004: Use php-parser for Document Structure +# 4: Use php-parser for Document Structure Status: accepted @@ -7,7 +7,7 @@ Status: accepted Parsed file structure is to use `nikic/php-parser`'s Abstract Syntax Tree (AST) and data types, regardless of the parsing mechanism. Parsers, including syntax-invalid file recovery, are to convert into it if necessary. -Walking the AST (recovered or otherwise) to extract other facts is still to be centralized per ADR 0001. +Walking the AST (recovered or otherwise) to extract other facts is still to be centralized per ADR 1. ## Context diff --git a/docs/adrs/0005-document-recovery.md b/docs/adrs/0005-document-recovery.md index 155f2c01..5d785f55 100644 --- a/docs/adrs/0005-document-recovery.md +++ b/docs/adrs/0005-document-recovery.md @@ -1,11 +1,11 @@ -# 0005: Syntax-invalid Document Recovery +# 5: Syntax-invalid Document Recovery Status: accepted ## Decision Initial recovery of syntax-invalid documents (common-case: mid-edit editor buffers) is done by best-effort file/AST modification. -Fallback logic stays self-contained so that downstream consumers need no awareness of how recovery occurred and can confidently build on a well-formed AST (ADR 0004). +Fallback logic stays self-contained so that downstream consumers need no awareness of how recovery occurred and can confidently build on a well-formed AST (ADR 4). Other recovery approaches are allowed but out of scope for now; if implemented, they must still fit within these guidelines. It is permissible for downstream consumers to be able to determine _if_ (but not how) a node came from recovery. @@ -15,7 +15,7 @@ Consumers are only to use this to filter out synthesized code. Documents in various mid-edit state should produce ASTs as close to valid as possible so symbols can be extracted and downstream tools can continue to rely on those symbols. Various downstream consumers and handlers must not need to build their own fallback or recovery, as this leads to logic drift. -To be clear: this is largely restating ADR 0001; mid-edit file recovery is central to any LSP server and has historically been a cause of drift within this project. +To be clear: this is largely restating ADR 1; mid-edit file recovery is central to any LSP server and has historically been a cause of drift within this project. Ideally, the design would not allow downstream consumers to know whether a node came from the recovery system at all. Unfortunately, that is unavoidable: the recovery can synthesize code that doesn't exist, and some operations must filter this out. diff --git a/docs/adrs/0006-domain-holds-facts.md b/docs/adrs/0006-domain-holds-facts.md index d7abb774..59438e86 100644 --- a/docs/adrs/0006-domain-holds-facts.md +++ b/docs/adrs/0006-domain-holds-facts.md @@ -1,4 +1,4 @@ -# 0006: The Domain Holds Facts +# 6: The Domain Holds Facts Status: accepted @@ -13,6 +13,6 @@ A local workaround is not a fix, and neither is a comment deferring one. ## Context -ADR 0001 forbids a second route to a fact, but a gap in the domain leaves no first route to compare against. +ADR 1 forbids a second route to a fact, but a gap in the domain leaves no first route to compare against. The gap shows up as missing structure rather than as a duplicate route, so it is easy to work around without noticing. One structure per declaration, regardless of origin, is what lets every feature see the same facts. diff --git a/docs/adrs/0007-syntax-produces-facts.md b/docs/adrs/0007-syntax-produces-facts.md index 971dbcee..434da746 100644 --- a/docs/adrs/0007-syntax-produces-facts.md +++ b/docs/adrs/0007-syntax-produces-facts.md @@ -1,6 +1,6 @@ -# 0007: Syntax Produces Facts +# 7: Syntax Produces Facts -Status: accepted, supplements 0004. +Status: accepted, supplements 4. ## Decision @@ -15,4 +15,4 @@ Code that needed a closure's parameter types read them from the syntax tree beca Recovered trees can make this worse: each walker tolerates broken code differently, so a feature can work on half-typed code while another does not. Note: walkers must not attempt to work around broken code themselves; that's an issue with the recovery tool. -ADR 0004 requires walking the tree to be centralized; this decision is how. +ADR 4 requires walking the tree to be centralized; this decision is how.