Skip to content

docs: trim architecture/ to charter — invariants only - #282

Merged
lesnik512 merged 1 commit into
mainfrom
docs/architecture-halving
Jul 7, 2026
Merged

docs: trim architecture/ to charter — invariants only#282
lesnik512 merged 1 commit into
mainfrom
docs/architecture-halving

Conversation

@lesnik512

Copy link
Copy Markdown
Member

The last item from the 2026-07-06 verbosity benchmark. architecture/ trimmed to its charter — the invariants, edge cases, and rationales a maintainer cannot read off the code. Deleted: a 30-line pseudocode transcription of Container.validate(), pasted-code-plus-narration, verbatim error-message quotes (one already stale — it named errors.INVALID_SCOPE_DEPENDENCY_ERROR, a constant that doesn't exist), and re-explanations of behavior docs/ already owns (now links). Spec: planning/changes/2026-07-07.04-architecture-halving.md.

6,902 → 5,320 words (-23%). Short of the spec's ~halving estimate by design: since the docstring cleanup (#280), architecture/ is the sole home of the rationales removed from code, and the trim stopped where cuts risked losing them. An adversarial information-loss review verified all ten protected kernels survive intact (cycle-guard rationale, alias transitivity + edge cases, registry-sharing table, set_context staleness, pre-2.16 note, LIFO finalization, WiringPlan buckets, kwargs-bypass-validate, override-bypasses-scope-check, the resolution rule) and checked every deleted passage's survival claim against the named code symbol or docs page.

file before after
validation.md 1,536 1,027
resolution.md 1,303 998
containers.md 1,300 1,073
providers.md 1,166 997
scopes.md 707 473
testing-and-overrides.md 739 593

Gates: just lint-ci green; stale-constant grep empty; inbound links from docs/ and CLAUDE.md verified.

Cut pseudocode transcriptions, pasted-code narration, verbatim
error-message quotes, and content now fully covered in docs/ or
duplicated across the six capability files. Fixed the stale
INVALID_SCOPE_DEPENDENCY_ERROR reference in validation.md. KEEP
kernels (cycle-guard rationale, effective_scope alias-transitivity,
registry sharing, WiringPlan bucket semantics, override-bypasses-scope
implications, etc.) preserved with meaning intact.

architecture/: 6902 -> 5291 words across the six files; README.md
unchanged. No behavior or docs/ changes.
@lesnik512
lesnik512 merged commit b2404c4 into main Jul 7, 2026
7 checks passed
@lesnik512
lesnik512 deleted the docs/architecture-halving branch July 7, 2026 11:45
lesnik512 added a commit that referenced this pull request Aug 13, 2026
architecture/ was 11 capability pages, 1,470 lines, restating what modern_di/
already says. It had been cut to invariants twice -- b2404c4 (#282, 433 deletions
against 110 insertions across six pages) and 047b6ea (#395, 292 against 147 across
four) -- and regrew both times. Promotion discipline was never the failure: 48 of
the 67 commits touching modern_di/ also touched it. The PR checklist asked "did you
update the page?" and never "should this paragraph exist?", so every PR added a
paragraph and none removed one, and the pages ratcheted toward restating code.

The invariants turned out to be already executable. 31 tests now carry an INVARIANT:
docstring -- the claim on line 1, what breaks it in the second paragraph -- and only
four tests are genuinely new (one-graph, compile-resolver-fails-loudly, scope.py
import purity, union-member origin degradation). The rest was marking, not writing.

tests/test_invariant_census.py guards the scheme: every test name cited in a comment
or docstring under modern_di/ and tests/ must resolve to a real test, every
INVARIANT: docstring must state what breaks it, and every tests/*.py and
planning/*.md path cited from code must exist. Code comments cite tests, not pages.

Vocabulary moved to CLAUDE.md, which is auto-loaded where architecture/README.md
never was. The free-threaded Beta support level moved to
docs/introduction/design-decisions.md at user altitude.

planning/decisions/ took nothing. Six records were written during the work and all
six were dropped, so the admission check narrowed to three routes: derivable from
modern_di/ -> don't write it; enforceable -> a test; a user needs it -> docs/;
otherwise it does not get written. Four negative contracts -- transient teardown
order, rebinding an in-use provider, override values not being type-checked, and the
integration-kit per-adapter boundary -- now live only in the code and its tests.

check-links passing after the deletion is the completeness proof: those references
resolve while architecture/ exists and only break once it is gone.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant