Skip to content

samples: FactoryDemo.Api.CSharp — JSON API companion, parity with F# sibling#147

Merged
AceHack merged 12 commits intomainfrom
feat/servicetitan-factory-demo-api-csharp
Apr 24, 2026
Merged

samples: FactoryDemo.Api.CSharp — JSON API companion, parity with F# sibling#147
AceHack merged 12 commits intomainfrom
feat/servicetitan-factory-demo-api-csharp

Conversation

@AceHack
Copy link
Copy Markdown
Member

@AceHack AceHack commented Apr 23, 2026

Summary

C# companion to PR #146's F# API. ServiceTitan uses C# with zero F#, so shipping the C# version minimises adoption friction for the target audience. F# stays the factory's reference language; C# stays the ServiceTitan-audience-facing output.

Identical behaviour — verified

Both versions return the same JSON for every endpoint:

/api/pipeline/funnel      → [{"stage":"Lead","count":10,"totalCents":5400000}, ...5 stages]
/api/pipeline/duplicates  → [{"email":"alice@acme.example","customerIds":[1,13]}, ...]
/api/customers            → 20 customers

The only cosmetic difference is name: "(F#)" vs name: "(C#)" at root.

What lands

  • ServiceTitanFactoryApi.CSharp.csprojMicrosoft.NET.Sdk.Web, nullable + implicit usings, TreatWarningsAsErrors
  • Customer.cs / Opportunity.cs / Activity.cs — records, one per file (satisfies MA0048)
  • Seed.cs — 20 customers / 30 opportunities / 33 activities / 2 intentional email collisions, deterministic fixed clock
  • Program.cs — 9 minimal-API endpoints, identical routes + JSON shapes to F#
  • README.md — parity guarantee, design notes, C# specifics

Analyzer discipline

Full SonarAnalyzer.CSharp + Meziantou.Analyzer + Microsoft .NET Analyzers active. All findings addressed:

  • MA0048 — one type per file
  • MA0002 — explicit StringComparer.Ordinal on GroupBy
  • CA1861 — static endpoint array instead of per-request allocation

Factory-pitch moment

Two implementations, one spec, behavioural parity. This is a concrete factory-capability signal: "your language, enforced by our quality floor."

Test plan

  • dotnet build -c Release — 0 Warning(s), 0 Error(s)
  • dotnet run starts API, all 9 endpoints return expected JSON
  • Parity against F# sibling verified for funnel, duplicates, customer count
  • Frontend team (Aaron's stack choice) picks one of the two

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings April 23, 2026 13:56
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71947fb38a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/audit/live-lock-audit.sh
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the ServiceTitan factory demo by adding a C# minimal-API companion (to match a C#-first audience) and rounds out the supporting factory substrate with new quality-scoring logic, scenario tests, and operational/audit documentation.

Changes:

  • Add C# companion ServiceTitan JSON API sample with deterministic seed data and minimal endpoints.
  • Add SignalQuality core module plus dedicated algebra/operator tests (incl. CRM-shaped scenarios).
  • Add factory operational tooling/docs: live-lock audit script + history log, drop-zone protocol, and autonomous-loop checklist updates.

Reviewed changes

Copilot reviewed 42 out of 44 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tools/audit/live-lock-audit.sh New script to classify recent commits and flag “live-lock” via external-change ratio.
tests/Tests.FSharp/Tests.FSharp.fsproj Registers new F# test files for compilation.
tests/Tests.FSharp/Operators/CrmScenarios.Tests.fs Adds CRM-shaped operator scenario tests (pipeline + duplicates + retraction updates).
tests/Tests.FSharp/Algebra/SignalQuality.Tests.fs Adds unit tests for SignalQuality scoring dimensions and composite behavior.
src/Core/SignalQuality.fs Introduces SignalQuality module: dimensions/measures + composite scoring API.
src/Core/Core.fsproj Includes SignalQuality.fs in Core compilation list.
samples/ServiceTitanFactoryApi/ServiceTitanFactoryApi.fsproj New F# minimal ASP.NET Core sample project.
samples/ServiceTitanFactoryApi/Seed.fs Deterministic in-memory seed data for the F# API sample.
samples/ServiceTitanFactoryApi/Program.fs F# minimal API endpoints for customers/opps/activities + derived pipeline views.
samples/ServiceTitanFactoryApi/README.md Documentation for running/using the F# API sample and its v0 contract.
samples/ServiceTitanFactoryApi.CSharp/ServiceTitanFactoryApi.CSharp.csproj New C# minimal ASP.NET Core sample project.
samples/ServiceTitanFactoryApi.CSharp/Seed.cs Deterministic in-memory seed data for the C# API sample.
samples/ServiceTitanFactoryApi.CSharp/README.md Documentation for running/using the C# API sample and parity guarantees.
samples/ServiceTitanFactoryApi.CSharp/Program.cs C# minimal API endpoints mirroring the F# sample and derived pipeline views.
samples/ServiceTitanFactoryApi.CSharp/Opportunity.cs Record type for opportunities (C# sample).
samples/ServiceTitanFactoryApi.CSharp/Customer.cs Record type for customers (C# sample).
samples/ServiceTitanFactoryApi.CSharp/Activity.cs Record type for activities (C# sample).
samples/ServiceTitanCrm/ServiceTitanCrm.fsproj New F# console demo project exercising CRM-shaped incremental views.
samples/ServiceTitanCrm/Program.fs CRM demo showcasing retraction-native updates and derived views over time.
memory/project_reproducible_stability_as_obvious_purpose_2026_04_22.md New memory entry capturing “reproducible stability” directive and boundaries.
memory/project_operator_input_quality_log_directive_2026_04_22.md New memory entry describing operator-input quality logging directive.
memory/project_arc3_adversarial_self_play_emulator_absorption_scoring_2026_04_22.md New memory entry capturing ARC-3-style scoring loop idea.
memory/project_aaron_drop_zone_protocol_2026_04_22.md New memory entry documenting the drop-zone inbox protocol.
memory/observed-phenomena/2026-04-19-transcript-duplication-splitbrain-hypothesis.md New observed-phenomena note for a prior artifact and its context.
drop/README.md Adds tracked drop-zone protocol doc (what to drop, how to absorb, handlers).
drop/.gitignore Implements “ignore everything except sentinels” for the drop-zone folder.
docs/research/zeta-self-use-tiny-bin-file-germination-2026-04-22.md Research sketch: tiny-bin self-use germination step.
docs/research/oss-deep-research-zeta-aurora-2026-04-22.md Absorption note for a dropped “deep research” report and its takeaways.
docs/research/openai-deep-ingest-cross-substrate-readability-2026-04-22.md Research note on OpenAI deep-ingest and cross-substrate readability tradeoffs.
docs/research/meta-pixel-perfect-text-to-image-youtube-wink-2026-04-22.md Research note on pixel-perfect T2I signal and UI-factory implications.
docs/research/cutting-edge-database-gap-review-2026-04-23.md Research note inventorying “cutting-edge” DB gaps and candidate backlog items.
docs/research/arc3-adversarial-self-play-emulator-absorption-scoring-2026-04-22.md Research doc elaborating the ARC-3-inspired three-role loop.
docs/research/amara-network-health-oracle-rules-stacking-2026-04-22.md Research doc distilling oracle/stacking critique and related directives.
docs/operator-input-quality-log.md New operator-input quality log with rubric and initial entries.
docs/hygiene-history/live-lock-audit-history.md Adds log/history for running the live-lock audit over time.
docs/AUTONOMOUS-LOOP.md Updates tick priority ladder to include drop-zone audit earlier.
README.md Adds “thesis: reproducible stability” section linking to AGENTS.md.
AGENTS.md Adds “purpose: reproducible stability” section and updates velocity wording.
.gitignore Fixes node_modules ignore + adds ignores for session-scoped artifacts.
.claude/commands/btw.md Adds /btw command protocol for non-interrupting maintainer asides.
Zeta.sln Adds sample projects to solution and expands build configurations/platforms.

Comment thread Zeta.sln Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b3a7f1355e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Zeta.sln Outdated
@AceHack AceHack changed the title samples: ServiceTitan factory-demo C# companion API — parity with F# sibling samples: FactoryDemo.Api.CSharp — JSON API companion, parity with F# sibling Apr 23, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fb73636ab0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Core/SignalQuality.fs Outdated
Copilot AI review requested due to automatic review settings April 23, 2026 15:19
@AceHack AceHack force-pushed the feat/servicetitan-factory-demo-api-csharp branch from fb73636 to 7636efc Compare April 23, 2026 15:19
@AceHack
Copy link
Copy Markdown
Member Author

AceHack commented Apr 23, 2026

Addressed the Zeta.sln finding (Copilot L1, codex L1):

Stripped the UTF-8 BOM (U+FEFF) from the top of Zeta.sln. Verified dotnet sln list still parses the file correctly. This finding applies identically to #141, #145, #146 (all added the C# or F# sample projects via dotnet sln add which auto-injects a BOM on macOS); same fix will propagate when I sweep those branches next.

Not addressed here (would need to land on their own PRs, not this one):

These appear in #147's diff because of branch stacking; fixing them here would conflate PR scopes.

Not self-resolving conversations — human maintainer's move on review.

🤖 Generated with Claude Code

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds new demo/sample surfaces (notably a minimal C# JSON API), plus supporting tooling/docs/tests intended to strengthen demo parity and factory hygiene.

Changes:

  • Add samples/FactoryDemo.Api.CSharp minimal API + seed data + smoke test.
  • Introduce Zeta.Core.SignalQuality module with new algebra/operator scenario tests.
  • Add live-lock audit + drop-zone protocol + multiple research/memory/documentation updates.

Reviewed changes

Copilot reviewed 43 out of 45 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
tools/audit/live-lock-audit.sh New git-history audit script to classify recent commits and detect “live-lock” smell.
tests/Tests.FSharp/Tests.FSharp.fsproj Registers new F# test files in compile order.
tests/Tests.FSharp/Operators/CrmScenarios.Tests.fs New operator scenario tests using CRM-shaped workloads.
tests/Tests.FSharp/Algebra/SignalQuality.Tests.fs New unit tests for SignalQuality scoring/measure helpers.
src/Core/SignalQuality.fs New core module implementing composable quality dimensions + composite scoring.
src/Core/Core.fsproj Adds SignalQuality.fs to core compile list.
samples/ServiceTitanFactoryApi/ServiceTitanFactoryApi.fsproj New F# minimal ASP.NET Core sample project.
samples/ServiceTitanFactoryApi/Seed.fs Deterministic in-memory CRM seed data for the sample API.
samples/ServiceTitanFactoryApi/README.md Usage + endpoints + design notes for the F# sample API.
samples/ServiceTitanFactoryApi/Program.fs F# minimal API endpoints + derived views (funnel/duplicates).
samples/ServiceTitanCrm/ServiceTitanCrm.fsproj New F# console CRM-shaped demo project.
samples/ServiceTitanCrm/Program.fs CRM-shaped incremental-computation demo over Zeta operators.
samples/FactoryDemo.Api.CSharp/smoke-test.sh Bash smoke test validating all API endpoints and JSON invariants.
samples/FactoryDemo.Api.CSharp/Seed.cs Deterministic in-memory seed data for the C# API sample.
samples/FactoryDemo.Api.CSharp/README.md Usage + parity/design notes for the C# API sample.
samples/FactoryDemo.Api.CSharp/Program.cs C# minimal API endpoints + derived views (funnel/duplicates).
samples/FactoryDemo.Api.CSharp/Opportunity.cs Record type for opportunities (one type per file).
samples/FactoryDemo.Api.CSharp/FactoryDemo.Api.CSharp.csproj New C# ASP.NET Core project configuration.
samples/FactoryDemo.Api.CSharp/Customer.cs Record type for customers.
samples/FactoryDemo.Api.CSharp/Activity.cs Record type for activities.
memory/project_reproducible_stability_as_obvious_purpose_2026_04_22.md New memory entry capturing “reproducible stability” directive.
memory/project_operator_input_quality_log_directive_2026_04_22.md New memory entry defining operator-input quality log directive.
memory/project_arc3_adversarial_self_play_emulator_absorption_scoring_2026_04_22.md New memory entry on ARC-3 style scoring loop concept.
memory/project_aaron_drop_zone_protocol_2026_04_22.md New memory entry describing drop/ inbox protocol.
memory/observed-phenomena/2026-04-19-transcript-duplication-splitbrain-hypothesis.md New observed-phenomena note and constraints around the artifact.
drop/README.md New drop/ protocol document (tracked sentinel).
drop/.gitignore Ignores all drop payloads except sentinel files.
docs/research/zeta-self-use-tiny-bin-file-germination-2026-04-22.md Research sketch about self-use via tiny bin-file DB germination.
docs/research/oss-deep-research-zeta-aurora-2026-04-22.md Absorption note for dropped Deep Research report.
docs/research/openai-deep-ingest-cross-substrate-readability-2026-04-22.md Research note on OpenAI deep-ingest and substrate tradeoffs.
docs/research/meta-pixel-perfect-text-to-image-youtube-wink-2026-04-22.md Research note on pixel-perfect T2I signal and relevance.
docs/research/cutting-edge-database-gap-review-2026-04-23.md Research-driven gap review with candidate backlog directions.
docs/research/arc3-adversarial-self-play-emulator-absorption-scoring-2026-04-22.md Research doc absorbing ARC-3 directive into a structured plan.
docs/research/amara-network-health-oracle-rules-stacking-2026-04-22.md Research doc capturing Amara report structure + annotations.
docs/operator-input-quality-log.md New operator-input quality log document + initial entries.
docs/hygiene-history/live-lock-audit-history.md Adds log format + inaugural run entry for live-lock audit.
docs/AUTONOMOUS-LOOP.md Updates tick priority ladder to include drop-zone audit.
README.md Adds “thesis: reproducible stability” section pointing to AGENTS.
AGENTS.md Adds “purpose: reproducible stability” and adjusts value wording.
.gitignore Ignores .btw-queue.md and .playwright-mcp/ scratch outputs.
.claude/commands/btw.md New /btw command procedure doc.

Comment thread src/Core/SignalQuality.fs Outdated
Comment thread tools/audit/live-lock-audit.sh Outdated
Comment thread samples/ServiceTitanFactoryApi/README.md Outdated
Comment thread samples/ServiceTitanFactoryApi/README.md Outdated
Comment thread samples/ServiceTitanFactoryApi/Seed.fs Outdated
Comment thread samples/FactoryDemo.Api.CSharp/FactoryDemo.Api.CSharp.csproj
Comment thread samples/FactoryDemo.Api.CSharp/Seed.cs Outdated
Comment thread samples/FactoryDemo.Api.CSharp/Program.cs
Comment thread samples/ServiceTitanFactoryApi/Program.fs
Comment thread samples/FactoryDemo.Api.CSharp/README.md Outdated
AceHack added a commit that referenced this pull request Apr 23, 2026
Investigated markdownlint failures across 7 demo-cluster PRs
(#141/#145/#146/#147/#142/#143/#144). Scoped back on per-PR
fixes in favor of a higher-leverage next-tick move:
either land #151 (gitignore drop/ on main) or fix the
MD056 tick-history row on main — both would unblock the
whole cluster in one move.

No new PRs this tick. Honest partial-execution per the
prefer-progress-over-quiet-close discipline — documenting
the unblock-vector rather than pushing through with
inefficient per-PR fixes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@AceHack AceHack enabled auto-merge (squash) April 24, 2026 14:55
@AceHack AceHack force-pushed the feat/servicetitan-factory-demo-api-csharp branch from 7636efc to 16ad746 Compare April 24, 2026 16:35
AceHack added a commit that referenced this pull request Apr 24, 2026
…ase, audit fail-hard, endpoint lists

Drains 14 unresolved review threads on PR #147 (FactoryDemo.Api.CSharp):
- Zeta.sln: strip leading blank line so 'Microsoft Visual Studio
  Solution File' is the first line (threads #2 #3).
- SignalQuality.fs: compressionRatio on empty input was 1.0, which
  composed as Quarantine via severityOfScore — flipped to 0.0 and
  added explicit empty-input Pass finding in compressionMeasure;
  also dropped unused System.Runtime.CompilerServices open
  (threads #4 #5).
- live-lock-audit.sh: fail hard (exit 2) when origin/main is not
  resolvable so a missing-remote CI checkout can't silently report
  'No commits found' -> healthy; switched --stat|awk file-list
  extraction to git diff-tree --name-only plumbing form
  (threads #1 #6).
- ServiceTitanFactoryApi README + Seed.fs: remove dead memory/
  and docs/plans/ links; replace Aaron's-name reference with
  'human maintainer' role wording; drop non-existent sibling
  SQL-seed refs (threads #7 #8 #9).
- FactoryDemo.Api.CSharp README + Program.cs + Seed.cs: fix dead
  refs to samples/FactoryDemo.Api.FSharp/ and samples/FactoryDemo.Db/
  to point at the real F# sibling samples/ServiceTitanFactoryApi/
  and to a BACKLOG row for the Postgres-backed follow-up
  (threads #11 #14).
- Program.cs + Program.fs: root endpoint index now advertises all
  9 routes including the parameterised {id} routes, matching the
  README tables (threads #12 #13).
- Thread #10 (project naming 'ServiceTitanFactoryApi.CSharp' in PR
  description): resolved in-thread — code/namespace already
  consistent (Zeta.Samples.FactoryDemo.Api); fix is PR-description-
  only, not code.

Build: dotnet build -c Release -> 0 Warning(s) 0 Error(s).
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 16ad74637e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/Tests.FSharp/Algebra/SignalQuality.Tests.fs Outdated
Comment thread samples/FactoryDemo.Api.CSharp/smoke-test.sh Outdated
Copilot AI review requested due to automatic review settings April 24, 2026 17:02
@AceHack AceHack force-pushed the feat/servicetitan-factory-demo-api-csharp branch from 16ad746 to 9eab25a Compare April 24, 2026 17:02
AceHack added a commit that referenced this pull request Apr 24, 2026
…ase, audit fail-hard, endpoint lists

Drains 14 unresolved review threads on PR #147 (FactoryDemo.Api.CSharp):
- Zeta.sln: strip leading blank line so 'Microsoft Visual Studio
  Solution File' is the first line (threads #2 #3).
- SignalQuality.fs: compressionRatio on empty input was 1.0, which
  composed as Quarantine via severityOfScore — flipped to 0.0 and
  added explicit empty-input Pass finding in compressionMeasure;
  also dropped unused System.Runtime.CompilerServices open
  (threads #4 #5).
- live-lock-audit.sh: fail hard (exit 2) when origin/main is not
  resolvable so a missing-remote CI checkout can't silently report
  'No commits found' -> healthy; switched --stat|awk file-list
  extraction to git diff-tree --name-only plumbing form
  (threads #1 #6).
- ServiceTitanFactoryApi README + Seed.fs: remove dead memory/
  and docs/plans/ links; replace Aaron's-name reference with
  'human maintainer' role wording; drop non-existent sibling
  SQL-seed refs (threads #7 #8 #9).
- FactoryDemo.Api.CSharp README + Program.cs + Seed.cs: fix dead
  refs to samples/FactoryDemo.Api.FSharp/ and samples/FactoryDemo.Db/
  to point at the real F# sibling samples/ServiceTitanFactoryApi/
  and to a BACKLOG row for the Postgres-backed follow-up
  (threads #11 #14).
- Program.cs + Program.fs: root endpoint index now advertises all
  9 routes including the parameterised {id} routes, matching the
  README tables (threads #12 #13).
- Thread #10 (project naming 'ServiceTitanFactoryApi.CSharp' in PR
  description): resolved in-thread — code/namespace already
  consistent (Zeta.Samples.FactoryDemo.Api); fix is PR-description-
  only, not code.

Build: dotnet build -c Release -> 0 Warning(s) 0 Error(s).
AceHack added a commit that referenced this pull request Apr 24, 2026
…dpoint-count

- tests/Tests.FSharp/Algebra/SignalQuality.Tests.fs: test asserted 1.0 for
  compressionRatio on empty input, but the fix in 16ad746 changed the
  convention to 0.0 (neutral = clean, not maximally suspicious). Updated
  the test expectation + name + comment to match the current code.
- samples/FactoryDemo.Api.CSharp/smoke-test.sh: root.endpoints length
  expectation was 5; Program.cs now advertises 8 routes in the index
  (post 16ad746 expansion). Corrected the smoke-test assertion.

Rebased onto origin/main (which advanced via #146 FactoryDemo.Api.FSharp
merge); Zeta.sln conflicts resolved by keeping both FactoryDemo.Api.FSharp
and the ServiceTitanCrm/samples solution-folder additions.

Build gate: 0 Warning(s) / 0 Error(s) in Release.
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a C# minimal-API companion for the factory demo JSON API, alongside new core “signal quality” scoring utilities, scenario tests, and factory-process tooling/docs to support ingestion, auditing, and operational cadence.

Changes:

  • Add samples/FactoryDemo.Api.CSharp (C# minimal API + deterministic seed + smoke test) with parity intent vs the F# API sample.
  • Introduce src/Core/SignalQuality.fs with accompanying algebra tests.
  • Add factory hygiene/process utilities and docs (live-lock audit script + history/logging, drop-zone protocol, loop docs updates, research/memory entries).

Reviewed changes

Copilot reviewed 42 out of 42 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tools/audit/live-lock-audit.sh New script to classify recent commits and flag “live-lock” smell based on external-change ratio.
tests/Tests.FSharp/Operators/CrmScenarios.Tests.fs Adds operator-level CRM scenario tests (pipeline funnel, duplicates, integrated updates).
tests/Tests.FSharp/Algebra/SignalQuality.Tests.fs Adds unit tests for SignalQuality scoring helpers and composite behavior.
src/Core/SignalQuality.fs New core module defining quality dimensions/measures and composite scoring.
src/Core/Core.fsproj Registers SignalQuality.fs for compilation in Core.
samples/ServiceTitanFactoryApi/ServiceTitanFactoryApi.fsproj Adds an F# Web API sample project file for the demo API.
samples/ServiceTitanFactoryApi/Seed.fs Deterministic in-memory CRM seed data (customers/opps/activities).
samples/ServiceTitanFactoryApi/README.md Documents the F# API sample, endpoints, and v0/v1 scope.
samples/ServiceTitanFactoryApi/Program.fs Implements the F# minimal API endpoints over the seed data.
samples/ServiceTitanCrm/ServiceTitanCrm.fsproj Adds an F# console demo project for CRM-shaped incremental views.
samples/ServiceTitanCrm/Program.fs Implements the CRM incremental demo using Zeta operators and prints views per tick.
samples/FactoryDemo.Api.CSharp/smoke-test.sh Adds a bash smoke test validating all endpoints + invariants via curl/jq.
samples/FactoryDemo.Api.CSharp/Seed.cs Deterministic C# seed data mirroring the F# seed.
samples/FactoryDemo.Api.CSharp/README.md Documents the C# API sample, parity expectations, and design notes.
samples/FactoryDemo.Api.CSharp/Program.cs Implements the C# minimal API endpoints over the C# seed.
samples/FactoryDemo.Api.CSharp/Opportunity.cs Adds Opportunity record type.
samples/FactoryDemo.Api.CSharp/FactoryDemo.Api.CSharp.csproj Adds C# Web SDK project targeting net10.0 with nullable/implicit usings/Werror.
samples/FactoryDemo.Api.CSharp/Customer.cs Adds Customer record type.
samples/FactoryDemo.Api.CSharp/Activity.cs Adds Activity record type.
memory/project_reproducible_stability_as_obvious_purpose_2026_04_22.md Captures directive/memory about “reproducible stability” framing.
memory/project_operator_input_quality_log_directive_2026_04_22.md Captures directive/memory describing operator-input quality log.
memory/project_arc3_adversarial_self_play_emulator_absorption_scoring_2026_04_22.md Captures directive/memory about ARC-3-style scoring loop concept.
memory/project_aaron_drop_zone_protocol_2026_04_22.md Captures directive/memory describing the drop/ inbox protocol.
memory/observed-phenomena/2026-04-19-transcript-duplication-splitbrain-hypothesis.md Adds an observed-phenomenon note and contextual framing.
drop/README.md Adds protocol documentation for the maintainer-to-agent inbox.
drop/.gitignore Ignores all dropped files except the two sentinel files.
docs/research/zeta-self-use-tiny-bin-file-germination-2026-04-22.md Research note on local-native tiny-bin-file “self-use” germination path.
docs/research/oss-deep-research-zeta-aurora-2026-04-22.md Absorption note for a deep-research report and oracle-gate ideas.
docs/research/openai-deep-ingest-cross-substrate-readability-2026-04-22.md Research note on cross-substrate ingest/readability tradeoffs.
docs/research/meta-pixel-perfect-text-to-image-youtube-wink-2026-04-22.md Research note on pixel-perfect text-to-image signal relevance.
docs/research/cutting-edge-database-gap-review-2026-04-23.md Research note reviewing database gaps and potential backlog items.
docs/research/arc3-adversarial-self-play-emulator-absorption-scoring-2026-04-22.md Research doc expanding on ARC-3-style loop concept and open questions.
docs/operator-input-quality-log.md Adds the operator-input quality log document and initial entries.
docs/hygiene-history/live-lock-audit-history.md Adds log/history doc for live-lock audit runs and lessons.
docs/BACKLOG.md Adds backlog entries for live-lock cadence + cadenced self-practices review + complexity measurement framework.
docs/AUTONOMOUS-LOOP.md Updates the tick priority ladder to include drop-zone audit and renumbers steps.
README.md Adds “thesis: reproducible stability” section pointing to AGENTS.md.
AGENTS.md Adds “purpose: reproducible stability” section and adjusts value text (“do no permanent harm”).
.claude/commands/btw.md Adds /btw command doc/protocol for non-interrupting maintainer asides.

Comment thread drop/README.md Outdated
Comment thread samples/ServiceTitanFactoryApi/ServiceTitanFactoryApi.fsproj Outdated
Comment thread samples/FactoryDemo.Api.CSharp/Program.cs Outdated
Comment thread samples/FactoryDemo.Api.CSharp/smoke-test.sh
Comment thread src/Core/SignalQuality.fs
AceHack added a commit that referenced this pull request Apr 24, 2026
Fixes the two remaining BLOCKED-state CI failures on PR #147:

- `lint (markdownlint)` — line 301 of
  `docs/research/cutting-edge-database-gap-review-2026-04-23.md`
  had a `+` at line start (reflow of `+ IORING_FEAT_NATIVE_WORKERS`)
  that markdownlint parsed as a list item, tripping MD032 (lists
  must be surrounded by blank lines). Reflowed the paragraph so
  the `+` sits mid-line.

- `check memory/MEMORY.md paired edit` — PR touched five
  `memory/*.md` files (auto-loop-43/44/45/46 absorptions from
  earlier in the branch) without a matching MEMORY.md index
  entry. Added five newest-first pointer rows after the Fast
  path header per GOVERNANCE §18, covering:
  - `project_aaron_drop_zone_protocol_2026_04_22.md`
  - `project_arc3_adversarial_self_play_emulator_absorption_scoring_2026_04_22.md`
  - `project_operator_input_quality_log_directive_2026_04_22.md`
  - `project_reproducible_stability_as_obvious_purpose_2026_04_22.md`
  - `observed-phenomena/2026-04-19-transcript-duplication-splitbrain-hypothesis.md`
    (written as `memory/observed-phenomena/...` so the
    `tools/hygiene/audit-memory-references.sh` `*/*` literal-path
    branch resolves it)

Verified locally:
- `npx markdownlint-cli2@0.18.1` clean on both touched files
- `tools/hygiene/audit-memory-references.sh --enforce` — 448
  refs, 0 broken
- `dotnet build -c Release` — 0 Warning, 0 Error

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b4f5a493ec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Zeta.sln Outdated
AceHack added a commit that referenced this pull request Apr 24, 2026
Addresses five unresolved review threads:

- drop/README.md: sweep name attribution to "the human
  maintainer" role-ref (BP-name-attribution).
- samples/FactoryDemo.Api.CSharp/Program.cs: fix endpoint
  comment "9 concrete endpoints" → "8 API endpoints besides
  `/`" (array has 8; root excluded).
- samples/FactoryDemo.Api.CSharp/smoke-test.sh: per-run log
  via mktemp (collision-safe + non-/tmp-host-safe); print
  path on failure + success.
- samples/ServiceTitanFactoryApi/: delete stale F# sibling
  dir (PR #146 already landed FactoryDemo.Api.FSharp on
  main with identical code); drop duplicate sln Project
  block + config duplicates; fix CSharp refs to point at
  the surviving FactoryDemo.Api.FSharp/.

Fifth thread (SignalQuality scope-creep) is judgment —
branch history is deep; splitting now adds more churn than
value. Replying with backlog-and-resolve per three-outcome.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the repo’s “factory demo” surface with a C# minimal JSON API companion (parity with the existing F# sample) and adds supporting demo/testing/tooling/docs that reinforce factory workflows (seeded CRM scenarios, signal-quality scoring, drop-zone protocol, and a live-lock audit).

Changes:

  • Add samples/FactoryDemo.Api.CSharp minimal API + deterministic seed + smoke-test to match the F# API’s JSON contract.
  • Introduce src/Core/SignalQuality.fs and add xUnit coverage for the signal-quality metrics plus CRM-shaped operator scenario tests.
  • Add operational tooling/docs: live-lock audit script + history log, drop-zone protocol, and related documentation updates.

Reviewed changes

Copilot reviewed 40 out of 40 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tools/audit/live-lock-audit.sh Adds a commit-window classifier to detect “live-lock” via EXT/INTL/SPEC ratios.
tests/Tests.FSharp/Operators/CrmScenarios.Tests.fs Adds CRM-shaped operator scenario tests mirroring the demo behavior.
tests/Tests.FSharp/Algebra/SignalQuality.Tests.fs Adds unit tests for SignalQuality scoring behavior and invariants.
src/Core/SignalQuality.fs Introduces composable “signal quality” dimensions (compression/grounding/etc.) + composite scoring.
src/Core/Core.fsproj Wires SignalQuality.fs into Core compilation.
samples/FactoryDemo.Crm/Program.fs Adds an executable CRM demo showcasing retraction-native updates and derived views.
samples/FactoryDemo.Crm/FactoryDemo.Crm.fsproj Adds the CRM demo project file with Core reference.
samples/FactoryDemo.Api.CSharp/smoke-test.sh Adds endpoint smoke test validating counts and key JSON invariants.
samples/FactoryDemo.Api.CSharp/Seed.cs Adds deterministic in-memory seed data (customers/opps/activities).
samples/FactoryDemo.Api.CSharp/README.md Documents how to run the C# API and the parity contract.
samples/FactoryDemo.Api.CSharp/Program.cs Implements the 9 minimal-API endpoints (root metadata + /api/*).
samples/FactoryDemo.Api.CSharp/Opportunity.cs Defines Opportunity record type for API payloads.
samples/FactoryDemo.Api.CSharp/FactoryDemo.Api.CSharp.csproj Adds the C# Web SDK project targeting net10.0.
samples/FactoryDemo.Api.CSharp/Customer.cs Defines Customer record type for API payloads.
samples/FactoryDemo.Api.CSharp/Activity.cs Defines Activity record type for API payloads.
memory/project_reproducible_stability_as_obvious_purpose_2026_04_22.md Adds memory entry capturing reproducible-stability directive context.
memory/project_operator_input_quality_log_directive_2026_04_22.md Adds memory entry describing the operator-input quality log directive.
memory/project_arc3_adversarial_self_play_emulator_absorption_scoring_2026_04_22.md Adds memory entry for ARC-3-style self-play scoring framing.
memory/project_aaron_drop_zone_protocol_2026_04_22.md Adds memory entry defining the drop-zone protocol rationale.
memory/observed-phenomena/2026-04-19-transcript-duplication-splitbrain-hypothesis.md Adds observed-phenomena note describing an unresolved artifact.
memory/MEMORY.md Updates the memory index with new entries added in this PR.
drop/README.md Adds the tracked drop-zone protocol documentation.
drop/.gitignore Ensures only sentinel files are tracked in drop/.
docs/research/zeta-self-use-tiny-bin-file-germination-2026-04-22.md Adds a research sketch on “tiny-bin-file” self-use germination.
docs/research/oss-deep-research-zeta-aurora-2026-04-22.md Adds absorbed deep-research note and its implications.
docs/research/openai-deep-ingest-cross-substrate-readability-2026-04-22.md Adds research note on cross-substrate readability and ingestion.
docs/research/meta-pixel-perfect-text-to-image-youtube-wink-2026-04-22.md Adds research note on pixel-perfect T2I signal relevance.
docs/research/cutting-edge-database-gap-review-2026-04-23.md Adds a gap review of “cutting-edge” DB areas vs current Zeta surface.
docs/research/arc3-adversarial-self-play-emulator-absorption-scoring-2026-04-22.md Adds research doc expanding ARC-3 scoring directive.
docs/pr-preservation/147-drain-log.md Adds PR-thread preservation log for prior review thread drainage.
docs/operator-input-quality-log.md Adds operator-input quality log doc and initial scoring entries.
docs/hygiene-history/live-lock-audit-history.md Adds a run-log for the live-lock audit and lessons learned.
docs/BACKLOG.md Adds backlog items for live-lock smell cadence and self-practices review.
docs/AUTONOMOUS-LOOP.md Updates tick priority ladder to include drop-zone audit.
Zeta.sln Adds solution entries for new samples (CRM + C# API) and solution folders/configs.
README.md Adds a “thesis: reproducible stability” section referencing AGENTS.
AGENTS.md Adds the “purpose” section and updates the velocity value wording.
.claude/commands/btw.md Adds a /btw command doc for non-interrupting maintainer asides.

Comment thread docs/operator-input-quality-log.md Outdated
Comment thread samples/FactoryDemo.Api.CSharp/Seed.cs
Comment thread drop/README.md Outdated
Comment thread tools/audit/live-lock-audit.sh
Comment thread docs/AUTONOMOUS-LOOP.md Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f2e0739b7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/audit/live-lock-audit.sh Outdated
Comment thread tests/Tests.FSharp/Algebra/SignalQuality.Tests.fs
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

AceHack added a commit that referenced this pull request Apr 24, 2026
- Seed.cs + Seed.fs: rename contact 13 'Aaron Smith' -> 'Acme Contact
  (new lead)' (Copilot P2 name-attribution, parity preserved across
  C# / F# siblings).
- drop/README.md: correct 'only tracked file' wording to reflect the
  README.md + .gitignore two-sentinel design (Copilot P2).
- tools/audit/live-lock-audit.sh: docstring attribution 'Aaron's ...'
  -> 'Human-maintainer ...' (Copilot P1); add '-m' plus 'sort -u' to
  'git diff-tree' so merge commits bucket on their real files instead
  of mis-classifying as OTHR (Codex P1 — was skewing EXT/INTL/SPEC %
  and could disable the live-lock gate after a round of merges).
- docs/pr-preservation/147-drain-log.md: append second-pass per-thread
  audit trail (git-native preservation).

Three threads resolved as scope-bleed / already-addressed: operator-
input-quality-log.md (file not in PR diff, landed via 204bbb6 on
main), AUTONOMOUS-LOOP.md (file not in PR diff, zero Aaron on HEAD),
Tests.FSharp.fsproj (both SignalQuality + CrmScenarios already listed
at lines 26 and 49).

Build: 0W/0E. Audit sanity: live-lock-audit.sh still healthy with
merges now bucketed correctly.
Copilot AI review requested due to automatic review settings April 24, 2026 18:42
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ca56e95c4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/audit/live-lock-audit.sh Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a C# companion implementation of the factory-demo JSON API (parity with the existing F# sample) while also tightening a few repo hygiene/tooling areas that support the factory-demo and quality pipeline.

Changes:

  • Add samples/FactoryDemo.Api.CSharp minimal API sample (9 endpoints) + smoke test + deterministic seed data.
  • Improve live-lock audit reliability (correct path detection for root + merge commits) and record related hygiene history / review-drain artifacts.
  • Adjust SignalQuality compression scoring semantics for empty/short inputs and update F# tests/docs accordingly.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tools/audit/live-lock-audit.sh Switches commit file detection to git diff-tree with root/merge handling for accurate categorization.
tests/Tests.FSharp/Operators/CrmScenarios.Tests.fs Updates scenario-test comment to match the renamed demo sample path.
tests/Tests.FSharp/Algebra/SignalQuality.Tests.fs Updates expected compression neutrality for empty input to match new semantics.
src/Core/SignalQuality.fs Introduces a minimum-length threshold + neutral handling for empty/short inputs in compression measurement.
samples/FactoryDemo.Crm/Program.fs Renames sample module + adjusts wording to be company-neutral.
samples/FactoryDemo.Crm/FactoryDemo.Crm.fsproj Renames RootNamespace to the company-neutral sample namespace.
samples/FactoryDemo.Api.FSharp/Seed.fs Updates seed naming/comment for company-neutral collision entry.
samples/FactoryDemo.Api.CSharp/smoke-test.sh Adds bash smoke-test script covering all endpoints and key invariants.
samples/FactoryDemo.Api.CSharp/Seed.cs Adds deterministic in-memory seed data mirroring the F# seed.
samples/FactoryDemo.Api.CSharp/Program.cs Implements 9 minimal-API endpoints + root metadata endpoint list.
samples/FactoryDemo.Api.CSharp/Opportunity.cs Adds record type for opportunities.
samples/FactoryDemo.Api.CSharp/Customer.cs Adds record type for customers.
samples/FactoryDemo.Api.CSharp/Activity.cs Adds record type for activities.
samples/FactoryDemo.Api.CSharp/FactoryDemo.Api.CSharp.csproj Adds the C# web project with strict warning/error settings.
samples/FactoryDemo.Api.CSharp/README.md Documents endpoints, parity guarantee, and C#-specific design notes.
memory/MEMORY.md Adds new memory index entries related to drop-zone protocol and other directives.
drop/README.md Updates drop-zone doc to use role references and describe sentinel files.
docs/research/cutting-edge-database-gap-review-2026-04-23.md Line-wrap tweak for readability.
docs/pr-preservation/147-drain-log.md Adds a PR review-drain log for audit trail preservation.
docs/hygiene-history/live-lock-audit-history.md Records “lessons integrated” section and prevention guidance for future audits.
Zeta.sln Adds the new C# sample project and updates sample project entries.
.claude/commands/btw.md Updates wording to use role references instead of a maintainer’s name.

Comment thread src/Core/SignalQuality.fs Outdated
Comment thread src/Core/SignalQuality.fs Outdated
Comment thread samples/FactoryDemo.Api.CSharp/smoke-test.sh Outdated
Comment thread drop/README.md Outdated
AceHack and others added 10 commits April 24, 2026 16:40
…cipline for next time

Aaron 2026-04-23:

> if you want to beat ARC3 and do better than humans at uptime and
> other DORA metrics then your live-lock smell and the decisions you
> make to prevent live locks in the future based on pass lessons, the
> ability to integrate previous lessions and not forget is ging to be
> key.

Lesson-permanence is the factory's competitive differentiator.
Detection (audit script) is table stakes. Integration — recording the
lesson, consulting it forward, preventing re-occurrence — is the
product.

## What lands

- New "Lessons integrated" section in
  `docs/hygiene-history/live-lock-audit-history.md`
- Inaugural lesson from tonight's smell-firing event, structured as
  signature / mechanism / prevention with 4 concrete prevention
  decisions:
  1. External-priority stack is authoritative; agent reorders only
     internal priorities
  2. Live-lock audit at round-close is a gate-not-a-report
  3. Speculative-work permit requires external-ratio check first
  4. Tick-history rows are explicitly NOT external work; pair INTL
     with EXT when the smell is near firing
- Open carry-forward named: round-close-ladder wiring is a P1
  follow-up (BACKLOG row already filed earlier this session)

## Discipline

Every future smell firing files a lesson to this same section.
`memory/feedback_lesson_permanence_is_how_we_beat_arc3_and_dora_2026_04_23.md`
captures the full rule: detection is not enough, integration is the
product, lessons are consulted BEFORE taking actions that match known
failure-mode signatures, memory persists across sessions.

The pattern extends beyond live-lock: other detection mechanisms
(SignalQuality firing, Amara-oracle rejecting, drift-tick exceeding
threshold, OpenSpec Viktor failing rebuild-from-spec) should file
lessons to their respective hygiene-history files.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ependent)

Minimal F# ASP.NET Core Web API serving CRM seed data as JSON. Any
frontend choice (Blazor / React / Vue / curl) consumes the same
endpoints. Ships now so the backend is not on the critical path when
Aaron picks the frontend stack.

## What lands

- `samples/ServiceTitanFactoryApi/ServiceTitanFactoryApi.fsproj`
  using `Microsoft.NET.Sdk.Web`; only explicit package ref is
  `FSharp.Core` (ASP.NET Core comes via framework reference, no
  Directory.Packages.props edit needed)
- `Seed.fs` — in-memory seed mirroring `ServiceTitanFactoryDemo/seed-data.sql`:
  20 customers, 30 opportunities (5 stages), 33 activities, 2 intentional
  email collisions. Deterministic fixed clock at 2026-04-23 00:00 UTC.
- `Program.fs` — minimal F# API with 9 endpoints: customers (list/detail),
  opportunities (list/detail), activities (list/per-customer), pipeline
  funnel (count + total-cents per stage), duplicates (customers sharing
  an email).
- `README.md` — framing (software-factory demo, not database pitch),
  endpoint table, design notes, v1 roadmap.

## Smoke-test output (verified)

```
GET /api/pipeline/funnel
[{"count":10,"stage":"Lead","totalCents":5400000},
 {"count":6, "stage":"Qualified","totalCents":4220000},
 {"count":6, "stage":"Proposal","totalCents":5720000},
 {"count":6, "stage":"Won","totalCents":2670000},
 {"count":2, "stage":"Lost","totalCents":490000}]

GET /api/pipeline/duplicates
[{"customerIds":[1,13],"email":"alice@acme.example"},
 {"customerIds":[5,19],"email":"bob@trades.example"}]
```

Build: 0 Warning(s), 0 Error(s). `dotnet run` starts the API;
curl confirms all endpoints respond correctly.

## Discipline signal

This is the third EXT commit of the session (CRM demo sample #141,
CRM scenario tests in #143, now this API). The live-lock audit's
inaugural lesson explicitly prescribed shipping external-priority
increments when the smell fires. Three landed this session, all on
priority #1 (ServiceTitan + UI) — the factory is correctly
response-pattern even before any of tonight's PRs merge to main.

## What this does NOT do

- Does NOT wire Postgres — in-memory only for v0; Npgsql wiring is
  a follow-up PR once Aaron confirms the DB driver
- Does NOT expose Zeta / DBSP / retraction-native language to the
  frontend — standard CRUD shape per the ServiceTitan positioning
  directive
- Does NOT implement writes — v0 is read-only; POST/PUT/DELETE is
  a follow-up
- Does NOT add auth — no authentication for v0
- Does NOT ship docker-compose — future PR bundles this API with
  Postgres in one command

Composes with:
- `samples/ServiceTitanFactoryDemo/` (SQL schema + seed) — sibling,
  same shapes; v1 wires this API to that schema
- `docs/plans/servicetitan-crm-ui-scope.md` — build sequence step 1
  (API skeleton) complete; step 2 (DB wiring) is next
- `memory/feedback_servicetitan_demo_sells_software_factory_not_zeta_database_2026_04_23.md`
- `memory/feedback_lesson_permanence_is_how_we_beat_arc3_and_dora_2026_04_23.md`

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…sibling

ServiceTitan uses C# for most of their backend with zero F#. Shipping
a C# companion to the F# API (#146) so ST engineers evaluating the
factory see code in the language they already read fluently.
F# stays the reference — it's closer to math, theorems are easier to
express — but factory output matches audience stack.

## What lands

- `ServiceTitanFactoryApi.CSharp.csproj` — `Microsoft.NET.Sdk.Web`,
  nullable + implicit usings enabled, TreatWarningsAsErrors
- `Customer.cs`, `Opportunity.cs`, `Activity.cs` — records, one
  per file (MA0048)
- `Seed.cs` — deterministic in-memory seed, identical to F# Seed.fs:
  20 customers, 30 opportunities, 33 activities, 2 intentional
  email collisions
- `Program.cs` — 9 minimal-API endpoints, identical routes + JSON
  shapes to the F# sibling
- `README.md` — parity guarantee, design notes, C# specifics

## Smoke-test parity (verified)

```
GET /api/pipeline/funnel
[{"stage":"Lead","count":10,"totalCents":5400000}, ...5 stages]

GET /api/pipeline/duplicates
[{"email":"alice@acme.example","customerIds":[1,13]},
 {"email":"bob@trades.example","customerIds":[5,19]}]

GET /api/customers  -> 20 customers
```

Same seed, same shapes, same numbers as the F# version (#146).
Frontends switch between them without code changes.

## Analyzer discipline passes

Build: 0 Warning(s), 0 Error(s) with the full SonarAnalyzer.CSharp +
Meziantou.Analyzer + Microsoft .NET Analyzers pack active. The C#
companion respects every rule the F# version's discipline
already encodes implicitly — StringComparer.Ordinal for GroupBy,
static-readonly for endpoint list, record-per-file, no-var-discarded.

## Discipline signal

Fourth EXT commit of the session (CRM demo #141, CRM scenario tests
#143, F# API #146, now this C# API). All on Aaron's priority #1.
The live-lock audit's inaugural lesson prescribed "ship external-
priority increments when smell fires" — four landed in one session.

## Factory-pitch moment

This pair (F# + C# from the same spec, identical behaviour) is a
concrete factory-capability signal. The software factory produces
code in your stack, to your analyzer discipline, with parity across
languages. The pitch isn't "pick our language"; it's "your language,
enforced by our quality floor."

## What this does NOT do

- Does NOT rewrite or deprecate the F# sibling — both live
- Does NOT wire Postgres — same v0 scope
- Does NOT leak Zeta / DBSP / retraction-native concepts to the
  ST-facing surface
- Does NOT claim the C# version is the primary — F# is reference

Composes with:
- `samples/ServiceTitanFactoryApi/` (F# sibling)
- `memory/project_zeta_f_sharp_reference_c_sharp_and_rust_future_servicetitan_uses_csharp_2026_04_23.md`
- `memory/feedback_servicetitan_demo_sells_software_factory_not_zeta_database_2026_04_23.md`

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…harp)

Aaron 2026-04-23 directive:

> lets try to reduce the number of class and thing we call servce titan
> or this will be confusing in a Zeta repo. ... this is not a service
> titan repo, it's an open source repo.

Plus, 2026-04-23 follow-up on language priority:

> c# is a more popular language than f# so it makes sense to start
> with a factory c# demo anyways

## What renames

- `samples/ServiceTitanFactoryApi.CSharp/` →
  `samples/FactoryDemo.Api.CSharp/`
- Project name + csproj filename same rename
- `RootNamespace` `Zeta.Samples.ServiceTitanFactoryApi` →
  `Zeta.Samples.FactoryDemo.Api`
- `namespace` declarations in .cs files match
- Zeta.sln project entry updated
- README rewritten to generic framing (C# is the popular
  .NET language; demo starts there; F# stays reference)
- Root endpoint name field `"ServiceTitan factory-demo API (C#)"` →
  `"Factory-demo API (C#)"`
- All doc cross-references updated to new path names

Build: 0 Warning(s), 0 Error(s) with the full SonarAnalyzer +
Meziantou + Microsoft .NET Analyzers pack. Behaviour unchanged —
same 9 endpoints, same JSON shapes, same seed.

Memory rule:
`memory/feedback_open_source_repo_demos_stay_generic_not_company_specific_2026_04_23.md`
captures the positioning directive in durable form so future
agents don't re-introduce company-specific names.

Sibling renames land in separate PRs / branches:
- F# API sibling (currently PR #146 / ServiceTitanFactoryApi)
- DB scaffold (PR #145 / ServiceTitanFactoryDemo)
- CRM kernel sample (PR #141 / ServiceTitanCrm)
- CRM-UI scope doc (PR #144 / docs/plans/servicetitan-crm-ui-scope.md)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…t verification

I chose to land this because the JSON-shape parity claim we make
in the README ("byte-identical shapes between F# and C# versions")
needs a machine-verifiable check. A smoke test on the C# side is the
first half; the F# sibling gets the same pattern in a follow-up.

Starts the API on a random port, waits up to 10s for readiness,
then runs 19 checks against all 9 endpoints:

  - Root metadata: name, version, endpoints length
  - Collection lengths: customers (20), opportunities (30), activities (33)
  - Single-item lookup: customer #1 name, opportunity #1 stage
  - Per-customer activities: customer #1 has 4
  - Pipeline funnel counts per stage: Lead 10, Qualified 6, Won 6, Lost 2
  - Pipeline funnel totals in cents: Lead $54k, Won $26.7k
  - Duplicates: 2 pairs, (1,13) share alice@acme, (5,19) share bob@trades
  - 404 behaviour: missing customer returns 404

Shuts the API down cleanly on exit via trap + kill.

```
$ bash samples/FactoryDemo.Api.CSharp/smoke-test.sh
Building API...
Starting API on http://localhost:5235...

Factory-demo C# API smoke test
==============================
  OK   root.name contains 'Factory-demo'                  (true)
  OK   root.version                                       (0.0.1)
  OK   root.endpoints length                              (5)
  OK   /api/customers length                              (20)
  ...
  OK   missing customer HTTP status                       (404)

All checks passed.
```

dotnet, curl, jq — all standard dev tools. The demo does not ask
for anything exotic. Matches the FactoryDemo.Db smoke-test.sh
pattern on the sibling branch.

- Random high port (5100-5499) instead of fixed — reduces collision
  with other dev services.
- `curl -sf` for normal checks, `curl -o /dev/null -w "%{http_code}"`
  for the 404 case — the two paths have different error semantics so
  I use different tools for each.
- Shape-level assertions against numeric counts rather than raw JSON
  diff — makes the test tolerant of property-ordering differences
  between serializers. The parity claim is about *shape*, not byte-
  identity, so this matches intent.
- Trap + kill on EXIT — guarantees the API stops even on test
  failure or ctrl-C. No leaked background processes.

- Does NOT test the F# sibling. Same-pattern smoke-test for
  FactoryDemo.Api.FSharp lands in its branch (or a follow-up
  PR on that branch).
- Does NOT diff F# vs C# outputs directly. A cross-language
  parity-diff test composes better as a separate tool once both
  APIs have merged.
- Does NOT wire to Postgres. In-memory seed only; docker-compose
  + DB wiring is a separate PR.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ase, audit fail-hard, endpoint lists

Drains 14 unresolved review threads on PR #147 (FactoryDemo.Api.CSharp):
- Zeta.sln: strip leading blank line so 'Microsoft Visual Studio
  Solution File' is the first line (threads #2 #3).
- SignalQuality.fs: compressionRatio on empty input was 1.0, which
  composed as Quarantine via severityOfScore — flipped to 0.0 and
  added explicit empty-input Pass finding in compressionMeasure;
  also dropped unused System.Runtime.CompilerServices open
  (threads #4 #5).
- live-lock-audit.sh: fail hard (exit 2) when origin/main is not
  resolvable so a missing-remote CI checkout can't silently report
  'No commits found' -> healthy; switched --stat|awk file-list
  extraction to git diff-tree --name-only plumbing form
  (threads #1 #6).
- ServiceTitanFactoryApi README + Seed.fs: remove dead memory/
  and docs/plans/ links; replace Aaron's-name reference with
  'human maintainer' role wording; drop non-existent sibling
  SQL-seed refs (threads #7 #8 #9).
- FactoryDemo.Api.CSharp README + Program.cs + Seed.cs: fix dead
  refs to samples/FactoryDemo.Api.FSharp/ and samples/FactoryDemo.Db/
  to point at the real F# sibling samples/ServiceTitanFactoryApi/
  and to a BACKLOG row for the Postgres-backed follow-up
  (threads #11 #14).
- Program.cs + Program.fs: root endpoint index now advertises all
  9 routes including the parameterised {id} routes, matching the
  README tables (threads #12 #13).
- Thread #10 (project naming 'ServiceTitanFactoryApi.CSharp' in PR
  description): resolved in-thread — code/namespace already
  consistent (Zeta.Samples.FactoryDemo.Api); fix is PR-description-
  only, not code.

Build: dotnet build -c Release -> 0 Warning(s) 0 Error(s).
…dpoint-count

- tests/Tests.FSharp/Algebra/SignalQuality.Tests.fs: test asserted 1.0 for
  compressionRatio on empty input, but the fix in 16ad746 changed the
  convention to 0.0 (neutral = clean, not maximally suspicious). Updated
  the test expectation + name + comment to match the current code.
- samples/FactoryDemo.Api.CSharp/smoke-test.sh: root.endpoints length
  expectation was 5; Program.cs now advertises 8 routes in the index
  (post 16ad746 expansion). Corrected the smoke-test assertion.

Rebased onto origin/main (which advanced via #146 FactoryDemo.Api.FSharp
merge); Zeta.sln conflicts resolved by keeping both FactoryDemo.Api.FSharp
and the ServiceTitanCrm/samples solution-folder additions.

Build gate: 0 Warning(s) / 0 Error(s) in Release.
Addresses five unresolved review threads:

- drop/README.md: sweep name attribution to "the human
  maintainer" role-ref (BP-name-attribution).
- samples/FactoryDemo.Api.CSharp/Program.cs: fix endpoint
  comment "9 concrete endpoints" → "8 API endpoints besides
  `/`" (array has 8; root excluded).
- samples/FactoryDemo.Api.CSharp/smoke-test.sh: per-run log
  via mktemp (collision-safe + non-/tmp-host-safe); print
  path on failure + success.
- samples/ServiceTitanFactoryApi/: delete stale F# sibling
  dir (PR #146 already landed FactoryDemo.Api.FSharp on
  main with identical code); drop duplicate sln Project
  block + config duplicates; fix CSharp refs to point at
  the surviving FactoryDemo.Api.FSharp/.

Fifth thread (SignalQuality scope-creep) is judgment —
branch history is deep; splitting now adds more churn than
value. Replying with backlog-and-resolve per three-outcome.
Threads drained:
- btw.md: name attribution -> "human maintainer" / "the maintainer" (Copilot P1, AGENT-BEST-PRACTICES.md:284-292)
- live-lock-audit.sh: add --root to git diff-tree so root commit classifies correctly (Copilot P2)
- FactoryDemo.Api.CSharp Program.cs: add "/" to endpoints list for F# parity; bump smoke-test length 8->9 (Copilot P1 + Codex P2, same fix)
- FactoryDemo.Api.CSharp smoke-test.sh: reword mktemp comment to describe system temp dir accurately (Copilot P2)
- ServiceTitanCrm -> FactoryDemo.Crm: rename dir, fsproj, module namespace, RootNamespace, sln entry, test doc-comment; drop stale ServiceTitanFactoryApi bin+obj (Copilot P1, memory/feedback_open_source_repo_demos_stay_generic_not_company_specific_2026_04_23.md:59-66)
- SignalQuality.fs: compressionRatio + compressionMeasure short-circuit to 0.0 (Pass) below 64-byte threshold to avoid gzip-header-dominates Quarantine of legitimate short strings (Codex P1)

Drain log: docs/pr-preservation/147-drain-log.md preserves each thread verbatim (git-native high-signal preservation).

dotnet build -c Release: 0 Warning(s), 0 Error(s).
- Seed.cs + Seed.fs: rename contact 13 'Aaron Smith' -> 'Acme Contact
  (new lead)' (Copilot P2 name-attribution, parity preserved across
  C# / F# siblings).
- drop/README.md: correct 'only tracked file' wording to reflect the
  README.md + .gitignore two-sentinel design (Copilot P2).
- tools/audit/live-lock-audit.sh: docstring attribution 'Aaron's ...'
  -> 'Human-maintainer ...' (Copilot P1); add '-m' plus 'sort -u' to
  'git diff-tree' so merge commits bucket on their real files instead
  of mis-classifying as OTHR (Codex P1 — was skewing EXT/INTL/SPEC %
  and could disable the live-lock gate after a round of merges).
- docs/pr-preservation/147-drain-log.md: append second-pass per-thread
  audit trail (git-native preservation).

Three threads resolved as scope-bleed / already-addressed: operator-
input-quality-log.md (file not in PR diff, landed via 204bbb6 on
main), AUTONOMOUS-LOOP.md (file not in PR diff, zero Aaron on HEAD),
Tests.FSharp.fsproj (both SignalQuality + CrmScenarios already listed
at lines 26 and 49).

Build: 0W/0E. Audit sanity: live-lock-audit.sh still healthy with
merges now bucketed correctly.
@AceHack AceHack force-pushed the feat/servicetitan-factory-demo-api-csharp branch from 3ca56e9 to 0f60193 Compare April 24, 2026 20:43
…d headers)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 24, 2026 20:47
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 725a15a6b5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread samples/FactoryDemo.Api.CSharp/smoke-test.sh
@AceHack AceHack disabled auto-merge April 24, 2026 20:51
@AceHack AceHack enabled auto-merge (squash) April 24, 2026 20:51
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a C# minimal-API companion for the existing F# factory-demo JSON API sample, aiming for route/shape parity and deterministic seed data, plus accompanying docs and a smoke-test script.

Changes:

  • Added samples/FactoryDemo.Api.CSharp/ (csproj, minimal API endpoints, C# record models, deterministic seed data, README, smoke-test script).
  • Updated seed/customer naming in the F# sibling to keep parity with the C# companion.
  • Updated solution + related docs/comments to reflect the FactoryDemo naming.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/Tests.FSharp/Operators/CrmScenarios.Tests.fs Updates scenario-test comment to reference the demo sample location.
samples/FactoryDemo.Api.FSharp/Seed.fs Renames the “collision” customer entry to match the C# sibling and stay company-neutral.
samples/FactoryDemo.Api.CSharp/smoke-test.sh Adds a bash smoke test that boots the API and validates all endpoints’ JSON invariants.
samples/FactoryDemo.Api.CSharp/Seed.cs Adds deterministic in-memory seed data mirroring the F# seed.
samples/FactoryDemo.Api.CSharp/README.md Documents how to run the C# API and the parity guarantee with the F# sibling.
samples/FactoryDemo.Api.CSharp/Program.cs Implements the 9 minimal-API endpoints and derived pipeline views.
samples/FactoryDemo.Api.CSharp/Opportunity.cs Adds C# record type for opportunities.
samples/FactoryDemo.Api.CSharp/FactoryDemo.Api.CSharp.csproj Adds the C# sample project targeting net10.0 with warnings-as-errors.
samples/FactoryDemo.Api.CSharp/Customer.cs Adds C# record type for customers.
samples/FactoryDemo.Api.CSharp/Activity.cs Adds C# record type for activities.
docs/pr-preservation/147-drain-log.md Adds a PR review-thread preservation log.
docs/hygiene-history/live-lock-audit-history.md Adds “lessons integrated” content to the live-lock audit history doc.
Zeta.sln Adds the new C# sample project to the solution and solution folder nesting/configs.

Comment thread docs/hygiene-history/live-lock-audit-history.md
Comment thread docs/pr-preservation/147-drain-log.md
Comment thread tests/Tests.FSharp/Operators/CrmScenarios.Tests.fs Outdated
Comment thread samples/FactoryDemo.Api.CSharp/smoke-test.sh Outdated
Comment thread Zeta.sln
Thread-by-thread outcomes across the 11 unresolved review threads on PR
#147 (5 FIX, 2 BACKLOG, 2 Otto-256 REJECT, 2 already-addressed/stale):

FIXES (code):
- live-lock-audit.sh: replace `git show --stat` with explicit
  `git log -1 -m --first-parent --name-only` so merge commits classify
  against parent-1 only (the landing side). The prior `git show` form
  risked combined-diff semantics in some git versions; the explicit
  form is first-parent by construction (Codex P1).
- SignalQuality.fs: restore `compressionMinInputBytes = 64` threshold
  (dropped by the f1dc2bb merge-conflict resolution) and mark it
  `private` so it is not part of the public API surface (Copilot).
  Short-circuits `compressionRatio` + `compressionMeasure` to 0.0 for
  sub-threshold inputs, avoiding spurious Quarantine on short legitimate
  strings. Evidence reports UTF-8 byte count (consistent with the
  threshold's units) instead of `text.Length` chars (Copilot). Adjusted
  the empty-string test to assert the new 0.0 neutral value.
- smoke-test.sh: replace non-portable `mktemp -t <template>` with a
  pre-constructed absolute-path template rooted at `${TMPDIR:-/tmp}`
  where XXXXXX is the tail (BSD/macOS requires tail-XXXXXX; GNU accepts
  either). `.log` extension is appended via `mv` after creation so the
  single invocation is cross-platform (Copilot x2 — threads 4 + 10).
- CrmScenarios.Tests.fs: update doc-comment `samples/FactoryDemo.Crm`
  -> `samples/CrmSample` to match the canonical sample path on main
  (Copilot).

BACKLOG (deferred P2):
- Smoke-test deterministic port allocation (Codex P2) — replace
  RANDOM-in-range with OS-assigned ephemeral port via `--urls
  http://127.0.0.1:0` and log-line parse.
- FactoryDemo.Api.CSharp solution project-type GUID hygiene (Copilot)
  — align with modern SDK-style GUID used by other C# projects.

OTTO-256 REJECT (history-file exemption):
- docs/pr-preservation/147-drain-log.md (Copilot) and
  docs/hygiene-history/live-lock-audit-history.md (Copilot): both
  requested stripping first-name "Aaron" attributions. Declined per
  Otto-256 (2026-04-24) — history files exempt from the "no name
  attribution" rule; a P2 BACKLOG row already exists
  (`## P2 — FACTORY-HYGIENE — name-attribution policy clarification
  (history-file exemption)`) to codify this in AGENT-BEST-PRACTICES.md.

ALREADY-ADDRESSED (stale reviewer context):
- drop/README.md heading (Copilot): Copilot flagged "one tracked
  sentinel" but the current heading reads "two tracked sentinels"
  (fixed in a prior drain). Resolving as addressed.

Build: `dotnet build -c Release` -> 0 Warning(s), 0 Error(s).
Tests: `dotnet test --filter "FullyQualifiedName~SignalQuality"` ->
  22/22 pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@AceHack AceHack merged commit 8c16712 into main Apr 24, 2026
11 checks passed
@AceHack AceHack deleted the feat/servicetitan-factory-demo-api-csharp branch April 24, 2026 21:03
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d11b5424f8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +64 to +65
files=$(git log -1 -m --first-parent --name-only --format= "$sha" 2>/dev/null \
| grep -v '^$' || true)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Stop swallowing git-log failures in classification

files=$(git log -1 -m --first-parent --name-only --format= "$sha" ... | grep -v '^$' || true) now treats any git log failure as success with an empty file list, so commits with unreadable/missing trees (common in partial or shallow histories) are silently mis-bucketed as OTHR instead of failing the audit. In that scenario the EXT/INTL/SPEC ratios are computed from incomplete data and can report a false healthy result; the script should only ignore grep's no-match status, not git log errors.

Useful? React with 👍 / 👎.

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.

2 participants