Skip to content

Enhance llm.md: architecture, error propagation, caching, and completeness - #138

Merged
DJGosnell merged 1 commit into
masterfrom
docs/llm-md-enhancements
Apr 1, 2026
Merged

Enhance llm.md: architecture, error propagation, caching, and completeness#138
DJGosnell merged 1 commit into
masterfrom
docs/llm-md-enhancements

Conversation

@DJGosnell

Copy link
Copy Markdown
Member

Summary

Comprehensive enhancement of src/Quarry.Generator/llm.md based on multi-perspective code review (architecture/data flow, debugging/troubleshooting, invariants/edge cases, file map completeness). 173 insertions, 15 deletions.

Reason for Change

The existing llm.md had significant gaps that would hinder maintainers and LLMs working on the generator:

  • Pipeline stages were described at too high a level — .Collect() barriers, post-analysis transforms (result type patching, site propagation), and the 3a/3b Bind/Translate split were invisible
  • Error propagation architecture (three QRY900 source channels, Bind vs Translate asymmetry) was undocumented
  • RuntimeBuild was described as a "fallback" but is actually a compile-error path (QRY032) with no runtime query builder
  • Conditional masking mechanics (bit assignment, mask enumeration, SQL variant rendering, carrier dispatch) were a two-sentence stub
  • 19 files and 15 model types were missing from the file map
  • Display class prediction assumptions, chain disqualifiers, and subquery method support were not documented

Impact

Documentation-only change. No code modifications.

Plan items implemented as specified

  • Item 3 (Error architecture): Documented the three QRY900 source paths, Bind/Translate split rationale (array vs scalar return types), and ThreadStatic lifecycle
  • Item 4 (RuntimeBuild): Verified no runtime fallback exists — RuntimeBuild produces QRY032 compile errors. Updated doc and added design decision Optimize: Make Join interceptors noops in PrebuiltDispatch chains #8
  • Item 5 (Conditional masking): Expanded to full lifecycle: bit assignment algorithm, baseline nesting depth, mask enumeration (independent bits × exclusive groups), SQL rendering with stable parameter indices, carrier dispatch
  • Item 6 (Display class prediction): Documented algorithm steps, compiler assumptions (GetMembers() ordering, closure ordinal assignment), error type resolution cascade, and known limitation (fixpoint iteration without explicit limit)
  • Item 7 (Subquery/aggregate): Added complete tables for navigation subqueries (Any/All/Count with SQL output) and Sql.* aggregates (Count/Sum/Avg/Min/Max)
  • Item 8 (File map): Added DiagnosticDescriptors.cs, CarrierParameter.cs, Translation/ directory (ParameterInfo, SqlLikeHelpers), expanded Models from 1 line to 27-row table
  • Item 9 (Post-ChainAnalyzer transforms): Expanded Pipeline B to show stages 5a-5e including BuildResultTypePatches and PropagateChainUpdatedSites

Deviations from plan implemented

  • Item 3: Brainstorm concluded the Bind/Translate error split is architecturally justified (not a bug to fix). Documented the rationale instead of unifying the error channels.
  • Item 6: Brainstorm concluded display class prediction is fragile but stable in practice. Documented assumptions as invariants rather than changing the approach. Runtime validation noted as future hardening option.

Gaps in original plan implemented

  • Added Caching Boundaries section with per-stage granularity and invalidation blast radius table
  • Added Chain Disqualification section with 7 disqualifiers and example code patterns
  • Added Project Boundaries section showing Generator vs Runtime vs Shared boundary
  • Updated AnalyzabilityChecker description to explain per-site gate behavior

Migration Steps

N/A — documentation only.

Performance Considerations

N/A — documentation only.

Security Considerations

N/A — documentation only.

Breaking Changes

  • Consumer-facing: None
  • Internal: None

… improvements

Multi-perspective review of llm.md identified gaps in pipeline stage documentation,
error architecture, caching boundaries, and file/type inventory. Adds new sections
for conditional masking mechanics, error propagation paths, chain disqualification,
display class prediction invariants, and subquery/aggregate support. Completes file
map with 19 previously undocumented files and expands Models inventory to 27 types.
@DJGosnell
DJGosnell merged commit a64aa4e into master Apr 1, 2026
1 check passed
@DJGosnell
DJGosnell deleted the docs/llm-md-enhancements branch April 2, 2026 12:32
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