Skip to content

docs: add STYLE.md documenting unwritten coding conventions - #1334

Closed
TimothyJones wants to merge 3 commits into
mainfrom
docs/add-style-guide
Closed

docs: add STYLE.md documenting unwritten coding conventions#1334
TimothyJones wants to merge 3 commits into
mainfrom
docs/add-style-guide

Conversation

@TimothyJones

Copy link
Copy Markdown
Member

Summary

Adds a new STYLE.md guide that documents the coding conventions in ContractCase that are not enforced by lint or covered by the existing CodingStandards.md. This captures the unwritten rules that survive through review — the trade-off reasoning behind key architectural choices — so that future maintainers (and LLMs) understand not just the rules but why they exist.

The guide covers:

  • Function/closure/class role split and dependency injection patterns
  • The preference for .then() chains over async/await
  • The two-error blame taxonomy for better user UX
  • Wire-format namespaced keys and type-tag constants
  • Context threading, location trails, and logging architecture
  • Plugin executor uniform shape and registry patterns
  • Documentation as a build artifact with TSDoc release tags
  • Testing without mocking libraries (DI-driven with real objects)
  • Cross-language binding rules (Java DSL as a mirror structure)
  • Known deviations and migration guidance

This is the companion to CodingStandards.md — one is the machine-checked rules, the other is the hand-maintained conventions.

Test plan

  • Read through STYLE.md for accuracy and completeness
  • Verify link from CodingStandards.md is correct
  • Confirm formatting and markdown render cleanly

This document complements CodingStandards.md by capturing the style
conventions that live between the lint rules — the choices that survive
only through review and through documentation.

The guide covers:
- Function/closure/class role split and DI patterns
- `.then()` chains over async/await, with rationale
- The two-error blame taxonomy (CaseConfigurationError vs CaseCoreError)
- Wire-format namespaced keys and type-tag constants
- Context threading and location trails for error messages
- Plugin executor shapes and registry patterns
- Documentation as a build artifact with release tags
- Testing patterns (no mocking library, test-data factories)
- Cross-language mirroring rules for Java and other bindings
- Known deviations (things to migrate opportunistically)

The guide also includes the motivation and trade-offs for each
convention, so future maintainers understand not just the rules but
why they exist.

Distilled from reading ~700 lines of TS source and 25+ files across
all packages.

Co-Authored-By: Timothy Jones <timothy.l.jones@gmail.com>
… function plugin

- Swap last two arguments (userFacingStackTrace and contractCaseErrorCode) in
  ConnectorFailure constructor signature to match TypeScript BoundaryFailure
  (userFacingStackTrace, then contractCaseErrorCode). Update all 17 call sites
  across 6 Java files.

- Fix copyright banner in case-core-plugin-function/src/index.ts which
  incorrectly said "HTTP Plugin" instead of "Function Plugin".

These were identified as bugs during style guide analysis. The swapped args
were a latent cross-language interface hazard (type-checker-invisible since
both are strings).

Co-Authored-By: Timothy Jones <timothy.l.jones@gmail.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